(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2c87fcf7"],{"09f4":function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),Math.easeInOutQuad=function(e,t,n,i){return e/=i/2,e<1?n/2*e*e+t:(e--,-n/2*(e*(e-2)-1)+t)};var i=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}();function r(e){document.documentElement.scrollTop=e,document.body.parentNode.scrollTop=e,document.body.scrollTop=e}function o(){return document.documentElement.scrollTop||document.body.parentNode.scrollTop||document.body.scrollTop}function s(e,t,n){var s=o(),a=e-s,c=20,u=0;t="undefined"===typeof t?500:t;var l=function e(){u+=c;var o=Math.easeInOutQuad(u,s,a,t);r(o),u0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1] ".concat(t))||this}m(t,e)})(Error);var I,C=function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var i=e.slice(t,n);return e.replace(i,(function(e){return e.toUpperCase()}))},R=function(e,t){void 0===t&&(t="utf-8");var n,i=0;if("utf-16"===t)for(var r=0,o=e.length;r0},V=function(e){return"[object Object]"===Object.prototype.toString.call(e)},k=function(e){return"[object Function]"===Object.prototype.toString.call(e)},x=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},G=function(e){return"[object Null]"===Object.prototype.toString.call(e)},B=function(e){for(var t in e)return!0;return!1},F=function(e){return w(e)&&Object.prototype.hasOwnProperty.call(O,e)},H=function(e){var t=!1;return U(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},K=function(e){var t=!1,n=!1,i=!1;if(V(e)){var r=Object.keys(e).length;for(var o in t=r>20,e)if(n||(n=U(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=e[o];i=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}};!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(M||(M={}));var q,Y=M;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.MAIN_PROCESS_ERROR=-5]="MAIN_PROCESS_ERROR",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.SUCCESS=0]="SUCCESS",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",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_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_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",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_TIMEOUT=30005]="RC_HTTP_REQ_TIMEOUT",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_RESOURCE_ERROR=30007]="RC_NAVI_RESOURCE_ERROR",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_SEND_FAIL=30012]="RC_PING_SEND_FAIL",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",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_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",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.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",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_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",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_EXISTS=33101]="TAG_EXISTS",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.READ_RECEIPT_ERROR=35003]="READ_RECEIPT_ERROR",e[e.PACKAGE_ENVIRONMENT_ERROR=35006]="PACKAGE_ENVIRONMENT_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_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",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.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",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"}(q||(q={}));var j,Q=q;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT"}(j||(j={}));var W,J=j,z={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18};!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(W||(W={}));var $,Z=W;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}($||($={}));var X,ee=$;!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"}(X||(X={}));var te,ne=X;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(te||(te={}));var ie,re=te;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC"}(ie||(ie={}));var oe,se=ie;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(oe||(oe={}));var ae,ce,ue,le,he=oe;!function(e){e[e.LOG=0]="LOG",e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.STATISTICS=6]="STATISTICS",e[e.NONE=1e3]="NONE"}(ae||(ae={})),function(e){e.IM="IM",e.RTC="RTC"}(ce||(ce={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.L_INIT_O="L-init-O",e.P_INIT_O="P-init-O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.P_CONNECT_O="P-connect-O",e.P_CONNECT_S="P-connect-S",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_O="P-regtype-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E"}(ue||(ue={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(le||(le={}));var de,fe=le;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(de||(de={}));var pe;!function(e){e[e.typing=0]="typing"}(pe||(pe={}));var ge,_e,me,ve,ye,Ee,Te;!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(ge||(ge={})),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"}(_e||(_e={})),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"}(me||(me={})),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"}(ve||(ve={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE"}(ye||(ye={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(Ee||(Ee={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(Te||(Te={}));var Ie,Ce,Re,Se={"RC:VCAccept":"RC:VCAccept","RC:VCRinging":"RC:VCRinging","RC:VCSummary":"RC:VCSummary","RC:VCHangup":"RC:VCHangup","RC:VCInvite":"RC:VCInvite","RC:VCModifyMedia":"RC:VCModifyMedia","RC:VCModifyMem":"RC:VCModifyMem"};!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Ie||(Ie={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Ce||(Ce={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(Re||(Re={}));var Ne="RC_Logs";function Oe(e){var t=e.target.result;if(1===e.oldVersion)try{t.deleteObjectStore(Ne)}catch(e){console.warn("version 1 indexDB delete error, name: ".concat(e.name,", message: ").concat(e.message,", stack: ").concat(e.stack))}!function(e,t,n){var i;if(!e.objectStoreNames.contains(t)){var r=v({},n.objectStoreParams);i=e.createObjectStore(t,r),n.indexs&&n.indexs.length>0&&n.indexs.forEach((function(e){i.createIndex(e.indexName,e.key,{unique:e.unique})}))}}(t,Ne,{indexs:[{indexName:"time",key:"time",unique:!1}],objectStoreParams:{autoIncrement:!0}})}var Me,be=function(){function e(){}return e.init=function(){if("undefined"!=typeof window&&window&&window.indexedDB){if(e.indexDBSwitch&&!e.opening){e.opening=!0;var t=window.indexedDB.open("RC_ENGINE_DB",2);t.onerror=function(t){e.opening=!1,console.warn("open indexDB request failed "+t.target.error)},t.onsuccess=function(t){e.opening=!1,e._db=t.target.result,e._db&&(e._db.onclose=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has unexpectedly closed."),t),e._db=null,e._instance=null},e._db.onerror=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening error."),t),e._db=null,e._instance=null},e._db.onabort=function(t){var n;console.warn("The database ".concat(null===(n=e._db)||void 0===n?void 0:n.name," has opening aborted."),t),e._db=null,e._instance=null}),e._instance=new e},t.onupgradeneeded=function(t){e.opening=!1,e._db=t.target.result,Oe(t)}}}else console.debug("IndexDB is not currently supported in the environment!")},e.getInstance=function(){return e._instance},e.prototype.addList=function(t,n){return new Promise((function(i){if(e._db){var r=e._db.transaction([t],"readwrite"),o=r.objectStore(t);n.forEach((function(e){null==o||o.add(e)})),r.oncomplete=function(e){i(!0)},r.onerror=function(e){i(!1)}}else i(!1)}))},e.prototype.getRangeData=function(t,n,i,r){return new Promise((function(o){if(e._db){var s=e._db.transaction([t],"readwrite").objectStore(t),a=IDBKeyRange.bound(i,r),c=s.index(n),u=[],l=c.openCursor(a);l.onsuccess=function(e){var t=e.target.result;t?(u.push(t.value),t.continue()):o(u)},l.onerror=function(e){console.error(e),o([])}}else o([])}))},e.prototype.getCount=function(t,n){return new Promise((function(n){if(e._db){var i=e._db.transaction([t],"readonly").objectStore(t).count();i.onsuccess=function(){n(i.result)},i.onerror=function(e){console.error(e),n(0)}}else n(0)}))},e.prototype.removeFirstData=function(t,n,i){return new Promise((function(n){if(e._db){var r=e._db.transaction([t],"readwrite").objectStore(t),o=r.getAllKeys(IDBKeyRange.lowerBound(0),i);o.onsuccess=function(){var e=o.result;e.length>0&&(r.delete(IDBKeyRange.bound(e[0],e[e.length-1])).onsuccess=function(){n(!0)})}}else n(!1)}))},e._db=null,e.indexDBSwitch=!0,e.opening=!1,e}(),Ue=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},Ae=function(){var e=Ue();if(e=e.replace(/-/g,"")+"a",(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(t[o])}while(i);return r.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n=1e3&&(o=function(e,t,n){if(void 0===n&&(n="utf-8"),!e||!t)return"";var i="utf-8"===n?3:2,r=0,o=0,s="";for(o=0;o255?r+=i:r++,r>t)return s;s+=e.charAt(o)}return e}(o,1e3));var s=Pe(e),a={sessionId:we,time:r,level:s,content:"".concat(we,",").concat(Date.now(),",").concat(i,",").concat(s,",").concat(t,",").concat(o,"\n"),userId:Ge.userId};return De.push(a),a}function xe(e,t){for(var n=[],i=2;i=0&&(clearInterval(Be),Be=-1),"undefined"!=typeof window&&window&&window.indexedDB&&(Be=setInterval((function(){De.length&&function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:if(!(t=be.getInstance()))return[3,6];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,t.addList(Ne,e)];case 2:return n=r.sent(),[4,t.getCount(Ne,"time")];case 3:return r.sent()>1e5&&t.removeFirstData(Ne,"time",2e3),[2,n];case 4:return i=r.sent(),ze(ue.G_UPLOAD_LOG_E,{name:i.name,message:i.message,stack:i.stack}),[2,!1];case 5:return[3,7];case 6:return be.init(),[2,!1];case 7:return[2]}}))}))}(De.slice()).then((function(e){e&&(De=[])}))}),3e3));var Fe=Date.now(),He=0;function Ke(){var e=Date.now();return Fe!==e&&(Fe=e,He=0),"".concat(Fe,"-").concat(He++)}function qe(e){!e.customLogPrint&&delete e.customLogPrint,Ge=Object.assign(Ge,e)}function Ye(e,t,n,i){if(void 0===n&&(n={}),void 0===i&&(i={}),e>ae.DEBUG&&(i&&(n=Object.assign(n,i)),ke(e,t,n,null==i?void 0:i.logSource)),e>=Ge.localLogLevel){var r="".concat((new Date).toISOString(),"[").concat(t,"][").concat(ae[e],"]"),o="".concat(r," - ").concat(Ve(n));Ge.customLogPrint?Ge.customLogPrint(e,o):xe(e,r,Ve(n))}}var je,Qe=Ye.bind(null,ae.DEBUG),We=Ye.bind(null,ae.INFO),Je=Ye.bind(null,ae.WARN),ze=Ye.bind(null,ae.ERROR),$e=Ye.bind(null,ae.FATAL),Ze=(Object.freeze({__proto__:null,sessionId:we,logLevelTransformer:Pe,formatLogObj:Ve,insertIntoLogCache:ke,_defaultStdout:xe,ID:Ke,init:qe,log:Ye,debug:Qe,info:We,warn:Je,error:ze,fatal:$e}),function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}}),Xe=function(e){var t="RCDeviceId",n=d(e),i="",r=n.get(t);return r?i=r:(i=Ae(),n.set(t,i)),i},et=function(){function e(){}return e.compress=function(e){for(var t=this,n={},i=0;i0){var e=s.join("");if(s=[],e.length>26){var n=t.numberEncode(e.length),i=String.fromCharCode(t.dataType.NormalExt|n.length);o.push(i+n)}else{var r=String.fromCharCode(t.dataType.Normal|e.length);o.push(r)}o.push(e)}},c=0;c=u.length)s.push(e.substr(c,u.length)),c+=u.length;else{a();var d=String.fromCharCode(t.dataType.Compressed|l.length<<2|h.length);o.push(d+l+h),c+=u.length}}}a();var f=t.numberEncode(e.length),p=String.fromCharCode(t.dataType.Tail|f.length);return o.push(p+f),o.join("")},e.uncompress=function(e){var t=this,n=0,i="";e:do{var r=e.charCodeAt(n++),o=r&t.dataType.Mark,s=15&r,a=void 0;switch(o){case t.dataType.Compressed:var c=s>>2,u=3&s;if(0===c||0===u)throw new Error("Data parsing error,at "+n);var l=t.numberDecode(e.substr(n,c)),h=t.numberDecode(e.substr(n+=c,u));if((l=i.length-l)+h>i.length)throw new Error("Data parsing error,at "+n);n+=u,i+=i.substr(l,h);break;case t.dataType.Tail:if((a=t.numberDecode(e.substr(n,s)))!==i.length)throw console.log(i.length),console.log(a),new Error("Data parsing error,at "+n);n+=s;break e;case t.dataType.NormalExt:a=t.numberDecode(e.substr(n,s)),i+=e.substr(n+=s,a),n+=a;break;case t.dataType.Normal:i+=e.substr(n,s),n+=s;break;case t.dataType.Mark:if(s>10)throw new Error("Data parsing error,at "+n);i+=e.substr(n,16+s),n+=16+s;break;default:throw new Error("Data parsing error,at "+n+" header:"+o)}}while(n=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var o=t.length-n,s=0,a=r.length;sthis.max)){var l=Math.min(o,u);if(l<=i.length)break;if(!(i.length>2&&t.charAt(c+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d=i.length&&(i.length=h,i.offset=c)}}}return i},e.numberEncode=function(e){var t=this,n=[],i=0;do{i=e%t.scale,n.push(t.chars.charAt(i)),e=(e-i)/t.scale}while(e>0);return n.join("")},e.numberDecode=function(e){for(var t=0,n=0,i=e.length-1;i>=0;i--){if(-1===(n=this.chars.indexOf(e.charAt(i))))throw new Error('decode number error, data is "'+e+'"');t=t*this.scale+n}return t},e.dataType={Tail:48,Compressed:64,NormalExt:80,Normal:96,Mark:112},e.chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",e.scale=e.chars.length,e.max=238327,e}(),tt=function(e){return U(e)&&/https?:\/\//.test(e)},nt=function(){function e(e){this.info=e,this.logUrl="logcollection.ronghub.com",this.level=1,this.itv=30,this.times=5,this.deviceId="",this.deviceInfo="",this.logSwitch=0,this.logUrl=e.logPolicy.url||this.logUrl,this.level=e.logPolicy.level||this.level,this.itv=e.logPolicy.itv||this.itv,this.times=e.logPolicy.times||this.times,this.deviceId=Xe(e.runtime),this.logSwitch=e.logSwitch;var t=Ze(e.runtime);this.deviceInfo="".concat(t.type,"|").concat(t.version,"|").concat(null==e?void 0:e.sessionId)}return e.prototype.updateUploadLogAttr=function(e){var t=e.logPolicy,n=e.logSwitch,i=e.runtime,r=e.sessionId,o=void 0===r?"":r,s=e.userId;if(t){var a=t.url,c=t.level,u=t.itv,l=t.times;this.logUrl=a||this.logUrl,this.level=c||this.level,this.itv=u||this.itv,this.times=l||this.times}if(n&&(this.logSwitch=n),i){this.deviceId=Xe(i);var h=Ze(i);this.deviceInfo="".concat(h.type,"|").concat(h.version,"|").concat(o)}s&&(this.info.userId=s)},e.init=function(t){return e.reportSwitch=!0,e._instance||(e._instance=new e(t)),e._instance},e.getInstance=function(){return e._instance},e.prototype.reportRealtimeLog=function(t){var n=this;if(0===t.length||!this.logUrl)return Promise.resolve();var i=et.compress(t.map((function(e){return e.content})).join("")),r=tt(this.logUrl)?"":"https://",o="".concat(r).concat(this.logUrl,"?version=").concat(this.info.version,"&appkey=").concat(this.info.appkey,"&userId=").concat(this.info.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web");return this.info.runtime.httpReq({method:"POST",url:o,body:i}).then((function(t){var i=t.data;i&&(i=JSON.parse(i),n.itv=i.nextTime,n.level=i.level,n.logSwitch=i.logSwitch,e.currentRTTimes=1)}))},e.prototype.reportFullLog=function(t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,l,h,d=this;return E(this,(function(f){switch(f.label){case 0:return n=t.startTime,i=t.endTime,r=t.platform,o=t.logId,s=t.uri,a=be.getInstance(),"web"===r.toLowerCase()&&a?n>i?[2]:[4,a.getRangeData(Ne,"time",n,i)]:[2];case 1:return c=(c=f.sent()).filter((function(e){return!e.userId||e.userId===d.info.userId})),u=et.compress(c.map((function(e){return e.content})).join("")||"no data"),l=1,h=function(){if(l>3||!e.reportSwitch)return Promise.resolve();var t=s||d.logUrl,n=tt(t)?"":"https://",i="".concat(n).concat(t,"?version=").concat(d.info.version,"&appkey=").concat(d.info.appkey,"&userId=").concat(d.info.userId,"&logId=").concat(o,"&deviceId=").concat(d.deviceId,"&deviceInfo=").concat(d.deviceInfo,"&platform=Web"),r=5e3*(l-1);return l++,new Promise((function(t,n){setTimeout((function(){e.reportSwitch&&d.info.runtime.httpReq({url:i,method:"POST",body:u}).then((function(){t()})).catch((function(e){n(e),h()}))}),r)}))},[2,h()]}}))}))},e.prototype.distroy=function(){e.currentRTTimes=1,e.reportSwitch=!1},e.currentRTTimes=1,e.reportSwitch=!1,e}(),it=[],rt=-1;function ot(e){je&&je.updateUploadLogAttr(e)}function st(e,t,n,i){ke(4-e,t,n);var r=JSON.stringify({message:n});r=r.replace(/"/g,'""'),r='"'.concat(r,'"');var o={level:e,content:[we,Date.now(),i||ce.IM,e,t,r].join()+"\n"};it.push(o),it.length>=600&&(it=it.slice(-500))}function at(){if(rt>=0&&(clearTimeout(rt),rt=-1),je&&je.logSwitch&&nt.reportSwitch){var e=je.itv*Math.pow(2,nt.currentRTTimes-1);nt.currentRTTimes "+e),at()}))}),1e3*e)}}var ct=function(){function e(e,t,n){this.tagId=e,this.logSource=t,this.initiator=n,this._localLogLevel=ae.WARN,this.debug=this.log.bind(this,ae.DEBUG),this.info=this.log.bind(this,ae.INFO),this.warn=this.log.bind(this,ae.WARN),this.error=this.log.bind(this,ae.ERROR),this.fatal=this.log.bind(this,ae.FATAL),this.reportLog=st}return e.prototype.setLogLevel=function(e){this._localLogLevel="number"!=typeof e?ae.WARN:e},e.prototype.setLogStdout=function(e){this._customLogPrint=e},e.prototype.log=function(e){for(var t=[],n=1;nae.DEBUG&&ke(e,this.tagId,t.map(Ve).join(" ")),!(e=0;r-=1){var o=i[r],s=o.target,a=o.once,c=o.listener;a&&i.splice(r,1);try{c.call.apply(c,T([s],t,!1))}catch(e){ut.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),ht="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};ht.engine="5.4.3";var dt,ft,pt=function(){function e(){}return e.add=function(e,t){ht[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return ut.warn("The validation engine version '".concat(e,"' is invalid!")),!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return ht.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return ht},e}();!function(e){e[e.STRING=0]="STRING",e[e.ONLY_STRING=1]="ONLY_STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.OBJECT=4]="OBJECT",e[e.ARRAY=5]="ARRAY",e[e.CALLBACK=6]="CALLBACK",e[e.CHANNEL_ID=7]="CHANNEL_ID",e[e.CONVERSATION=8]="CONVERSATION"}(ft||(ft={}));(dt={})[ft.STRING]=D,dt[ft.ONLY_STRING]=U,dt[ft.NUMBER]=w,dt[ft.BOOLEAN]=function(e){return"boolean"==typeof e},dt[ft.OBJECT]=V,dt[ft.ARRAY]=L,dt[ft.CALLBACK]=function(e){var t=!0;return V(e)||(t=!1),(e=e||{}).onSuccess&&!k(e.onSuccess)&&(t=!1),e.onError&&!k(e.onError)&&(t=!1),t},dt[ft.CHANNEL_ID]=H,dt[ft.CONVERSATION]=function(e){var t=!0;return V(e)||(t=!1),U(e.targetId)||(t=!1),F(e.conversationType)||(t=!1),x(e.channelId)||H(e.channelId)||(t=!1),t},function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}m(t,e)}(Error);var gt,_t,mt,vt,yt,Et=function(e){if(!V(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{"+t.length+"}$"),t),16)},Tt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=Ue(),r=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),i=t.getMonth()+1,r=t.getDate();return"".concat(n).concat(e).concat(i).concat(e).concat(r)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s="."+a[a.length-1]}return"".concat(e,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},It=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,l=t.googleConfig,h={};h["thread-id"]=n||"",h["apns-collapse-id"]=i||"",h.category=r||"",h.richMediaUri=o||"";var d={};d.collapse_key=null==l?void 0:l.collapseKey,d.imageUrl=null==l?void 0:l.imageUrl;var f=null==l?void 0:l.priority;f&&!["high","normal"].includes(f)&&(f="normal"),d.priority=f;var p=[{HW:{channelId:a||""}},{MI:{channelId:s||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||""}},{APNS:h},{FCM:d}];return JSON.stringify(p)},Ct=function(e,t){var n={},i={notificationId:t||""};if(!e)return{iOSConfig:n,androidConfig:i};try{var r=JSON.parse(e);null==r||r.forEach((function(e){var t,r,o,s,a=Object.keys(e);if(0!==a.length){var c=a[0];switch(c){case"HW":return void(i.channelIdHW=null===(t=e[c])||void 0===t?void 0:t.channelId);case"MI":return void(i.channelIdMi=null===(r=e[c])||void 0===r?void 0:r.channelId);case"OPPO":return void(i.channelIdOPPO=null===(o=e[c])||void 0===o?void 0:o.channelId);case"VIVO":return void(i.typeVivo=null===(s=e[c])||void 0===s?void 0:s.classification);case"APNS":return n.threadId=e[c]["thread-id"],n.apnsCollapseId=e[c]["apns-collapse-id"],n.category=e[c].category,void(n.richMediaUri=e[c].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[c].collapse_key||"",imageUrl:e[c].imageUrl||"",priority:e[c].priority||""}}}}))}catch(t){ut.error("Wrong format for pushConfigs field! content: "+e)}return{iOSConfig:n,androidConfig:i}},Rt=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&n<=128&&n>=1},St=function(e){var t=e.length;return t<=4096&&t>=1},Nt=function(e,t,n){t=t||function(){};var i=(n=n||{}).isReverse;V(e)&&function(){for(var n in e)t(e[n],n,e)}(),(L(e)||U(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,o=e.length;r0;e&&r&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=i)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|(this._dup?8:0)},e}(),Bt=function(){function e(){}return e.writeUTF=function(e,t){var n=[],i=0;if(U(e))for(var r=0,o=e.length;r=0&&s<=127?(i+=1,n.push(s)):s>=128&&s<=2047?(i+=2,n.push(192|31&s>>6),n.push(128|63&s)):s>=2048&&s<=65535&&(i+=3,n.push(224|15&s>>12),n.push(128|63&s>>6),n.push(128|63&s))}for(r=0,o=n.length;r255&&(n[r]&=255);return t?n:i<=255?[0,i].concat(n):[i>>8,255&i].concat(n)},e.readUTF=function(e){for(var t,n,i=[],r=-1,o=e,s="";++r1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: "+a);a<=65535?i.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,i.push(t,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},e}(),Ft=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var i=e._pool[e._position++].toString(16);1===i.length&&(i="0"+i),t+=i}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._pool.subarray(this._position,this._position+=e);return Bt.readUTF(t)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),Ht=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=Bt.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Kt="UpStreamMessage",qt="PushExtra",Yt="DownStreamMessage",jt="DownStreamMessages",Qt="SessionsAttQryInput",Wt="SessionsAttOutput",Jt="SyncRequestMsg",zt="ChrmPullMsg",$t="NotifyMsg",Zt="HistoryMsgInput",Xt="HistoryMsgOuput",en="RelationQryInput",tn="RelationsOutput",nn="DeleteSessionsInput",rn="SessionInfo",on="DeleteSessionsOutput",sn="RelationsInput",an="DeleteMsgInput",cn="CleanHisMsgInput",un="SessionMsgReadInput",ln="ChrmInput",hn="ChrmOutput",dn="QueryChatRoomInfoInput",fn="QueryChatRoomInfoOutput",pn="RtcInput",gn="RtcUserListOutput",_n="SetUserStatusInput",mn="RtcSetDataInput",vn="RtcUserSetDataInput",yn="RtcDataInput",En="RtcSetOutDataInput",Tn="MCFollowInput",In="RtcTokenOutput",Cn="RtcQryOutput",Rn="RtcQryUserOutDataInput",Sn="RtcUserOutDataOutput",Nn="RtcQueryListInput",On="RtcRoomInfoOutput",Mn="RtcValueInfo",bn="RtcKeyDeleteInput",Un="GetQNupTokenInput",An="GetQNupTokenOutput",wn="GetQNdownloadUrlInput",Ln="GetDownloadUrlInput",Pn="GetQNdownloadUrlOutput",Dn="GetDownloadUrlOutput",Vn="ChrmKVEntity",kn="SetChrmKV",xn="SetChrmKVS",Gn="DeleteChrmKVS",Bn="ChrmKVOutput",Fn="ChrmKVSOutput",Hn="ChrmKVSVersionEntity",Kn="ChrmKVSOutputEntity",qn="QueryChrmKV",Yn="SetUserSettingInput",jn="SetUserSettingOutput",Qn="PullUserSettingInput",Wn="PullUserSettingOutput",Jn="UserSettingNotification",zn="SessionReq",$n="SessionStates",Zn="SessionState",Xn="SessionStateItem",ei="SessionStateModifyReq",ti="SessionStateModifyResp",ni="GroupUnpushQuery",ii="GroupUnpushSet",ri="GroupUnpushResult",oi="GrpReadReceiptMsg",si="GrpReadReceiptQryReq",ai="GrpReadReceiptQryResp",ci="GrpMsgReadUser",ui="SessionTagAddInput",li="SessionTagItem",hi="SessionTagDelInput",di="SessionDisTagReq",fi="ReportSDKInput",pi="ReportSDKOutput",gi="UltraGrpPullSes",_i="UltraGrpPullMsg",mi="MsgChangeReq",vi="QueryMsgChange",yi="MsgChange",Ei="MsgChangeList",Ti="MsgQuery",Ii="MessageQueryInfo",Ci="MsgQueryAck",Ri="OperateStatus",Si="OperateStatusNotify",Ni="OperateInfo",Oi="OperateSummary",Mi="RtcNotifyMsg",bi="RtcPullKV",Ui="RtcKVOutput",Ai="RtcQueryUserJoinedInput",wi="RtcQueryUserJoinedOutput",Li="RtcViewerJoinedOutput",Pi="RtcInviteInput",Di="RtcCancelInviteInput",Vi="RtcInviteAnswerInput",ki="RtcEndInviteInput",xi="SetRtcRoomIdInput",Gi="SetRtcRoomIdOutput",Bi=((xt={})[Kt]=["sessionId","classname","content","pushText","userId","configFlag","appData","extraContent","pushExt","busChannel"],xt[jt]=["list","syncTime","finished","broadcastSyncTime"],xt[Yt]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],xt[qt]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],xt[Qt]=["nothing"],xt[Wt]=["inboxTime","sendboxTime","totalUnreadCount"],xt[Jt]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],xt[zt]=["syncTime","count"],xt[$t]=["type","time","chrmId"],xt[Zt]=["targetId","time","count","order","busChannel"],xt[Xt]=["list","syncTime","hasMsg"],xt[en]=["type","count","startTime","order"],xt[tn]=["info","isFinished"],xt[nn]=["sessions"],xt[rn]=["type","channelId","busChannel"],xt[on]=["nothing"],xt[sn]=["type","msg","count","busChannel","startTime","endTime"],xt[an]=["type","conversationId","msgs","busChannel"],xt[cn]=["targetId","dataTime","conversationType","busChannel"],xt[un]=["type","msgTime","channelId","busChannel"],xt[ln]=["nothing"],xt[hn]=["nothing","sessionId","joinTime"],xt[dn]=["count","order"],xt[fn]=["userTotalNums","userInfos"],xt[Un]=["type","key","httpMethod","queryString"],xt[wn]=["type","key","fileName"],xt[Ln]=["type","key","fileName"],xt[An]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],xt[Pn]=["downloadUrl"],xt[Dn]=["downloadUrl"],xt[Vn]=["key","value","status","timestamp","uid","version"],xt[kn]=["entry","bNotify","notification","type"],xt[xn]=["entry","bNotify","notification","type"],xt[Gn]=["entry","bNotify","notification","type"],xt[Bn]=["entries","bFullUpdate","syncTime"],xt[Fn]=["timestamp","errorKeys","keysVersion"],xt[Hn]=["version","key"],xt[Kn]=["key","errorCode"],xt[qn]=["timestamp"],xt[Yn]=["version","value"],xt[jn]=["version","reserve"],xt[Qn]=["version","reserve"],xt[Wn]=["items","version"],xt.UserSettingItem=["targetId","type","key","value","version","status","tags"],xt[zn]=["time"],xt[$n]=["version","state"],xt[Zn]=["type","channelId","time","stateItem","busChannel"],xt[Xn]=["sessionStateType","value","tags"],xt[ei]=["version","state"],xt[ti]=["version"],xt[ii]=["busChannel","unpushLevel"],xt[ni]=["busChannel"],xt[ri]=["groupId","busChannel","unpushLevel"],xt[oi]=["msgId","busChannel"],xt[si]=["msgId","busChannel"],xt[ai]=["totalMemberNum","list"],xt[ci]=["readTime","userId"],xt[ui]=["version","tags"],xt[li]=["tagId","name","createdTime","isTop"],xt[hi]=["version","tags"],xt[di]=["tagId"],xt[Jn]=["version","reserve"],xt[fi]=["sdkInfo"],xt[pi]=["nothing"],xt[gi]=["syncTime","isEraseMsgContent"],xt[_i]=["syncTime"],xt[mi]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],xt[vi]=["syncTime"],xt[Ei]=["list","syncTime","hasNext"],xt[yi]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType"],xt[Ti]=["targetId","type","query"],xt[Ii]=["msgTime","msgUID","busChannel"],xt[Ci]=["list"],xt[Ri]=["targetId","type","opType","busChannel"],xt[Si]=["type","notifyType","info","summary"],xt[Ni]=["targetId","busChannel","userId","opType","optime"],xt[Oi]=["targetId","busChannel","count","opType"],xt[pn]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType"],xt[gn]=["users","token","sessionId","roomInfo"],xt[_n]=["status"],xt[mn]=["interior","target","key","value","objectName","content"],xt[vn]=["valueInfo","objectName","content"],xt[yn]=["interior","target","key","objectName","content"],xt[En]=["target","valueInfo","objectName","content"],xt[Tn]=["state"],xt[In]=["rtcToken"],xt[Cn]=["outInfo"],xt[Rn]=["userId"],xt[Sn]=["user"],xt[Nn]=["order"],xt[On]=["roomId","roomData","userCount","list"],xt[Mn]=["key","value"],xt[bn]=["key"],xt[Mi]=["type","time","roomId"],xt[bi]=["timestamp","roomId"],xt[Ui]=["entries","bFullUpdate","syncTime"],xt[Ai]=["userId"],xt[wi]=["info"],xt[Pi]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],xt[Di]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],xt[Vi]=["inviteUserID","answerCode","inviteRoomId","inviteSessionId","content","key","value"],xt[ki]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],xt[xi]=["rtcRoomId"],xt[Gi]=["nothing"],xt),Fi={},Hi=function(e){var t=Bi[e];Fi[e]=function(){for(var e={},n={getArrayData:function(){return e}},i=function(i){var r=t[i],o="set".concat(C(r,0,1));n[o]=function(t){e[r]=t}},r=0;r>>=0)>=0&&e<256)&&(i=c[e])?i:(n=r(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?g:p;if(t){if(e<0)return g;if(e>=h)return E}else{if(-d>=e)return T;if(e+1>=d)return y}return e<0?i(-e,t).neg():r(0|e%l,0|e/l,t)}function r(t,n,i){return new e(t,n,i)}function o(e,t,n){var r,s,a,c,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return p;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(e.substring(1),t,n).neg();for(s=i(u(n,8)),a=p,c=0;c>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},I.toString=function(e){var t,n,r,o,s,a,c,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(T)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(o=i(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),l=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<=0},I.isOdd=function(){return 1==(1&this.low)},I.isEven=function(){return 0==(1&this.low)},I.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),i=e.isNegative();return n&&!i?-1:!n&&i?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},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(_)},I.neg=I.negate,I.add=function(e){var n,i,o,a,c,u,l,h,d,f,p;return t(e)||(e=s(e)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,l=e.low>>>16,h=0,d=0,f=0,p=0,f+=(p+=a+(65535&e.low))>>>16,d+=(f+=o+l)>>>16,h+=(d+=i+u)>>>16,h+=n+c,r((f&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){var n,o,a,c,u,l,h,d,g,_,m,v;return this.isZero()?p:(t(e)||(e=s(e)),e.isZero()?p:this.eq(T)?e.isOdd()?T:p:e.eq(T)?this.isOdd()?T:p:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(f)&&e.lt(f)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,g=0,_=0,m=0,v=0,m+=(v+=c*(d=65535&e.low))>>>16,_+=(m+=a*d)>>>16,m&=65535,_+=(m+=c*h)>>>16,g+=(_+=o*d)>>>16,_&=65535,g+=(_+=a*h)>>>16,_&=65535,g+=(_+=c*l)>>>16,g+=n*d+o*h+a*l+c*u,r((m&=65535)<<16|(v&=65535),(g&=65535)<<16|(_&=65535),this.unsigned)))},I.mul=I.multiply,I.divide=function(e){var n,r,o,a,c,l,h;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:p;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return m;o=g}else{if(this.eq(T))return e.eq(_)||e.eq(v)?T:e.eq(T)?_:(n=this.shr(1).div(e).shl(1)).eq(p)?e.isNegative()?_:v:(r=this.sub(e.mul(n)),o=n.add(r.div(e)));if(e.eq(T))return this.unsigned?g:p;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();o=p}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=c,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},I.div=I.divide,I.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.not=function(){return r(~this.low,~this.high,this.unsigned)},I.and=function(e){return t(e)||(e=s(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return t(e)||(e=s(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return t(e)||(e=s(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<>>32-e,this.unsigned):r(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0==(e&=63)?this:(n=this.high,e<32?r(this.low>>>e|n<<32-e,n>>>e,this.unsigned):r(32===e?n:n>>>e-32,0,this.unsigned))},I.shru=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,255&t>>>8,255&t>>>16,255&t>>>24,255&e,255&e>>>8,255&e>>>16,255&e>>>24]},I.toBytesBE=function(){var e=this.high,t=this.low;return[255&e>>>24,255&e>>>16,255&e>>>8,255&e,255&t>>>24,255&t>>>16,255&t>>>8,255&t]},e}(),ji=function(e){function t(e){var t=0;return function(){return t1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function i(e,t,n,i,r){var o,s,a=8*r-i-1,c=(1<>1,l=-7,h=n?r-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=u}return(f?-1:1)*s*Math.pow(2,o-i)}function r(e,t,n,i,r,o){var s,a,c,u=8*o-r-1,l=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,r),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[n+f]=255&a,f+=p,a/=256,r-=8);for(s=s<0;e[n+f]=255&s,f+=p,s/=256,u-=8);e[n+f-p]|=128*g}var o,s,a,c,u,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,i){var r,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(r+=o);if(0===r)return new l(0,n,i);for(u=new l(r,n,i),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,i){var r,s;if("string"!=typeof t&&(i=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(r=o.clone.call(e)).markedOffset=-1,r;if(e instanceof Uint8Array)r=new l(0,n,i),e.length>0&&(r.buffer=e.buffer,r.offset=e.byteOffset,r.limit=e.byteOffset+e.byteLength,r.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)r=new l(0,n,i),e.byteLength>0&&(r.buffer=e,r.offset=0,r.limit=e.byteLength,r.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((r=new l(e.length,n,i)).limit=e.length,s=0;s>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,o=(r=e.length)>>3,s=0,t+=this.writeVarint32(r,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!e[s++])<>3,o=0,s=[],e+=n.length;r--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(i>o)for(a=0,t=this.readByte(e++);i>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,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)}return n=this.slice(t,t+e),i&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,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)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(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)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,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)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(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)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,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)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,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)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n: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},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(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)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=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 n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,i,r,o=void 0===t;if(o&&(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)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=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 n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=t.low,o=t.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,i,r,o=void 0===t;if(o&&(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)}return n=0,i=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0):(i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),r=new e(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,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)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,r(this.view,e,t,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(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)}return t=i(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,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)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,r(this.view,e,t,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(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)}return t=i(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,i,r,o=void 0===t;if(o&&(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)}for((t+=i=l.calculateVarint32(e))>(r=this.buffer.byteLength)&&this.resize((r*=2)>t?r:t),t-=i,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):i},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,i,r,o=void 0===e;if(o&&(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)}n=0,i=0;do{if(!this.noAssert&&e>this.limit)throw(r=Error("Truncated")).truncated=!0,r;t=this.view[e++],n<5&&(i|=(127&t)<<7*n),++n}while(0!=(128&t));return i|=0,o?(this.offset=e,i):{value:i,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,r=t.shiftRightUnsigned(56).toInt()>>>0;return 0==r?0==i?n<16384?n<128?1:2:1<<21>n?3:4:i<16384?i<128?5:6:1<<21>i?7:8:r<128?9:10},l.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()},l.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()},o.writeVarint64=function(t,n){var i,r,o,s,a,c=void 0===n;if(c&&(n=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 n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),i=l.calculateVarint64(t),r=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return c?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,i,r,o,s,a,c=void 0===t;if(c&&(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)}if(n=t,i=0,r=0,o=0,s=0,i=127&(s=this.view[t++]),128&s&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=u.calculateUTF16asUTF8(t(e))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(e){var t,i,r,o=void 0===e;if(o&&(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)}return t=e,r=-1,u.decodeUTF8toUTF16(function(){if(0===r)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(r=this.view[e++])?null:r}.bind(this),i=n(),!0),o?(this.offset=e,i()):{string:i(),length:e-t}},o.writeIString=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(r=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i):(this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(e){var t,n,i,r=void 0===e;if(r&&(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)}return t=e,n=this.readUint32(e),i=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=u.calculateUTF16asUTF8(t(e))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,i){var r,o,s,a,c;if("number"==typeof t&&(i=t,t=void 0),(r=void 0===i)&&(i=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+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)}if(s=0,a=i,t===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&i>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(c=i+e,u.decodeUTF8toUTF16(function(){return c>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==c)throw RangeError("Illegal range: Truncated data, "+i+" == "+c);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,i,r=void 0===e;if(r&&(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)}return t=e,n=this.readVarint32(e),i=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=i.length,r?(this.offset=e,i.string):{string:i.string,length:e-t}},o.append=function(e,t,n){var i,r,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(r=e.limit-e.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,i,r;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 0===e&&t===this.buffer.byteLength?this:0==(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(e,t)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=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(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,i=new l(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=e),this.copyTo(i,0,e,t),i},o.copyTo=function(e,t,n,i){var r,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0==(s=i-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var i=void 0===t;if(i&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=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 n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return i&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.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},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var i,r,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(i=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(r=e.limit-e.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-r),e.offset=e.limit,i&&(this.offset-=r)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;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)}return this.buffer.byteLength>>=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},o.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},o.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 n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,i=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal limit: Not an integer");if(i>>>=0,n<0||n>i||i>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+i+" <= "+this.buffer.byteLength)}return e||0!==n||i!==this.buffer.byteLength?n===i?s:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},i=[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],r=[];for(e=0,t=i.length;t>e;++e)r[i[e]]=e;return n.encode=function(e,t){for(var n,r;null!==(n=e());)t(i[63&n>>2]),r=(3&n)<<4,null!==(n=e())?(t(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=e())?(t(i[63&(r|3&n>>6)]),t(i[63&n])):(t(i[63&r]),t(61))):(t(i[63&r]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var i,o,s;null!==(i=e());)if(void 0===(o=r[i])&&n(i),null!==(i=e())&&(void 0===(s=r[i])&&n(i),t(o<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;n(i)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.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 t>e?this.view[e++]:null}.bind(this),i=n()),i()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var i=new l(e.length/4*3,n),r=0;return c.decode(t(e),(function(e){i.view[r++]=e})),i.limit=r,i},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},o.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 n=[],i=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,i=0,r=e.length,o=new l(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==i?" ":""}if(e&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return e?s:r},l.fromDebug=function(e,t,n){for(var i,r,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,c=0,u=!1,h=!1,d=!1,f=!1,p=!1;o>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||f){p=!0;break}h=d=f=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(h||f){p=!0;break}h=f=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(h||d){p=!0;break}h=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(h){p=!0;break}h=!0}s.offset=c,u=!1;break;case"]":if(!n){if(f||d){p=!0;break}f=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(f){p=!0;break}f=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){p=!0;break}if(r=parseInt(i+e.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=r,u=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!f)throw TypeError("Illegal str: Missing offset or limit");if(c>>=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 n,i=new Array(t-e);t>e;)(n=this.view[e++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},l.fromHex=function(e,t,n){var i,r,o,s,a;if(!n){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(r=e.length,o=new l(0|r/2,t),s=0,a=0;r>s;s+=2){if(i=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,i,r,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(i=e())&&s([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&s([n,i,r]),t((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=e())||null===(r=e())||null===(o=e()))&&s([n,i,r,o]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,i=null;null!==(n=null!==i?i:e());)n>=55296&&n<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(n-55296)+i-56320+65536),i=null):t(n);null!==i&&t(i)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,i=0;return e.UTF16toUTF8(t,(function(e){++n,i+=e<128?1:e<2048?2:e<65536?3:4})),[n,i]}};return e}(),o.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{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),i=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return i()},l.fromUTF8=function(e,n,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var r=new l(u.calculateUTF16asUTF8(t(e),!0)[1],n,i),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){r.view[o++]=e})),r.limit=o,r},l}(Yi),Qi=function(t,n){var i,r,o={};return o.ByteBuffer=t,o.c=t,i=t,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var t={};return t.IS_NODE=!("object"!=typeof e||e+""!="[object process]"||e.browser),t.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e]/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]*)+$/,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},o.DotProto=function(e,t){function n(e,n){var i=-1,r=1;if("-"==e.charAt(0)&&(r=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))i=parseInt(e);else if(t.NUMBER_HEX.test(e))i=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(r<0?"-":"")+e);i=parseInt(e.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+e);return i}function i(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function r(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(i=this.source.charAt(this.index));)if("\n"===i&&++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("*"!==(i=this.source.charAt(this.index)))return"/";do{if("\n"===i&&++this.line,++this.index===this.source.length)return null;n=i,i=this.source.charAt(this.index)}while("*"!==n||"/"!==i);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(r=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(r++)))for(;r"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(r)&&!t.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,i,r,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},s._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()},s._parseEnum=function(e){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},s._parseExtensionRanges=function(){var t,n,r,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":r=e.ID_MIN;break;case"max":r=e.ID_MAX;break;default:r=i(t)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,i=this.tn.next();if(!t.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(t.RULE.test(i))this._parseMessageField(n,i);else{if(!t.TYPEREF.test(i))throw Error("illegal extend token: "+i);if(!this.proto3)throw Error("illegal field rule: "+i);this._parseMessageField(n,"optional",i)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(e){function n(t,n){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===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function r(t,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case e.WIRE_TYPES.STARTGROUP:r(s,n);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}var o,s,a,c,u,l,h,d,f,p,g,_,m,v,y,E,T={},I=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},C=I.prototype;return C.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},C.toString=function(e){return(e?this.className+" ":"")+this.fqn()},C.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},T.T=I,o=function(e,t,n,i,r){I.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(I.prototype)).getChildren=function(e){var t,n,i;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.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)},s.getChild=function(e){var t,n,i="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][i]===e)return this.children[t];return null},s.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof T.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof T.T&&(!t||n instanceof T.Namespace))){r=null;break}r=n,o++}while(ot;++t)(e=r[t])instanceof o&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var e,t,n,i,r={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],i=this.options[o[e]],r[n]=i;return r},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},T.Namespace=o,a=function(t,n,i,r){if(this.type=t,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},c=a.prototype,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},c.verifyValue=function(i){var r,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i>4294967295?0|i:i;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i<0?i>>>0:i;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(i,!1)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(i,!0)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof i&&a(typeof i,"not a boolean"),i;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof i&&a(typeof i,"not a number"),i;case e.TYPES.string:return"string"==typeof i||i&&i instanceof String||a(typeof i,"not a string"),""+i;case e.TYPES.bytes:return t.isByteBuffer(i)?i:t.wrap(i);case e.TYPES.enum:for(r=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s4294967295||i<0)&&a(typeof i,"not in range for uint32"),i;a(i,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(i&&"object"==typeof i||a(typeof i,"object expected"),i instanceof this.resolvedType.clazz)return i;if(i instanceof e.Builder.Message){for(s in o={},i)i.hasOwnProperty(s)&&(o[s]=i[s]);i=o}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},c.calculateLength=function(t,n){if(null===n)return 0;var r;switch(this.type){case e.TYPES.int32:return n<0?i.calculateVarint64(n):i.calculateVarint32(n);case e.TYPES.uint32:return i.calculateVarint32(n);case e.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(n));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(n);case e.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return i.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return r=i.calculateUTF8Bytes(n),i.calculateVarint32(r)+r;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return i.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return r=this.resolvedType.calculate(n),i.calculateVarint32(r)+r;case e.TYPES.group:return(r=this.resolvedType.calculate(n))+i.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(t,n,r){var o,s;if(null===n)return r;switch(this.type){case e.TYPES.int32:n<0?r.writeVarint64(n):r.writeVarint32(n);break;case e.TYPES.uint32:r.writeVarint32(n);break;case e.TYPES.sint32:r.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:r.writeUint32(n);break;case e.TYPES.sfixed32:r.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:r.writeVarint64(n);break;case e.TYPES.sint64:r.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:r.writeUint64(n);break;case e.TYPES.sfixed64:r.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?r.writeVarint32("false"===n.toLowerCase()?0:!!n):r.writeVarint32(n?1:0);break;case e.TYPES.enum:r.writeVarint32(n);break;case e.TYPES.float:r.writeFloat32(n);break;case e.TYPES.double:r.writeFloat64(n);break;case e.TYPES.string:r.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=o;break;case e.TYPES.message:s=(new i).LE(),this.resolvedType.encode(n,s),r.writeVarint32(s.offset),r.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,r),r.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return r},c.decode=function(t,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;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(o=t.readVarint32(),t.remaining()r;++r)this[c[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new e.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof u)||Array.isArray(t)||t instanceof e.Map||i.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(t)},l=u.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,i,r){var o=n._fieldsByName[t];if(!r){if(!o)throw Error(this+"#"+t+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+t+" is not a repeated field");i=o.verifyValue(i,!0)}return null===this[t]&&(this[t]=[]),this[t].push(i),this},l.$add=l.add,l.set=function(t,i,r){var o,s,a;if(t&&"object"==typeof t){for(o in r=i,t)t.hasOwnProperty(o)&&void 0!==(i=t[o])&&this.$set(o,i,r);return this}if(s=n._fieldsByName[t],r)this[t]=i;else{if(!s)throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));this[s.name]=i=s.verifyValue(i)}return s&&s.oneof&&(a=this[s.oneof.name],null!==i?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===t&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(t,i){if(i)return this[t];var r=n._fieldsByName[t];if(!(r&&r instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(r instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+r.toString(!0));return this[r.name]},l.$get=l.get,o=0;os;s++)if((o=this.children[s])instanceof g||o instanceof u||o instanceof v){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof m))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)r=e[(i=this._fields[o]).name],i.required&&null===r?null===c&&(c=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=e[(t=this._fields[r]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);i+=t.calculate(n,e)}return i},l.decode=function(t,n,i){var o,s,a,c,u,l,h,d,f,p,g,_;for(n="number"==typeof n?n:-1,u=t.offset,l=new this.clazz;t.offset0;){if(a=(o=t.readVarint32())>>>3,(s=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==i)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(i?i+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?l[c.name].push(c.decode(s,t)):c.map?(d=c.decode(s,t),l[c.name].set(d[0],d[1])):(l[c.name]=c.decode(s,t),c.oneof&&(null!==(f=l[c.oneof.name])&&f!==c.name&&(l[f]=null),l[c.oneof.name]=c.name));else switch(s){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:h=t.readVarint32(),t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;r(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(p=0,g=this._fields.length;g>p;++p)if(null===l[(c=this._fields[p]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,_;e.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},T.Message=u,h=function(t,n,i,r,o,s,a,c,l,h){I.call(this,t,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(I.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"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)},d.verifyValue=function(t,n){var i,r,o;if(n=n||!1,i=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&i(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&i(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],r=0;r0;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}},d.encode=function(t,n,r){var o,s,a,c,u;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 n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o1&&(u=n.slice(s,n.offset),s+=c-1,n.offset=s,n.append(u)),n.writeVarint32(a,s-c)}else for(o=0;o=0){for(r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o=0&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset0;)if(t=7&(l=u.readVarint32()),1==(h=l>>>3))c=this.keyElement.decode(u,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(u,t,h)}return[c,r]}return this.element.decode(n,t,this.id)},T.Message.Field=h,f=function(e,t,n,i,r,o,s){h.call(this,e,t,n,null,i,r,o,s),this.extension},f.prototype=Object.create(h.prototype),T.Message.ExtensionField=f,p=function(e,t,n){I.call(this,e,t,n),this.fields=[]},T.Message.OneOf=p,g=function(e,t,n,i,r){o.call(this,e,t,n,i,r),this.className="Enum",this.object=null},g.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;ir;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},T.Enum=g,_=function(e,t,n,i){I.call(this,e,t,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(I.prototype),T.Enum.Value=_,m=function(e,t,n,i){I.call(this,e,t,n),this.field=i},m.prototype=Object.create(I.prototype),T.Extension=m,v=function(e,t,n,i){o.call(this,e,t,n,i),this.className="Service",this.clazz=null},(v.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,r=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){i.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var i,r,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var r,o,s,a,c,u,l,h,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,e.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c0&&r._codec[t].decode(e),V(o)&&(o=function(e){for(var t in e)V(e[t])&&(e[t]=Et(e[t]));return e}(o)),k(s)&&(o=s.call(this,o,n))}catch(n){ut.error("PB parse error\n",n,e,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=P(n)?new Uint8Array(n):n;return Bt.readUTF(r.subarray(t,i))}catch(e){ut.info("readBytes error\n",e)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=JSON.parse(t)}catch(e){ut.info("formatBytes error\n",e)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,o=e.finished;return(x(o)||null===o)&&(e.finished=!0),e.syncTime=Et(r),e.list=Ot(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var n=(t=t||{}).currentUserId,i=t.connectedTime,r=e.content,s=e.fromUserId,a=e.type,c=e.groupId,u=e.status,l=e.dataTime,h=e.classname,d=e.msgId,f=e.extraContent,p=e.pushContent,g=e.pushExt,_=e.configFlag,m=e.extStatus;e.toUserId,e.groupUnpush;var y=(e.direction||Y.RECEIVE)===Y.SEND,E=function(e){var t=o.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?o.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(u),T=E.isPersited,I=E.isCounted,C=E.isMentioned,R=E.disableNotification,S=E.receivedStatus,N=E.canIncludeExpansion,M=!!(2&(m||0)),b=!!(4&(m||0)),U=8&(m||0)?ge.PRIVATE:ge.PUBLIC,A=[O.GROUP,O.CHATROOM,O.RTC_ROOM,O.ULTRA_GROUP].indexOf(a)>-1?c:s,w=y?n:s,L=Et(l),P=L "+e)}))}}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Xi||(Xi={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(er||(er={}));var Lr,Pr,Dr={},Vr={sdkPrivate:Xi.OPEN,serverPrivate:Xi.OPEN,bundleId:"lib-next"};function kr(e){Vr.sdkPrivate=e.sdkPrivate===Xi.PRIVATE?Xi.PRIVATE:Xi.OPEN,Vr.serverPrivate=e.serverPrivate===Xi.PRIVATE?Xi.PRIVATE:Xi.OPEN,e.bundleId&&(Vr.bundleId=e.bundleId)}function xr(){return Vr}function Gr(e,t,n){void 0===t&&(t={}),void 0===n&&(n=!1),V(t)&&e&&(Dr[e]&&!n||(Dr[e]={}),Dr[e]=v(v({},Dr[e]),t))}function Br(e){return Dr[e]||{}}!function(e){e.GET="GET",e.POST="POST"}(Lr||(Lr={})),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"}(Pr||(Pr={}));var Fr,Hr=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Kr=function(){function e(e){this.header=e,this._name=null,this.lengthSize=0,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Hr(e,t)},e.prototype.read=function(e,t,n){this.readMessage(e,t,n)},e.prototype.readMessage=function(e,t,n){return{stream:e,length:t}},e}(),qr=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Gt(e,!1,gt.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Hr(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new Ht;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e.prototype.getCometData=function(){var e=this.data||{};return JSON.stringify(e)},e}(),Yr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=mt.CONN_ACK,t.status=null,t.userId=null,t.timestamp=0,t}return m(t,e),t.prototype.readMessage=function(e,n,i){if(e.readByte(),this.status=+e.readByte(),n<=t.MESSAGE_LENGTH)return{stream:e,length:n};if(i===yt.V4){var r=e.readByte();1&r&&(this.userId=e.readUTF()),2&r&&e.readUTF(),4&r&&(this.timestamp=e.readLong()),8&r&&(this.messageId=e.read2Byte())}else{this.userId=e.readUTF();var o=e.readUTF();ut.debug("server sessionId -> "+o),this.timestamp=e.readLong()}return{stream:e,length:n}},t.MESSAGE_LENGTH=2,t}(Kr),jr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=mt.DISCONNECT,t.status=0,t}return m(t,e),t.prototype.readMessage=function(e,t){return e.readByte(),this.status=+e.readByte(),{stream:e,length:t}},t.MESSAGE_LENGTH=2,t}(Kr),Qr=function(e){function t(){var t=e.call(this,_t.PING_REQ)||this;return t._name=mt.PING_REQ,t}return m(t,e),t.prototype.writeMessage=function(e){},t}(qr),Wr=function(e){function t(t){var n=e.call(this,t)||this;return n._name=mt.PING_RESP,n}return m(t,e),t}(Kr),Jr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return m(t,e),t.prototype.readMessage=function(e,t){var n=256*e.readByte()+e.readByte();return this.messageId=parseInt(n.toString(),10),{stream:e,length:t}},t}(Kr),zr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return m(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,i=(65280&t)>>8;e.write(i),e.write(n)},t}(qr),$r=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=mt.PUBLISH,t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=vt.PUB,t}return m(t,e),t.prototype.readMessage=function(t,n){return this.date=t.readInt(),this.topic=t.readUTF(),this.targetId=t.readUTF(),e.prototype.readMessage.call(this,t,n),this.data=t.readAll(),{stream:t,length:n}},t}(Jr),Zr=function(e){function t(t,n,i){var r=e.call(this,_t.PUBLISH)||this;return r._name=mt.PUBLISH,r.syncMsg=!1,r.identifier=vt.PUB,r.topic=t,r.data=U(n)?Bt.writeUTF(n):n,r.targetId=i,r}return m(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(zr),Xr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=mt.PUB_ACK,t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=vt.PUB,t.topic="",t.targetId="",t}return m(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.millisecond=256*t.readByte()+t.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=t.readUTF(),{stream:t,length:n}},t}(Jr),eo=function(e){function t(t){var n=e.call(this,_t.PUB_ACK)||this;return n._name=mt.PUB_ACK,n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return m(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(zr),to=function(e){function t(t,n,i){var r=e.call(this,_t.QUERY)||this;return r.name=mt.QUERY,r.identifier=vt.QUERY,r.topic=t,r.data=U(n)?Bt.writeUTF(n):n,r.targetId=i,r}return m(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(zr),no=function(e){function t(t){var n=e.call(this,_t.QUERY_CONFIRM)||this;return n._name=mt.QUERY_CON,n.messageId=t,n}return m(t,e),t}(zr),io=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._name=mt.QUERY_ACK,t.status=0,t.identifier=vt.QUERY,t.topic="",t.targetId="",t}return m(t,e),t.prototype.readMessage=function(t,n){return e.prototype.readMessage.call(this,t,n),this.date=t.readInt(),this.status=256*t.readByte()+t.readByte(),this.data=t.readAll(),{stream:t,length:n}},t}(Jr),ro=function(e){var t,n=e.type;switch(n){case _t.CONN_ACK:t=new Yr(e);break;case _t.PUBLISH:(t=new $r(e)).syncMsg=e.syncMsg;break;case _t.PUB_ACK:t=new Xr(e);break;case _t.QUERY_ACK:t=new io(e);break;case _t.SUB_ACK:case _t.UNSUB_ACK:case _t.PING_RESP:t=new Wr(e);break;case _t.DISCONNECT:t=new jr(e);break;default:t=new Kr(e),ut.error("No support for deserializing "+n+" messages")}return t};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.rrMsg=14]="rrMsg",e[e.rrList=15]="rrList",e[e.s_ntf=16]="s_ntf",e[e.s_msg=17]="s_msg",e[e.s_stat=18]="s_stat",e[e.s_cmd=19]="s_cmd",e[e.s_us=20]="s_us",e[e.pullUS=21]="pullUS",e[e.pgMsgS=22]="pgMsgS",e[e.chatMsgS=23]="chatMsgS",e[e.qrySessionsAtt=24]="qrySessionsAtt",e[e.pullMsg=25]="pullMsg",e[e.qrySessions=26]="qrySessions",e[e.delSessions=27]="delSessions",e[e.delMsg=28]="delMsg",e[e.updRRTime=29]="updRRTime",e[e.chrmPull=30]="chrmPull",e[e.joinChrm=31]="joinChrm",e[e.joinChrmR=32]="joinChrmR",e[e.exitChrm=33]="exitChrm",e[e.queryChrmI=34]="queryChrmI",e[e.setKV=35]="setKV",e[e.delKV=36]="delKV",e[e.pullKV=37]="pullKV",e[e.qryRelation=38]="qryRelation",e[e.delRelation=39]="delRelation",e[e.pullSeAtts=40]="pullSeAtts",e[e.setSeAtt=41]="setSeAtt",e[e.qnTkn=42]="qnTkn",e[e.qnUrl=43]="qnUrl",e[e.aliUrl=44]="aliUrl",e[e.s3Url=45]="s3Url",e[e.stcUrl=46]="stcUrl",e[e.cleanPMsg=47]="cleanPMsg",e[e.cleanGMsg=48]="cleanGMsg",e[e.cleanCMsg=49]="cleanCMsg",e[e.cleanSMsg=50]="cleanSMsg",e[e.rtcRJoin_data=51]="rtcRJoin_data",e[e.rtcRExit=52]="rtcRExit",e[e.rtcPing=53]="rtcPing",e[e.rtcSetData=54]="rtcSetData",e[e.rtc_ntf=55]="rtc_ntf",e[e.viewerJoinR=56]="viewerJoinR",e[e.viewerExitR=57]="viewerExitR",e[e.rtcPullKv=58]="rtcPullKv",e[e.rtcIdentityChange=59]="rtcIdentityChange",e[e.userSetData=60]="userSetData",e[e.rtcQryData=61]="rtcQryData",e[e.rtcDelData=62]="rtcDelData",e[e.rtcSetOutData=63]="rtcSetOutData",e[e.rtcQryUserOutData=64]="rtcQryUserOutData",e[e.rtcToken=65]="rtcToken",e[e.rtcUserState=66]="rtcUserState",e[e.rtcRInfo=67]="rtcRInfo",e[e.rtcUData=68]="rtcUData",e[e.rtcUPut=69]="rtcUPut",e[e.rtcUDel=70]="rtcUDel",e[e.rtcUList=71]="rtcUList",e[e.rtcQueryJoined=72]="rtcQueryJoined",e[e.rtcInvite=73]="rtcInvite",e[e.rtcCancelInvite=74]="rtcCancelInvite",e[e.rtcInviteAnswer=75]="rtcInviteAnswer",e[e.rtcEndInvite=76]="rtcEndInvite",e[e.addSeTag=77]="addSeTag",e[e.delSeTag=78]="delSeTag",e[e.addTag=79]="addTag",e[e.delTag=80]="delTag",e[e.disTag=81]="disTag",e[e.reportsdk=82]="reportsdk",e[e.pullUgSes=83]="pullUgSes",e[e.pullUgMsg=84]="pullUgMsg",e[e.ugMsg=85]="ugMsg",e[e.qryUgMsg=86]="qryUgMsg",e[e.updUgRTime=87]="updUgRTime",e[e.upMsgEx=88]="upMsgEx",e[e.modifyMsg=89]="modifyMsg",e[e.qryMsgChange=90]="qryMsgChange",e[e.qryMsg=91]="qryMsg",e[e.operate=92]="operate",e[e.s_opNtf=93]="s_opNtf",e[e.ugUnpushQuery=94]="ugUnpushQuery",e[e.ugUnpushSet=95]="ugUnpushSet",e[e.setRtcRoomId=96]="setRtcRoomId"}(Fr||(Fr={}));var oo,so,ao=Fr,co=function(e,t,n,i,r,o,s,a){return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(o,"&pid=").concat(s,"&apiVer=").concat(r.isFromUniapp?"uniapp":"normal").concat(r.connectPlatform?"&platform="+r.connectPlatform:"").concat(a?"&protocolVer="+a:"")},uo=function(e){return[ao.ppMsgS,ao.pgMsgS,ao.chatMsgS].map((function(e){return ao[e]})).indexOf(e)>=0};!function(e){e[e.REDIRECT=0]="REDIRECT",e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.REMOTE_CLOSE=3]="REMOTE_CLOSE",e[e.LOGOUT=4]="LOGOUT",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW"}(oo||(oo={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_COMET="IM-stats_comet-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S"}(so||(so={}));var lo=function(e,t){ut.info("websocket send -> messageId: ".concat(e.messageId," topic: ").concat(e.topic));var n=e.getBufferData();t.send(n.buffer)},ho=(function(e){function t(t,n){var i=e.call(this,"websocket",n)||this;return i._runtime=t,i._socket=null,i._messageIds={},i._syncMessageIds={},i._failedCount=0,i.ALLOW_FAILED_TIMES=2,i._timer=null,i._idCount=0,i._generateMessageId=function(){return i._idCount>=65535&&(i._idCount=0),++i._idCount},i}m(t,e),t.prototype.connect=function(e,t,n,i,r,o){return y(this,void 0,void 0,(function(){var s=this;return E(this,(function(a){return[2,new Promise((function(a){var c=n.slice(),u=!1,l=function(){return y(s,void 0,void 0,(function(){var n,s,h;return E(this,(function(d){switch(d.label){case 0:return 0===c.length||u?[2]:(u=!0,n=c.shift(),Gr(so.IM_WEBSOCKET,{startTime:(new Date).getTime(),host:n,protocol:er.WS}),[4,this._connect(e,t,n,i,r,o)]);case 1:if(s=d.sent(),h=s===Q.SUCCESS||s===z.REDIRECT?s:wt(s),Gr(so.IM_WEBSOCKET,{endTime:(new Date).getTime(),code:h}),function(e){y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d,f,p;return E(this,(function(g){switch(g.label){case 0:t=so.IM_WEBSOCKET,n=xr(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Br(t),a=s.protocol,c=s.startTime,u=s.endTime,l=s.code,h=s.host,d=Pr.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),ut.info(f.message),[3,4];case 4:return p=0,w(c)&&w(u)&&u>c&&c&&(p=u-c),wr(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:l,hos:h,net:d}),[2]}}))}))}(this._runtime),s===Q.SUCCESS)this._checkAlive(),a(s);else if(s===z.REDIRECT)a(s);else{if(0===c.length)return a(wt(s)),[2];u=!1,l()}return[2]}}))}))};r=S(r),s._watcher.status(J.CONNECTING),l()}))]}))}))},t.prototype._connect=function(e,t,n,i,r,o){return y(this,void 0,void 0,(function(){var s,a,c,u,l,h=this;return E(this,(function(d){switch(d.label){case 0:return s=i.replace("http","ws"),a=co(s,n,e,t,this._runtime,r,"",o),ut.info("conenct start -> ".concat(a)),this.sendConnectTime=Date.now(),c=this._runtime.createWebSocket(a),u=function(e){h._timer&&(clearTimeout(h._timer),h._timer=null),h._socket===c&&(h._socket=null,h._watcher.status(e))},[4,new Promise((function(e){c.onMessage((function(t){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var n=function(e,t){var n=new Uint8Array(e),i=new Ft(n),r=i.readByte(),o=new Gt(r),s=ro(o);return s.read(i,n.length-1,t),s}(t,o);if(n instanceof Wr&&h._pingResolve)return h._pingResolve(Q.SUCCESS),void(h._pingResolve=void 0);if(n instanceof Yr)return ut.info("recv connect ack -> ".concat(n.status)),n.status!==z.ACCEPTED?(ut.warn("connect failed: ".concat(n.status)),void e(n.status)):(ut.info("connect success -> ".concat(a)),h.connectedTime=n.timestamp,h.userId=n.userId||"",h._idCount=n.messageId,void e(Q.SUCCESS));if(n instanceof jr){var i=n.status;switch(ut.warn("recv disconnect signal -> status: ".concat(i)),i){case oo.BLOCK_NEW:case oo.BLOCK:h._watcher.status(J.BLOCKED);break;case oo.OTHER_DEVICE_LOGIN:h._watcher.status(J.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case oo.REDIRECT_NEW:case oo.REDIRECT:h._watcher.status(J.REDIRECT);break;default:h._watcher.status(J.DISCONNECT_BY_SERVER)}}else h._onReceiveSignal(n)}else ut.error("Socket received invalid data:",t)})),c.onClose((function(t,n){for(var i in ut.warn("websocket closed! code:",t,"reason:",n),u(J.CONNECTION_CLOSED),h._messageIds){var r=h._messageIds[i];delete h._messageIds[i],r(Q.RC_NET_CHANNEL_INVALID)}e(t)})),c.onError((function(t){for(var n in ut.error("websocket error!",null==t?void 0:t.stack),u(J.WEBSOCKET_ERROR),h._messageIds){var i=h._messageIds[n];delete h._messageIds[n],i(Q.RC_NET_CHANNEL_INVALID)}e(Q.NETWORK_ERROR)})),c.onOpen((function(){return ut.info("websocket open =>",a)})),setTimeout((function(){e(Q.TIMEOUT)}),5e3)}))];case 1:return(l=d.sent())===Q.SUCCESS?this._socket=c:(ut.warn("connect result -> code: ".concat(l,", url: ").concat(a)),c.close()),[2,l]}}))}))},t.prototype._checkAlive=function(){var e;return y(this,void 0,void 0,(function(){var t,n,i=this;return E(this,(function(r){switch(r.label){case 0:return this._socket?(ut.info("send ping ->"),this.sendOnly(new Qr),t=Ke(),We(ue.L_CHECK_ALIVE_IM_T,{},{traceId:t}),[4,new Promise((function(e){i._pingResolve=e,i._timer&&clearTimeout(i._timer),i._timer=setTimeout((function(){i._pingResolve=void 0,e(Q.TIMEOUT)}),15e3)}))]):[2];case 1:return n=r.sent(),(n===Q.SUCCESS?We:Je)(ue.L_CHECK_ALIVE_IM_R,{isSuccess:n===Q.SUCCESS},{traceId:t}),n!==Q.SUCCESS?(this._failedCount+=1,ut.warn("ping failed count: ".concat(this._failedCount,", code: ").concat(n)),this._failedCount>=this.ALLOW_FAILED_TIMES?(this._failedCount=0,ut.warn("ping timeout, close current websocket to reconnect!"),null===(e=this._socket)||void 0===e||e.close(),this._socket=null,this._watcher.status(J.NETWORK_UNAVAILABLE)):this._checkAlive(),[2]):(ut.info("recv ping <-"),this._failedCount=0,setTimeout((function(){return i._checkAlive()}),15e3),[2])}}))}))},t.prototype._onReceiveSignal=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a=this;return E(this,(function(c){switch(c.label){case 0:return t=e.messageId,e.header&&e.header.qos!==gt.AT_MOST_ONCE&&(e instanceof $r&&!e.syncMsg&&(ut.info("send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new eo(t))),e instanceof io&&(ut.info("send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new no(t)))),t>0&&(e instanceof Xr||e instanceof io)&&(ut.info("recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof $r?(r=e.syncMsg,o=e.topic,ut.info("recv PublishReader -> messageId: ".concat(t," ").concat(o)),o===ao[ao.userSetData]?[2]:!r||uo(o)?(this._watcher.signal(e),[2]):[4,new Promise((function(e){a._syncMessageIds[t]=e}))]):[3,2];case 1:s=c.sent(),delete this._syncMessageIds[t],this._watcher.signal(e,s),c.label=2;case 2:return[2]}}))}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof Zr||e instanceof to)&&(e.messageId=this._generateMessageId()),lo(e,this._socket))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),y(this,void 0,void 0,(function(){var r,o,s,a,c=this;return E(this,(function(u){switch(u.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,lo(e,this._socket),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){c._messageIds[r]&&delete c._messageIds[r],e()}),i)}))]):[3,2];case 1:return(o=u.sent())?o instanceof io||o instanceof Xr?(s=t&&o.data&&[Q.SUCCESS,Q.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(ut.warn("send failed -> message: ".concat(r,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:Q.SUCCESS,data:a}]):[2,{code:o}]:(ut.warn("send timeout -> message: ".concat(r,", respPBName: ").concat(t,", timeout: ").concat(i)),[2,{code:Q.TIMEOUT}]);case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.close=function(){this._socket&&(this._socket.close(),this._socket=null,this._watcher.status(J.DISCONNECTED))}}(Ar),function(e){function t(t,n){var i=e.call(this,"comet",n)||this;return i._runtime=t,i._messageIds={},i._syncMessageIds={},i._idCount=0,i._generateMessageId=function(){return++i._idCount},i._pid=encodeURIComponent((new Date).getTime()+Math.random()+""),i}m(t,e),t.prototype.handleCometRes=function(e){var t=this;if(200!==e.status&&202!==e.status)return!1;var n=U(e.data)?JSON.parse(e.data):e.data;return n?!L(n)||(Nt(n,(function(e){return y(t,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d=this;return E(this,(function(f){switch(f.label){case 0:if((t=e.sessionid)&&(this._sessionid=t),n=function(e){var t=e.headerCode,n=new Gt(t),i=ro(n);for(var r in e)i[r]=e[r];return i}(e),i=n.messageId,r=n._header,o=n.status,s=r&&r.qos!==gt.AT_MOST_ONCE,i&&n.getIdentifier&&((a=this._messageIds[i])&&a(n),this._syncMessageIds[i]&&this._syncMessageIds[i](n)),s&&(n instanceof $r&&!n.syncMsg&&(c=new eo(i),this.sendOnly(c)),n instanceof io&&(c=new no(i),this.sendOnly(c))),n instanceof jr){switch(o){case oo.OTHER_DEVICE_LOGIN:this._watcher.status(J.KICKED_OFFLINE_BY_OTHER_CLIENT);break;case oo.BLOCK:case oo.BLOCK_NEW:this._watcher.status(J.BLOCKED);break;case oo.REDIRECT_NEW:case oo.REDIRECT:this._watcher.status(J.REDIRECT);break;default:this._watcher.status(J.DISCONNECT_BY_SERVER)}return[2]}return n instanceof $r?(u=n.syncMsg,l=n.topic,!u||uo(l)?(this._watcher.signal(n),[2,!1]):[4,new Promise((function(e){d._syncMessageIds[i]=e}))]):[3,2];case 1:h=f.sent(),delete this._syncMessageIds[i],this._watcher.signal(n,h),f.label=2;case 2:return[2]}}))}))})),!0):(ut.error("received data is not a validJson",n),!1)},t.prototype._startPullSignal=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o;return E(this,(function(s){switch(s.label){case 0:return t=(new Date).getTime(),n="".concat(e,"://").concat(this._domain,"/pullmsg.js?sessionid=").concat(this._sessionid,"×trap=").concat(t,"&pid=").concat(this._pid),i=Ke(),We(ue.L_CHECK_ALIVE_IM_T,{},{traceId:i}),[4,this._runtime.httpReq({url:n,body:{pid:this._pid},timeout:45e3})];case 1:return r=s.sent(),o=this.handleCometRes(r),(o?We:Je)(ue.L_CHECK_ALIVE_IM_R,{isSuccess:o},{traceId:i}),this._isDisconnected||(o?this._startPullSignal(e):(this._isDisconnected=!0,this._watcher.status(J.NETWORK_UNAVAILABLE))),[2]}}))}))},t.prototype.connect=function(e,t,n,i,r,o){return y(this,void 0,void 0,(function(){var o,s,a=this;return E(this,(function(c){return r=S(r),this._protocol=i,this._isDisconnected=!1,this._watcher.status(J.CONNECTING),o=n.slice(),s=!1,[2,new Promise((function(n){var c=function(){return y(a,void 0,void 0,(function(){var a,u,l;return E(this,(function(h){switch(h.label){case 0:return 0===o.length||s?[2]:(s=!0,a=o.shift(),Gr(so.IM_COMET,{startTime:(new Date).getTime(),host:a,protocol:er.NAVI}),[4,this._connect(e,t,a,i,r)]);case 1:if(u=h.sent(),l=u===Q.SUCCESS||u===z.REDIRECT?u:wt(u),Gr(so.IM_COMET,{endTime:(new Date).getTime(),code:l}),function(e){y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d,f,p;return E(this,(function(g){switch(g.label){case 0:t=so.IM_COMET,n=xr(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Br(t),a=s.protocol,c=s.startTime,u=s.endTime,l=s.code,h=s.host,d=Pr.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),ut.info(f.message),[3,4];case 4:return p=0,w(c)&&w(u)&&u>c&&c&&(p=u-c),wr(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:l,hos:h,net:d}),[2]}}))}))}(this._runtime),u===Q.SUCCESS)this._startPullSignal(i),n(u);else if(u===z.REDIRECT)n(u);else{if(0===o.length)return n(wt(u)),[2];s=!1,c()}return[2]}}))}))};a._watcher.status(J.CONNECTING),c()}))]}))}))},t.prototype._connect=function(e,t,n,i,r){return y(this,void 0,void 0,(function(){var o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return o=function(e){return 200!==e.status&&202!==e.status?(ut.error("handle comet res -> res: ".concat(JSON.stringify(e||{}))),!1):!!e.data&&(function(e){if(V(e))return!0;var t=!1;try{var n=JSON.parse(e);t=JSON.stringify(n)===e}catch(e){t=!1}return t}(e.data)?V(e.data)?e.data:JSON.parse(e.data):(ut.error("received data is not a validJson",e.data),!1))},s=co(i,n,e,t,this._runtime,r,this._pid),this.sendConnectTime=Date.now(),ut.info("conenct start -> ".concat(s)),[4,this._runtime.httpReq({url:s,body:{pid:this._pid},timeout:5e3})];case 1:return a=u.sent(),c=o(a),this._domain=n,c&&0===c.status?(this._sessionid=c.sessionid,this.userId=c.userId,this.connectedTime=c.timestamp,We("connect success -> userId: ".concat(c.userId,", url: ").concat(s))):ut.warn("connect result -> code: ".concat(null==c?void 0:c.status,", url: ").concat(s)),[2,null==c?void 0:c.status]}}))}))},t.prototype.sendCometData=function(e,t){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l;return E(this,(function(h){switch(h.label){case 0:return n=(t=this)._domain,i=t._sessionid,r=t._pid,o=e.messageId,s=e.topic,a=e.targetId,c=e.getHeaderFlag(),u=s?"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&topic=").concat(s,"&targetid=").concat(a,"&pid=").concat(r):"".concat(this._protocol,"://").concat(n,"/websocket?messageid=").concat(o,"&header=").concat(c,"&sessionid=").concat(i,"&pid=").concat(r),[4,this._runtime.httpReq({url:u,method:Lr.POST,body:e.getCometData()})];case 1:return l=h.sent(),this.handleCometRes(l),[2]}}))}))},t.prototype.sendOnly=function(e){this.sendCometData(e)},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),y(this,void 0,void 0,(function(){var r,o,s,a,c=this;return E(this,(function(u){switch(u.label){case 0:return r=this._generateMessageId(),e.messageId=r,this.sendCometData(e),[4,new Promise((function(e){c._messageIds[r]=e,setTimeout((function(){delete c._messageIds[r],e()}),i)}))];case 1:return(o=u.sent())?(s=t&&o.data&&[Q.SUCCESS,Q.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?[2,{code:o.status,data:t&&o.data?a:null}]:[2,{code:Q.SUCCESS,data:a}]):[2,{code:Q.TIMEOUT}]}}))}))},t.prototype.close=function(){this._isDisconnected=!0,this._watcher.status(J.DISCONNECTED)}}(Ar),function(e){return["navi",e].join("_")});function fo(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d,f,p;return E(this,(function(g){switch(g.label){case 0:t=so.IM_NAVI,n=xr(),i=n.sdkPrivate,r=n.serverPrivate,o=n.bundleId,s=Br(t),a=s.protocol,c=s.startTime,u=s.endTime,l=s.code,h=s.host,d=Pr.UNKONWN,g.label=1;case 1:return g.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return d=g.sent(),[3,4];case 3:return f=g.sent(),ut.debug(f.message),[3,4];case 4:return p=0,w(c)&&w(u)&&u>c&&c&&(p=u-c),wr(t,{spr:i,pr:r,bid:o,ptc:a,dur:p,cod:l,hos:h,net:d}),[2]}}))}))}var po=function(){function e(e,t,n){this.runtime=e,this._watcher=t,this._options=n,this._appkey=this._options.appkey,this._apiVer=this._options.apiVersion,this._apiVersion=S(this._options.apiVersion)}return e.prototype.getNaviInfo=function(e,t,n,i){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return n&&this._clear(e),i=function(e,t,n){var i,r,o=ho(e);try{var s=n.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();return r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5}))),0===r.length?n.removeItem(o):n.setItem(o,JSON.stringify(r)),(null===(i=r.find((function(e){return e.token===t})))||void 0===i?void 0:i.naviInfo)||null}(this._appkey,e,this.runtime.localStorage),i?[2,i]:(r=this._options.navigators.slice(),t.length&&t.forEach((function(e){r.indexOf(e)<0&&r.unshift(e)})),[4,this.requestNaviInfo(r,this._appkey,e)]);case 1:return(i=o.sent())?(this.setNaviInfo2Cache(e,i),[2,i]):[2,i]}}))}))},e.prototype.setNaviInfo2Cache=function(e,t){!function(e,t,n,i){var r,o=ho(e);try{var s=i.getItem(o);r=s?JSON.parse(s):[]}catch(e){r=[]}var a=Date.now();r.length>0&&(r=r.filter((function(e){return a-e.timestamp<72e5&&t!==e.token}))),r.push({timestamp:a,naviInfo:n,token:t}),i.setItem(o,JSON.stringify(r))}(this._appkey,e,t,this.runtime.localStorage)},e.prototype._clear=function(e){!function(e,t,n){var i,r=ho(e);try{var o=n.getItem(r);i=o?JSON.parse(o):[]}catch(e){i=[]}var s=Date.now();i.length>0&&(i=i.filter((function(e){return s-e.timestamp<72e5&&t!==e.token}))),0===i.length?n.removeItem(r):n.setItem(r,JSON.stringify(i))}(this._appkey,e,this.runtime.localStorage)},e}(),go=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.getNaviInfo=function(){return this._context.getInfoFromCache()},e.prototype.getCoreVersion=function(){return this._context.coreVersion},e.prototype.getAPIVersion=function(){return this._context.apiVersion},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,i){void 0===i&&(i=[]),this._context.registerMessageType(e,t,n,i)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getRTCJoinedUserInfo=function(e){return this._context.getRTCJoinedUserInfo(e)},e}(),_o=function(e,t,n){return[e,t,n].join("_")},mo=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]||(this._users[e]={inboxTime:0,outboxTime:0,broadcastSyncTime:0})},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=_o("inbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=_o("inbox",this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||x(e))){n.broadcastSyncTime=e;var i=_o("broadcastbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=_o("broadcastbox",this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n))||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var i=_o("outbox",this._appkey,t);this._runtime.localStorage.setItem(i,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=_o("outbox",this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n))||0}return t.outboxTime},e}(),vo={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},yo=function(){function e(e,t){this._kvCaches={},this._chatroomId=e,this._currentUserId=t}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,i=e.type,r=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=i===he.DELETE,c=s===o,u=!this._isExisted(n),l=a?this._remove:this._add;(t||r||c||u)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,i=t.isDeleted;return n&&!i},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,i=e.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,i)})),ut.debug("end setEntries")},e.prototype.clear=function(){this._kvCaches={}},e}(),Eo=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return y(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(i=vo.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===Q.SUCCESS?(vo.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){vo.clear(e);var t=this._storeCaches[e];t&&t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var i=this._storeCaches[e];B(i)||(i=new yo(e,n)),i.setEntries(t),this._storeCaches[e]=i},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),To=function(){function e(e,t,n,i){this._runtime=e,this._appkey=t,this._userId=n,this._canJoinMulipleChrm=i,this._sessionKey="",this._joinedChrmsInfo={},this._sessionKey="sync-chrm-".concat(this._appkey,"-").concat(this._userId)}return e.prototype.set=function(e,t){void 0===t&&(t=10),!this._canJoinMulipleChrm&&(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t,this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo))},e.prototype.get=function(){var e,t;try{t=this._runtime.sessionStorage.getItem(this._sessionKey),e=JSON.parse(t||"{}")}catch(o){ut.error("parse rejoined chrm infos error -> ".concat(t)),e={}}return e},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e],B(this._joinedChrmsInfo)?this._runtime.sessionStorage.setItem(this._sessionKey,JSON.stringify(this._joinedChrmsInfo)):this.clear()},e.prototype.clear=function(){this._joinedChrmsInfo={},this._runtime.sessionStorage.removeItem(this._sessionKey)},e}(),Io="converStatusChanged",Co=function(){function e(e,t,n){this._eventEmitter=new lt,this._pullQueue=[],this._isPulling=!1,this._storage=d(e.runtime),this._appkey=t,this._currentUserId=n,this._engine=e,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n)}return e.prototype._set=function(e){var t=this;if(!x(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(Io,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return y(this,void 0,void 0,(function(){var e,t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=r.sent(),n=t.code,i=t.data,n===Q.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(Io,(function(t){e(t)}))},e.prototype.unwatch=function(){this._eventEmitter.off(Io,(function(e){}))},e}(),Ro={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0}},So={};for(var No in Ro){var Oo=Ro[No].keyName;So[Oo]=No}var Mo,bo=function(){function e(e,t,n){this._appkey=t,this._currentUserId=n;var i="con-".concat(t,"-").concat(n);this.storage=new p(e,i),this._localStore=new p(e,"CONVER-".concat(t,"-").concat(n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),i=t.shift(),r=t.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:O.PRIVATE,targetId:"",channelId:""}},e.prototype.updateMentionedData=function(e){var t=this,n=e.conversationType,i=e.targetId,r=e.messageType,o=e.isMentioned,s=e.content,a=e.senderUserId,c=e.channelId,u=this._getStoreKey(n,i,c),l=this._localStore.get(u)||{},h=So.mentionedInfo,d=So.hasMentioned,f=l[h]||{},p=f.userIdList||[],g=s.mentionedInfo;if(g){if(o&&n===O.GROUP&&((g.userIdList||[]).forEach((function(e){e===t._currentUserId&&p.indexOf(a)<0&&p.push(a)})),g.type===re.ALL&&p.indexOf(a)<0&&p.push(a)),r===Z.RECALL&&n===O.GROUP){var _=p.indexOf(a);_>=0&&p.splice(_,1)}g={userIdList:p,type:(null==g?void 0:g.type)||f.type},0!==p.length?(l[h]=g,l[d]=!0):(delete l[h],delete l[d]),B(l)?this._localStore.set(u,l):this._localStore.remove(u)}},e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),o=this._localStore.get(r)||{};for(var s in n){var a=So[s],c=n[s];if(!x(a)&&!x(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s){if(c===Ro[a].defaultVal||"tags"===s&&!B(c))delete o[a];else if("tags"===s){var u=c;for(var l in u)u[l].isTop||delete u[l].isTop;o[a]=c}else o[a]=c;o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}}B(o)?this._localStore.set(r,o):this._localStore.remove(r)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var i=this._getStoreKey(e,t,n),r=this._localStore.get(i)||{},o={};for(var s in Ro){var a=Ro[s],c=a.keyName,u=a.defaultVal;o[c]=r[s]||Ut(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=t[i];for(var a in s)if(Ro[a]){var c=Ro[a],u=c.keyName,l=c.defaultVal;o[u]=s[a]||Ut(l)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=e[n];for(var c in a){var u=Ro[c],l=u.keyName,h=u.defaultVal;s[l]=a[c]||Ut(h)}for(var d in s.tags){x(t[d])&&(t[d]=[]);var f=Object.assign({},s,{conversationType:r,targetId:o});delete f.tags,t[d].push(f)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){ut.error("adaptOldStore error: ".concat(e.message))}},e}(),Uo=[O.PRIVATE,O.GROUP,O.SYSTEM,O.PUBLIC_SERVICE,O.APP_PUBLIC_SERVICE],Ao="conversationChanged",wo="conTagStatusChanged",Lo=function(){function e(e,t,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new lt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new bo(e.runtime,t,n),this._statusManager=new Co(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(Ao,(function(e){i(e)})),this._eventEmitter.on(wo,(function(){r()}))}return e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===Y.SEND&&a===this._loginUserId,u=i===Z.RECALL,l=V(n),h=!1,d={},f=t.lastUnreadTime||0,p=t.lastReadTime||0,g=t.unreadMessageCount||0;if(f>r||c)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=g+1,t.lastUnreadTime=r,h=!0),u&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),m=!this._recallMsgTimeMap[_]||this._recallMsgTimeMap[_]&&!this._recallMsgTimeMap[_].find((function(e){return e===n.sentTime})),v=f>=n.sentTime;p&&(v=p=0){var a=!1,c=this._store.get(i,o,s),u={};if([this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,c),r=i.hasChanged,o=i.localConversation,s=i.updateItems;a=a||r,u=v(v({},u),s),c=Ut(o)})),a&&this._store.set(i,o,c,s),this._store.updateMentionedData(e),r){var l=this._store.get(i,o,s);l.updatedItems=v({latestMessage:{time:e.sentTime,val:e}},u),l.latestMessage=e;var h=Object.assign(l,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(h)}(a||r)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(e){var i=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;i=i||0,(n||1!==o||s===ne.NOT_SET||s===ne.ALL_MESSAGE)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],i=0;return n.forEach((function(e){var n=e.unreadMessageCount,r=e.notificationStatus,o=e.notificationLevel;(t||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,i){void 0===i&&(i=!0);var r=this._store.get(e,t,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,r,n),i&&0!==Object.keys(a).length){var c=Object.assign(r,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,t.lastReadTime=t.lastUnreadTime,e._recallMsgTimeMap={},e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,i){var r="".concat(e,"_").concat(t,"_").concat(i);this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[i]},e.prototype.addTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;r=Object.assign(r,n),this._store.set(e,t,{tags:r},i)},e.prototype.deleteTagStatus=function(e,t,n,i){void 0===i&&(i="");var r=this._store.get(e,t,i).tags;n.forEach((function(e){delete r[e]})),this._store.set(e,t,{tags:r},i)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===ee.OPEN||-1!==e.notificationLevel&&0!==e.notificationLevel})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.getTopConversationList=function(){return(this._store.getValue()||{}).filter((function(e){return e.isTop})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===e&&(e=""),this.get(t,n,e).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e}(),Po=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey="tag-".concat(t,"-").concat(n),this._storagePullTimeKey="us-s-".concat(t,"-").concat(n),this._storage=d(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,i=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return y(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,i=t.data,n!==Q.SUCCESS||x(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,x(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),Do=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return y(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===Q.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),Vo=function(e,t){return["send_msg",e,t].join("_")},ko=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=Vo(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=Vo(this._appkey,this._userId),i=this._getLocalInfo(n);i[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(i))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=Vo(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t] ".concat(s)),[4,this.runtime.httpReq({url:s,timeout:1e4,dataType:"text"})]):[3,4];case 2:if(a=p.sent(),c=(new Date).getTime(),Gr(so.IM_NAVI,{endTime:c}),200!==a.status)return u=void 0,403===a.status?(u=Q.RC_CONN_USER_OR_PASSWD_ERROR,ze("request navi error: "+u)):401===a.status&&(u=Q.RC_CONN_APP_BLOCKED_OR_DELETED,ze("request navi error: "+u)),Gr(so.IM_NAVI,{code:u}),fo(this.runtime),[3,3];try{return l=a.data.match(/{[\d\D]+}/),0===(h=l&&l[0]?l[0]:"").indexOf('{\\"code\\":')&&(h=JSON.parse('"'+h+'"')),f=JSON.parse(h),d=/^https/.test(s)?"https":"http",f.protocol=d,this.runtime.useNavi||(f.server="",f.backupServer=this._miniConnectUrl,f.logSwitch=0),kr({serverPrivate:f.type===Xi.PRIVATE?Xi.PRIVATE:Xi.OPEN}),Gr(so.IM_NAVI,{code:Q.SUCCESS}),f.userId&&(ot({userId:f.userId}),qe({userId:f.userId})),fo(this.runtime),[2,f]}catch(e){ze("parse navi err =>",e)}p.label=3;case 3:return r+=1,[3,1];case 4:return this.runtime.useNavi?[2,null]:(f={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,uploadServer:"https://upload.qiniup.com",bosAddr:"https://gz.bcebos.com",location:"",monitor:0,joinMChrm:!1,openMp:0,openUS:0,grpMsgLimit:0,isFormatted:0,gifSize:2048,logSwitch:0,logPolicy:"",compDays:0,msgAck:"",activeServer:"",qnAddr:"",extkitSwitch:0,alone:!1,voipServer:"",offlinelogserver:"",backupServer:this._miniConnectUrl},Gr(so.IM_NAVI,{code:f.code,startTime:0,endTime:0,host:""}),fo(this.runtime),[2,f])}}))}))},t.prototype.getNaviInfoFromCache=function(){return this.naviInfo?v({},this.naviInfo):null},t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connect=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a=this;return E(this,(function(c){switch(c.label){case 0:return n=[],this.naviInfo=t,t.server?n.push(t.server):ut.warn("navi.server is invalid"),(i=t.backupServer)&&i.split(",").forEach((function(e){n.indexOf(e)<0&&n.push(e)})),0===n.length?(ut.error("navi invaild.",n),[2,Q.UNKNOWN]):(r=this.runtime.createDataChannel({status:function(i){a._connectionStatusHandler(i,e,n,t.protocol)},signal:this._signalHandler.bind(this)},this._options.connectionType),o=yt.V3,1===t.openAnti&&(o=yt.V4),[4,r.connect(this._appkey,e,n,t.protocol,this._apiVer,o)]);case 1:return(s=c.sent())===Q.SUCCESS?(this._channel=r,this.currentUserId=r.userId,this._connectedTime=r.connectedTime,this._localConnectedTime=Math.floor((Date.now()+r.sendConnectTime)/2),this._watcher.status(J.CONNECTED),this._status=J.CONNECTED,this._pullOfflineFinished=!1,this._conversationManager=new Lo(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag),this._ultraGroupManager=new qo(this,this._appkey,this.currentUserId),this._conversationManager.startPullConversationStatus(0),this._userSettingManager=new Po(this,this._appkey,this.currentUserId,this._watcher.tag),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._conversationManager.adaptOldStore(),this._rtcKVManager=new Do(this),this._joinedChrmManager=new To(this.runtime,this._appkey,this.currentUserId,t.joinMChrm),this._startSyncInterval(),1===t.ugMsg&&this._startUltraSyncInterval()):r.close(),[2,s]}}))}))},t.prototype._connectionStatusHandler=function(e,t,n,i){if(ut.warn("connection status changed:",e),this._status=e,e!==J.CONNECTING)if(e!==J.CONNECTED){if(this._channel&&e!==J.DISCONNECTED)return e===J.BLOCKED||e===J.KICKED_OFFLINE_BY_OTHER_CLIENT||e===J.DISCONNECT_BY_SERVER?(this.disconnect(),void this._watcher.status(e)):void(e!==J.REDIRECT?(this._watcher.status(e),this._try2Reconnect(t,n,i)):this._watcher.status(e));this._watcher.status(e)}else this._watcher.status(e);else this._watcher.status(e)},t.prototype._try2Reconnect=function(e,t,n){var i,r;return y(this,void 0,void 0,(function(){var o,s=this;return E(this,(function(a){switch(a.label){case 0:return this._channel?(o=yt.V3,1===(null===(i=this.naviInfo)||void 0===i?void 0:i.openAnti)&&(o=yt.V4),[4,this._channel.connect(this._appkey,e,t,n,this._apiVer,o)]):[2];case 1:return a.sent()===Q.SUCCESS?(this._pullOfflineFinished=!1,this._startSyncInterval(),this._watcher.status(J.CONNECTED),this._status=J.CONNECTED,1===(null===(r=this.naviInfo)||void 0===r?void 0:r.ugMsg)&&this._startUltraSyncInterval(),this._rejoinChrm(),[2]):(this._watcher.status(J.WEBSOCKET_UNAVAILABLE),this._status=J.WEBSOCKET_UNAVAILABLE,this._reconnectTimer=setTimeout((function(){s._reconnectTimer=-1,s._try2Reconnect(e,t,n)}),5e3),[2])}}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,i=e.topic;if(n)this._receiveSyncMsg(e,t);else{var r=ao[i];if(r)switch(r){case ao.s_ntf:ut.info("recv s_ntf -> signal.messageId: ".concat(e.messageId)),this._pullMsg(e);break;case ao.s_msg:this._receiveMsg(e);break;case ao.s_cmd:this._receiveStateNotify(e);break;case ao.s_us:this._receiveSettingNotify(e);break;case ao.rtc_ntf:this._receiveRtcKv(e);break;case ao.s_opNtf:this._pullOperateStatusNotify(e)}else ut.error("unknown topic:",i)}},t.prototype._receiveStateNotify=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,$t),i=n.time,r=n.type,o=n.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(o,i);break;case 3:this._conversationManager.startPullConversationStatus(i);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(i),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(i),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t,n=(null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Jn)).version;this._userSettingManager.pullUserSettings(n)},t.prototype._receiveRtcKv=function(e){var t,n=null===(t=this._channel)||void 0===t?void 0:t.codec.decodeByPBName(e.data,Mi),i=n.time,r=n.type,o=n.roomId;1===r&&this._rtcKVManager.pullEntry(o,i)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,i=t.del,r=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},t.prototype._receiveSyncMsg=function(e,t){var n,i;if(xo.includes(e.topic)){if(e.topic===ao[ao.updUgRTime]){var r=null===(n=this._channel)||void 0===n?void 0:n.codec.decodeByPBName(e.data,un),o=r.channelId,s=r.busChannel,a=this._ultraGroupMap[s+"_"+o];return a&&(a.unreadMessageCount=0,a.unreadMentionedCount=0,a.lastReadTime=t.timestamp,this._watcher.conversation(Pt([a]))),void(t&&(this._ultraMsgMap[t.messageUId]=t.timestamp))}var c=null===(i=this._channel)||void 0===i?void 0:i.codec.decodeByPBName(e.data,Kt,{currentUserId:this.currentUserId,signal:e});c=this._handleMsgProperties(c),t&&(c.sentTime=t.timestamp,c.messageUId=t.messageUId),this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||c.sentTime):(t&&this._sendMessageStore.setMessage(t.messageUId,t.timestamp),c.messageType!==Z.EXPANSION_NOTIFY?(c.messageType===Z.SYNC_READ_STATUS&&this._conversationManager.clearUnreadCount(c.conversationType,c.targetId,c.channelId),this._conversationManager.setConversationCacheByMessage(c,!0),this._watcher.batchMessage([c])):this._receiveMessageExpansion(c))}},t.prototype._pullMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,$t),n=t.type,i=t.chrmId,r=t.time;if(ut.info("s_ntf -> type: ".concat(n,", chrmId: ").concat(i,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()}},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval(),this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncMsg=function(){return y(this,void 0,void 0,(function(){var e,t,n,i,r,o,s,a,c,u,l,h,d,f,p,g,_,m,v,y=this;return E(this,(function(E){switch(E.label){case 0:return this._pullingMsg?[2]:this._channel?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),ut.info("pullMsg -> sendboxTime: ".concat(e,", inboxTime: ").concat(t,", broadcastSyncTime: ").concat(n)),i=this._channel.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new to(ao[ao.pullMsg],i,this.currentUserId),o=Ke(),We(ue.L_PULL_MSG_T,{outboxTime:e,inboxTime:t,broadcastSyncTime:n},{traceId:o}),[4,this._channel.send(r,jt,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=E.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==Q.SUCCESS||!c||x(c.finished)||x(c.list)||x(c.syncTime)?(ut.warn("pullMsg failed -> code:",a,", data: ",c),Je(ue.L_PULL_MSG_R,{code:a,timestamp:this._latestSyncTimestamp},{traceId:o}),this._pullingMsg=!1,[2]):(u=c.list,l=c.finished,h=c.syncTime,d=c.broadcastSyncTime,f=void 0===d?1:d,ut.info("pullMsg success -> syncTime: ".concat(h,", finished: ").concat(l)),p=0,g=[],_=[],u.forEach((function(e){if(g.push(e.messageUId),e.messageDirection===Y.SEND&&(p=Math.max(e.sentTime,p),y._sendMessageStore.getSendMessageMap()[e.messageUId]))y._sendMessageStore.removeByUID(e.messageUId);else if(e.messageType!==Z.EXPANSION_NOTIFY){if(e.messageType===Z.SYNC_READ_STATUS){if(e.senderUserId!==y.currentUserId)return;y._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId)}var t=y._handleMsgProperties(e);y._conversationManager.setConversationCacheByMessage(t,!0),_.push(t)}else y._receiveMessageExpansion(e)})),this._watcher.batchMessage(_),this._letterbox.setInboxTime(h,this.currentUserId),this._letterbox.setOutboxTime(p,this.currentUserId),this._letterbox.setBroadcastSyncTime(f,this.currentUserId),this._sendMessageStore.removeByTimestamp(p),this._pullingMsg=!1,m=this._pullQueue.filter((function(e){return e>h})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,m),l&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),We(ue.L_PULL_MSG_R,{code:a,messageUIds:g.join(","),timestamp:this._latestSyncTimestamp,hasmore:!l},{traceId:o}),(!l||m.length>0)&&this._syncMsg(),[2])}}))}))},t.prototype._receiveMsg=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Yt,{currentUserId:this.currentUserId,connectedTime:this._channel.connectedTime});if((t=this._handleMsgProperties(t)).conversationType!==O.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}t.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==Z.EXPANSION_NOTIFY?t.messageType===Z.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._watcher.batchMessage([t])):this._receiveMessageExpansion(t)}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isCounted,o=e.isPersited,s=e.isStatusMessage,a=i in u,c=i in this._customMessageType;if(n=a?v(v({},u[i]),{isStatusMessage:l.includes(i)}):c?this._customMessageType[i]:{isCounted:!G(r)&&r,isPersited:!G(o)&&o,isStatusMessage:!1},Object.assign(e,n),t&&!x(s)&&(e.isStatusMessage=s),!t){var h=e.content.user;if(h){var d=h.portrait,f=h.portraitUri,p=d||f;p&&(h.portrait=h.portraitUri=p)}}return e},t.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){return void 0===o&&(o=""),y(this,void 0,void 0,(function(){var s,c,u,l,h,d,f,p,g,_;return E(this,(function(m){switch(m.label){case 0:return c=(s=this).currentUserId,u=s._channel,l=Cr[e]||mr,h=1===i&&0===n,u?(d=u.codec.encodeGetHistoryMsg(t,{timestamp:n,count:h?2:i,order:r,channelId:o}),We(ue.L_GET_HISTORY_MSG_T,{targetId:t,conversationType:e,channelId:o,timestamp:n,count:i,order:r},{traceId:a}),[4,u.send(new to(l,d,c),Xt,{currentUserId:c,connectedTime:u.connectedTime,conversation:{targetId:t}})]):[3,2];case 1:return f=m.sent(),(p=f.code)===Q.SUCCESS&&d?(g=f.data,h&&2===g.list.length&&(g.hasMore=!0,0===r?g.list.shift():g.list.pop()),_=[],g.list&&g.list.forEach((function(e){e&&_.push(e.messageUId)})),We(ue.L_GET_HISTORY_MSG_R,{code:p,messageUIds:_.join(",")},{traceId:a}),[2,{code:p,data:{list:g.list,hasMore:g.hasMore}}]):(Je(ue.L_GET_HISTORY_MSG_R,{code:p,messageUIds:""},{traceId:a}),[2,{code:p}]);case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.reportSDKInfo=function(e){var t=this.currentUserId,n=this._channel;if(n){ut.info("reportSDKInfo ->",e);var i=n.codec.encodeReportSDKInfo(JSON.stringify(e)),r=new to(ao[ao.reportsdk],i,t);n.send(r).then((function(e){var t=e.code;t!==Q.SUCCESS&&ut.warn("reportSDKInfo failed -> code: ".concat(t))}))}},t.prototype.deleteRemoteMessage=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l;return E(this,(function(h){switch(h.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeDeleteMessages(e,t,n,i),c=new to(or,a,o),[4,s.send(c)]):[3,2];case 1:return u=h.sent(),l=u.code,Q.SUCCESS,[2,l];case 2:return[2,Q.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l,h;return E(this,(function(d){switch(d.label){case 0:return o=(r=this).currentUserId,(s=r._channel)?(a=s.codec.encodeClearMessages(t,n,i,e),c=Rr[e],u=new to(c,a,o),[4,s.send(u)]):[3,2];case 1:return l=d.sent(),h=l.code,Q.SUCCESS,[2,h];case 2:return[2,Q.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l,h,d=this;return E(this,(function(f){switch(f.label){case 0:return o=(r=this).currentUserId,s=r._channel,t=t||O.PRIVATE,s?(a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),c=new to(fr,a,o),[4,s.send(c,tn,{currentUserId:o,connectedTime:s.connectedTime,afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=d._conversationManager.get(t,n,i);return Object.assign(e,r),e}})]):[3,2];case 1:return u=f.sent(),l=u.code,h=u.data,l!==Q.SUCCESS?[2,{code:l}]:[2,{code:l,data:null==h?void 0:h.list}];case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.removeConversation=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return(i=this._channel)?(r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new to(pr,r,t),[4,i.send(o)]):[3,2];case 1:return s=c.sent(),ut.info("RemoveConversation =>",s),a=s.code,Q.SUCCESS,[2,a];case 2:return[2,Q.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype.getConversation=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return e!==O.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:Q.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:Q.CONVER_GET_ERROR}];case 2:if(o=u.sent(),s=o.code,a=o.data,s!==Q.SUCCESS)return[2,{code:Q.CONVER_GET_ERROR}];c=(null==a?void 0:a.list[0])||null,i={conversationType:e,targetId:t,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:c,notificationStatus:r.notificationStatus||ee.CLOSE,notificationLevel:r.notificationLevel||ne.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},u.label=3;case 3:return[2,{code:Q.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:Q.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return r=e===O.ULTRA_GROUP?(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0:this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:Q.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(Q.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(Q.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve(Q.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:Q.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(Q.SUCCESS)},t.prototype.pullConversationStatus=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l=this;return E(this,(function(h){switch(h.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeGetConversationStatus(e),o=new to(ao[ao.pullSeAtts],r,i),[4,n.send(o,$n)]):[3,2];case 1:return s=h.sent(),a=s.code,c=s.data,We(ue.L_PULL_CONVERSATION_S,{timestamp:e,userId:i}),a!==Q.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.channelId,o=e.isTop,s=e.notificationLevel,a=l._ultraGroupMap[r+"_"+n];t===O.ULTRA_GROUP?a&&(void 0!==i&&(a.notificationStatus=i),void 0!==s&&(a.notificationLevel=s),void 0===s&&void 0===i||l._ultraGroupManager.addUltraGroupStatus(e),"boolean"==typeof o&&(a.isTop=o)):u.push(e)})),[2,{code:a,data:u}]);case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.batchSetConversationStatus=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d=this;return E(this,(function(f){switch(f.label){case 0:return n=(t=this).currentUserId,(i=t._channel)?(r=i.codec.encodeSetConversationStatus(e,this._conversationUpdatedTime),o=new to(gr,r,n),[4,i.send(o,ti)]):[3,2];case 1:return s=f.sent(),a=s.code,c=s.data,a===Q.SUCCESS?(u=c,this._conversationUpdatedTime=u.version,l=[],e.forEach((function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,o=e.channelId,s=e.isTop;if(t===O.ULTRA_GROUP){var a=d._ultraGroupMap[o+"_"+n];a&&(void 0!==i&&(a.notificationStatus=i),void 0!==r&&(a.notificationLevel=r),void 0===r&&void 0===i||d._ultraGroupManager.addUltraGroupStatus(a),void 0!==s&&(a.isTop=s),l.push(a))}else d._conversationManager.addStatus(v(v({},e),{updatedTime:u.version}),!0)})),l.length>0&&(h=Pt(l),h=jo(h),this._watcher.conversation(h)),[2,a]):[2,a];case 2:return[2,Q.RC_NET_CHANNEL_INVALID]}}))}))},t.prototype._joinChrm=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l,h;return E(this,(function(d){switch(d.label){case 0:return(r=this._channel)?(o=r.codec.encodeJoinOrQuitChatRoom(),a=new to(s=n?ar:sr,o,e),We(ue.L_JOIN_CHATROOM_T,{chatroomId:e,count:t,topic:s},{traceId:i}),[4,r.send(a,hn)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return c=d.sent(),u=c.code,l=c.data,(u===Q.SUCCESS?We:Je)(ue.L_JOIN_CHATROOM_R,{code:u,timestamp:(new Date).getTime()},{traceId:i}),u===Q.SUCCESS&&(h=l.joinTime,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,h),this.naviInfo.kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull()),[2,u]}}))}))},t.prototype._rejoinChrm=function(){return y(this,void 0,void 0,(function(){var e,t,n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,a.label=1;case 1:return id})),p=[],g=[],h.forEach((function(e){e.sentTime0)&&this._pullChrmMsg(e),[2]):(Je(ue.L_PULL_CHATROOM_MSG_R,{code:u,timestamp:o,messageUIds:""}),ut.warn("pull chatroom msg failed, code:",u,", data:",l),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return y(this,void 0,void 0,(function(){return E(this,(function(i){return[2,this._joinChrm(e,t,!1,n)]}))}))},t.prototype.joinExistChatroom=function(e,t,n){return y(this,void 0,void 0,(function(){return E(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o;return E(this,(function(s){switch(s.label){case 0:return(t=this._channel)?(n=t.codec.encodeJoinOrQuitChatRoom(),i=new to(cr,n,e),[4,t.send(i)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return r=s.sent(),(o=r.code)===Q.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return(i=this._channel)?(r=i.codec.encodeGetChatRoomInfo(t,n),o=new to(ao[ao.queryChrmI],r,e),[4,i.send(o,fn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==Q.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u;return E(this,(function(l){switch(l.label){case 0:return(r=this._channel)?(o=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),s=new to(yr,o,e),[4,r.send(s,Xt,{conversation:{targetId:e}})]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return a=l.sent(),c=a.code,u=a.data,c!==Q.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,l;return E(this,(function(h){switch(h.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===he.UPDATE?ur:lr,c=new to(a,s,e),[4,i.send(c,hn)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return u=h.sent(),(l=u.code)===Q.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:(new Date).getTime()},r),[2,l]):[2,l]}}))}))},t.prototype._modifyChatroomKVS=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,l,h,d,f,p=this;return E(this,(function(g){switch(g.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t.entries.forEach((function(t){var n=p._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?p.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(e,t,r),s=t.type===he.UPDATE?hr:dr,a=new to(s,o,e),[4,i.send(a,Fn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return c=g.sent(),u=c.code,-1!==[Q.SUCCESS,Q.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(u)&&(h=[],delete(d=Object.assign({},t)).entries,t.entries.forEach((function(e){h.push(Object.assign({},e,d))})),u===Q.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,ut.warn("设置失败的属性:",f.errorKeys),l=f.errorKeys,f&&Array.isArray(f.errorKeys)&&f.errorKeys.forEach((function(e){var t=h.findIndex((function(t){return e.key===t.key}));-1!==t&&h.splice(t,1)}))),ut.warn("设置成功的属性:",h),this._chrmEntryHandler.setLocal(e,{kvEntries:h,syncTime:(new Date).getTime()},r)),[2,{code:u,data:l}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return t.type=he.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,Promise.resolve({code:Q.SUCCESS,data:n})]:[3,1];case 1:return(i=this._channel)?(r=i.codec.encodePullChatRoomKV(0),o=new to(ao[ao.pullKV],r,e),[4,i.send(o,Bn)]):[2,Promise.reject({code:Q.RC_NET_CHANNEL_INVALID})];case 2:return s=u.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(e){return e.key===t})),void 0!==c)?[2,Promise.resolve({code:Q.SUCCESS,data:null==c?void 0:c.value})]:[2,Promise.resolve({code:Q.CHATROOM_KEY_NOT_EXIST})]}}))}))},t.prototype.getAllChatroomEntry=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,Promise.resolve({code:Q.SUCCESS,data:t})]:[3,1];case 1:return(n=this._channel)?(i={},r=n.codec.encodePullChatRoomKV(0),o=new to(ao[ao.pullKV],r,e),[4,n.send(o,Bn)]):[2,Promise.reject({code:Q.RC_NET_CHANNEL_INVALID})];case 2:return s=c.sent(),(a=s.data||{})&&a.kvEntries&&a.kvEntries.length&&a.kvEntries.forEach((function(e){e.key&&(i[e.key]=e.value||"")})),[2,Promise.resolve({code:Q.SUCCESS,data:i})]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,l,h,d,f;return E(this,(function(p){switch(p.label){case 0:return i=(n=this)._channel,r=n.currentUserId,i?(t||(t=this._pullChatroomEntryTimestamp),o=i.codec.encodePullChatRoomKV(t),s=new to(ao[ao.pullKV],o,e),We(ue.L_PULL_CHATROOM_KV_T,{chatroomId:e,timestamp:t}),[4,i.send(s,Bn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return a=p.sent(),c=a.code,u=a.data,(c===Q.SUCCESS?We:Je)(ue.L_PULL_CHATROOM_KV_R,{code:c,timestamp:t}),c===Q.SUCCESS?(ut.info("Pull success ChrmKV, "+JSON.stringify(a)),this._chrmEntryHandler.setLocal(e,u,r),ut.info("Save into cache success!"),h=(l=u).kvEntries,d=l.syncTime,this._pullChatroomEntryTimestamp=d||0,f=[],h.length>0&&(h.forEach((function(t){var n=t.key,i=t.value,r=t.type,o=t.timestamp;f.push({key:n,value:i,type:r,timestamp:o,chatroomId:e})})),this._watcher.chatroom({updatedEntries:f})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._channel?t.forEach((function(t){e._pullChrmMsg(t),e.naviInfo.kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),18e4)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,i,r){return y(this,void 0,void 0,(function(){var o,s,a,c,u,l,h,d,f,p,g;return E(this,(function(_){switch(_.label){case 0:return this._channel?(n=function(e,t){return"RC:SRSMsg"===e.messageType&&Object.assign(e,{directionalUserIdList:[t]}),e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![O.PRIVATE,O.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[O.PRIVATE]=ao.ppMsgS,t[O.GROUP]=ao.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[O.PRIVATE]=ao.ppMsgP,t[O.GROUP]=ao.pgMsgP,t[O.CHATROOM]=ao.chatMsg,t[O.CUSTOMER_SERVICE]=ao.pcMsgP,t[O.RTC_ROOM]=ao.prMsgS,t)[e]}(e)||ao.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},n),(c=new Zr(ao[s],a,t)).setHeaderQos(gt.AT_LEAST_ONCE),u=n.isPersited?Wo():0,o?(this._channel.sendOnly(c),[2,{code:Q.SUCCESS,data:Yo(e,t,v({},n),"",0,this.currentUserId,u)}]):(l=Date.now()-this._localConnectedTime+this._connectedTime,h=Yo(e,t,v({},n),"",l,this.currentUserId,u),i&&i(u),We(ue.L_SEND_MSG_T,{messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId},{traceId:r}),[4,this._channel.send(c)])):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return d=_.sent(),f=d.code,p=d.data,f!==Q.SUCCESS?(Je(ue.L_SEND_MSG_R,{code:f,messageUId:h.messageUId,messageId:h.messageId},{traceId:r}),[2,{code:f,data:h}]):(We(ue.L_SEND_MSG_R,{code:f,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId},{traceId:r}),g=p,this._sendMessageStore.setMessage(g.messageUId,g.timestamp),h.sentTime=g.timestamp,h.messageUId=g.messageUId,this._conversationManager.setConversationCacheByMessage(h,!0),[2,{code:Q.SUCCESS,data:h}])}}))}))},t.prototype.recallMsg=function(e,t,n,i,r){var o;return y(this,void 0,void 0,(function(){var s,a,c,u,l,h,d,f,p,g,_,m,y;return E(this,(function(E){switch(E.label){case 0:return this._channel?(s=r.user,a=r.extra,c=r.isDelete,u={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},s&&(u.user=s),a&&(u.extra=a),l={content:u,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},h=ao[ao.recallMsg],d=this._channel.codec.encodeUpMsg({conversationType:e,targetId:t},l),(f=new Zr(h,d,this.currentUserId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(f)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return p=E.sent(),g=p.code,_=p.data,e===O.ULTRA_GROUP&&Qe(ue.L_RECALL_ULTRA_MSG_S,{code:g,conversationType:e,targetId:t,channelId:r.channelId}),g!==Q.SUCCESS?[2,{code:g}]:(m=_,e===O.ULTRA_GROUP?(this._ultraMsgMap[m.messageUId]=m.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:Q.SUCCESS}]):(this._sendMessageStore.setMessage(m.messageUId,m.timestamp),y=Yo(e,t,v(v({},l),{isPersited:!0}),m.messageUId,m.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),[2,{code:Q.SUCCESS,data:y}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeReadReceipt(t,n),r=new to(ao[ao.rrMsg],i,e),[4,this._channel.send(r)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.getMessageReader=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeMessageReader(t,n),r=new to(ao[ao.rrList],i,e),[4,this._channel.send(r,ai)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return[2,o.sent()]}}))}))},t.prototype.pullUserSettings=function(e){return y(this,void 0,void 0,(function(){var t,n;return E(this,(function(i){return this._channel?(t=this._channel.codec.encodePullUserSetting(e),n=new to(ao[ao.pullUS],t,this.currentUserId),[2,this._channel.send(n,Wn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getFileToken=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u;return E(this,(function(l){switch(l.label){case 0:return this._channel?(r=i&&"uploads"!==i?t||"":Tt(e,t),o=this._channel.codec.encodeGetFileToken(e,r,n||"",i||""),s=new to(ao[ao.qnTkn],o,this.currentUserId),[4,this._channel.send(s,An)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return a=l.sent(),c=a.code,u=a.data,u=Object.assign(u,{fileName:r}),c===Q.SUCCESS?[2,{code:c,data:u}]:[2,{code:c}]}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l,h,d;return E(this,(function(f){switch(f.label){case 0:return this._channel?(r="",o="",s="",t===se.QINIU?(o=wn,s=Pn):(o=Ln,s=Dn),r=t===se.QINIU?ao[ao.qnUrl]:t===se.AWS?ao[ao.s3Url]:t===se.STC?ao[ao.stcUrl]:ao[ao.aliUrl],a=this._channel.codec.encodeGetFileUrl(o,e,n,i),c=new to(r,a,this.currentUserId),[4,this._channel.send(c,s)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return u=f.sent(),l=u.code,h=u.data,d=h,l===Q.SUCCESS?[2,{code:l,data:d}]:[2,{code:l}]}}))}))},t.prototype.disconnect=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._channel&&(this._channel.close(),this._channel=void 0),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData()},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.destroy=function(){throw new Error("JSEngine's method not implemented.")},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new to(ao[ao.addSeTag],n,this.currentUserId),[4,this._channel.send(i,jn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Q.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([v(v({},e),{createdTime:a})],a),[2,{code:Q.SUCCESS,data:s}])}}))}))},t.prototype.removeTag=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeRemoveTag([e],t),i=new to(ao[ao.delSeTag],n,this.currentUserId),[4,this._channel.send(i,jn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Q.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:Q.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?(t=this._userSettingManager.getVersion(),n=this._channel.codec.encodeCreateTag([e],t),i=new to(ao[ao.addSeTag],n,this.currentUserId),[4,this._channel.send(i,jn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Q.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:Q.SUCCESS,data:s}])}}))}))},t.prototype.getTagList=function(){return y(this,void 0,void 0,(function(){var e,t;return E(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:Q.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s=this;return E(this,(function(a){switch(a.label){case 0:return this._channel?this._userSettingManager.getTagById(e)?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new to(ao[ao.addTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:Q.TAG_NOT_EXIST}]:[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return(r=a.sent().code)!==Q.SUCCESS?[2,{code:r}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:Q.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o=this;return E(this,(function(s){switch(s.label){case 0:return this._channel?(n=this._channel.codec.encodeUpdateConversationTag([{tagId:e}],t),i=new to(ao[ao.delTag],n,this.currentUserId),[4,this._channel.send(i)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return(r=s.sent().code)!==Q.SUCCESS?[2,{code:r}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:Q.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return this._channel?(n=e.conversationType,i=e.targetId,r=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._channel.codec.encodeUpdateConversationTag(o,[e]),a=new to(ao[ao.delTag],s,this.currentUserId),[4,this._channel.send(a)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return(c=u.sent().code)!==Q.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,i,t,r),[2,{code:Q.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,l,h;return E(this,(function(d){switch(d.label){case 0:return r=(i=this).currentUserId,(o=i._channel)?(s=o.codec.encodeOldConversationList({count:n,type:O.PRIVATE,startTime:t}),a=new to(fr,s,r),[4,o.send(a,tn,{currentUserId:r,connectedTime:o.connectedTime})]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return c=d.sent(),u=c.code,l=c.data,h=this._conversationHasTagFilter(e,null==l?void 0:l.list),ut.info("GetConversationListByTag",h),u!==Q.SUCCESS?[2,{code:u}]:[2,{code:u,data:h}]}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,c=n._conversationManager.get(o,s,a),u=c.hasMentioned,l=c.mentionedInfo,h=c.lastUnreadTime,d=c.notificationStatus,f=c.isTop,p=c.tags,g=c.unreadMessageCount,_=p&&p[e];if(_){var m=v(v({},t),{hasMentioned:u,mentionedInfo:l,lastUnreadTime:h,notificationStatus:d,isTop:f,unreadMessageCount:g});_.isTop?i.push(v(v({},m),{isTopInTag:!0})):r.push(v(v({},m),{isTopInTag:!1}))}})),T(T([],i.sort(o),!0),r.sort(o),!0)},t.prototype.getUnreadCountByTag=function(e,t){return y(this,void 0,void 0,(function(){var n;return E(this,(function(i){return this._channel?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:Q.SUCCESS,data:n}]):[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,l,h,d;return E(this,(function(f){switch(f.label){case 0:return this._channel?(i=t.targetId,r=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._channel.codec.encodeUpdateConversationTag(a,[t]),l=new to(ao[ao.addTag],u,this.currentUserId),[4,this._channel.send(l)]):[2,{code:Q.NO_TAG_IN_CONVER}]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return(h=f.sent().code)!==Q.SUCCESS?[2,{code:h}]:((d={})[e]={},s&&(d[e].isTop=!0),this._conversationManager.addTagStatus(r,i,d,o),[2,{code:Q.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return y(this,void 0,void 0,(function(){var n,i,r,o;return E(this,(function(s){if(!this._channel)return[2,{code:Q.RC_NET_CHANNEL_INVALID}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(t=i[o])||void 0===t?void 0:t.tagName});return[2,{code:Q.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:Q.SUCCESS,data:e})},t.prototype.getTopConversationList=function(){var e=this._conversationManager.getTopConversationList();return Promise.resolve({code:Q.SUCCESS,data:e})},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===O.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.channelId,e.conversationType,e.targetId),Promise.resolve({code:Q.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:Q.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===O.ULTRA_GROUP)return Promise.resolve({code:Q.METHOD_NOT_AVAILABLE});var i;if(!(i=e===O.ULTRA_GROUP?this._ultraGroupManager.get(O.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:Q.SUCCESS,data:ne.NOT_SET});var r=i.notificationLevel;return x(i.notificationLevel)&&!x(i.notificationStatus)&&(r=ee.OPEN===i.notificationStatus?1:0),Promise.resolve({code:Q.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===O.ULTRA_GROUP?this._ultraGroupManager.get(O.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:Q.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:Q.SUCCESS,data:ee.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,o){return this.getHistoryMessage(e,t,n,i,r,o)},t.prototype.getUltraGroupList=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r;return E(this,(function(o){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap)).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&w(n))})),i=jo(i),r=Pt(i),[2,{code:Q.SUCCESS,data:r}]):[2,{code:Q.METHOD_NOT_AVAILABLE}]}))}))},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Q.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){e.notificationStatus===ee.OPEN&&t.push({conversationType:O.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Q.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Q.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:O.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:Q.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){if(!this._isUltraGroupListExist)return Promise.resolve({code:Q.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap)n.match(/_.*/g)[0].substring(1)===e&&(t+=this._ultraGroupMap[n].unreadMentionedCount);return Promise.resolve({code:Q.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e){var t=0;for(var n in this._ultraGroupMap){var i=this._ultraGroupMap[n];i.targetId===e&&(t+=i.unreadMessageCount||0)}return Promise.resolve({code:Q.SUCCESS,data:t})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:Q.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap)t+=e?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return Promise.resolve({code:Q.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),y(this,void 0,void 0,(function(){var n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._channel?this._status!==J.CONNECTED?[2,Q.RC_NET_UNAVAILABLE]:(n=Date.now(),i=this._channel.codec.encodeClearUnreadCount({conversationType:O.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new Zr(ao[ao.updUgRTime],i,this.currentUserId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(r)]):[2,Q.RC_NET_CHANNEL_INVALID]:[2,Promise.resolve(Q.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===Q.SUCCESS&&(s=this._ultraGroupMap[t+"_"+e])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.lastReadTime=n),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h,d,f,p=this;return E(this,(function(g){switch(g.label){case 0:return this._channel&&this._status===J.CONNECTED?(t=this._channel.codec.encodeUltraGroup(e,!1),n=new to(ao[ao.pullUgSes],t,this.currentUserId),[4,this._channel.send(n,tn,{currentUserId:this.currentUserId,conversationType:O.ULTRA_GROUP})]):[2];case 1:return i=g.sent(),r=i.code,o=i.data,r===Q.SUCCESS&&o?(a=(null==o?void 0:o.list)||[],c=null==o?void 0:o.isFinished,a.forEach((function(e){e.notificationStatus=ee.CLOSE,e.notificationLevel=ne.NOT_SET,e.isTop=!1,p._ultraGroupMap[e.channelId+"_"+e.targetId]=e,p._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(ut.warn("pull super conversation failed, code:",r,", data:",o,"retrying..."),s=setTimeout((function(){p._firstPullUltraGroupTime=e,p._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return[4,this.pullConversationStatus(this._firstPullUltraGroupTime)];case 3:l=g.sent(),h=l.code,d=l.data,h!==Q.SUCCESS&&ut.warn("pullConversationStatus fail code: ".concat(h,", data: ").concat(d)),f=Object.values(this._ultraGroupMap),f=jo(f),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Pt(f)),0===this._firstPullUltraGroupTime&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),g.label=4;case 4:return[2]}}))}))},t.prototype._startUltraSyncInterval=function(){var e=this,t=function(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._syncUltraMsg(0),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._syncUltraMsg=function(e){var t;return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,u,l,h,d,f,p,g,_=this;return E(this,(function(m){switch(m.label){case 0:return this._channel&&this._status===J.CONNECTED?this._isUltraPulling?[2]:(ut.info("start pull ultra msg, time: ".concat(e)),this._isUltraPulling=!0,n=this._channel.codec.encodeSuperSyncMsg(e),i=new to(ao[ao.pullUgMsg],n,this.currentUserId),r=Ke(),We(ue.L_PULL_ULTRA_MSG_T,{timestamp:e},{traceId:r}),[4,this._channel.send(i,jt,{currentUserId:this.currentUserId,conversation:{conversationType:O.ULTRA_GROUP}})]):[2];case 1:if(o=m.sent(),s=o.code,a=o.data,ut.info("end pull ultra msg, code: ".concat(s,", syncTime: ").concat(null==a?void 0:a.syncTime,", count: ").concat(null===(t=null==a?void 0:a.list)||void 0===t?void 0:t.length)),this._lastSyncUltraMsgLocalTimeStamp=Date.now(),s!==Q.SUCCESS||!a)return Je(ue.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:"",timestamp:e},{traceId:r}),ut.warn("sync super message failed, code:",s,", data:",a),this._isUltraPulling=!1,[2];if(this._isUltraPulling=!1,c=a.list,u=a.syncTime,l=a.finished,!this._isUltraGroupListExist)return ut.info("init getUltraGroupList"),this._firstPullUltraGroupTime=0,this._getUltraGroupList(0),this._lastSyncUltraMsgTimeStamp=u,[2];for(g in h=[],d={},f=[],c.forEach((function(e){var t,n,i,r=e.targetId,o=e.content,s=e.messageType,a=e.messageUId,c=e.channelId,l=e.isCounted,p=e.channelType;if(h.push(a),_._ultraMsgMap[a])delete _._ultraMsgMap[a];else{var g=0;((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===re.ALL||(null===(i=null===(n=null==o?void 0:o.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(_.currentUserId)))&&(g=1);var m=_._ultraGroupMap[c+"_"+r];if(m)l&&(s===Z.RECALL?m.unreadMessageCount>0&&(m.unreadMessageCount-=1):(m.unreadMessageCount+=1,m.unreadMentionedCount+=g)),m.versionTime=u,m.latestMessage=e,m.channelType=p,d[c+"_"+r]=m,_._ultraGroupManager.addUltraGroupStatus(m);else{var v={conversationType:O.ULTRA_GROUP,targetId:r,channelId:c,unreadMessageCount:l?1:0,unreadMentionedCount:l?g:0,versionTime:u,latestMessage:e,notificationStatus:ee.CLOSE,notificationLevel:ne.NOT_SET,isTop:!1,channelType:p};_._ultraGroupMap[c+"_"+r]=v,d[c+"_"+r]=v,_._ultraGroupManager.addUltraGroupStatus(v)}f.push(e)}})),Object.keys(d).length>0&&(ut.info("notice ultragroups"),p=Object.values(d),p=jo(p),this._watcher.conversation(Pt(p))),We(ue.L_PULL_ULTRA_MSG_R,{code:s,messageUIds:h.join(","),timestamp:u},{traceId:r}),ut.info("notice ultragroup message"),this._watcher.batchMessage(f),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>u})),this._ultraMsgMap)this._ultraMsgMap[g]0&&(this._lastSyncUltraMsgTimeStamp=u),this._ultraGroupTimeQue.length>0&&this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,i){return y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l,h,d,f,p;return E(this,(function(g){switch(g.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:("RC:SRSMsg"===t.messageType&&ut.warn("ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=this._channel.codec.encodeUpMsg({conversationType:O.ULTRA_GROUP,targetId:e},t),(o=new Zr(ao[ao.ugMsg],r,e)).setHeaderQos(gt.AT_LEAST_ONCE),s=Date.now()-this._localConnectedTime+this._connectedTime,a=t.isPersited?Wo():0,c=Yo(O.ULTRA_GROUP,e,v({},t),"",s,this.currentUserId,a),n&&n(a),We(ue.L_SEND_MSG_T,{messageType:t.messageType,conversationType:O.ULTRA_GROUP,targetId:e,channelId:t.channelId},{traceId:i}),[4,this._channel.send(o)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return u=g.sent(),l=u.code,h=u.data,l!==Q.SUCCESS?(Je(ue.L_SEND_MSG_R,{code:l,messageUId:c.messageUId,messageId:c.messageId},{traceId:i}),[2,{code:l,data:c}]):(We(ue.L_SEND_MSG_R,{code:l,messageUId:null==h?void 0:h.messageUId,messageId:null==h?void 0:h.messageId},{traceId:i}),d=h,c.sentTime=d.timestamp,c.messageUId=d.messageUId,this._ultraMsgMap[d.messageUId]=d.timestamp,f=t.channelId||"",(p=this._ultraGroupMap[f+"_"+e])?(p.latestMessage=c,w(p.channelType)&&(c.channelType=p.channelType)):(p={conversationType:O.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:ee.CLOSE,notificationLevel:ne.NOT_SET,isTop:!1},this._ultraGroupMap[f+"_"+e]=p,this._ultraGroupManager.addUltraGroupStatus(p)),this._watcher.conversation(Pt([p])),[2,{code:l,data:c}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:(n=e.conversationType,i=e.channelId,r=e.targetId,o=this._channel.codec.encodeOperateStatus(r,n,i||"",t||0),(s=new Zr(ao[ao.operate],o,r)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(s)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return(a=c.sent().code)!==Q.SUCCESS?[2,{code:a,msg:Q[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:Q.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._channel.codec.encodeMsgQuery(e),(i=new to(ao[ao.qryMsg],n,this.currentUserId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(i,Ci,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Q.SUCCESS?[2,{code:o,msg:Q[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},t.prototype._pullOperateStatusNotify=function(e){if(this._channel){var t=this._channel.codec.decodeByPBName(e.data,Si),n=t.conversationType,i=t.info,r=t.summary;ut.info("s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Zr(ao[ao.upMsgEx],t,e.targetId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==Q.SUCCESS?[2,{code:r,msg:Q[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype.modifyMessage=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s;return E(this,(function(a){switch(a.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodemodifyMessage(e,this.currentUserId),(n=new Zr(ao[ao.modifyMsg],t,e.targetId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(n)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==Q.SUCCESS?[2,{code:r,msg:Q[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h;return E(this,(function(d){switch(d.label){case 0:return this._channel?this._status!==J.CONNECTED||this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._channel.codec.encodeQueryMsgChange(e),(n=new to(ao[ao.qryMsgChange],t,this.currentUserId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(n,Ei)]):[2];case 1:if(i=d.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r!==Q.SUCCESS||!o)return[2];for(l in s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._ultraChannelTypeChangeNotice(a),this._ultraChannelUserKickedNotice(a),this._ultraChannelDeleteNotice(a),this._ultraRecalledNotice(a),this._ultraMsgUpdateNotice(me.MSG_EXPANSION,a),this._ultraMsgUpdateNotice(me.MSG_MODIFY,a),u=this._pullUltraChangeMessageQue.filter((function(e){return e>c})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,u),this._ultraMsgMap)this._ultraMsgMap[l]0&&this._watcher.ultraGroupChannelChangeType(n)},t.prototype._ultraChannelDeleteNotice=function(e){var t=this,n=[];Array.isArray(e)&&e.forEach((function(e){var i=e.targetId,r=e.sendTime,o=e.changeType,s=e.subChangeType,a=e.channelId,c=void 0===a?"":a;if(o===me.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(c,"_").concat(i)]){var u=t._ultraGroupMap["".concat(c,"_").concat(i)].channelType,l=void 0===u?ge.PUBLIC:u;s===ve.CHANNEL_DELETE&&(n.push({targetId:i,channelId:c,channelType:l,deleteTime:r}),delete t._ultraGroupMap["".concat(c,"_").concat(i)])}})),n.length>0&&this._watcher.ultraGroupChannelDelete(n)},t.prototype._ultraChannelUserKickedNotice=function(e){var t=this,n=[];e.forEach((function(e){var i=e.targetId,r=e.changeType,o=e.operatorId,s=e.subChangeType,a=e.channelId,c=void 0===a?"":a;r===me.CHANNEL_CHANGE&&t._ultraGroupMap["".concat(c,"_").concat(i)]&&(s===ve.CHANNEL_USER_KICKED&&n.push({targetId:i,channelId:c,userId:o,channelType:ge.PRIVATE}),o===t.currentUserId&&s===ve.CHANNEL_USER_KICKED&&delete t._ultraGroupMap["".concat(c,"_").concat(i)])})),n.length>0&&this._watcher.ultraGroupChannelUserKicked(n)},t.prototype._ultraRecalledNotice=function(e){var t=this,n=[];e.forEach((function(e){var i=e.targetId,r=e.conversationType,o=e.sendTime,s=e.messageUId,a=e.changeType,c=e.operatorId,u=e.channelId,l=void 0===u?"":u;a===me.MSG_RECALL&&(t._updateUltraGroupWhenRecallMsg(i,l,s),n.push({targetId:i,conversationType:r,sendTime:o,messageUId:s,senderUserId:c,channelId:l}))})),n.length>0&&this._watcher.ultraGroupMessageRecalled(n)},t.prototype._ultraMsgUpdateNotice=function(e,t){var n=this,i={};t.forEach((function(t){var r=t.targetId,o=t.conversationType,s=t.sendTime,a=t.messageUId,c=t.changeType,u=t.channelId,l=o+"_"+r,h=a+"_"+(void 0===u?"":u)+"_"+s,d=i[l];if(d)d.add(h);else{var f=new Set([h]);i[l]=f}c===e&&(n._ultraMsgChangeMap[a]=c)}));var r=function(e){var t=e.split("_"),n=t.shift(),r=t.join("_"),s=i[e],a=[];s.forEach((function(e){var t=e.split("_"),n=t[0],i=t[1],r=t[2];a.push({sendTime:Number(r),messageUId:n,channelId:i})}));var c={targetId:r,conversationType:Number(n),messages:a};o._pullUltraMessageList(c)},o=this;for(var s in i)r(s)},t.prototype._pullUltraMessageList=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u=this;return E(this,(function(l){switch(l.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:(t=this._channel.codec.encodeMsgQuery(e),(n=new to(ao[ao.qryMsg],t,this.currentUserId)).setHeaderQos(gt.AT_LEAST_ONCE),[4,this._channel.send(n,Ci,{connectedTime:this._channel.connectedTime,currentUserId:this.currentUserId})]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return i=l.sent(),r=i.code,o=i.data,r!==Q.SUCCESS?[2,{code:r,msg:Q[r]}]:(s=(o||{}).list,a=[],c=[],Array.isArray(s)&&s.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=u._ultraGroupMap[n+"_"+t];r&&r.latestMessage.messageUId===e.messageUId&&(r.latestMessage=e);var o=u._ultraMsgChangeMap[i+""];o===me.MSG_EXPANSION?a.push(e):o===me.MSG_MODIFY&&c.push(e)})),a.length>0&&this._watcher.ultraGroupMessageExpansionUpdated(a||[]),c.length>0&&this._watcher.ultraGroupMessageModified(c||[]),[2])}}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:(i=this._channel.codec.encodeGetHistoryMsg(e,t),r=new to(ao[ao.qryUgMsg],i,this.currentUserId),We(ue.L_GET_HISTORY_MSG_T,{targetId:e,conversationType:O.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count},{traceId:n}),[4,this._channel.send(r,Xt,{currentUserId:this.currentUserId,conversation:{conversationType:O.ULTRA_GROUP,targetId:e}})]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return o=u.sent(),s=o.code,a=o.data,s===Q.SUCCESS&&a?(c=[],a.list&&a.list.forEach((function(e){e&&c.push(e.messageUId)})),We(ue.L_GET_HISTORY_MSG_R,{code:s,messageUIds:c.join(",")},{traceId:n}),[2,{code:s,data:a}]):(Je(ue.L_GET_HISTORY_MSG_R,{code:s,messageUIds:""},{traceId:n}),ut.warn("get super history message failed, code:",s,", data:",a),[2,{code:s}])}}))}))},t.prototype.searchUltraGroupMessages=function(e){return y(this,void 0,void 0,(function(){return E(this,(function(e){return this._channel?this._status!==J.CONNECTED?[2,{code:Q.RC_NET_UNAVAILABLE}]:[2,{code:Q.SUCCESS}]:[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?(i=this._channel)?(r=i.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),o=new to(ao[ao.ugUnpushSet],r,e),[4,i.send(o)]):[3,2]:[2,Promise.resolve({code:Q.METHOD_NOT_AVAILABLE})];case 1:return s=c.sent(),a=s.code,Q.SUCCESS,[2,{code:a}];case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return y(this,void 0,void 0,(function(){var n,i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?(n=this._channel)?(i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new to(ao[ao.ugUnpushQuery],i,e),[4,n.send(r,ri)]):[3,2]:[2,Promise.resolve({code:Q.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===Q.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}];case 2:return[2,{code:Q.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n){var i="".concat(t,"_").concat(e);if(this._ultraGroupMap[i]){var r=this._ultraGroupMap[i],o=r.latestMessage;o&&o.messageUId===n&&(r.latestMessage=null)}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:Q.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.joinRTCRoom=function(e,t,n,i,r,o){return y(this,void 0,void 0,(function(){var s,a;return E(this,(function(c){return this._channel?(s=this._channel.codec.encodeJoinRTCRoom(t,n,i,r,o),a=new to(ao[ao.rtcRJoin_data],s,e),[2,this._channel.send(a,gn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.quitRTCRoom=function(e){return y(this,void 0,void 0,(function(){var t,n;return E(this,(function(i){switch(i.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new to(ao[ao.rtcRExit],t,e),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new to(ao[ao.rtcPing],i,e),[4,this._channel.send(r)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCRoomInfo=function(e){return y(this,void 0,void 0,(function(){var t,n;return E(this,(function(i){return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new to(ao[ao.rtcRInfo],t,e),[2,this._channel.send(n,On)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.getRTCUserInfoList=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o;return E(this,(function(s){switch(s.label){case 0:return this._channel?(t=this._channel.codec.encodeGetRTCRoomInfo(),n=new to(ao[ao.rtcUData],t,e),[4,this._channel.send(n,gn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return i=s.sent(),r=i.code,o=i.data,[2,{code:r,data:o?{users:o.users}:o}]}}))}))},t.prototype.setRTCUserInfo=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeSetRTCUserInfo(t,n),r=new to(ao[ao.rtcUPut],i,e),[4,this._channel.send(r)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return y(this,void 0,void 0,(function(){var n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeRemoveRTCUserInfo(t),i=new Zr(ao[ao.rtcUDel],n,e),[4,this._channel.send(i)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,o){return y(this,void 0,void 0,(function(){var s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?(s=this._channel.codec.encodeSetRTCData(t,n,i,r,o),a=new Zr(ao[ao.rtcSetData],s,e),[4,this._channel.send(a)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,c.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return y(this,void 0,void 0,(function(){var o,s;return E(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeUserSetRTCData(t,n,i,r),s=new to(ao[ao.userSetData],o,e),[4,this._channel.send(s)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(i=this._channel.codec.encodeUserSetRTCCDNUris(t,n),r=new to(ao[ao.userSetData],i,e),[4,this._channel.send(r)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,o.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){if(!this._channel)return Promise.resolve({code:Q.RC_NET_CHANNEL_INVALID});var r=this._channel.codec.encodeGetRTCData(t,n,i),o=new to(ao[ao.rtcQryData],r,e);return this._channel.send(o,Cn)},t.prototype.removeRTCData=function(e,t,n,i,r){return y(this,void 0,void 0,(function(){var o,s;return E(this,(function(a){switch(a.label){case 0:return this._channel?(o=this._channel.codec.encodeRemoveRTCData(t,n,i,r),s=new Zr(ao[ao.rtcDelData],o,e),[4,this._channel.send(s)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCOutData=function(e,t){throw new Error("JSEngine's method not implemented.")},t.prototype.getRTCToken=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r;return E(this,(function(o){return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new to(ao[ao.rtcToken],i,e),[2,this._channel.send(r,In)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}]}))}))},t.prototype.setRTCState=function(e,t){return y(this,void 0,void 0,(function(){var n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(n=this._channel.codec.encodeSetRTCState(t),i=new to(ao[ao.rtcUserState],n,e),[4,this._channel.send(i)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserInfo=function(e){return y(this,void 0,void 0,(function(){return E(this,(function(e){throw new Error("Method not implemented.")}))}))},t.prototype.getRTCUserList=function(e){if(!this._channel)return Promise.resolve({code:Q.RC_NET_CHANNEL_INVALID});var t=this._channel.codec.encodeGetRTCRoomInfo(),n=new to(ao[ao.rtcUList],t,e);return this._channel.send(n,gn)},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return void 0===t&&(t=ye.LIVE),y(this,void 0,void 0,(function(){var i,r,o,s,a,c,u,l;return E(this,(function(h){switch(h.label){case 0:return this._channel?(i=this._channel.codec.encodeJoinRTCRoom(t,n),r=new to(ao[ao.viewerJoinR],i,e),[4,this._channel.send(r,Li)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return o=h.sent(),s=o.code,a=o.data,s!==Q.SUCCESS?[2,{code:s}]:(u=(c=a).rtcToken,l=c.entries,[2,{code:s,data:{token:u,kvEntries:l}}])}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeQuitRTCRoom(),n=new to(ao[ao.viewerExitR],t,e),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return y(this,void 0,void 0,(function(){var i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return this._channel?(i=this._channel.codec.encodeIdentityChangeInfo(t,n),r=new to(ao[ao.rtcIdentityChange],i,e),[4,this._channel.send(r,gn)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return o=c.sent(),s=o.code,a=o.data,s!==Q.SUCCESS?[2,{code:s}]:[2,{code:s,data:a}]}}))}))},t.prototype.pullRTCRoomEntry=function(e,t){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return E(this,(function(l){switch(l.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(ut.info("audience in room start pull KV"),r=n.codec.encodePullRTCRoomKV(e,0),o=new to(ao[ao.rtcPullKv],r,i),[4,n.send(o,Ui)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return s=l.sent(),a=s.code,c=s.data,ut.info("audience in room end pull KV, code: ".concat(a,", data: ").concat(JSON.stringify(c||{}))),a===Q.SUCCESS?(u=c.kvEntries,this._watcher.onRTCDataChange(u,e),[2,{code:a,data:c}]):[2,{code:a}]}}))}))},t.prototype.getRTCJoinedUserInfo=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c;return E(this,(function(u){switch(u.label){case 0:return n=(t=this)._channel,i=t.currentUserId,n?(r=n.codec.encodeQueryUserJoinedInfo(e),o=new to(ao[ao.rtcQueryJoined],r,i),[4,n.send(o,wi)]):[2,{code:Q.RC_NET_CHANNEL_INVALID}];case 1:return s=u.sent(),a=s.code,c=s.data,a===Q.SUCCESS?[2,{code:a,data:c}]:[2,{code:a}]}}))}))},t.prototype.getDeviceId=function(){return Xe(this.runtime)},t.prototype.requestRoomPK=function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeRequestRoomPK(e),n=new to(ao[ao.rtcInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.cancelRoomPK=function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeCancelRoomPK(e),n=new to(ao[ao.rtcCancelInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.responseRoomPK=function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeResponseRoomPK(e),n=new to(ao[ao.rtcInviteAnswer],t,e.roomId),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.endRoomPK=function(e){return y(this,void 0,void 0,(function(){var t,n,i;return E(this,(function(r){switch(r.label){case 0:return this._channel?(t=this._channel.codec.encodeEndRoomPK(e),n=new to(ao[ao.rtcEndInvite],t,e.roomId),[4,this._channel.send(n)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return i=r.sent().code,this._rtcKVManager.reset(),[2,i]}}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r;return E(this,(function(o){switch(o.label){case 0:return this._channel?(t=e.chatRoomId,n=this._channel.codec.encodebindRTCRoomForChatroom(e),i=new to(ao[ao.setRtcRoomId],n,t),[4,this._channel.send(i)]):[2,Q.RC_NET_CHANNEL_INVALID];case 1:return r=o.sent(),[2,r.code]}}))}))},t.prototype.callExtra=function(e){for(var t=[],n=1;n6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.filter((function(e){return/^https?:\/\//.test(e)})),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")})),0===this._options.navigators.length&&(n=this._options.navigators).push.apply(n,s),kr({bundleId:this.apiPKGName}),function(e){je=nt.init(v(v({},e),{sessionId:we})),at()}({runtime:this._runtime,logSwitch:1,logPolicy:JSON.parse("{}"),appkey:this.appkey,version:this.apiVersion});var i={status:this._connectionStatusListener.bind(this),batchMessage:this._batchMessageReceiver.bind(this),chatroom:this._chatroomInfoListener.bind(this),conversation:this._conversationInfoListener.bind(this),expansion:this._expansionInfoListener.bind(this),tag:this._tagListener.bind(this),conversationTag:this._conversationTagListener.bind(this),onRTCDataChange:this._rtcDataChange.bind(this),pullFinished:this._pullFinishedListener.bind(this),ultraGroupEnable:this._ultraGroupEnableListener.bind(this),operateStatus:this._operateStatusListener.bind(this),ultraGroupMessageExpansionUpdated:this._ultraGroupMessageExpansionUpdatedListener.bind(this),ultraGroupMessageModified:this._ultraGroupMessageModifiedListener.bind(this),ultraGroupMessageRecalled:this._ultraGroupMessageRecalledListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this)};this._engine=At()?new RCCppEngine(e,i,this._options):new Jo(e,i,this._options)}e.init=function(t,n){return qe({customLogPrint:n.logStdout,localLogLevel:n.logLevel}),ut.setLogLevel(n.logLevel),ut.setLogStdout(n.logStdout),We(ue.L_INIT_O,{appkey:n.appkey,navigators:n.navigators,connectionType:n.connectionType,logLevel:n.logLevel,typingExpireTime:n.typingExpireTime}),!1===n.indexDBSwitch&&(be.indexDBSwitch=!1),We(ue.L_IMSDK_VER_O,{commitId:"b3936f05590d2beb491dee0dbb7071eeb648e941",version:"5.4.3"}),ut.debug("APIContext.init =>",n.appkey,n.navigators),this._context?(ut.error("Repeat initialize!"),this._context):(ut.warn("RCEngine Commit:","b3936f05590d2beb491dee0dbb7071eeb648e941"),this._context=new e(t,n),this._context)},e.destroy=function(){this._context&&(this._context._destroy(),this._context=void 0)},e.prototype.install=function(e,t){if(this._pluginInstanseMap[e.tag])return ut.warn("Repeat install plugin: ".concat(e.tag)),this._pluginInstanseMap[e.tag];var n="RCRTC"===e.tag?new zo(this):new go(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(n,this._runtime,t)}catch(e){ut.error("install plugin error!\n",e)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&this._pluginContextQueue.push(n),i&&(this._pluginInstanseMap[e.tag]=i),i},e.prototype._handleRedirect=function(){return y(this,void 0,void 0,(function(){var e,t=this;return E(this,(function(n){switch(n.label){case 0:return ut.debug("_handleRedirct",this._token),[4,this.connect(this._token,!0)];case 1:return(e=n.sent().code)!==Q.SUCCESS&&this._canRedirectConnect&&(this._handleSuspend(e),setTimeout((function(){t._handleRedirect()}),5e3)),[2]}}))}))},e.prototype._connectionStatusListener=function(e){var t;return y(this,void 0,void 0,(function(){return E(this,(function(n){return We(ue.L_CONNECT_S,{status:e}),[J.REDIRECT,J.BLOCKED,J.KICKED_OFFLINE_BY_OTHER_CLIENT,J.DISCONNECT_BY_SERVER,J.DISCONNECTED,J.NETWORK_UNAVAILABLE].includes(e)&&(Gr(so.IM_CONNECTION_DURATION,{endTime:(new Date).getTime(),code:e}),function(e){y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u;return E(this,(function(l){switch(l.label){case 0:t=so.IM_CONNECTION_DURATION,n=xr().bundleId,i=Br(t),r=i.startTime,o=i.endTime,s=i.code,a=Pr.UNKONWN,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,e.getNetworkType()];case 2:return a=l.sent(),[3,4];case 3:return c=l.sent(),ut.debug(c.message),[3,4];case 4:return u=0,w(r)&&w(o)&&o>r&&r&&(u=o-r),wr(t,{bid:n,cod:s,dur:u,net:a}),[2]}}))}))}(this._runtime)),this._connectionStatus=e,e===J.REDIRECT?(this._canRedirectConnect=!0,this._handleSuspend(e),this._handleRedirect()):e===J.BLOCKED||e===J.KICKED_OFFLINE_BY_OTHER_CLIENT||e===J.DISCONNECT_BY_SERVER?(this._canRedirectConnect=!1,this._handleDisconnect(e)):e===J.CONNECTING?this._handleConnecting():e===J.CONNECTED?this._handleConnected():e===J.DISCONNECTED?this._handleDisconnect(e):e===J.NETWORK_UNAVAILABLE&&this._handleSuspend(e),(null===(t=this._watcher.rtcInnerWatcher)||void 0===t?void 0:t.status)&&this._watcher.rtcInnerWatcher.status(e),this._pluginContextQueue.forEach((function(t){t.onconnectionstatechange&&t.onconnectionstatechange(e)})),this._watcher.connectionState&&this._watcher.connectionState(e),[2]}))}))},e.prototype._handleConnecting=function(){this._watcher.onConnecting&&this._watcher.onConnecting()},e.prototype._handleConnected=function(){this._watcher.onConnected&&this._watcher.onConnected()},e.prototype._handleDisconnect=function(e){this._watcher.onDisconnect&&this._watcher.onDisconnect(e)},e.prototype._handleSuspend=function(e){this._watcher.onSuspend&&this._watcher.onSuspend(e)},e.prototype._messageReceiver=function(e,t,n){var i,r,o;if((e.conversationType===O.RTC_ROOM||Object.prototype.hasOwnProperty.call(Se,e.messageType))&&this._watcher.rtcInnerWatcher&&this._watcher.rtcInnerWatcher.message)this._watcher.rtcInnerWatcher.message($o(e));else if(-1===["RC:ChrmJoinNtf","RC:ChrmQuitNtf"].indexOf(e.messageType)||"function"!=typeof this._watcher.chatroomState){if("RC:ChrmMemChange"!==e.messageType){if(e.messageType!==Z.TYPING_STATUS||(this._addTypingInfo($o(e)),!this._watcher.typingState))if(e.messageType!==Z.LOG_COMMAND||"rongcloudsystem"!==e.senderUserId)if(e.messageType!==Z.INTERCEPT){if(!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage($o(e))}catch(e){return ut.error("plugin error =>",e),!1}})))if(this._watcher.message&&this._watcher.message($o(e),t,n),"RC:ReadNtf"!==e.messageType)if("RC:RRReqMsg"!==e.messageType){if("RC:RRRspMsg"!==e.messageType)return e;var s=null===(o=e.content)||void 0===o?void 0:o.receiptMessageDic,a=this._engine.getCurrentUserId();s&&Array.isArray(s[a])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,s[a])}else"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId);else"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)}else this._MessageBlockedListener({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra});else{var c=e.content,u=c.startTime,l=c.endTime,h=c.platform,d=c.logId,f=c.uri,p=c.packageName,g={startTime:parseInt(u),endTime:parseInt(l),platform:h,logId:d,uri:f,packageName:p};null===(r=nt.getInstance())||void 0===r||r.reportFullLog(g)}}else if("function"==typeof this._watcher.chatroomState){var _={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){_[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:_,chatroomId:e.targetId}})}}else this._watcher.chatroomState({userChange:{users:(i={},i[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?fe.QUIT:fe.JOIN,i),chatroomId:e.targetId}})},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[];e.forEach((function(e){var o=i._messageReceiver(e,t,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&this._watcher.batchMessage(r)},e.prototype._chatroomInfoListener=function(e){this._watcher.chatroomState&&this._watcher.chatroomState(e)},e.prototype._conversationInfoListener=function(e){this._watcher.conversationState&&this._watcher.conversationState(e)},e.prototype._expansionInfoListener=function(e){this._watcher.expansion&&this._watcher.expansion(e)},e.prototype._tagListener=function(){this._watcher.tag&&this._watcher.tag()},e.prototype._conversationTagListener=function(){this._watcher.conversationTagChanged&&this._watcher.conversationTagChanged()},e.prototype._typingStatusListener=function(e){this._watcher.typingState&&this._watcher.typingState(e)},e.prototype._pullFinishedListener=function(){this._watcher.pullFinished&&this._watcher.pullFinished()},e.prototype._MessageBlockedListener=function(e){this._watcher.messageBlocked&&this._watcher.messageBlocked(e)},e.prototype._ultraGroupEnableListener=function(e){this._watcher.ultraGroupEnable&&this._watcher.ultraGroupEnable(e)},e.prototype._operateStatusListener=function(e){this._watcher.operateStatus&&this._watcher.operateStatus(e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){this._watcher.ultraGroupMessageExpansionUpdated&&this._watcher.ultraGroupMessageExpansionUpdated(e)},e.prototype._ultraGroupMessageModifiedListener=function(e){this._watcher.ultraGroupMessageModified&&this._watcher.ultraGroupMessageModified(e)},e.prototype._ultraGroupMessageRecalledListener=function(e){this._watcher.ultraGroupMessageRecalled&&this._watcher.ultraGroupMessageRecalled(e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){this._watcher.ultraGroupChannelChangeType&&this._watcher.ultraGroupChannelChangeType(e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){this._watcher.ultraGroupChannelUserKicked&&this._watcher.ultraGroupChannelUserKicked(e)},e.prototype._ultraGroupChannelDeleteListener=function(e){this._watcher.ultraGroupChannelDelete&&this._watcher.ultraGroupChannelDelete(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){n.onrtcdatachange&&n.onrtcdatachange(e,t)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var i=e[n];t._watcher[n]=k(i)||V(i)?i:void 0}}))},e.prototype.resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,i=e.targetId,r=e.content,o=e.channelId,s=r.typingContentType,a=o||"",c="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp0){var i=e._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));e._typingStatusListener(i),e._typingChangedList=[]}0===Object.keys(e._typingInfo).length&&(clearInterval(e._typingInternalTimer),e._typingInternalTimer=-1)}),500))},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._connectionStatus},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.connect=function(e,t,n,i){return void 0===t&&(t=!1),y(this,void 0,void 0,(function(){var r,o,s,a,c,u,l;return E(this,(function(h){switch(h.label){case 0:return this._connectionStatus===J.CONNECTED?[2,{code:Q.SUCCESS,userId:this._engine.getCurrentUserId()}]:this._connectionStatus===J.CONNECTING?[2,{code:Q.BIZ_ERROR_CONNECTING}]:"string"!=typeof e||0===e.length?[2,{code:Q.RC_CONN_USER_OR_PASSWD_ERROR}]:(this._token=e,r=e.split("@"),o=r[1],s=o?o.split(";").map((function(e){return/^https?:/.test(e)?e:"https://".concat(e)})):[],We(ue.L_GET_NAVI_T,{token:e,uris:s},{traceId:i}),[4,this._engine.getNaviInfo(this._getTokenWithoutNavi(),s,t,this._options.checkCA)]);case 1:return(a=h.sent())?(We(ue.L_GET_NAVI_R,{code:Q.SUCCESS,naviInfo:a},{traceId:i}),We(ue.L_ENV_S,{isEnterprise:1===(null==a?void 0:a.type)},{traceId:i}),1===(null==a?void 0:a.type)?[2,{code:Q.PACKAGE_ENVIRONMENT_ERROR}]:(c=pt.getInfo(),We(ue.L_CONNECT_T,{token:e,refreshNavi:t,reconnectKickEnable:n},{traceId:i}),[4,this._engine.connect(this._getTokenWithoutNavi(),a,n,i)])):(Je(ue.L_GET_NAVI_R,{code:Q.RC_NAVI_RESOURCE_ERROR},{traceId:i}),[2,{code:Q.RC_NAVI_RESOURCE_ERROR}]);case 2:return u=h.sent(),(u===Q.SUCCESS?We:Je)(ue.L_CONNECT_R,{code:u,userId:this._engine.getCurrentUserId()},{traceId:i}),u!==z.REDIRECT?[3,4]:(this._connectionStatus=J.REDIRECT,[4,this.connect(e,!0)]);case 3:return[2,h.sent()];case 4:return l=this._engine.getCurrentUserId(),u===Q.SUCCESS&&(Gr(so.IM_CONNECTION_DURATION,{startTime:(new Date).getTime()},!0),ut.info("connect success, userId: ".concat(l)),1!==(null==a?void 0:a.type)&&this._engine.reportSDKInfo&&this._engine.reportSDKInfo(c),ot({runtime:this._runtime,logSwitch:(null==a?void 0:a.logSwitch)||0,logPolicy:JSON.parse((null==a?void 0:a.logPolicy)||"{}"),appkey:this.appkey,version:this.apiVersion,userId:l}),qe({userId:l}),this._isInternalConnected=!0),u!==Q.SUCCESS||At()||1===a.openUS&&this._pullUserSettings(),u!==Q.SUCCESS&&(this._connectionStatus=J.CONNECTION_CLOSED),[2,{code:u,userId:l}]}}))}))},e.prototype._pullUserSettings=function(){return y(this,void 0,void 0,(function(){return E(this,(function(e){return[2]}))}))},e.prototype.disconnect=function(){var e;return this._isInternalConnected=!1,clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},null===(e=nt.getInstance())||void 0===e||e.distroy(),qe({userId:""}),this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){ut.error("plugin error =>",e)}})),Promise.resolve()},e.prototype.reconnect=function(e){return this._isInternalConnected?Promise.resolve({code:Q.CAN_NOT_RECONNECT}):this.connect(this._getTokenWithoutNavi(),!1,e)},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.sendMessage=function(e,t,n,i,r){if(e!==O.ULTRA_GROUP){var o=this.getInfoFromCache();if(1===((null==o?void 0:o.grpRRVer)||0)&&n.messageType===Z.READ_RECEIPT_RESPONSE)return Promise.resolve({code:Q.READ_RECEIPT_ERROR})}var s=n.canIncludeExpansion,a=void 0!==s&&s,c=n.expansion;if(a){var u=K(c),l=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit;if(u.isExceedLimit||h)return Promise.resolve({code:Q.EXPANSION_LIMIT_EXCEET});if(l)return Promise.resolve({code:Q.BIZ_ERROR_INVALID_PARAMETER})}var d=JSON.stringify(n.content);return R(d)>131072?Promise.resolve({code:Q.RC_MSG_CONTENT_EXCEED_LIMIT}):e===O.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,i,r):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,u,l,h;return E(this,(function(d){switch(d.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(c=K(s),u=c.isIllgalEx,l=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||l?[2,Promise.resolve({code:Q.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:Q.BIZ_ERROR_INVALID_PARAMETER})]:(h={mid:r},s&&(h.put=s),o&&(h.del=o),a&&(h.removeAll=1),[4,this._engine.sendMessage(n,i,{content:h,messageType:Z.EXPANSION_NOTIFY,channelId:t})])):[2,{code:Q.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:d.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return y(this,void 0,void 0,(function(){var i;return E(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Q.READ_RECEIPT_ERROR,data:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return y(this,void 0,void 0,(function(){var i;return E(this,(function(r){return i=this.getInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Q.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){var e;this._isInternalConnected=!1,this._watcher={batchMessage:void 0,message:void 0,conversationState:void 0,chatroomState:void 0,connectionState:void 0,rtcInnerWatcher:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,typingState:void 0,pullFinished:void 0,onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0},this._engine.disconnect(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){ut.error("plugin error =>",e)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},null===(e=nt.getInstance())||void 0===e||e.distroy(),qe({userId:""})},e.prototype.getHistoryMessage=function(e,t,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),e===O.ULTRA_GROUP){var c={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(t,c,a)}return this._engine.getHistoryMessage(e,t,n,i,r,o,s||"",a)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,o,s)},e.prototype.getConversationList=function(e,t,n,i,r){if(void 0===e&&(e=300),void 0===r&&(r=""),t===O.ULTRA_GROUP){var o=Q.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:Q[o]})}return this._engine.getConversationList(e,t,n,i,r)},e.prototype.getConversationsByPage=function(e,t,n,i){return this._engine.getConversationsByPage(e,t,n,i)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===O.ULTRA_GROUP?Promise.resolve(Q.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(e){return this._engine.getUltraGroupList(e)},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===O.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(O.ULTRA_GROUP)){var i=Q.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:Q[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[O.PRIVATE,O.GROUP,O.SYSTEM,O.PUBLIC_SERVICE],!!n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),y(this,void 0,void 0,(function(){var r;return E(this,(function(o){return r=[{conversationType:e,targetId:t,notificationLevel:n,channelId:i}],[2,this._engine.batchSetConversationStatus(r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,i,r){if(void 0===r&&(r=""),e===O.ULTRA_GROUP&&void 0!==n)return Promise.resolve(Q.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(e,t,n,i)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,i,r){return this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){return void 0===i&&(i=""),e===O.ULTRA_GROUP?Promise.resolve(Q.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,i)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,i)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return Rt(n)&&St(i)?this._engine.setChatroomEntry(e,t):Promise.resolve(Q.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n1e3?[2,Promise.reject(Q.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return y(this,void 0,void 0,(function(){return E(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return y(this,void 0,void 0,(function(){return E(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return y(this,void 0,void 0,(function(){return E(this,(function(i){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return y(this,void 0,void 0,(function(){return E(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(){return this._engine.getTopConversationList()},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==O.ULTRA_GROUP){var t=Q.METHOD_ONLY_SUPPORT_ULTRA_GROUP;return Promise.resolve({code:t,msg:Q[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return y(this,void 0,void 0,(function(){var t,n,i,r,o,s,a;return E(this,(function(c){switch(c.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==O.ULTRA_GROUP?[2,{code:r=Q.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Q[r]}]:i?(o=K(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:Q.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:Q.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:Q.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return y(this,void 0,void 0,(function(){var t;return E(this,(function(n){switch(n.label){case 0:return e.conversationType!==O.ULTRA_GROUP?[2,{code:t=Q.METHOD_ONLY_SUPPORT_ULTRA_GROUP,msg:Q[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e){return this._engine.getUltraGroupUnreadCountByTargetId(e)},e.prototype.getAllUltraGroupUnreadCount=function(e){return void 0===e&&(e=!1),this._engine.getAllUltraGroupUnreadCount(e)},e.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i0||e.pageInfo.page>1)&&e.contextFlag||!e.isSearch?n("div",{staticClass:"m-core"},[n("save-form",{ref:"searchForm",staticClass:"searchForm",attrs:{inline:!0,model:e.searchForm},on:{submit:e.search,reset:e.onReSet}},[n("el-form-item",{attrs:{prop:"search"}},[n("el-input",{attrs:{clearable:"",placeholder:"单位/乐团主管名称"},model:{value:e.searchForm.search,callback:function(t){e.$set(e.searchForm,"search",t)},expression:"searchForm.search"}})],1),e._v(" "),n("el-form-item",{attrs:{prop:"organId"}},[n("el-select",{attrs:{placeholder:"请选择分部",filterable:"",clearable:""},model:{value:e.searchForm.organId,callback:function(t){e.$set(e.searchForm,"organId","string"===typeof t?t.trim():t)},expression:"searchForm.organId"}},e._l(e.selects.branchs,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1),e._v(" "),n("el-form-item",{attrs:{prop:"isEnable"}},[n("el-select",{attrs:{placeholder:"请选择状态",filterable:"",clearable:""},model:{value:e.searchForm.isEnable,callback:function(t){e.$set(e.searchForm,"isEnable","string"===typeof t?t.trim():t)},expression:"searchForm.isEnable"}},[n("el-option",{attrs:{label:"开启",value:!0}}),e._v(" "),n("el-option",{attrs:{label:"关闭",value:!1}})],1)],1),e._v(" "),n("el-form-item",[n("el-button",{attrs:{"native-type":"submit",type:"danger"}},[e._v("搜索")]),e._v(" "),n("el-button",{attrs:{"native-type":"reset",type:"primary"}},[e._v("重置")]),e._v(" "),n("el-button",{directives:[{name:"permission",rawName:"v-permission",value:"export/cooperationOrgan",expression:"'export/cooperationOrgan'"}],attrs:{type:"primary"},on:{click:e.onExport}},[e._v("导出")])],1)],1),e._v(" "),n("el-button",{directives:[{name:"permission",rawName:"v-permission",value:"cooperationOrgan/add",expression:"'cooperationOrgan/add'"}],staticStyle:{"margin-bottom":"20px"},attrs:{type:"primary"},on:{click:function(t){return e.openTeaching("create")}}},[e._v("\n 新建\n ")]),e._v(" "),n("div",{staticClass:"tableWrap"},[n("el-table",{attrs:{data:e.tableList,"header-cell-style":{background:"#EDEEF0",color:"#444"}}},[n("el-table-column",{attrs:{align:"center",prop:"id",label:"单位编号"}}),e._v(" "),n("el-table-column",{attrs:{align:"center",prop:"name",label:"单位名称"}}),e._v(" "),n("el-table-column",{attrs:{align:"center",prop:"logo",label:"logo"},scopedSlots:e._u([{key:"default",fn:function(e){return[n("el-image",{staticStyle:{width:"100px",height:"100px"},attrs:{src:e.row.logo,"preview-src-list":[e.row.logo]}})]}}],null,!1,2311787032)}),e._v(" "),n("el-table-column",{attrs:{align:"center",prop:"name",label:"所属分部"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("div",[e._v("\n "+e._s(t.row.organization.name)+"\n ")])]}}],null,!1,1062854371)}),e._v(" "),n("el-table-column",{attrs:{align:"center",prop:"realName",label:"乐团主管"}}),e._v(" "),1==e.tenantId?n("el-table-column",{attrs:{align:"center",label:"是否全职资源"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.fullJobResource?"是":"否")+"\n ")]}}],null,!1,2194503727)}):e._e(),e._v(" "),n("el-table-column",{attrs:{align:"center",label:"状态"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("div",[e._v("\n "+e._s(t.row.isEnable?"开启":"关闭")+"\n ")])]}}],null,!1,3827644254)}),e._v(" "),n("el-table-column",{attrs:{align:"center",label:"操作",width:"140px"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-button",{attrs:{type:"text"},on:{click:function(n){return e.openTeaching("look",t.row)}}},[e._v("查看")]),e._v(" "),n("el-button",{directives:[{name:"permission",rawName:"v-permission",value:"cooperationOrgan/update",expression:"'cooperationOrgan/update'"}],attrs:{type:"text"},on:{click:function(n){return e.openTeaching("update",t.row)}}},[e._v("修改")]),e._v(" "),n("el-button",{attrs:{type:"text"},on:{click:function(n){return e.rejuest(t.row)}}},[e._v("领队注册")])]}}],null,!1,4091386992)})],1),e._v(" "),n("pagination",{attrs:{sync:"",total:e.pageInfo.total,page:e.pageInfo.page,limit:e.pageInfo.limit,"page-sizes":e.pageInfo.page_size},on:{"update:total":function(t){return e.$set(e.pageInfo,"total",t)},"update:page":function(t){return e.$set(e.pageInfo,"page",t)},"update:limit":function(t){return e.$set(e.pageInfo,"limit",t)},pagination:e.getList}})],1)],1):e._e(),e._v(" "),e.tableList.length>0||e.pageInfo.page>1||!e.contextFlag||!e.isSearch?e._e():n("emptyPage",{attrs:{title:"合作单位",btnTitle:"新建合作单位",context:e.context},on:{submit:function(t){return e.openTeaching("create")}}})],1),e._v(" "),e.teachingStatus?n("el-dialog",{attrs:{title:e.formTitle[e.formActionTitle],visible:e.teachingStatus,width:"1060px"},on:{"update:visible":function(t){e.teachingStatus=t}}},[n("el-form",{ref:"ruleForm",staticClass:"eidtForm",attrs:{model:e.form,rules:e.rules,inline:!0,"label-position":"left"}},[n("el-alert",{staticStyle:{margin:"10px 0"},attrs:{title:"合作单位信息",closable:!1,type:"info"}}),e._v(" "),n("el-row",[n("el-form-item",{attrs:{label:"单位名称",prop:"name","label-width":e.formLabelWidth}},[n("el-input",{attrs:{disabled:e.basdisabled,autocomplete:"off"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name","string"===typeof t?t.trim():t)},expression:"form.name"}})],1),e._v(" "),n("el-form-item",{attrs:{label:"所属分部",prop:"organId","label-width":e.formLabelWidth}},[n("el-select",{attrs:{disabled:e.basdisabled,filterable:"",clearable:""},on:{change:e.changeOrgan},model:{value:e.form.organId,callback:function(t){e.$set(e.form,"organId","string"===typeof t?t.trim():t)},expression:"form.organId"}},e._l(e.selects.branchs,(function(e){return n("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1)],1),e._v(" "),n("el-row",[n("el-form-item",{attrs:{label:"乐团主管",prop:"educationUserId","label-width":e.formLabelWidth,rules:[{required:!0,message:"乐团主管不能为空"}]}},[n("el-select",{attrs:{disabled:!e.form.organId||e.basdisabled,filterable:"",clearable:""},model:{value:e.form.educationUserId,callback:function(t){e.$set(e.form,"educationUserId","string"===typeof t?t.trim():t)},expression:"form.educationUserId"}},e._l(e.educationList,(function(t,i){return n("el-option",{key:i,attrs:{label:t.userName,value:t.userId}},[n("span",{staticStyle:{float:"left"}},[e._v(e._s(t.userName))]),e._v(" "),n("span",{staticStyle:{float:"right",color:"#8492a6","font-size":"13px"}},[e._v(e._s(String(t.userId)))])])})),1)],1),e._v(" "),n("el-form-item",{attrs:{label:"合作单位状态",prop:"isEnable","label-width":e.formLabelWidth}},[n("el-select",{attrs:{disabled:e.basdisabled,filterable:"",clearable:""},model:{value:e.form.isEnable,callback:function(t){e.$set(e.form,"isEnable","string"===typeof t?t.trim():t)},expression:"form.isEnable"}},[n("el-option",{attrs:{label:"开启",value:!0}}),e._v(" "),n("el-option",{attrs:{label:"关闭",value:!1}})],1)],1),e._v(" "),1==e.tenantId?n("el-form-item",{attrs:{label:"是否全职资源",prop:"fullJobResource","label-width":e.formLabelWidth}},[n("el-select",{attrs:{disabled:e.basdisabled},model:{value:e.form.fullJobResource,callback:function(t){e.$set(e.form,"fullJobResource","string"===typeof t?t.trim():t)},expression:"form.fullJobResource"}},[n("el-option",{attrs:{label:"是",value:1}}),e._v(" "),n("el-option",{attrs:{label:"否",value:0}})],1)],1):e._e()],1),e._v(" "),n("el-row",[n("el-form-item",{attrs:{label:"合作单位logo","label-width":e.formLabelWidth}},[n("image-cropper",{attrs:{options:e.cropperOptions,bucket_name:"daya",imgSize:2,imageUrl:e.form.logo,showSize:""},on:{"crop-upload-success":e.cropSuccess}}),e._v(" "),n("p",{staticStyle:{color:"red"}},[e._v("大小2M以内,格式为jpg、png、gif图片")])],1)],1),e._v(" "),n("el-alert",{staticStyle:{margin:"10px 0"},attrs:{title:"合作单位联系人",closable:!1,type:"info"}}),e._v(" "),e._l(e.form.cooperationOrganLinkmanList,(function(t,i){return n("el-row",{key:i,staticClass:"greyRow"},[n("div",{staticClass:"concatTitle"},[n("p",[e._v("联系人"+e._s(i+1))]),e._v(" "),e.form.cooperationOrganLinkmanList.length>1&&!e.basdisabled?n("i",{staticClass:"el-icon-delete-solid marginLeft10 iconStyle",staticStyle:{"font-size":"20px",cursor:"pointer"},on:{click:function(t){return e.deleteLinkMan(i)}}}):e._e()]),e._v(" "),n("el-form-item",{attrs:{rules:[{required:!0,message:"请输入联系人",trigger:"blur"}],label:"联系人姓名",prop:"cooperationOrganLinkmanList."+i+".linkman","label-width":e.formLabelWidth}},[n("el-input",{attrs:{disabled:e.basdisabled,autocomplete:"off"},model:{value:t.linkman,callback:function(n){e.$set(t,"linkman","string"===typeof n?n.trim():n)},expression:"item.linkman"}})],1),e._v(" "),n("el-form-item",{attrs:{rules:[{required:!0,message:"请输入职位",trigger:"blur"}],label:"联系人职位",prop:"cooperationOrganLinkmanList."+i+".job","label-width":e.formLabelWidth}},[n("el-input",{attrs:{disabled:e.basdisabled,autocomplete:"off"},model:{value:t.job,callback:function(n){e.$set(t,"job","string"===typeof n?n.trim():n)},expression:"item.job"}})],1),e._v(" "),n("el-form-item",{attrs:{rules:[{required:!0,validator:e.validPhone,trigger:"blur"},,{pattern:/^1[3456789]\d{9}$/,message:"请输入正确的手机号",trigger:"blur"}],label:"联系人手机号",prop:"cooperationOrganLinkmanList."+i+".mobileNo","label-width":e.formLabelWidth}},[n("el-input",{attrs:{disabled:e.basdisabled,max:11,min:11,maxlength:"11",autocomplete:"off"},model:{value:t.mobileNo,callback:function(n){e.$set(t,"mobileNo","string"===typeof n?n.trim():n)},expression:"item.mobileNo"}})],1)],1)})),e._v(" "),e.basdisabled?e._e():n("el-button",{staticClass:"greyRow",staticStyle:{width:"100%"},attrs:{icon:"el-icon-plus"},on:{click:e.addLinkMan}},[e._v("添加联系人")])],2),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.teachingStatus=!1}}},[e._v("取 消")]),e._v(" "),e.basdisabled?e._e():n("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onTeachingSubmit("ruleForm")}}},[e._v("确 定")])],1)],1):e._e(),e._v(" "),n("qr-code",{ref:"qrCode",attrs:{title:"领队注册",codeUrl:e.codeUrl,value:e.radio,isDown:!0},model:{value:e.codeStatus,callback:function(t){e.codeStatus=t},expression:"codeStatus"}},[n("el-radio-group",{staticClass:"groupWrap",on:{change:e.changeRadio},model:{value:e.radio,callback:function(t){e.radio=t},expression:"radio"}},[n("el-radio",{attrs:{label:"SCHOOL_LEADER"}},[e._v("分管领导")]),e._v(" "),n("el-radio",{attrs:{label:"TEACHER"}},[e._v("负责老师")]),e._v(" "),n("el-radio",{attrs:{disabled:e.staffStat.orchestraLeaderNums>0,label:"ORCHESTRA_LEADER"}},[e._v("乐团领队")]),e._v(" "),n("el-radio",{attrs:{disabled:e.staffStat.schoolmasterNums>0,label:"SCHOOLMASTER"}},[e._v("学校校长")])],1)],1)],1)},r=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("h2",[n("div",{staticClass:"squrt"}),e._v("\n 合作单位\n ")])}],o=n("2909"),s=(n("7f7f"),n("5530")),a=(n("386d"),n("c7eb")),c=(n("96cf"),n("1da1")),u=n("333d"),l=n("99b4"),h=n("e3eb"),d=n.n(h),f=n("61f7"),p=n("adb21"),g=n("1cc7"),_=n("1062"),m=n("4328"),v=n.n(m),y=n("903e"),E=n("896b"),T=n("641c"),I=n("8985"),C=function(e,t,n){t?Object(f["b"])(t)?n():n(new Error("请输入正确的11位手机号码")):n(new Error("请输入电话号码"))},R={name:"branchManager",components:{pagination:u["a"],emptyPage:_["a"],ImageCropper:E["a"],qrCode:T["a"]},data:function(){return{searchForm:{organId:null,isEnable:null,search:null},validPhone:C,searchLsit:[],tableList:[],educationList:[],pageInfo:{limit:10,page:1,total:0,page_size:[10,20,40,50]},teachingStatus:!1,formActionTitle:"create",formTitle:{create:"添加合作单位",update:"修改合作单位",look:"查看合作单位"},formLabelWidth:"120px",form:{id:null,name:null,linkman:null,job:null,mobileNo:null,fullJobResource:null,organId:null,educationUserId:null,logo:null,cooperationOrganLinkmanList:[{cooperationOrganId:"",job:"",linkman:"",mobileNo:""}]},rules:{name:[{required:!0,message:"请输入教学点名称",trigger:"blur"}],organId:[{required:!0,message:"请选择所属分部",trigger:"change"}],educationUserId:[{required:!0,message:"请选择乐团主管",trigger:"change"}],fullJobResource:[{required:!0,message:"请选择是否全职资源",trigger:"change"}],isEnable:[{required:!0,message:"请选择状态",trigger:"change"}]},basdisabled:!1,actionRow:null,tenantId:null,context:"合作单位即为合作学校,可以为本机构下的各个分部创建合作单位,创建乐团时需选择合作单位用于区分和管理各合作方的乐团。若本机构乐团无合作方,可将本机构创建为合作单位,并在创建乐团时选择。",contextFlag:!1,cropperOptions:{autoCrop:!0,autoCropWidth:200,autoCropHeight:200,fixedBox:!0,previewsCircle:!1,full:!0,enlarge:2,title:"logo"},codeStatus:!1,codeUrl:"www.baidu.com",radio:"SCHOOL_LEADER",staffStat:{orchestraLeaderNums:0,orchestraNums:0,schoolLeaderNums:0,schoolmasterNums:0,studentNums:0,teacherNums:0}}},mounted:function(){var e=Object(c["a"])(Object(a["a"])().mark((function e(){return Object(a["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.tenantId=this.$helpers.tenantId,this.getList(),e.next=4,this.$store.dispatch("setBranchs");case 4:this.selects.branchs.length<=0&&this.$bus.$emit("showguide",["organ"]);case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),methods:{onDelete:function(e){var t=this;this.$confirm("您确定删除合作单位?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(l["d"])(e.id).then((function(e){200==e.code?(t.$message.success("删除成功"),t.teachingStatus=!1,t.getList()):t.$message.error(e.msg)}))})).catch((function(){}))},search:function(){this.pageInfo.page=1,this.getList()},onReSet:function(){this.searchForm={organId:null,isEnable:null,search:null},this.$refs.searchForm.resetFields(),this.$refs.searchForm.save(),this.search(),this.$forceUpdate()},changeRadio:function(){this.$refs.qrCode.resetImage(),this.codeUrl="".concat(Object(f["d"])(),"/#/school-register?id=").concat(this.activeRow.id,"&type=").concat(this.radio)},onExport:function(){Object(p["a"])(this,{url:"/api-web/export/cooperationOrgan",fileName:"合作单位.xls",method:"post",params:v.a.stringify(d()(this.searchForm))},"您确定导出合作单位?")},onTeachingSubmit:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return!1;"create"==t.formActionTitle?(t.form.id&&delete t.form.id,Object(l["c"])(t.form).then((function(e){200==e.code?(t.$message.success("创建成功"),t.teachingStatus=!1,t.getList()):t.$message.error(e.msg)}))):"update"==t.formActionTitle&&Object(l["e"])(t.form).then((function(e){200==e.code?(t.$message.success("修改成功"),t.teachingStatus=!1,t.getList()):t.$message.error(e.msg)}))}))},getList:function(){var e=this;this.contextFlag=!1,Object(l["H"])(Object(s["a"])({rows:this.pageInfo.limit,page:this.pageInfo.page},this.searchForm)).then((function(t){200==t.code&&t.data&&(e.contextFlag=!0,e.tableList=t.data.rows,e.pageInfo.total=t.data.total)}))},openTeaching:function(e,t){if(this.teachingStatus=!0,this.actionRow=Object(s["a"])({},t)||null,this.formActionTitle=e,"update"==e){this.changeOrgan(t.organId),this.form={id:t.id,name:t.name,linkman:t.linkman,job:t.job,mobileNo:t.mobileNo?t.mobileNo:null,ownershipType:t.ownershipType,organId:t.organId,fullJobResource:t.fullJobResource,isEnable:t.isEnable,educationUserId:t.educationUserId,logo:t.logo};var n=t.cooperationOrganLinkmanList.length>0?Object(o["a"])(t.cooperationOrganLinkmanList):[{cooperationOrganId:t.id,job:"",linkman:"",mobileNo:""}];this.$set(this.form,"cooperationOrganLinkmanList",n),this.basdisabled=!1}else if("look"==e){this.changeOrgan(t.organId),this.form={id:t.id,name:t.name,linkman:t.linkman,job:t.job,mobileNo:t.mobileNo?t.mobileNo:null,ownershipType:t.ownershipType,organId:t.organId,fullJobResource:t.fullJobResource,isEnable:t.isEnable,educationUserId:t.educationUserId,logo:t.logo};var i=t.cooperationOrganLinkmanList.length>0?Object(o["a"])(t.cooperationOrganLinkmanList):[];this.$set(this.form,"cooperationOrganLinkmanList",i),this.basdisabled=!0}else this.basdisabled=!1,this.actionRow=null},changeOrgan:function(){var e=Object(c["a"])(Object(a["a"])().mark((function e(t){var n,i,r;return Object(a["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.form.educationUserId=null,!t){e.next=13;break}return e.prev=2,e.next=5,Object(g["wb"])({id:t});case 5:r=e.sent,this.educationList=null===r||void 0===r||null===(n=r.data)||void 0===n?void 0:n.EDUCATION,(!this.educationList||(null===(i=this.educationList)||void 0===i?void 0:i.length)<=0)&&this.$bus.$emit("showguide",["teamManager"]),e.next=13;break;case 10:e.prev=10,e.t0=e["catch"](2),console.log(e.t0);case 13:case"end":return e.stop()}}),e,this,[[2,10]])})));function t(t){return e.apply(this,arguments)}return t}(),deleteLinkMan:function(e){this.form.cooperationOrganLinkmanList.splice(e,1)},addLinkMan:function(){this.actionRow?this.form.cooperationOrganLinkmanList.push({cooperationOrganId:this.actionRow.id,job:"",linkman:"",mobileNo:""}):this.form.cooperationOrganLinkmanList.push({cooperationOrganId:"",job:"",linkman:"",mobileNo:""})},cropClose:function(){console.log("上传操作结束")},cropSuccess:function(e){this.$set(this.form,"logo",e.data.url),console.log(this.form.logo,"cropSuccess")},rejuest:function(){var e=Object(c["a"])(Object(a["a"])().mark((function e(t){var n;return Object(a["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Object(I["d"])({id:t.id});case 3:n=e.sent,console.log(n,"rejuest"),this.staffStat=Object(s["a"])({},n.data.staffStat),this.activeRow=t,this.codeUrl="".concat(Object(f["d"])(),"/#/school-register?id=").concat(t.id,"&type=").concat(this.radio),this.codeStatus=!0,e.next=13;break;case 11:e.prev=11,e.t0=e["catch"](0);case 13:case"end":return e.stop()}}),e,this,[[0,11]])})));function t(t){return e.apply(this,arguments)}return t}()},watch:{teachingStatus:function(e){e||(this.form={id:null,name:null,linkman:null,job:null,mobileNo:null,fullJobResource:null,organId:null,isEnable:null,educationUserId:null,cooperationOrganLinkmanList:[]},this.$refs.ruleForm.resetFields())}},computed:{isSearch:function(){return!this.searchForm.search&&!this.searchForm.organId&&!Object(y["a"])(this.searchForm.isEnable)&&!this.searchForm.isEnable}}},S=R,N=(n("e0e0"),n("2877")),O=Object(N["a"])(S,i,r,!1,null,"34b7e4f5",null);t["default"]=O.exports}}]);