@rongcloud/engine 5.9.8 → 5.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1 +1 @@
1
- var e;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,i=function(e){return t||(t={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),t},r=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),s=function(){function e(e,t){var n;this._rootStorage=i(e);var s=this._rootStorage.get(t)||{};this._cache=new r(((n={})[t]=s,n)),this._storageKey=t}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e.prototype.update=function(e){void 0===e&&(e={});var t=this._storageKey;this._cache.set(t,e),this._rootStorage.set(t,e)},e}(),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=function(){return u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},u.apply(this,arguments)};function c(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))}function l(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function h(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var d,p=function(e){function t(t){return e.call(this,"TODO => "+t)||this}return a(t,e),t}(Error),_=function(e){return new p(e)},f=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},E=function(e){for(var t,n=0,i=0,r=e.length;i<r;i++)n+=(t=e.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return n},T=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return e+"="+t[e]})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},I=72e5,v=6e4,R=1e4,C=5e3,S=3e4,m=15e3,y=15e3,A=2e3,N=131072,O=18e4,M=32,L=4096,U="cd4936151214ce45dc1d12673a59d94c",b="51ad078e5eb17a91",P={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0,searchProps:["content","title"]},"RC:FileMsg":{isCounted:!0,isPersited:!0,searchProps:["name"]},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:CombineV2Msg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:RcNtf":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:Delivered":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},D={"RC:DizNtf":{isCounted:!1,isPersited:!1}},w=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.9.8",F=x.replace(/-.+$/,""),H=5368709120,Y=10485760,q=18e5,K="rongcloudsystem",j=864e5,Q={NAVI_KEY:function(e){return"navi_"+e},CONVER_STATE_PULL_TIME_KEY:function(e,t){return"RCV4-con-s-"+e+"-"+t},OLD_CONVER_STATE_KEY:function(e,t){return"RCV4-con-"+e+"-"+t},CONVER_STATE_KEY:function(e,t){return"RCV4-CONVER-"+e+"-"+t},ULTRA_GROUP_STATE_KEY:function(e,t){return"RCV4-ultragroupconversation-"+e+"-"+t},OUTBOX_TIME_KEY:function(e,t){return"outbox_"+e+"_"+t},INBOX_TIME_KEY:function(e,t){return"inbox_"+e+"_"+t},BROADCASTBOX_TIME_KEY:function(e,t){return"broadcastbox_"+e+"_"+t},SEND_MSG_KEY:function(e,t){return"send_msg_"+e+"_"+t},USER_SETTING_TIME_KEY:function(e,t){return"us-s-"+e+"-"+t},TAG_STATE_KEY:function(e,t){return"tag-"+e+"-"+t},USER_SETTING_KEY:function(e,t){return"RC-us-"+e+"-"+t},STATIC_CONFIG_KEY:function(e){return"rc-static-config-"+e},CLOUD_CONTROL_KEY:function(e){return"RC-cc-"+e},READ_RECEIPT_KEY:function(e,t){return"RC-RR-"+e+"-"+t}};!function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var W,J=d;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(W||(W={}));var X,Z=W;!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.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.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(X||(X={}));var z,$=X;!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(z||(z={}));var ee,te=z;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(ee||(ee={}));var ne,ie=ee;!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.COMBINE_V2="RC:CombineV2Msg",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.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",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.READ_STATE="RC:RSMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg",e.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg"}(ne||(ne={}));var re,se=ne;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(re||(re={}));var oe,ae=re;!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"}(oe||(oe={}));var ue,ce=oe;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(ue||(ue={}));var le,he=ue;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(le||(le={}));var de,pe=le;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(de||(de={}));var ge,_e,fe,Ee,Te,Ie=de;!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"}(ge||(ge={})),function(e){e.IM="IM",e.RTC="RTC"}(_e||(_e={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.A_INIT_REPEAT_O="A_INIT_REPEAT_O",e.L_INIT_O="L-init-O",e.A_DESTROY_O="A_DESTROY_O",e.L_DESTROY_O="L_DESTROY_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.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",e.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",e.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",e.A_MSG_LISTENER_E="A-MSG_LISTENER-E",e.O="L-original-O",e.T="L-TEST-O",e.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",e.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",e.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",e.L_NAVI_CMP_R="L-NAVI_CPM-R",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-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_MSG_E="L-pull_msg-E",e.L_PULL_MSG_O="L-pull_msg-O",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.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",e.L_RECV_S_MSG_O="L-recv_s_msg-O",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_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_REQUEST_T="L-request-T",e.L_REQUEST_R="L-request-R",e.L_PARSE_NAVI_E="L-parse_navi-E",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_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",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_REPORT_LOG_S="G-report_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.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",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_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",e.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E",e.L_CALLBACK_E="L-callback-E",e.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",e.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",e.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",e.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",e.A_SYNC_READ_STATUS_T="A-sync_read_status-T",e.A_SYNC_READ_STATUS_R="A-sync_read_status-R",e.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",e.L_PB_ENCODE_E="L-pb-encode-E",e.L_PB_DECODE_E="L-pb-decode-E",e.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",e.L_REPORT_FULL_LOG_O="L-report_full_log-O",e.L_REPORT_FULL_LOG_T="L-report_full_log-T",e.L_REPORT_FULL_LOG_R="L-report_full_log-R",e.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",e.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",e.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",e.L_LOGDB_CLOSED_S="L-logDB_closed-S",e.L_LOGDB_ERROR_E="L-logDB_error-S",e.L_LOGDB_ABORT_S="L-logDB_abort-S",e.L_REALTIME_LOG_R="L_REALTIME_LOG_R",e.L_REALTIME_LOG_O="L_REALTIME_LOG_O",e.L_REALTIME_LOG_T="L_REALTIME_LOG_T",e.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",e.L_RECV_RMTP_O="L_RECV_RMTP_O",e.L_RECV_RMTP_E="L_RECV_RMTP_E",e.L_RECV_S_NTF_O="L-recv_s_ntf_O",e.L_VER_REPORT_T="L-VER_REPORT-T",e.L_VER_REPORT_R="L-VER_REPORT-R",e.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",e.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",e.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",e.A_REMOVE_PROXY_O="A-remove_proxy-O",e.A_SET_PROXY_O="A-set_proxy-O",e.A_TEST_PROXY_O="A-test_proxy-O",e.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",e.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",e.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",e.L_GET_STATIC_CONF_T="L-get_static_conf-T",e.L_GET_STATIC_CONF_R="L-get_static_conf-R",e.L_GET_STATIC_CONF_E="L-get_static_conf-E",e.L_CLOUD_DISABLED="L-cloud_disabled",e.L_CLOUD_EXPIRE="L-cloud_expire",e.L_CLOUD_OVERCLOCK="L-cloud_overclock",e.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",e.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",e.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",e.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",e.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",e.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",e.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",e.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",e.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",e.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",e.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",e.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R"}(fe||(fe={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(Ee||(Ee={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Te||(Te={}));var ve,Re,Ce=Te;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(ve||(ve={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Re||(Re={}));var Se,me=ve;!function(e){e[e.typing=0]="typing"}(Se||(Se={}));var ye,Ae,Ne=Se;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(ye||(ye={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Ae||(Ae={}));var Oe,Me=Ae;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Oe||(Oe={}));var Le,Ue=Oe;!function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(Le||(Le={}));var be,Pe=Le;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(be||(be={}));var De,we,Ve,Ge,Be,ke,xe,Fe,He,Ye,qe,Ke,je,Qe,We,Je,Xe,Ze,ze,$e,et,tt,nt,it=be;!function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(De||(De={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(we||(we={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(Ve||(Ve={})),function(e){e.NAVI="rc-navi",e.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Ge||(Ge={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Be||(Be={})),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"}(ke||(ke={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(xe||(xe={})),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"}(Fe||(Fe={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(He||(He={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(Ye||(Ye={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(qe||(qe={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Ke||(Ke={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(je||(je={})),function(e){e[e.CURRENT=2]="CURRENT"}(Qe||(Qe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(We||(We={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Je||(Je={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(Xe||(Xe={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini"}(Ze||(Ze={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS"}(ze||(ze={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}($e||($e={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(et||(et={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(tt||(tt={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(nt||(nt={}));var rt,st,ot,at={"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"}(rt||(rt={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(st||(st={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(ot||(ot={}));var ut=function(e){return"string"==typeof e},ct=function(e){return"boolean"==typeof e},lt=function(e){return"number"==typeof e&&!Number.isNaN(e)},ht=function(e){return function(t){return Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max)}},dt=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},pt=function(e){return function(t){return dt(t)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.itemValidator||t.every(e.itemValidator))}},gt=function(e){return function(t){return ut(t)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t))}},_t=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},ft=function(e){return ut(e)&&e.length>0},Et=function(e){return dt(e)&&e.length>0},Tt=function(e){return"[object Object]"===Object.prototype.toString.call(e)},It=function(e){return"[object Function]"===Object.prototype.toString.call(e)},vt=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Rt=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ct=function(e){return ut(e)&&/https?:\/\//.test(e)},St=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},mt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(te,e)},yt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(ce,e)},At=function(e){var t=!1;return ut(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Nt=function(e){return gt({minLength:1,maxLength:64})(e)},Ot=function(e){return[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE].includes(e)},Mt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(J,e)},Lt=function(e){var t=!1,n=!1,i=!1;if(Tt(e)){var r=Object.keys(e).length;for(var s in t=r>20,e)if(n||(n=ut(s)&&!/^[A-Za-z0-9_=+-]+$/.test(s)),!i){var o=e[s];i=s.length>32||o.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},Ut=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var i=this._map[e];i&&((i=i.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=i:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._map[e];if(i)for(var r=i.length-1;r>=0;r-=1){var s=i[r],o=s.target,a=s.once,u=s.listener;a&&i.splice(r,1);try{u.call.apply(u,h([o],t,!1))}catch(e){null===console||void 0===console||console.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),bt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};bt.engine="5.9.8";var Pt=function(){function e(){}return e.add=function(e,t){bt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return bt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return bt},e}();function Dt(){return!0}var wt=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)}))},Vt=function(){var e=wt();if(e=e.replace(/-/g,"")+"a",e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var s=i%n;i=(i-s)/n,r.unshift(t[s])}while(i);return r.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e},Gt=function(e){var t="RCDeviceId",n=i(e),r="",s=n.get(t);return s?r=s:(r=Vt(),n.set(t,r)),r},Bt=null;function kt(e,t,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-e];if(Bt&&e<ge.FATAL)try{var s=JSON.stringify(n);Bt[r](t,s)}catch(e){console.error(e)}}var xt,Ft,Ht=kt.bind(null,ge.DEBUG),Yt=kt.bind(null,ge.INFO),qt=kt.bind(null,ge.WARN),Kt=kt.bind(null,ge.ERROR),jt=kt.bind(null,ge.FATAL),Qt=Object.freeze({__proto__:null,init:function(e){Bt=e},log:kt,debug:Ht,info:Yt,warn:qt,error:Kt,fatal:jt}),Wt=function(){function e(e,t){var n=this;this._promise=new Promise((function(t){n._resolve=t,e(n._onResolve.bind(n))})),this._onCancel=t}return e.prototype._onResolve=function(e){this._resolve(e)},e.prototype.result=function(){return this._promise},e.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},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",e[e.CONVERSATION_TYPE=9]="CONVERSATION_TYPE"}(Ft||(Ft={}));var Jt=((xt={})[Ft.STRING]=ft,xt[Ft.ONLY_STRING]=ut,xt[Ft.NUMBER]=lt,xt[Ft.BOOLEAN]=function(e){return"boolean"==typeof e},xt[Ft.OBJECT]=Tt,xt[Ft.ARRAY]=dt,xt[Ft.CALLBACK]=function(e){var t=!0;return Tt(e)||(t=!1),(e=e||{}).onSuccess&&!It(e.onSuccess)&&(t=!1),e.onError&&!It(e.onError)&&(t=!1),t},xt[Ft.CHANNEL_ID]=At,xt[Ft.CONVERSATION]=function(e){var t=!0;return Tt(e)||(t=!1),ut(e.targetId)||(t=!1),mt(e.conversationType)||(t=!1),vt(e.channelId)||At(e.channelId)||(t=!1),t},xt[Ft.CONVERSATION_TYPE]=mt,xt),Xt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return a(t,e),t}(Error),Zt=function(e,t,n,i){if(void 0===i&&(i=!1),!zt(e,t,n,i))throw new Xt("'"+e+"' is invalid: "+JSON.stringify(t))},zt=function(e,t,n,i){void 0===i&&(i=!1),n=Jt[n]||n;var r=i?n(t):vt(t)||null==t||n(t);return r||null===console||void 0===console||console.error("'"+e+"' is invalid: "+JSON.stringify(t)),r},$t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function en(e){var t,n,i,r,s,o,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=$t.indexOf(e.charAt(u++))<<2|(r=$t.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(s=$t.indexOf(e.charAt(u++)))>>2,i=(3&s)<<6|(o=$t.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==s&&(a+=String.fromCharCode(n)),64!==o&&(a+=String.fromCharCode(i));return a}function tn(e){for(var t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}var nn,rn,sn,on,an=function(e){if(!Tt(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)},un=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=wt(),r=function(e){e=e||"-";var t=new Date;return""+t.getFullYear()+e+(t.getMonth()+1)+e+t.getDate()}(),s=(new Date).getTime(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return e+"__RC-"+r+"_"+n+"_"+s+i+o},cn=function(e){var t="application/octet-stream";switch(e){case J.IMAGE:t="image/jpeg";break;case J.AUDIO:t="audio/amr";break;case J.VIDEO:t="video/3gpp";break;case J.SIGHT:t="video/mpeg4";break;case J.COMBINE_HTML:t="text/html"}return t},ln=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=t.channelIdMi,i=t.channelIdHW,r=t.channelIdOPPO,s=t.typeVivo,o=t.importanceHW,a=t.categoryHW,u=t.imageUrlHW,c=t.categoryVivo,l=t.importanceHonor,h=t.imageUrlHonor,d=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,s=e.richMediaUri,o=e.interruptionLevel,a=t.googleConfig,u={};u["thread-id"]=n||"",u["apns-collapse-id"]=i||"",u.category=r||"",u.richMediaUri=s||"",u["interruption-level"]=o||"active";var c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;var l=null==a?void 0:a.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),c.priority=l,{APNS:u,FCM:c}}(e,t),p=[{HW:{channelId:i||"",importance:o||"NORMAL",image:u||"",category:a||""}},{MI:{channelId:n||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:s||"",category:c||""}},{APNS:d.APNS},{FCM:d.FCM},{HONOR:{importance:l||Ve.NORMAL,image:h||""}}];return JSON.stringify(p)},hn=function(e,t,n){var i={},r={notificationId:n||""};if(!t)return{iOSConfig:i,androidConfig:r};try{var s=JSON.parse(t);null==s||s.forEach((function(e){var t,n,s,o,a,u,c,l,h,d,p=Object.keys(e);if(0!==p.length){var g=p[0];switch(g){case"HW":return r.channelIdHW=null===(t=e[g])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[g])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(s=e[g])||void 0===s?void 0:s.image,void(r.categoryHW=null===(o=e[g])||void 0===o?void 0:o.category);case"MI":return void(r.channelIdMi=null===(a=e[g])||void 0===a?void 0:a.channelId);case"OPPO":return void(r.channelIdOPPO=null===(u=e[g])||void 0===u?void 0:u.channelId);case"VIVO":return r.typeVivo=null===(c=e[g])||void 0===c?void 0:c.classification,void(r.categoryVivo=null===(l=e[g])||void 0===l?void 0:l.category);case"APNS":return i.threadId=e[g]["thread-id"],i.apnsCollapseId=e[g]["apns-collapse-id"],i.category=e[g].category,i.richMediaUri=e[g].richMediaUri,void(i.interruptionLevel=e[g]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[g].collapse_key||"",imageUrl:e[g].imageUrl||"",priority:e[g].priority||""});case"HONOR":r.importanceHonor=null===(h=e[g])||void 0===h?void 0:h.importance,r.imageUrlHonor=null===(d=e[g])||void 0===d?void 0:d.image}}}))}catch(n){e.error(fe.O,"Wrong format for pushConfigs field! content: "+t)}return{iOSConfig:i,androidConfig:r}},dn=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},pn=function(e){var t=e.length;return t<=4096&&t>=1},gn=(nn=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+nn.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return nn=2047&++nn,parseInt(n,2)}),_n=function(){var e=Pt.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},fn=function(e,t,n){return c(void 0,void 0,void 0,(function(){var i,r;return l(this,(function(s){switch(s.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(t),"AES-CBC",!0,["decrypt"])];case 1:return i=s.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,tn(e))];case 2:return r=s.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function En(e,t){var n;if(!e)return"";var i="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?i?e.replace(/^https?:\/\//i,"https://"):e:t!==De.HTTP||i?"https://"+e:"http://"+e}function Tn(e){if(!e)return Math.floor(4294967296*Math.random());var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return Math.abs(t)}!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(rn||(rn={})),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"}(sn||(sn={})),function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(on||(on={}));function In(e){var t,n=e.method||rn.GET,i=e.timeout||6e4,r=e.headers,s=e.query,o=e.body,a=e.onProgress,u=T(e.url,s),c=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),l="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(n,u),r&&c.setRequestHeader)for(var h in r)c.setRequestHeader(h,r[h]);return l?function(e,t,n){return new Wt((function(i){0!==t&&(e.timeout=t),e.onload=function(){i({data:e.responseText,status:e.status||200})},e.onerror=function(){i({status:e.status})},e.ontimeout=function(){i({status:e.status})};var r="object"==typeof n?JSON.stringify(n):n;e.send(r)}),(function(t){e.abort(),t({status:-1})}))}(c,i,o):function(e,t,n,i){return new Wt((function(r){e.onreadystatechange=function(){4===e.readyState&&r({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){r({status:e.status})},i&&(e.upload.onprogress=function(e){return i(e)}),0!==t&&setTimeout((function(){e.abort(),r({status:e.status})}),t),e.send(n)}),(function(t){e.abort(),t({status:-1})}))}(c,i,o,a)}var vn,Rn,Cn=function(e,t,n){var i=null==n?void 0:n.isReverse;Tt(e)&&function(){for(var n in e)t(e[n],n,e)}(),(dt(e)||ut(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,s=e.length;r<s;r++)t(e[r],r)}()},Sn=function(e,t){return Cn(e,(function(n,i){e[i]=t(n,i)})),e},mn=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return Cn(e,(function(e,i){t===e&&(n=i)})),n},yn=function(e,t){return-1!==mn(e,t)},An=function(e,t){var n=[];return Cn(e,(function(e){n.push(e)})),-1!==mn(n,t)},Nn=function(e){return JSON.parse(JSON.stringify(e))},On=function(){return"undefined"!=typeof RCCppEngine},Mn=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 s in r)if(r.hasOwnProperty(s)){var o=i.match(r[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ln=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Ln(e[n]));else for(var n in t={},e)t[n]=Ln(e[n]);else t=e;return t},Un=function(e){var t;try{t=Ln(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},bn=function(e){return{isRead:(e&n.READ)===n.READ,isListened:(e&n.LISTENED)===n.LISTENED,isDownload:(e&n.DOWNLOADED)===n.DOWNLOADED,isRetrieved:(e&n.RETRIEVED)===n.RETRIEVED}},Pn=function(e){var t=n.UNREAD;return(null==e?void 0:e.isRead)&&(t|=n.READ),(null==e?void 0:e.isListened)&&(t|=n.LISTENED),(null==e?void 0:e.isDownload)&&(t|=n.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=n.RETRIEVED),t},Dn=function(e){return[Ze.Android,Ze.iOS,Ze.Web,Ze.PC,Ze.Mini].map((function(t){var n=e.findIndex((function(e){return e.platform===t}));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]}))},wn={_delayTime:0,setTime:function(e){var t=(new Date).getTime();wn._delayTime=t-e},getTime:function(){var e=wn._delayTime;return(new Date).getTime()-e}},Vn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},Gn=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o;return l(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(),s=r.code,o=r.data,s===$.SUCCESS?(this._isPulling=!1,this._pullTime=o.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}(),Bn="rtcRJoin_data",kn="rtcRExit",xn="rtcRInfo",Fn="rtcUData",Hn="rtcUPut",Yn="rtcUDel",qn="rtcSetData",Kn="userSetData",jn="rtcQryData",Qn="rtcDelData",Wn="rtcToken",Jn="rtcUserState",Xn="rtcUList",Zn="viewerJoinR",zn="viewerExitR",$n="rtcPullKv",ei="rtcIdentityChange",ti="rtcInvite",ni="rtcCancelInvite",ii="rtcInviteAnswer",ri="rtcEndInvite",si="rtcQueryJoined";!function(e){e.RtcInput="RtcInput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcOutput="RtcOutput"}(Rn||(Rn={}));var oi=((vn={})[Rn.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],vn[Rn.RtcUserListOutput]=["users","token","sessionId","roomInfo"],vn[Rn.SetUserStatusInput]=["status"],vn[Rn.RtcSetDataInput]=["interior","target","key","value","objectName","content"],vn[Rn.RtcUserSetDataInput]=["valueInfo","objectName","content"],vn[Rn.RtcDataInput]=["interior","target","key","objectName","content"],vn[Rn.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],vn[Rn.MCFollowInput]=["state"],vn[Rn.RtcTokenOutput]=["rtcToken"],vn[Rn.RtcQryOutput]=["outInfo"],vn[Rn.RtcQryUserOutDataInput]=["userId"],vn[Rn.RtcUserOutDataOutput]=["user"],vn[Rn.RtcQueryListInput]=["order"],vn[Rn.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],vn[Rn.RtcValueInfo]=["key","value"],vn[Rn.RtcKeyDeleteInput]=["key"],vn[Rn.RtcNotifyMsg]=["type","time","roomId"],vn[Rn.RtcPullKV]=["timestamp","roomId"],vn[Rn.RtcKVOutput]=["entries","bFullUpdate","syncTime"],vn[Rn.RtcQueryUserJoinedInput]=["userId"],vn[Rn.RtcQueryUserJoinedOutput]=["info"],vn[Rn.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],vn[Rn.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],vn[Rn.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],vn[Rn.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],vn),ai="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message "+Rn.SetUserStatusInput+"\n {\n optional int32 status=1;\n }\n message "+Rn.MCFollowInput+"\n {\n required string state = 1;\n }\n message "+Rn.RtcQueryListInput+"{\n optional int32 order=1;\n }\n message "+Rn.RtcKeyDeleteInput+"{\n repeated string key=1;\n }\n message "+Rn.RtcValueInfo+"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated "+Rn.RtcValueInfo+" userData=2; //用户资源信息\n }\n message "+Rn.RtcUserListOutput+"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated "+Rn.RtcValueInfo+" roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message "+Rn.RtcInput+"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated "+Rn.RtcValueInfo+" innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated "+Rn.RtcValueInfo+" outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message "+Rn.RtcQryOutput+"{\n repeated "+Rn.RtcValueInfo+" outInfo=1;\n }\n message "+Rn.RtcDataInput+"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message "+Rn.RtcSetDataInput+"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message "+Rn.RtcUserSetDataInput+" {\n repeated "+Rn.RtcValueInfo+" valueInfo = 1;\n required string objectName = 2;\n repeated "+Rn.RtcValueInfo+" content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message "+Rn.RtcTokenOutput+"{\n required string rtcToken=1;\n }\n message "+Rn.RtcSetOutDataInput+"{\n required targetType target=1;\n repeated "+Rn.RtcValueInfo+" valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message "+Rn.RtcQryUserOutDataInput+"{\n repeated string userId = 1;\n }\n message "+Rn.RtcUserOutDataOutput+"{\n repeated RtcUserInfo user = 1;\n }\n message "+Rn.RtcNotifyMsg+" \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message "+Rn.RtcPullKV+"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message "+Rn.RtcKVOutput+"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message "+Rn.RtcQueryUserJoinedInput+"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message "+Rn.RtcQueryUserJoinedOutput+"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message "+Rn.RtcViewerJoinedOutput+"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message "+Rn.RtcInviteInput+"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message "+Rn.RtcCancelInviteInput+"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message "+Rn.RtcInviteAnswerInput+"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message "+Rn.RtcEndInviteInput+"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n",ui=function(){function e(e,t,n,i,r,s){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=s,this._appkey=this._options.appkey,this._rtcKVManager=new Gn(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.getInnerStatisticLog=function(){return this.statisticLog},e.prototype.pullRTCRoomEntry=function(e,t){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return t=this.rtcCodec.encode(Rn.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,$n,!0,t)];case 1:return n=c.sent(),i=n.code,r=n.buffer,i!==$.SUCCESS?[2,{code:i}]:(s=this.rtcCodec.decode(Rn.RtcKVOutput,r),o=s.entries,a=s.syncTime,o=(o||[]).map((function(e){return u(u({},e),{timestamp:an(e.timestamp)})})),this._watcher.onRTCDataChange(o,e),[2,{code:i,data:{kvEntries:o,syncTime:an(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(Rn.RtcNotifyMsg,e),n=t.time,i=t.type,r=t.roomId;1===i&&this._rtcKVManager.pullEntry(r,an(n))}},e.prototype.destroy=function(){},e}();function ci(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,i,s;return t?(s=(e>>>=0)>=0&&e<256)&&(i=u[e])?i:(n=r(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),s&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?_:g;if(t){if(e<0)return _;if(e>=h)return v}else{if(-d>=e)return R;if(e+1>=d)return I}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 s(e,t,n){var r,o,a,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;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 s(e.substring(1),t,n).neg();for(o=i(c(n,8)),a=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(d=i(c(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(o)).add(i(h));return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?i(t):"string"==typeof t?s(t):r(t.low,t.high,t.unsigned)}var a,u,c,l,h,d,p,g,_,f,E,T,I,v,R,C;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,c=Math.pow,e.fromString=s,e.fromValue=o,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,_=n(0,!0),e.UZERO=_,f=n(1),e.ONE=f,E=n(1,!0),e.UONE=E,T=n(-1),e.NEG_ONE=T,I=r(-1,2147483647,!1),e.MAX_VALUE=I,v=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=v,R=r(0,-2147483648,!1),e.MIN_VALUE=R,(C=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},C.toString=function(e){var t,n,r,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(s=i(c(e,6),this.unsigned),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},C.isZero=function(){return 0===this.high&&0===this.low},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return!(1&~this.low)},C.isEven=function(){return!(1&this.low)},C.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.lessThan=function(e){return this.comp(e)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(e){if(t(e)||(e=o(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},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(f)},C.neg=C.negate,C.add=function(e){var n,i,s,a,u,c,l,h,d,p,g;return t(e)||(e=o(e)),n=this.high>>>16,i=65535&this.high,s=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=s+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},C.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){var n,s,a,u,c,l,h,d,_,f,E,T;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(R)?e.isOdd()?R:g:e.eq(R)?this.isOdd()?R:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,_=0,f=0,E=0,T=0,E+=(T+=u*(d=65535&e.low))>>>16,f+=(E+=a*d)>>>16,E&=65535,f+=(E+=u*h)>>>16,_+=(f+=s*d)>>>16,f&=65535,_+=(f+=a*h)>>>16,f&=65535,_+=(f+=u*l)>>>16,_+=n*d+s*h+a*l+u*c,r((E&=65535)<<16|(T&=65535),(_&=65535)<<16|(f&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,r,s,a,u,l,h;if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?_:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return E;s=_}else{if(this.eq(R))return e.eq(f)||e.eq(T)?R:e.eq(R)?f:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?f:T:(r=this.sub(e.mul(n)),s=n.add(r.div(e)));if(e.eq(R))return this.unsigned?_:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=f),s=s.add(l),r=r.sub(h)}return s},C.div=C.divide,C.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.not=function(){return r(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=o(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=o(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=o(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},C.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):r(0,this.low<<e-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.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))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},C.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},C.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]},C.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}(),n=function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function i(e,t,n,i,r){var s,o,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,p=e[t+h];for(h+=d,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+h],h+=d,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)}function r(e,t,n,i,r,s){var o,a,u,c=8*s-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,g=i?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,r),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=g,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;e[n+p]=255&o,p+=g,o/=256,c-=8);e[n+p-g]|=128*_}var s,o,a,u,c,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?o: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,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=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,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(r+=s);if(0===r)return new l(0,n,i);for(c=new l(r,n,i),o=0;a>o;)(s=(u=e[o++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,i){var r,o;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=s.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,o=0;o<e.length;++o)r.view[o]=e[o]}return r},s.writeBitSet=function(e,t){var n,i,r,s,o,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,s=(r=e.length)>>3,o=0,t+=this.writeVarint32(r,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(r>o){for(a=0,n=0;r>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-i},s.readBitSet=function(e){var t,n,i,r,s,o,a,u=void 0===e;for(u&&(e=this.offset),r=(i=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;r--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(i>s)for(a=0,t=this.readByte(e++);i>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.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},s.writeBytes=s.append,s.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},s.writeByte=s.writeInt8,s.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&~(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},s.readByte=s.readInt8,s.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},s.writeUInt8=s.writeUint8,s.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},s.readUInt8=s.readUint8,s.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},s.writeShort=s.writeInt16,s.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&~t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},s.readShort=s.readInt16,s.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},s.writeUInt16=s.writeUint16,s.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},s.readUInt16=s.readUint16,s.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},s.writeInt=s.writeInt32,s.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},s.readInt=s.readInt32,s.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},s.writeUInt32=s.writeUint32,s.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},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var i,r,s,o=void 0===n;if(o&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.readInt64=function(t){var n,i,r,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+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),s&&(this.offset+=8),r},s.readLong=s.readInt64,s.writeUint64=function(t,n){var i,r,s,o=void 0===n;if(o&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.readUint64=function(t){var n,i,r,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+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),s&&(this.offset+=8),r},s.readUInt64=s.readUint64),s.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},s.writeFloat=s.writeFloat32,s.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},s.readFloat=s.readFloat32,s.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},s.writeDouble=s.writeFloat64,s.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},s.readDouble=s.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 e>>>1^-(1&e)},s.writeVarint32=function(e,t){var n,i,r,s=void 0===t;if(s&&(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,s?(this.offset=t,this):i},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.readVarint32=function(e){var t,n,i,r,s=void 0===e;if(s&&(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(128&t);return i|=0,s?(this.offset=e,i):{value:i,length:n}},s.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()},s.writeVarint64=function(t,n){var i,r,s,o,a,u=void 0===n;if(u&&(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,s=t.shiftRightUnsigned(28).toInt()>>>0,o=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&o>>>7;case 9:this.view[n+8]=9!==i?128|o:127&o;case 8:this.view[n+7]=8!==i?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==i?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==i?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==i?128|s:127&s;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 u?(this.offset+=i,this):i},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,i,r,s,o,a,u=void 0===t;if(u&&(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,s=0,o=0,i=127&(o=this.view[t++]),128&o&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(r=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.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}),s.writeCString=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=r+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):r},s.readCString=function(e){var t,i,r,s=void 0===e;if(s&&(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,c.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),s?(this.offset=e,i()):{string:i(),length:e-t}},s.writeIString=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s: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,c.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 o?(this.offset=n,this):n-r},s.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",s.writeUTF8String=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-r},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,s.readUTF8String=function(e,t,i){var r,s,o,a,u;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(o=0,a=i,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return r?(this.offset=i,s()):{string:s(),length:i-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(u=i+e,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),s=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return r?(this.offset=i,s()):{string:s(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var i,r,s,o,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(s=n,i=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+i,n+=this.writeVarint32(i,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-s},s.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}},s.append=function(e,t,n){var i,r,s;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)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.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},s.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=o,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)},s.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},s.copyTo=function(e,t,n,i){var r,s,o;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=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===(o=i-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.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},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.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},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var i,r,s,o,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||((s=r-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=o,this.view=a,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):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},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.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<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},s.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},s.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},s.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},s.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?o:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},s.toArrayBuffer=s.toBuffer,s.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)}},u=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,s,o;null!==(i=e());)if(void 0===(s=r[i])&&n(i),null!==(i=e())&&(void 0===(o=r[i])&&n(i),t(s<<2>>>0|(48&o)>>4),null!==(i=e()))){if(void 0===(s=r[i])){if(61===i)break;n(i)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(i=e())){if(void 0===(o=r[i])){if(61===i)break;n(i)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.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 u.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 u.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()},s.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,s=new l(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);s.view[i++]=n}return s.limit=r,s},s.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",s="",o="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";o+=r+s+"\n",r=s=""}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+=" ";o+=r+s+"\n"}return e?o:r},l.fromDebug=function(e,t,n){for(var i,r,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,d=!1,p=!1,g=!1;s>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}o.limit=u,c=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!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");o.view[u++]=r,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var 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,s,o,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,s=new l(0|r/2,t),o=0,a=0;r>o;o+=2){if(i=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=i}return s.limit=a,s},c=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,s,o=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(128&n)if(192==(224&n))null===(i=e())&&o([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&o([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===(s=e()))&&o([n,i,r,s]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&s)}else t(n)},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}(),s.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{c.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(c.calculateUTF16asUTF8(t(e),!0)[1],n,i),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){r.view[s++]=e})),r.limit=s,r},l}(t),i=function(t,n){var i,r,s={};return s.ByteBuffer=t,s.c=t,i=t,s.Long=n||null,s.VERSION="5.0.1",s.WIRE_TYPES={},s.WIRE_TYPES.VARINT=0,s.WIRE_TYPES.BITS64=1,s.WIRE_TYPES.LDELIM=2,s.WIRE_TYPES.STARTGROUP=3,s.WIRE_TYPES.ENDGROUP=4,s.WIRE_TYPES.BITS32=5,s.PACKABLE_WIRE_TYPES=[s.WIRE_TYPES.VARINT,s.WIRE_TYPES.BITS64,s.WIRE_TYPES.BITS32],s.TYPES={int32:{name:"int32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},uint64:{name:"uint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.UZERO:void 0},sint64:{name:"sint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},bool:{name:"bool",wireType:s.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:s.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:s.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.ZERO:void 0},float:{name:"float",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:s.WIRE_TYPES.STARTGROUP,defaultValue:null}},s.MAP_KEY_TYPES=[s.TYPES.int32,s.TYPES.sint32,s.TYPES.sfixed32,s.TYPES.uint32,s.TYPES.fixed32,s.TYPES.int64,s.TYPES.sint64,s.TYPES.sfixed64,s.TYPES.uint64,s.TYPES.fixed64,s.TYPES.bool,s.TYPES.string,s.TYPES.bytes],s.ID_MIN=1,s.ID_MAX=536870911,s.convertFieldsToCamelCase=!1,s.populateAccessors=!0,s.populateDefaults=!0,s.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.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<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var i=e.XHR();if(i.open("GET",t,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),s.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,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},s.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 s,o,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._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]},c.next=function(){var e,n,i,r,s;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<this.source.length&&!t.DELIM.test(this.source.charAt(r));)++r;return('"'===(s=this.source.substring(this.index,this.index=r))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,s=function(e){this.tn=new u(e),this.proto3=!1},(o=s.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},o._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return i(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},o._parseOption=function(e,n){var i,r=this.tn.next(),s=!1;if("("===r&&(s=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,s&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,i),n||this.tn.skip(";")},o._parseOptionValue=function(e,n){var i=this.tn.peek();if("{"!==i)r(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!t.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(e.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(e,n+"."+i)}},o._parseService=function(e){var n,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},o._parseServiceRPC=function(e){var n,i,r="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(i.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(i.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(i.response_stream=!0,s=this.tn.next()),i.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][n]=i},o._parseMessage=function(e,i){var r=!!i,s=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(r?"group":"message")+" name: "+s);for(o.name=s,r&&(this.tn.skip("="),i.id=n(this.tn.next()),o.isGroup=!0),"["===(s=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(o,s);else if("oneof"===s)this._parseMessageOneOf(o);else if("enum"===s)this._parseEnum(o);else if("message"===s)this._parseMessage(o);else if("option"===s)this._parseOption(o);else if("service"===s)this._parseService(o);else if("extensions"===s)o.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(o);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(o,"optional",s)}return this.tn.omit(";"),e.messages.push(o),o},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,r){var s,o,a;if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);if(s={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.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(s.type=r,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._parseMessageOneOf=function(e){var n,i,r,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(i=s,r=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var i,r={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(r.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(r);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),i={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},o._parseExtensionRanges=function(){var t,n,r,s=[];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()}s.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),s},o._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},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(s,s.Lang),s.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(),s=7&i,o=i>>>3;switch(s){case e.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(!(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(o,n);break;case e.WIRE_TYPES.ENDGROUP:if(o===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+s)}return!0}var s,o,a,u,c,l,h,d,p,g,_,f,E,T,I,v,R={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},S=C.prototype;return S.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},S.toString=function(e){return(e?this.className+" ":"")+this.fqn()},S.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=C,s=function(e,t,n,i,r){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(o=s.prototype=Object.create(C.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},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.getChild=function(e){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},o.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,s=0;if(""===i[s]){for(;null!==r.parent;)r=r.parent;s++}do{do{if(!(r instanceof R.Namespace)){r=null;break}if(!((n=r.getChild(i[s]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){r=null;break}r=n,s++}while(s<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},o.qn=function(e){var t,n,i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(t=1;t<=i.length;t++)if(n=i.slice(i.length-t),e===this.resolve(n,e instanceof R.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,i={},r=this.children;for(t=0,n=r.length;n>t;++t)(e=r[t])instanceof s&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},o.buildOpt=function(){var e,t,n,i,r={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],i=this.options[s[e]],r[n]=i;return r},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=s,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)},u=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},u.verifyValue=function(i){var r,s,o,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(e){a(typeof i,e.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(e){a(typeof i,e.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),o=0;o<r.length;o++){if(r[o].name==i)return r[o].id;if(r[o].id==i)return r[o].id}if("proto3"===this.syntax)return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),(i>4294967295||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(o in s={},i)i.hasOwnProperty(o)&&(s[o]=i[o]);i=s}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},u.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)")},u.encodeValue=function(t,n,r){var s,o;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");s=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=s;break;case e.TYPES.message:o=(new i).LE(),this.resolvedType.encode(n,o),r.writeVarint32(o.offset),r.append(o.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},u.decode=function(t,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,s;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(s=t.readVarint32(),t.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+t.remaining());return(r=t.clone()).limit=r.offset+s,t.offset+=s,r;case e.TYPES.message:return s=t.readVarint32(),this.resolvedType.decode(t,s);case e.TYPES.group:return this.resolvedType.decode(t,-1,i)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},R.Element=a,c=function(e,t,n,i,r,o){s.call(this,e,t,n,i,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(s.prototype)).build=function(n){var r,s,o,a;if(this.clazz&&!n)return this.clazz;for(r=function(e,n){function r(t,n,s,o){var a,u,c,l,h,d,p;if(null===t||"object"!=typeof t)return o&&o instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(o.object,t))?a:t;if(i.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return s?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=r(e,n,s,o)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=r(l.value[1],n,s,t.valueElem.resolvedType);return u}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(u[p]=h&&(d=h.getChild(p))?r(t[p],n,s,d.resolvedType):r(t[p],n,s));return u}var s,o,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var r,s,o,l;for(e.Builder.Message.call(this),r=0,s=u.length;s>r;++r)this[u[r].name]=null;for(r=0,s=a.length;s>r;++r)this[(o=a[r]).name]=o.repeated?[]:o.map?new e.Map(o):null,!o.required&&"proto3"!==n.syntax||null===o.defaultValue||(this[o.name]=o.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof c)||Array.isArray(t)||t instanceof e.Map||i.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(r=0,s=arguments.length;s>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,i,r){var s=n._fieldsByName[t];if(!r){if(!s)throw Error(this+"#"+t+" is undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+t+" is not a repeated field");i=s.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 s,o,a;if(t&&"object"==typeof t){for(s in r=i,t)t.hasOwnProperty(s)&&void 0!==(i=t[s])&&this.$set(s,i,r);return this}if(o=n._fieldsByName[t],r)this[t]=i;else{if(!o)throw Error(this+"#"+t+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));this[o.name]=i=o.verifyValue(i)}return o&&o.oneof&&(a=this[o.oneof.name],null!==i?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===t&&(this[o.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,s=0;s<a.length;s++)(o=a[s])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,i,r,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),i=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},r=function(){return this[e.name]},null===n.getChild("set"+s)&&(l["set"+s]=i),null===n.getChild("set_"+t)&&(l["set_"+t]=i),null===n.getChild("get"+s)&&(l["get"+s]=r),null===n.getChild("get_"+t)&&(l["get_"+t]=r)}(o);return l.encode=function(e,i){var r,s;"boolean"==typeof e&&(i=e,e=void 0),r=!1,e||(e=new t,r=!0),s=e.littleEndian;try{return n.encode(this,e.LE(),i),(r?e.flip():e).LE(s)}catch(t){throw e.LE(s),t}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,r=!1;return e||(e=new i,r=!0),t=(new i).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},c.decode=function(e,t){var r,s;"string"==typeof e&&(e=i.wrap(e,t||"base64")),r=(e=i.isByteBuffer(e)?e:i.wrap(e)).littleEndian;try{return s=n.decode(e.LE()),e.LE(r),s}catch(t){throw e.LE(r),t}},c.decodeDelimited=function(e,t){var r,s,o;if("string"==typeof e&&(e=i.wrap(e,t||"base64")),(e=i.isByteBuffer(e)?e:i.wrap(e)).remaining()<1)return null;if(r=e.offset,s=e.readVarint32(),e.remaining()<s)return e.offset=r,null;try{return o=n.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof _||s instanceof c||s instanceof T){if(r.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");r[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,s,o,a,u=null;for(s=0,o=this._fields.length;o>s;++s)r=e[(i=this._fields[s]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,i=0,r=0,s=this._fields.length;s>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 s,o,a,u,c,l,h,d,p,g,_,f;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(s=t.readVarint32())>>>3,(o=7&s)===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(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,t)):u.map?(d=u.decode(o,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(o,t),u.oneof&&(null!==(p=l[u.oneof.name])&&p!==u.name&&(l[p]=null),l[u.oneof.name]=u.name));else switch(o){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: "+o)}}for(g=0,_=this._fields.length;_>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(f=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,f;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=c,h=function(t,n,i,r,s,o,a,u,l,h){C.call(this,t,n,o),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=s,this.resolvedType=null,this.id=a,this.options=u||{},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 c.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(C.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,s;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]),s=[],r=0;r<t.length;r++)s.push(this.element.verifyValue(t[r]));return s}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||i(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&i(typeof t,"no array expected"),this.element.verifyValue(t))},d.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},d.encode=function(t,n,r){var s,o,a,u,c;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),o=n.offset,s=0;s<t.length;s++)this.element.encodeValue(this.id,t[s],n);a=n.offset-o,(u=i.calculateVarint32(a))>1&&(c=n.slice(o,n.offset),o+=u-1,n.offset=o,n.append(c)),n.writeVarint32(a,o-u)}else for(s=0;s<t.length;s++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[s],n);else this.map?t.forEach((function(t,r){var s=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(s),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var r,s,o;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,s=0;s<t.length;s++)o+=this.element.calculateLength(this.id,t[s]);r+=i.calculateVarint32(o),r+=o}else for(s=0;s<t.length;s++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t[s]);else this.map?t.forEach((function(t,n){var s=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(s),r+=s}),this):this.hasWirePresence(t,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},d.decode=function(t,n,i){var r,s,o,u,c,l,h;if(!(!this.map&&t==this.type.wireType||!i&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!i){for(s=n.readVarint32(),s=n.offset+s,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),s=n.readVarint32(),n.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,t,h)}return[u,r]}return this.element.decode(n,t,this.id)},R.Message.Field=h,p=function(e,t,n,i,r,s,o){h.call(this,e,t,n,null,i,r,s,o),this.extension},p.prototype=Object.create(h.prototype),R.Message.ExtensionField=p,g=function(e,t,n){C.call(this,e,t,n),this.fields=[]},R.Message.OneOf=g,_=function(e,t,n,i,r){s.call(this,e,t,n,i,r),this.className="Enum",this.object=null},_.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(_.prototype=Object.create(s.prototype)).build=function(t){var n,i,r,s;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,r=0,s=(i=this.getChildren(_.Value)).length;s>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=_,f=function(e,t,n,i){C.call(this,e,t,n),this.className="Enum.Value",this.id=i},f.prototype=Object.create(C.prototype),R.Enum.Value=f,E=function(e,t,n,i){C.call(this,e,t,n),this.field=i},E.prototype=Object.create(C.prototype),R.Extension=E,T=function(e,t,n,i){s.call(this,e,t,n,i),this.className="Service",this.clazz=null},(T.prototype=Object.create(s.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)}},s=r.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<o.length;n++)!function(e){s[e.name]=function(n,r){try{try{n=e.resolvedRequestType.clazz.decode(i.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,i){if(!n){try{i=e.resolvedResponseType.clazz.decode(i)}catch(e){}return i&&i instanceof e.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+t.name+"#"+e.name))}r(n)}))}catch(e){setTimeout(r.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:r[e.name].$options}))}(o[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),r}(e,this)},R.Service=T,I=function(e,t,n,i){C.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(I.prototype=Object.create(C.prototype)).buildOpt=o.buildOpt,R.Service.Method=I,v=function(e,t,n,i,r,s,o,a){I.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=s,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null},v.prototype=Object.create(I.prototype),R.Service.RPCMethod=v,R}(s),s.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var r=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},s=r.prototype;return r.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},s.create=function(t){var i,s,o,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(s=t.shift(),r.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){i.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(r.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(r.isService(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!r.isExtend(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.fields.forEach((function(t){var i,r,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(i=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var r,s,o,a,u,c,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="\\"),s=r+d+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),d="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(i=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},s.build=function(e){var t,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,i=0;i<t.length;i++){if(!n[t[i]]){n=null;break}n=n[t[i]]}return n},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(s,s.Lang,s.Reflect),s.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var i=function(e,n){var i,r,s,o;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)s=this.keyElem.valueFromString(i[r]),o=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(s)]={key:s,value:o}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},r.entries=function(){var e,t,i=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)i.push([(e=this.map[r[t]]).key,e.value]);return n(i)},r.keys=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].key);return n(t)},r.values=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].value);return n(t)},r.forEach=function(e,t){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},r.set=function(e,t){var n=this.keyElem.verifyValue(e),i=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,s.Reflect),s.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),s.loadJson(s.DotProto.Parser.parse(e),t,n)},s.protoFromString=s.loadProto,s.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,s.loadProto(i,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:s.loadProto(i,n,e)},s.protoFromFile=s.loadProtoFile,s.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=s.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=s.populateAccessors),new s.Builder(e)},s.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=s.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},s.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,s.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:s.loadJson(JSON.parse(i),n,e)},r=e,s.loadProto(r,void 0,"").build("Modules").probuf}(n,t);return i}var li,hi,di=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=ci(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var i=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&i["set"+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()}))}(e,0,1)](n)}))}catch(t){var r="pbname: "+e+", stack: "+t.stack;this.logger?this.logger.error(fe.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(fe.L_PB_ENCODE_E,r)}return n?i:i.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!Tt(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{"+n.length+"}$"),n),16)}for(var i in e)e[i]=this.fixInt64Values(e[i]);return e},e}();!function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA"}(hi||(hi={}));var pi=((li={})[hi.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},li[hi.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1saWdodC1lZGdlLmNvbQ==",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},li[hi.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi51cy1saWdodC1lZGdlLmNvbQ==",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},li[hi.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},li[hi.SA]={naviUrlBase64:["bmF2LnNhdS1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zYXUtbGlnaHQtZWRnZS5jb20=",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2F1LWxpZ2h0LWVkZ2UuY29t","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNhdS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},li);function gi(e){return hi[e]?e:hi.BJ}var _i,fi,Ei,Ti,Ii,vi,Ri,Ci=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e,t){var n,i=this.initOption||{},r=i.areaCode,s=i.navigators,o=(n=r,void 0===n&&(n=hi.BJ),pi[gi(n)].naviUrlBase64).map((function(e){return en(e)})),a=[],u=e.split("@")[1];t&&(a=u?u.split(";"):[]);var c=s&&s.length>0?h(h([],a,!0),s,!0):h(h([],a,!0),o,!0);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return En(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,i=e||{},r=i.log,s=i.logPolicy,o=this.initOption||{},a=o.areaCode,c=o.logServerUrl,l=(n=a,void 0===n&&(n=hi.BJ),pi[gi(n)].logUrlBase64).map((function(e){return u(u({},e),{addr:en(e.addr)})})),d=[],p={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(p,r.policy);else if(s)try{var g=JSON.parse(s);d.push({addr:g.url,protocol:De.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){t.warn(fe.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var _=c?h([{addr:c,protocol:De.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,addrs:_.filter((function(e,t){return _.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return u(u({},e),{addr:En(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=hi.BJ),pi[gi(t)].miniCmpBase64).map((function(e){return en(e)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},e.prototype.getStaticConfigUrl=function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=hi.BJ),pi[gi(t)].staticConfigUrlBase64).map((function(e){return en(e)}))},e.prototype.getCloudControllerUrl=function(e){var t,n,i=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(n=i,void 0===n&&(n=hi.BJ),pi[gi(n)].cloudControllerUrlBase64).map((function(e){return en(e)}))},e.prototype.getAreaCode=function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:hi.BJ},e.prototype.setAreaCode=function(e){return!(!e||!hi[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e}(),Si=new Ci,mi=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:if(!(t=this.getCache()))return[3,6];c.label=1;case 1:return c.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<q?[4,this.decryptData(n.val)]:[3,3];case 2:return i=c.sent(),(r=i.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:r.map((function(e){return En(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return s=c.sent(),this.logger.error(fe.L_GET_STATIC_CONF_E,JSON.stringify({error:null==s?void 0:s.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(o=c.sent())?[4,this.decryptData(o)]:[2];case 8:return(null==(a=c.sent())?void 0:a.areaCode)!==Si.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:o})),this.staticUrls=(null==a?void 0:a.bootstrap)||[],(u=null===(e=null==a?void 0:a.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:u.map((function(e){return En(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:e=(e=h(h([],this.staticUrls,!0),Si.getStaticConfigUrl(),!0).map((function(e){return En(e)}))).filter((function(t,n){return e.indexOf(t)===n})),t=0,n=e,u.label=1;case 1:return t<n.length?(i=n[t],this.logger.info(fe.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest(i+"/"+this.appkey)]):[3,4];case 2:if(s=u.sent(),o=s.code,a=s.data,200===o)return this.logger.info(fe.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:o,duration:Date.now()-r})),[2,a];this.logger.warn(fe.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:o,duration:Date.now()-r})),u.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},e}(),yi={"set.proxy":$.INVALID_PARAMETER_PROXY,"test.proxy":$.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":$.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":$.INVALID_PARAMETER_TESTHOST,channelId:$.INVALID_PARAMETER_CHANNEL_ID,count:$.INVALID_PARAMETER_COUNT,startTime:$.INVALID_PARAMETER_START_TIME,endTime:$.INVALID_PARAMETER_END_TIME,offset:$.INVALID_PARAMETER_OFFSET,limit:$.INVALID_PARAMETER_LIMIT,keyword:$.INVALID_PARAMETER_KEYWORD,messageTypes:$.INVALID_PARAMETER_MESSAGE_TYPE,messageType:$.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:$.INVALID_PARAMETER_MESSAGE_TYPE,conversation:$.INVALID_PARAMETER_CONVERSATION_TYPE,conversationType:$.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:$.INVALID_PARAMETER_TARGET_ID,targetIds:$.INVALID_PARAMETER_TARGET_ID,userId:$.INVALID_PARAMETER_USER_ID,senderUserId:$.INVALID_PARAMETER_USER_ID,timestamp:$.INVALID_PARAMETER_TIMESTAMP,order:$.INVALID_PARAMETER_ORDER,messageId:$.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:$.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:$.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:$.INVALID_PARAMETER_SENT_STATUS,content:$.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:$.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:$.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:$.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:$.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:$.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:$.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:$.MSG_LIMIT_ERROR,checkDuplicate:$.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:$.INVALID_PARAMETER_MESSAGE_UID,key:$.INVALID_PARAMETER_KEY,keys:$.INVALID_PARAMETER_KEYS,value:$.INVALID_PARAMETER_VALUE,isAutoDelete:$.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:$.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:$.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:$.INVALID_PARAMETER_ENTRIES,isForce:$.INVALID_PARAMETER_IS_FORCE,rtcRoomId:$.INVALID_PARAMETER_RTCROOMID,token:$.RC_CONN_TOKEN_INCORRECT,conversations:$.INVALID_PARAMETER_CONVERSATIONS,draft:$.INVALID_PARAMETER_DRAFT,conversationTypes:$.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:$.INVALID_PARAMETER_IS_TOP,isUpdateTime:$.INVALID_PARAMETER_IS_UPDATE_TIME,message:$.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:$.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:$.INVALID_PARAMETER_USERIDLIST,directedUserIds:$.INVALID_PARAMETER_USERIDLIST,isStatusMessage:$.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:$.INVALID_PARAMETER_PUSH_CONTENT,pushData:$.INVALID_PARAMETER_PUSH_DATA,isMentioned:$.INVALID_PARAMETER_IS_MENTIONED,mentionedType:$.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:$.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:$.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:$.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:$.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:$.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:$.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:$.SEARCH_PROPS_LIMIT_ERROR,tagId:$.INVALID_PARAMETER_TAG_ID,tagIds:$.INVALID_PARAMETER_TAG_ID,tagName:$.INVALID_PARAMETER_TAG_NAME,containMuted:$.INVALID_PARAMETER_CONTAIN_MUTED,channelType:$.INVALID_PARAMETER_CHANNEL_TYPE,file:$.MEDIA_EXCEPTION,fileType:$.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:$.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:$.INVALID_PARAMETER_MEDIA_URL,filename:$.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:$.INVALID_PARAMETER_SAVE_NAME,serverType:$.INVALID_PARAMETER_SERVER_TYPE,subscribeType:$.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:$.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:$.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:$.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:$.INVALID_PARAMETER_BEFORE,afterCount:$.INVALID_PARAMETER_AFTER},Ai=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return this._context.createCodec(e,t)},e.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.9.8"},e.prototype.getAPIVersion=function(){return"5.9.8"},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.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e.prototype.createStatisticLogger=function(e,t){return this._context.createStatisticLogger(e,t)},e}(),Ni="pgMsgP",Oi="chatMsg",Mi="pcMsgP",Li="pbMsgP",Ui={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},bi="delMsg",Pi="delUgMsg",Di="joinChrm",wi="joinChrmR",Vi="exitChrm",Gi="setKV",Bi="delKV",ki="setKVS",xi="delKVS",Fi="qryRelationR",Hi="delRelation",Yi="delRelationBatch",qi="setSeAtt",Ki={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg",APP_PUBLIC_SERVICE:"cleanMCMsg",PUBLIC_SERVICE:"cleanMPMsg"},ji="cleanMsgBatch",Qi="reqCall",Wi="pullKvMsg",Ji="qryPMsg",Xi="qryGMsg",Zi="qryCHMsg",zi="qryCMsg",$i="qrySMsg",er="qryMCMsg",tr="qryMPMsg",nr=((_i={})["ppMsgP"]=te.PRIVATE,_i[Ni]=te.GROUP,_i[Oi]=te.CHATROOM,_i[Mi]=te.CUSTOMER_SERVICE,_i[Li]=te.SYSTEM,_i),ir=((fi={})[te.PRIVATE]=Ji,fi[te.GROUP]=Xi,fi[te.CHATROOM]=Zi,fi[te.CUSTOMER_SERVICE]=zi,fi[te.SYSTEM]=$i,fi[te.APP_PUBLIC_SERVICE]=er,fi[te.PUBLIC_SERVICE]=tr,fi),rr=((Ei={})[te.PRIVATE]=Ki.PRIVATE,Ei[te.GROUP]=Ki.GROUP,Ei[te.ULTRA_GROUP]=Ki.ULTRA_GROUP,Ei[te.CUSTOMER_SERVICE]=Ki.CUSTOMER_SERVICE,Ei[te.SYSTEM]=Ki.SYSTEM,Ei[te.APP_PUBLIC_SERVICE]=Ki.APP_PUBLIC_SERVICE,Ei[te.PUBLIC_SERVICE]=Ki.PUBLIC_SERVICE,Ei),sr="1",or="0",ar=1,ur=2,cr=3;!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(Ti||(Ti={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Ii||(Ii={})),function(e){e.PUB="pub",e.QUERY="qry"}(vi||(vi={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Ri||(Ri={}));var lr,hr=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=Ti.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Ti.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,e&&e>0&&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&~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}(),dr=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),i=n.back,r=n.byteSize,s=0,o=i.length;s<o;s++)i[s]>255&&(i[s]&=255);return t?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},e._getBackAndByteSize=function(e){var t=[],n=0;if(ut(e))for(var i=0,r=e.length;i<r;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(n+=1,t.push(s)):s>=128&&s<=2047?(n+=2,t.push(192|31&s>>6),t.push(128|63&s)):s>=2048&&s<=65535&&(n+=3,t.push(224|15&s>>12),t.push(128|63&s>>6),t.push(128|63&s))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,i=[],r=-1,s=e,o="";++r<s.length;){var a=Number(s[r]);if(a===(127&a)||(240&~a?224&~a?192&~a||(a=(a^=192)<<6|128^s[++r]):a=(a=(a^=224)<<6|128^s[++r])<<6|128^s[++r]:a=(a=(a=(a^=240)<<6|128^s[++r])<<6|128^s[++r])<<6|128^s[++r]),!Number.isFinite(a)||a<0||a>1114111||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===s.length||i.length>16384)&&(o+=String.fromCharCode.apply(null,i),i.length=0)}return o},e}(),pr=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._position;this._position+=e;var n=this._pool.subarray(t,this._position);return dr.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),gr=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=dr.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),_r=function(e,t){return e&&t?t+"_"+e:e||Date.now()},fr=function(){function e(e){this.header=e,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return _r(e,t)},e.prototype.read=function(e,t,n,i){this.readMessage(e,t,n,i)},e.prototype.readMessage=function(e,t,n,i){return{stream:t,length:n}},e}(),Er=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new hr(e,!1,Ti.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return _r(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 gr;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),Tr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=null,t.userId=null,t.timestamp=0,t}return a(t,e),t.prototype.readMessage=function(e,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=t.MESSAGE_LENGTH)return{stream:n,length:i};if(r===Ri.V4){var s=n.readByte();1&s&&(this.userId=n.readUTF()),2&s&&n.readUTF(),4&s&&(this.timestamp=n.readLong()),8&s&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var o=n.readUTF();e.debug(fe.O,"server sessionId -> "+o),this.timestamp=n.readLong()}return{stream:n,length:i}},t.MESSAGE_LENGTH=2,t}(fr),Ir=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){return t.readByte(),this.status=+t.readByte(),{stream:t,length:n}},t.MESSAGE_LENGTH=2,t}(fr),vr=function(e){function t(){return e.call(this,Ii.PING_REQ)||this}return a(t,e),t.prototype.writeMessage=function(e){},t}(Er),Rr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t}(fr),Cr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){var i=256*t.readByte()+t.readByte();return this.messageId=parseInt(i.toString(),10),{stream:t,length:n}},t}(fr),Sr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(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}(Er),mr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=vi.PUB,t}return a(t,e),t.prototype.readMessage=function(t,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,i),this.data=n.readAll(),{stream:n,length:i}},t}(Cr),yr=function(e){function t(t,n,i){var r=e.call(this,Ii.PUBLISH)||this;return r.syncMsg=!1,r.identifier=vi.PUB,r.topic=t,r.data=ut(n)?dr.writeUTF(n):n,r.targetId=i,r}return a(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}(Sr),Ar=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=vi.PUB,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.millisecond=256*n.readByte()+n.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=n.readUTF(),{stream:n,length:i}},t}(Cr),Nr=function(e){function t(t){var n=e.call(this,Ii.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return a(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(Sr),Or=function(e){function t(t,n,i){var r=e.call(this,Ii.QUERY)||this;return r.identifier=vi.QUERY,r.topic=t,r.data=ut(n)?dr.writeUTF(n):n,r.targetId=i,r}return a(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}(Sr),Mr=function(e){function t(t){var n=e.call(this,Ii.QUERY_CONFIRM)||this;return n.messageId=t,n}return a(t,e),t}(Sr),Lr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=vi.QUERY,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},t}(Cr),Ur=function(e,t,n){var i=new Uint8Array(t),r=new pr(i),s=r.readByte(),o=function(e,t){var n,i=e.type;switch(i){case Ii.CONN_ACK:n=new Tr(e);break;case Ii.PUBLISH:(n=new mr(e)).syncMsg=e.syncMsg;break;case Ii.PUB_ACK:n=new Ar(e);break;case Ii.QUERY_ACK:n=new Lr(e);break;case Ii.SUB_ACK:case Ii.UNSUB_ACK:case Ii.PING_RESP:n=new Rr(e);break;case Ii.DISCONNECT:n=new Ir(e);break;default:n=new fr(e),t.error(fe.O,"No support for deserializing "+i+" messages")}return n}(new hr(s),e);return o.read(e,r,i.length-1,n),o};!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.pbMsgP=14]="pbMsgP",e[e.rrMsg=15]="rrMsg",e[e.rrList=16]="rrList",e[e.s_ntf=17]="s_ntf",e[e.s_msg=18]="s_msg",e[e.s_stat=19]="s_stat",e[e.s_cmd=20]="s_cmd",e[e.s_us=21]="s_us",e[e.pullUS=22]="pullUS",e[e.sendMsgRead=23]="sendMsgRead",e[e.qryMsgRead=24]="qryMsgRead",e[e.qryMsgReadCntBatch=25]="qryMsgReadCntBatch",e[e.updRTime=26]="updRTime",e[e.pgMsgS=27]="pgMsgS",e[e.chatMsgS=28]="chatMsgS",e[e.qrySessionsAtt=29]="qrySessionsAtt",e[e.pullMsg=30]="pullMsg",e[e.qrySessions=31]="qrySessions",e[e.delSessions=32]="delSessions",e[e.delMsg=33]="delMsg",e[e.updRRTime=34]="updRRTime",e[e.chrmPull=35]="chrmPull",e[e.joinChrm=36]="joinChrm",e[e.joinChrmR=37]="joinChrmR",e[e.exitChrm=38]="exitChrm",e[e.queryChrmI=39]="queryChrmI",e[e.setKV=40]="setKV",e[e.delKV=41]="delKV",e[e.pullKV=42]="pullKV",e[e.qryRelation=43]="qryRelation",e[e.delRelation=44]="delRelation",e[e.pullSeAtts=45]="pullSeAtts",e[e.setSeAtt=46]="setSeAtt",e[e.qnTkn=47]="qnTkn",e[e.qnUrl=48]="qnUrl",e[e.aliUrl=49]="aliUrl",e[e.s3Url=50]="s3Url",e[e.stcUrl=51]="stcUrl",e[e.minioUrl=52]="minioUrl",e[e.cleanPMsg=53]="cleanPMsg",e[e.cleanGMsg=54]="cleanGMsg",e[e.cleanCMsg=55]="cleanCMsg",e[e.cleanSMsg=56]="cleanSMsg",e[e.rtcPing=57]="rtcPing",e[e.rtc_ntf=58]="rtc_ntf",e[e.rtcSetOutData=59]="rtcSetOutData",e[e.rtcQryUserOutData=60]="rtcQryUserOutData",e[e.addSeTag=61]="addSeTag",e[e.delSeTag=62]="delSeTag",e[e.addTag=63]="addTag",e[e.delTag=64]="delTag",e[e.disTag=65]="disTag",e[e.reportsdk=66]="reportsdk",e[e.pullUgSes=67]="pullUgSes",e[e.pullUgMsg=68]="pullUgMsg",e[e.ugMsg=69]="ugMsg",e[e.qryUgMsg=70]="qryUgMsg",e[e.updUgRTime=71]="updUgRTime",e[e.upMsgEx=72]="upMsgEx",e[e.modifyMsg=73]="modifyMsg",e[e.qryMsgChange=74]="qryMsgChange",e[e.qryMsg=75]="qryMsg",e[e.operate=76]="operate",e[e.s_opNtf=77]="s_opNtf",e[e.ugUnpushQuery=78]="ugUnpushQuery",e[e.ugUnpushSet=79]="ugUnpushSet",e[e.setRtcRoomId=80]="setRtcRoomId",e[e.qryUgUal=81]="qryUgUal",e[e.s_pubCall=82]="s_pubCall",e[e.updUserSub=83]="updUserSub",e[e.pullUserSub=84]="pullUserSub",e[e.pullSubData=85]="pullSubData",e[e.qrySubData=86]="qrySubData"}(lr||(lr={}));var br=lr,Pr=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},this._users[e]},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=Q.INBOX_TIME_KEY(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=Q.INBOX_TIME_KEY(this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||vt(e))){n.broadcastSyncTime=e;var i=Q.BROADCASTBOX_TIME_KEY(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=Q.BROADCASTBOX_TIME_KEY(this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var i=Q.OUTBOX_TIME_KEY(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=Q.OUTBOX_TIME_KEY(this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),Dr={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},wr=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}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,s=e.userId,o=this._getSetUserId(n),a=i===Ie.DELETE,u=o===s,c=!this._isExisted(n),l=a?this._remove:this._add;(t||r||u||c)&&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)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),Vr=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o;return l(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=Dr.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),s=r.code,o=r.data,this._isPulling=!1,s===$.SUCCESS?(Dr.set(t,o.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Dr.clear(e);var t=this._storeCaches[e];null==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];St(i)||(i=new wr(this._engine.getInnerLogger(),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}(),Gr=function(){function e(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t},e.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e]},e.prototype.clear=function(){this._joinedChrmsInfo={}},e}(),Br=function(){function e(){this._callerQueue=[],this._isCalling=!1,this._retryCount=0}return e.prototype.pushTask=function(e){var t=this;return new Promise((function(n){t._callerQueue.push({task:e,resolve:n}),t._startCall()}))},e.prototype._startCall=function(){return c(this,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return this._isCalling||0===this._callerQueue.length?[2]:(this._isCalling=!0,e=this._callerQueue.shift(),[4,this._callHandler(e)]);case 1:return t=n.sent(),e.resolve(t),this._isCalling=!1,this._startCall(),[2]}}))}))},e.prototype._callHandler=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.task,n=this.getVersion(),[4,t(n)];case 1:return(i=r.sent()).code===$.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return r.sent(),[2,this._callHandler(e)];case 3:return this._retryCount=0,[2,i]}}))}))},e.prototype.stopAllTask=function(){this._callerQueue.forEach((function(e){e.resolve({code:$.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},e}(),kr="converStatusChanged",xr=function(e){function t(t,n,r){var o=e.call(this)||this;return o._eventEmitter=new Ut,o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storagePullTimeKey="con-s-"+n+"-"+r,o._oldStorage=i(t.runtime),o._storage=new s(t.runtime,Q.CONVER_STATE_PULL_TIME_KEY(n,r)),o._appkey=n,o._currentUserId=r,o._engine=t,o.adaptOldStatus(),o}return a(t,e),t.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){this._engine.getInnerLogger().error(fe.A_CALLBACK_E,"adaptOldStatus error: "+e.message)}},t.prototype._set=function(e){var t=this;if(!vt(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(kr,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(e){return e>n}))}},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullConversationStatus(e),[4,this._pullPromise]);case 1:return t=r.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n===$.SUCCESS&&this._set(i),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},t.prototype._startCall=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pull=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.watch=function(e){this._eventEmitter.on(kr,(function(t){e(t)}))},t.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},t.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(Br),Fr={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},fut:{keyName:"firstUnreadTime",defaultVal:0},fuid:{keyName:"firstUnreadMessageUid",defaultVal:""},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},Hr={};for(var Yr in Fr){var qr=Fr[Yr].keyName;Hr[qr]=Yr}var Kr,jr=function(){function e(e,t,n,i){this._appkey=t,this._currentUserId=n,this.logger=i,this.storage=new s(e,Q.OLD_CONVER_STATE_KEY(t,n)),this._localStore=new s(e,Q.CONVER_STATE_KEY(t,n))}return e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+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:te.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var i=this,r=e.conversationType,s=e.messageType,o=e.isMentioned,a=e.senderUserId;o&&r===te.GROUP&&((n.userIdList||[]).forEach((function(e){e===i._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===he.ALL&&t.indexOf(a)<0&&t.push(a));if(s===se.RECALL&&r===te.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,i=e.content,r=e.channelId,s=e.senderUserId,o=i.mentionedInfo;if(o&&s!==this._currentUserId){var a=this._getStoreKey(t,n,r),u=this._localStore.get(a)||{},c=Hr.mentionedInfo,l=Hr.hasMentioned,h=u[c]||{},d=h.userIdList||[];o={userIdList:d=this._updateMentionedUserList(e,d,o),type:(null==o?void 0:o.type)||h.type},0!==d.length?(u[c]=o,u[l]=!0):(delete u[c],delete u[l]),St(u)?this._localStore.set(a,u):this._localStore.remove(a)}},e.prototype._setLocal=function(e,t){if("tags"===e)for(var n in t)t[n].isTop||delete t[n].isTop;return t},e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),s=this._localStore.get(r)||{};for(var o in n){var a=Hr[o],u=n[o];if(!vt(a)&&!vt(u)&&"hasMentioned"!==o&&"MentionedInfo"!==o)u===Fr[a].defaultVal||"tags"===o&&!St(u)?delete s[a]:s[a]=this._setLocal(o,u),s.c||(delete s.t,delete s.fut,delete s.fuid,delete s.hm,delete s.m,delete s.mc)}var c=Object.keys(s);1===c.length&&c.includes("st")&&delete s.st,St(s)?this._localStore.set(r,s):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)||{},s={};for(var o in Fr){var a=Fr[o],u=a.keyName,c=a.defaultVal;s[u]=r[o]||Nn(c)}return s},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),s={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},o=t[i];for(var a in o)if(Fr[a]){var u=Fr[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||Nn(l)}s=e?e(s):s,n.push(s)}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,s=i.targetId,o={},a=e[n];for(var c in a){var l=Fr[c],h=l.keyName,d=l.defaultVal;o[h]=a[c]||Nn(d)}for(var p in o.tags){vt(t[p])&&(t[p]=[]);var g=u(u({},o),{conversationType:r,targetId:s});delete g.tags,t[p].push(g)}}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="_"+t;this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(fe.O,"adaptOldStore error: "+e.message)}},e.prototype.remove=function(e,t,n){var i=this._getStoreKey(e,t,n);this._localStore.remove(i)},e}(),Qr=[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE],Wr="conversationChanged",Jr="conTagStatusChanged",Xr=function(){function e(e,t,n,i,r){var s=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Ut,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new jr(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new xr(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(Wr,(function(e){i(e)})),this._eventEmitter.on(Jr,(function(){r()}));var o=this._store.getValue();o.length>1e3&&(o=o.sort((function(e,t){var n=e.lastMessageSentTime,i=void 0===n?0:n,r=t.lastMessageSentTime;return(void 0===r?0:r)-i})),o.splice(1e3,o.length).forEach((function(e){s._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,i){var r=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===i.sentTime})),s=t>=i.sentTime;return n&&(s=n<i.sentTime),{isNotRead:s,isNotRepeadRecallSendTime:r}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=e.messageUId,c=o===Z.SEND&&a===this._loginUserId,l=i===se.RECALL,h=Tt(n),d=!1,p={},g=t.lastUnreadTime,_=t.lastReadTime,f=t.unreadMessageCount;if(g>r||c)return{hasChanged:d,localConversation:t,updateItems:p};if(s&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=u,t.firstUnreadTime=r),t.unreadMessageCount=f+1,t.lastUnreadTime=r,d=!0),l&&h){var E=this._handleRecall2UnreadCount(e,g,_,f,d),T=E.unreadMessageCount,I=E.hasChanged;t.unreadMessageCount=T,d=I,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return d&&(p.unreadMessageCount={val:t.unreadMessageCount||0,time:r}),{hasChanged:d,localConversation:t,updateItems:p}},e.prototype._handleRecall2UnreadCount=function(e,t,n,i,r){var s=e.conversationType+"_"+e.channelId+"_"+e.targetId,o=this._calcMsg(s,t,n,e.content),a=o.isNotRead,u=o.isNotRepeadRecallSendTime;return a&&i&&u?(this._recallMsgTimeMap[s]||(this._recallMsgTimeMap[s]=[]),this._recallMsgTimeMap[s].push(e.content.sentTime),{unreadMessageCount:i-1,hasChanged:!0}):{unreadMessageCount:i,hasChanged:r}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=e.messageDirection,r=e.isMentioned,s=e.sentTime,o=i===Z.SEND,a=Tt(n),u=!1,c={};return!o&&r&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:s},c.mentionedInfo={val:n.mentionedInfo,time:s}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===Z.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var s=n.mentionedInfo,o=s.type,a=s.userIdList;if(o===he.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Tt(e)){var t=e.conversationType,n=e.targetId,i=e.channelId,r=t+"_"+n,s=this._store.get(t,n,i)||{};this._updatedConversations[r]=Object.assign(s,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,i){var r=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var s in r)if(!n[s]||!!r[s].isTop!=!!n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,i=e.targetId,r=e.updatedTime,s=e.notificationStatus,o=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},h={};if(n!==te.ULTRA_GROUP){vt(s)||(h.notificationStatus={time:r,val:s}),vt(o)||(h.notificationLevel={time:r,val:o}),vt(a)||(h.isTop={time:r,val:a}),vt(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,l,c);var d=this._store.get(n,i,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:s,notificationLevel:o,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),t&&this._notifyConversationChanged()}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(Wr,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Jr),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,i=e.conversationType,r=e.isPersited,s=e.targetId,o=e.channelId,a=e.sentTime;if(Qr.indexOf(i)>=0){var c=!1,l=this._store.get(i,s,o),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,l),r=i.hasChanged,s=i.localConversation,o=i.updateItems;c=c||r,h=u(u({},h),o),l=Nn(s)})),this._store.set(i,s,l,o),this._store.updateMentionedData(e),r){var d=this._store.get(i,s,o);d.updatedItems=u({latestMessage:{time:e.sentTime,val:e}},h),d.latestMessage=e;var p=Object.assign(d,{conversationType:i,targetId:s,channelId:o});this._setUpdatedConversation(p)}(c||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,s=e.notificationStatus,o=e.notificationLevel,a=e.conversationType;i=i||0,(n||void 0!==o&&o<=0||void 0===o&&s!==ae.OPEN)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var s=i.unreadMessageCount,o=i.notificationLevel,a=void 0===o?0:o,u=i.conversationType,c=i.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(r+=(n?c:s)||0)})),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,s=e.notificationLevel;(t||1!==r||-1===s||0===s)&&(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,r){void 0===r&&(r=!0);var s=this._store.get(e,t,n);s.lastReadTime=s.lastUnreadTime,this._recallMsgTimeMap[e+"_"+n+"_"+t]=[];var o=s.unreadMessageCount,a=s.hasMentioned,u={};if(o&&(s.unreadMessageCount=0,u.unreadMessageCount={val:0,time:i}),a&&(s.hasMentioned=!1,s.unreadMentionedCount=0,s.mentionedInfo=void 0,u.hasMentioned={val:!1,time:i},u.mentionedInfo={val:void 0,time:i}),this._store.set(e,t,s,n),r&&0!==Object.keys(u).length){var c=Object.assign(s,{conversationType:e,targetId:t,channelId:n,updatedItems:u});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=e+"_"+t+"_"+i;this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i=e+"_"+t+"_"+n;return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i=e+"_"+t+"_"+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),s=r.tags;s=Object.assign(s,n);var o=r.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:s,lastMessageSentTime:o},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===ae.OPEN||e.notificationLevel&&e.notificationLevel>0})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,notificationLevel:e.notificationLevel||0,notificationStatus:e.notificationStatus||2}}))},e.prototype.getTopConversationList=function(e,t){var n=this;return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(vt(t)||t===n.channelId)&&n.isTop})).map((function(e){return n._buildConversation(e)}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===n&&(n=""),this.get(e,t,n).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.prototype.getUnreadConversationList=function(e){var t=this;return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){return t._buildConversation(e)}))},e.prototype._buildConversation=function(e){var t=this.getDraft(e.conversationType,e.targetId,e.channelId);return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel||0,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0,draft:t}},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getVersion()},e.prototype.pushTask=function(e){return this._statusManager.pushTask(e)},e.prototype.stopAllTask=function(){this._statusManager.stopAllTask()},e}(),Zr=function(e){function t(t,n,i,r){var o=e.call(this)||this;return o._tagKey="tags",o._versionKey="version",o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storageKey=Q.USER_SETTING_KEY(n,i),o._storage=new s(t.runtime,o._storageKey),o._engine=t,o._tagWatcherFunc=r,o}return a(t,e),t.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._tagKey,n),this._tagWatcherFunc()},t.prototype.addTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){var t,n=(null===(t=i[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;i[e.tagId]={tagName:e.tagName,createdTime:n}})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.deleteTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){delete i[e]})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.getTagsInfo=function(){return this._storage.get(this._tagKey)||{}},t.prototype.getTags=function(){var e=this._storage.get(this._tagKey)||{},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)}))},t.prototype.getTagById=function(e){var t=this._storage.get(this._tagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullUserSettings(e),[4,this._pullPromise]);case 1:return t=u.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n!==$.SUCCESS||vt(i)||(s=(r=i).settings,o=r.version,a=s.Tag,vt(a)||this._updateTag(a),this._storage.set(this._versionKey,o),this._pullQueue=this._pullQueue.filter((function(e){return e>o}))),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},t.prototype._startCall=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pullUserSettings=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.getVersion=function(){return this._storage.get(this._versionKey)||0},t.prototype.updateVersion=function(e){this._storage.set(this._versionKey,e)},t}(Br),zr=function(e){return e.replace(/@.+$/,"@")},$r=function(){function e(e,t,n,i,r,s){void 0===r&&(r=!0),void 0===s&&(s=!0),this.appkey=e,this.logger=t,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.isUseDynamicNaviUrl=s,this.crtRequest=null}return e.prototype.request=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a;return l(this,(function(u){switch(u.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,i,r),[4,this.crtRequest]);case 1:return s=u.sent(),o=s.code,a=s.data,this.crtRequest=null,[2,{code:o,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c,h,d,p,g,_,f,E,T;return l(this,(function(l){switch(l.label){case 0:return s=zr(e),!t&&(o=this.getNaviCache(s))&&(a=o.timestamp,u=o.naviInfo,n||Date.now()-a<I)?(this.logger.info(fe.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:u}),i),c={bid:_n(),ptc:Ke.NAVI,cod:$.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:u.type||0,hos:"",cache:je.LOCAL,v:Qe.CURRENT,rsn:null==r?void 0:r.reason,cid:(null==r?void 0:r.uuid)+"_"+(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.statisticLog.record(Ee.IM_NAVI,JSON.stringify(c),i),[2,{code:$.SUCCESS,data:u}]):(h=Si.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(fe.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),i),[4,this.requestHandler(h,e,i,r)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===$.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(_=l.sent())?void 0:_.navi)&&(null==_?void 0:_.navi.length)>0?(f=_.navi,[4,this.requestHandler(f,e,i,r)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==$.SUCCESS?(this.logger.warn(fe.L_GET_NAVI_R,p,i),[2,{code:p}]):(T=g,this.logger.info(fe.L_GET_NAVI_R,JSON.stringify({naviInfo:T}),i),this.setNaviCache(s,T),[2,{code:p,data:T}])}}))}))},e.prototype.requestHandler=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:r=0,s=e.length,l.label=1;case 1:return r<s?(o=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,o)]):[3,4];case 2:if(c=l.sent(),h=c.code,d=c.data,p={bid:_n(),ptc:Ke.NAVI,cod:h,net:null==i?void 0:i.type,dur:Date.now()-u,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[r],cache:je.REQUEST,v:Qe.CURRENT,rsn:null==i?void 0:i.reason,cid:(null==i?void 0:i.uuid)+"_"+(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.record(Ee.IM_NAVI,JSON.stringify(p),n),[$.SUCCESS,$.RC_CONN_TOKEN_INCORRECT,$.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return $.RC_CONN_TOKEN_INCORRECT;case 416:return $.RC_LICENSE_EXPIRED;default:return $.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(zr(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(zr(e),u(u({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,i=e.token,r=e.platform,s=e.protocol;t=n+"/v2/navi.json?cloud=0";var o="token="+encodeURIComponent(i)+"&v=5.9.8&p="+r;return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn="+s+";rtc=4;log=2"},body:o,url:t,timeout:R}},e.prototype.useV2Navi=function(){return!0},e}(),es={},ts={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,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:Si.getMiniCmpUrlList().join(",")},ns=function(e){function t(t,n,i,r,s){var o=e.call(this,t,n,i,s,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),r.useNavi)||this;return o.runtime=r,o}return a(t,e),t.prototype.httpRequest=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return s=e+"/navi.js?appId="+t+"&token="+encodeURIComponent(n)+"&callBack=x&v="+F+"&r="+Date.now(),this.logger.debug(fe.L_REQUEST_T,"req navi => "+s,i),[4,this.runtime.httpReq({url:s,timeout:R,dataType:"text"})];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(fe.L_REQUEST_R,"request navi failed: "+o.status,i),!this.runtime.useNavi&&r?[2,{code:$.SUCCESS,data:ts}]:[2,{code:this.transHttpCode(o.status)}];try{return 0===(a=o.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'+a+'"')),(u=JSON.parse(a)).protocol=/^https/.test(s)?"https":"http",this.runtime.useNavi||(u.server="",u.backupServer=Si.getMiniCmpUrlList().join(","),u.logSwitch=0),[2,{code:$.SUCCESS,data:u}]}catch(e){this.logger.error(fe.L_PARSE_NAVI_E,o.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return s=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?De.WSS:De.WS).toString()}),this.logger.debug(fe.L_REQUEST_T,"req navi => "+s.url,i),[4,this.runtime.httpReq(s)];case 1:if(200!==(o=l.sent()).status)return this.logger.debug(fe.L_REQUEST_R,"request navi failed: "+o.status,i),!this.runtime.useNavi&&r?[2,{code:$.SUCCESS,data:ts}]:[2,{code:this.transHttpCode(o.status)}];try{return a=o.data,(u="object"!=typeof a?JSON.parse(a):a).protocol=/^https/.test(s.url)?"https":"http",this.runtime.useNavi||(u.logSwitch=0,c=Si.getMiniCmpUrlList(),u.serverAddr=c.map((function(e,t){return{addr:e,protocol:/^https/.test(s.url)?De.WSS:De.WS,weight:c.length-t}}))),[2,{code:$.SUCCESS,data:u}]}catch(e){this.logger.error(fe.L_PARSE_NAVI_E,o.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(es[e])return es[e];var t,n=Q.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var r=i.getItem(n);t=r?JSON.parse(r):[]}catch(e){t=[]}if(0===t.length)return null;var s=t.find((function(t){return t.token===e}))||null;return es[e]=s,s},t.prototype.setNaviCache=function(e,t){var n,i=Q.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var s=r.getItem(i);n=s?JSON.parse(s):[]}catch(e){n=[]}var o=Date.now();n.length>0&&(n=n.filter((function(t){return o-t.timestamp<I&&e!==t.token})));var a={timestamp:o,naviInfo:t,token:e};n.push(a),r.setItem(i,JSON.stringify(n)),es[e]=a},t}($r),is=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=Q.SEND_MSG_KEY(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=Q.SEND_MSG_KEY(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=Q.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))},e}();(Kr={})[te.PRIVATE]=br.qryPMsg,Kr[te.GROUP]=br.qryGMsg,Kr[te.CHATROOM]=br.qryCHMsg,Kr[te.CUSTOMER_SERVICE]=br.qryCMsg,Kr[te.SYSTEM]=br.qrySMsg;var rs=[br[br.recallMsg],br[br.ppMsgS],br[br.pgMsgS],br[br.ppMsgP],br[br.pgMsgP],br[br.chatMsg],br[br.pcMsgP],br[br.prMsgS],br[br.pbMsgP]],ss=function(){function e(e,t,n){this._localStore=new s(e,Q.ULTRA_GROUP_STATE_KEY(t,n))}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),s=this._localStore.get(r)||{};for(var o in n){var a=as[o],u=n[o];if(!vt(a)&&!vt(u))u===os[a].defaultVal?delete s[a]:s[a]=u}St(s)?this._localStore.set(r,s):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)||{},s={};for(var o in os){var a=os[o],u=a.keyName,c=a.defaultVal;s[u]=r[o]||Nn(c)}return s},e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+t},e}(),os={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},as={};for(var us in os){var cs=os[us].keyName;as[cs]=us}var ls,hs=function(){function e(e,t,n){this._store=new ss(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,s=e.channelId;t===te.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:i,notificationLevel:r},s)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),ds="UpStreamMessage",ps="PushExtra",gs="DownStreamMessage",_s="DownStreamMessages",fs="SessionsAttQryInput",Es="SessionsAttOutput",Ts="SyncRequestMsg",Is="ChrmPullMsg",vs="NotifyMsg",Rs="HistoryMsgInput",Cs="HistoryMsgOuput",Ss="RelationQryInput",ms="RelationsOutput",ys="UnreadMsgInfo",As="DeleteSessionsInput",Ns="SessionInfo",Os="DeleteSessionsOutput",Ms="RelationDelBatchReq",Ls="RelationOpInput",Us="RelationsInput",bs="DeleteMsgInput",Ps="CleanHisMsgInput",Ds="CleanMsgBatchReq",ws="SessionMsgReadInput",Vs="ChrmInput",Gs="ChrmOutput",Bs="QueryChatRoomInfoInput",ks="QueryChatRoomInfoOutput",xs="GetQNupTokenInput",Fs="GetQNupTokenOutput",Hs="GetQNdownloadUrlInput",Ys="GetDownloadUrlInput",qs="GetQNdownloadUrlOutput",Ks="GetDownloadUrlOutput",js="ChrmKVEntity",Qs="SetChrmKV",Ws="SetChrmKVS",Js="DeleteChrmKVS",Xs="ChrmKVOutput",Zs="ChrmKVSOutput",zs="ChrmKVSVersionEntity",$s="ChrmKVSOutputEntity",eo="QueryChrmKV",to="SetUserSettingInput",no="SetUserSettingOutput",io="PullUserSettingInput",ro="PullUserSettingOutput",so="UserSettingNotification",oo="SessionReq",ao="SessionStates",uo="SessionState",co="SessionStateItem",lo="SessionStateModifyReq",ho="SessionStateModifyResp",po="GroupUnpushQuery",go="GroupUnpushSet",_o="QryRemindListReq",fo="QryRemindListResp",Eo="GroupUnpushResult",To="GrpReadReceiptMsg",Io="GrpReadReceiptQryReq",vo="GrpReadReceiptQryResp",Ro="GrpMsgReadUser",Co="SessionTagAddInput",So="SessionTagItem",mo="SessionTagDelInput",yo="SessionDisTagReq",Ao="ReportSDKInput",No="ReportSDKOutput",Oo="UltraGrpPullSes",Mo="UltraGrpPullMsg",Lo="MsgChangeReq",Uo="QueryMsgChange",bo="MsgChange",Po="MsgChangeList",Do="MsgQuery",wo="MessageQueryInfo",Vo="MsgQueryAck",Go="OperateStatus",Bo="OperateStatusNotify",ko="OperateInfo",xo="OperateSummary",Fo="SetRtcRoomIdInput",Ho="SetRtcRoomIdOutput",Yo="CallInfoUpStream",qo="CallInfoDownStream",Ko="KvInput",jo="KvOutput",Qo="ReadReceiptMsg",Wo="ReceiptQryReq",Jo="QueryReceiptResp",Xo="ReceiptUser",Zo="ReceiptCntQryReq",zo="ReceiptCntQryResp",$o="MsgReadCnt",ea="UpdateUserSubReq",ta="UserSubDetail",na="UpdateUserSubResp",ia="PUllUserSubResp",ra="PullUserSubReq",sa="UserSubList",oa="PullSubDataReq",aa="PullSubDataResp",ua="SubDataDetail",ca="SubData",la="QrySubDataReq";(ls={})[ds]=["sessionId","classname","content","pushText","toUserIds","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],ls[_s]=["list","syncTime","finished","broadcastSyncTime"],ls[gs]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserIds","groupUnpush"],ls[ps]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],ls[fs]=["nothing"],ls[Es]=["inboxTime","sendboxTime","totalUnreadCount"],ls[Ts]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],ls[Is]=["syncTime","count"],ls[vs]=["type","time","chrmId"],ls[Rs]=["targetId","time","count","order","busChannel"],ls[Cs]=["list","syncTime","hasMsg"],ls[Ss]=["type","count","startTime","order"],ls[ms]=["info","isFinished"],ls[ys]=["msgId","msgTime","remindType","className"],ls[As]=["sessions"],ls[Ms]=["RelationOpInput"],ls[Ls]=["conversationId","conversationType","busChannel"],ls[Ns]=["type","channelId","busChannel"],ls[Os]=["nothing"],ls[Us]=["type","msg","count","busChannel","startTime","endTime"],ls[bs]=["type","conversationId","msgs","busChannel"],ls[Ps]=["targetId","dataTime","conversationType","busChannel"],ls[Ds]=["CleanHisMsgInput"],ls[ws]=["type","msgTime","channelId","busChannel"],ls[Vs]=["nothing"],ls[Gs]=["nothing","sessionId","joinTime"],ls[Bs]=["count","order"],ls[ks]=["userTotalNums","userInfos"],ls[xs]=["type","key","httpMethod","queryString","url"],ls[Hs]=["type","key","fileName"],ls[Ys]=["type","key","fileName"],ls[Fs]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],ls[qs]=["downloadUrl"],ls[Ks]=["downloadUrl"],ls[js]=["key","value","status","timestamp","uid","version"],ls[Qs]=["entry","bNotify","notification","type"],ls[Ws]=["entry","bNotify","notification","type"],ls[Js]=["entry","bNotify","notification","type"],ls[Xs]=["entries","bFullUpdate","syncTime"],ls[Zs]=["timestamp","errorKeys","keysVersion"],ls[zs]=["version","key"],ls[$s]=["key","errorCode"],ls[eo]=["timestamp"],ls[to]=["version","value"],ls[no]=["version","reserve"],ls[io]=["version","reserve"],ls[ro]=["items","version"],ls.UserSettingItem=["targetId","type","key","value","version","status","tags"],ls[oo]=["time"],ls[ao]=["version","state"],ls[uo]=["type","channelId","time","stateItem","busChannel"],ls[co]=["sessionStateType","value","tags"],ls[lo]=["version","state"],ls[ho]=["version"],ls[go]=["busChannel","unpushLevel"],ls[_o]=["groupId","busChannel","msgTime","size"],ls[po]=["busChannel"],ls[Eo]=["groupId","busChannel","unpushLevel"],ls[To]=["msgId","busChannel"],ls[Io]=["msgId","busChannel"],ls[vo]=["totalMemberNum","list"],ls[Ro]=["readTime","userId"],ls[Co]=["version","tags"],ls[So]=["tagId","name","createdTime","isTop"],ls[mo]=["version","tags"],ls[yo]=["tagId"],ls[so]=["version","reserve"],ls[Ao]=["sdkInfo"],ls[No]=["nothing"],ls[Oo]=["syncTime","isEraseMsgContent"],ls[Mo]=["syncTime"],ls[Lo]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],ls[Uo]=["syncTime"],ls[Po]=["list","syncTime","hasNext"],ls[bo]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],ls[Do]=["targetId","type","query"],ls[wo]=["msgTime","msgUID","busChannel"],ls[Vo]=["list"],ls[Go]=["targetId","type","opType","busChannel"],ls[Bo]=["type","notifyType","info","summary"],ls[ko]=["targetId","busChannel","userId","opType","optime"],ls[xo]=["targetId","busChannel","count","opType"],ls[Fo]=["rtcRoomId"],ls[Ho]=["nothing"],ls[Qo]=["targetId","type","busChannel","startMsgId","endMsgId"],ls[Wo]=["msgId","busChannel","targetId"],ls[Jo]=["num","list"],ls[Xo]=["receiptTime","userId"],ls[Zo]=["type","channelId","busChannel","msgId"],ls[zo]=["result"],ls[$o]=["msgId","cnt","tmn"],ls[ea]=["subType","subUsers","opType","expiry"],ls[ta]=["subUserId"],ls[na]=["subUsers","subTime"],ls[ra]=["version","pageToken"],ls[ia]=["list","version","hasNext","pageToken","isFull"],ls[sa]=["subUsers","subType","subTime","expiry","opType"],ls[oa]=["versionTime","needAllData","pageToken"],ls[aa]=["list","versionTime","hasNext","pageToken","isFull"],ls[ua]=["statusStr","subUserId","data","subType"],ls[ca]=["platformInfo","value","versionTime"],ls[la]=["subType","subUsers"];var ha,da="\npackage Modules;\nmessage probuf {\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message "+vs+" {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message "+Ts+" {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message "+ds+" {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13; // 该消息所属会话的业务标识\n optional string systemId = 16; // 系统会话消息时需填该字段为 targetId, 其他类型无需传\n }\n message "+ps+" {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message "+_s+" {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message "+gs+" {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n // 消息的扩展标记\n // 第0位,表示送达状态: 0x01 表示已送达;\n // 断档: 0x02 表示是否需要执行断档策略;\n // 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n // 0x08 每条消息携带的频道类型\n optional int64 extStatus = 20;\n repeated string toUserIds = 21; //指定接收者(限定群, 讨论组, 超级群)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = "+J.IMAGE+";\n audio = "+J.AUDIO+";\n video = "+J.VIDEO+";\n file = "+J.FILE+";\n sight = "+J.SIGHT+";\n html = "+J.COMBINE_HTML+";\n }\n message "+xs+" {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5; // url, sdk 设置下载地址\n }\n message "+Hs+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+Ys+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+Fs+" {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n // 兼容 minio 协议\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24; // 下载鉴权信息,格式为 Json 格式\n }\n message "+qs+" {\n required string downloadUrl = 1;\n }\n message "+Ks+" {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message "+Vs+" {\n required int32 nothing = 1;\n }\n message "+Gs+" {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message "+Is+" {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message "+Ss+"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message "+Us+"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message "+ms+"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n optional int32 busChannelType = 9; // 0: 公有频道; 1: 私有频道;\n optional "+ys+" msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message "+ys+" //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message "+_o+" // 新增 查询未读@列表入参\n {\n required string groupId = 1; // 群 ID\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int64 msgTime = 3; // 消息时间戳\n optional int32 size = 4; // 单页长度,默认20,最大20\n }\n message "+fo+" //查询未读@列表出参\n {\n repeated "+ys+" msgInfo = 1; //未读@消息摘要列表\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message "+Ps+"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message "+Ds+"\n {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message "+Bs+"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message "+ks+"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message "+Rs+"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message "+Cs+"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message "+fs+"{\n required int32 nothing = 1;\n }\n message "+Es+"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message "+ws+"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message "+As+"\n {\n repeated SessionInfo sessions = 1;\n }\n message "+Ns+"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message "+Os+"\n {\n optional int32 nothing=1;\n }\n message "+Ms+" \n {\n repeated RelationOpInput relation = 1;\n }\n message "+Ls+"\n {\n required string conversationId = 1;//会话ID\n required ChannelType conversationType = 2;//会话类型,比如单聊、群等\n optional string busChannel = 3;//该消息所属会话的业务标识,限制20字符以内\n }\n message "+bs+"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message "+Qs+" {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+Ws+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+Js+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+Xs+" {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message "+Zs+" {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message "+$s+"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message "+eo+" {\n required int64 timestamp = 1;\n }\n message "+to+" {\n required int64 version=1;\n required string value=2;\n }\n message "+no+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+io+" {\n required int64 version=1;\n optional bool reserve=2;\n }\n message "+ro+" {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message "+oo+" {\n required int64 time = 1;\n }\n message "+ao+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+uo+" {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message "+co+" {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message "+lo+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+po+" {\n optional string busChannel = 1;\n }\n message "+go+"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message "+Eo+" {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message "+ho+" {\n required int64 version=1;\n }\n message "+To+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+Io+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+vo+" {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message "+Ro+" {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message "+Co+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+So+" {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message "+mo+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+yo+" {\n repeated string tagId=1;\n }\n message "+so+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Ao+' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message '+No+"\n {\n optional int32 nothing=1; //占位\n }\n message "+Oo+"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message "+Mo+"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message "+Lo+"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message "+Uo+" //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message "+Po+" //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message "+bo+" //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回,4:频道变更,5:用户组变更)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0, 设为 1 时, IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 消息变更的操作人 Id; subChangeType 为 5 时,operatorId 表示被踢出超级群私有频道白名单的用户\n // subChangeType 的意义由 changeType 的值来决定\n // 当 changeType 为 4 时;\n // 1: 删除频道;\n // 2: 公有频道变为私有频道;\n // 3: 私有频道变为公有频道;\n // 4: 私有频道成员变更-加入, SDK 不通知业务层;\n // 5: 私有频道成员变更-退出;\n // 6: 公有频道变为私有频道,当前用户不在白名单中;\n // 当 changeType 为 5 时;\n // 1: 删除用户组 (通知到 用户组下所有用户)\n // 2: 用户组增加用户 (仅通知到该用户)\n // 3: 用户组删除用户 (仅通知到该用户)\n // 4: 频道绑定用户组 (通知到 用户组下所有用户)\n // 5: 频道解绑用户组 (通知到 用户组下所有用户)\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12; // 0:公有频道; 1:私有频道\n optional bool isRemindMe = 13;// 是否为@我的消息, 消息撤回时, 该字段有意义, 用于客户端计算是否未读数总数-1,未读@消息数-1 -- server 暂未支持\n repeated string userGroupIds = 14; //用户组id列表,用于用户组增删成员或频道绑定解绑用户组的通知中\n optional int32 remindType = 15; // @类型:0非@我消息,1@所有人消息,2@我单人的消息\n }\n message "+Do+" //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message "+Vo+" //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message "+Go+" //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message "+Bo+" //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message "+ko+" {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message "+xo+" {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n\n message "+Fo+"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message "+Ho+"\n {\n required int32 nothing = 1; //用于占位\n }\n message "+Yo+"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message "+qo+"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message "+Ko+"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message "+jo+"\n {\n required int64 maxTime = 1; //最大时间戳\n repeated KvInfo info = 2; //kv对象\n }\n \n message KvInfo{\n required string key =1; //健名\n required string value =2; //健值\n }\n message "+Qo+"\n {\n required string targetId = 1;\n required ChannelType type = 2; //会话类型:单聊1、群聊3\n optional string busChannel = 3; //该消息所属会话的业务标识\n optional string startMsgId = 4; //已读消息ID区间开始(单聊极端场景下,无此属性或为空字符串)\n optional string endMsgId = 5; //已读消息ID区间结束(对应RC:RRMsg 中 endMsgId)\n }\n message "+Wo+"\n {\n required string msgId = 1;//已读 消息ID \n optional string busChannel = 2; //该消息所属会话的业务标识\n required string targetId = 3; //群聊:群id\n }\n message "+Jo+"\n {\n optional int32 num = 1;// 群总人数\n repeated ReceiptUser list = 2;//已读用户列表(list复类型)\n optional int32 readCnt = 3; //已读人数\n }\n message "+Xo+"\n {\n required int64 receiptTime = 1;//已读 时间。已做归并,SDK 向上层返回应最多只精确到分钟 \n required string userId = 2;//已读 用户id\n }\n message "+Zo+"\n {\n optional ChannelType type = 1; //发送类型如:(GROUP)\n optional string channelId = 2; //会话id\n optional string busChannel = 3; //该消息所属会话的业务标识\n repeated string msgId = 4; //消息id列表\n }\n message "+zo+"\n {\n repeated MsgReadCnt result= 1; //已读状态列表\n }\n\n message "+$o+"\n {\n optional string msgId = 1; //消息id\n optional int32 cnt = 2; //已读人数\n optional int32 tmn = 3; //群人数\n }\n message "+ea+"\n {\n optional int32 subType = 1;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n repeated UserSubDetail subUsers = 2;//订阅用户列表(单次请求最大 200)\n optional int32 opType = 3; //操作类型(0订阅(且自动过期,需携带订阅有效期),1 取消订阅)\n optional int32 expiry = 4; //订阅有效期(秒),默认 xx秒待产品定义\n }\n message "+ta+" {\n optional string subUserId = 1;//被订阅用户ID\n }\n message "+na+" {\n repeated UserSubDetail subUsers = 1; //被订阅达到上限用户ID列表\n optional int64 subTime = 2;//订阅时间\n }\n message "+ra+" {\n optional int64 version = 1;//用于增量拉取,卸载重装后使用0,后续使用 Resp.subTime\n optional string pageToken = 2;//用于分页,首页请求为空字符串,第二页及后续请求时 使用 Resp.pageToken\n }\n message "+ia+" {\n repeated UserSubList list = 1;//订阅用户列表(单次请求最大 200)\n optional int64 version = 2;//数据版本时间(用于分页,返回后 用于SDK 请求下一页携带)\n optional bool hasNext = 3;//是否还有下一页\n optional string pageToken = 4; //分页Token(返回后 用于SDK 请求下一页携带)\n optional bool isFull = 5; // true->全量的数据; false 增量的数据\n }\n message "+sa+" {\n repeated UserSubDetail subUsers = 1;//被订阅用户ID列表\n optional int32 subType = 2;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n optional int64 subTime = 3;//订阅时间\n optional int32 expiry = 4;// 订阅有效期(秒),默认 xx秒待产品定义\n optional int32 opType = 5;// 增量拉取时返回 操作类型(0主动订阅(且自动过期,需携带订阅有效期),1主动取消订阅)\n } \n message "+oa+" {\n optional int64 versionTime = 1; // 用于增量拉取,卸载重装后使用0,后续使用 Resp.versionTime\n optional bool needAllData = 2; // 是否查询全量订阅数据(初始化时 为 true,s_cmd触发增量拉取 为false)\n optional string pageToken = 3; // 用于分页,首页请求为空字符串,第二页及后续请求时 使用 Resp.pageToken\n }\n message "+aa+" {\n repeated SubDataDetail list = 1; //数据列表\n optional int64 versionTime = 2; //数据版本时间(用于分页)\n optional bool hasNext = 3; //是否还有下一页\n optional string pageToken = 4; //分页Token(返回后 用于SDK 请求下一页携带)\n optional bool isFull = 5; // true->全量的数据; false 增量的数据\n }\n message "+ua+" {\n optional string statusStr = 1;//兼容旧版s_stat,字段废弃\n optional string subUserId = 2;//被订阅用户ID\n repeated SubData data = 3;// 订阅数据\n optional int32 subType = 4; //类型(1:在线状态订阅, 2:用户信息托管订阅)\n }\n\n message "+ca+" {\n optional int32 platformInfo = 1;//设备类型枚举值\n optional int32 value = 2;//具体数据(在线状态订阅表示:0离线,1上线)\n optional int64 versionTime = 3;//数据生成时间\n }\n message "+la+" {\n optional int32 subType = 1;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n repeated UserSubDetail subUsers = 2;//订阅用户列表(单次请求最大 200)\n }\n}\n",pa=function(e,t,n,i,r,s){var o=r?Object.keys(r).map((function(t){return e.encode(Rn.RtcValueInfo,{key:t,value:r[t]},!0)})):void 0,a=s?Object.keys(s).map((function(t){return e.encode(Rn.RtcValueInfo,{key:t,value:s[t]},!0)})):void 0;return e.encode(Rn.RtcInput,{roomType:t,broadcastType:n,joinType:i,innerDatas:o,outerDatas:a})},ga=function(e,t){var n=e.decode(Rn.RtcUserListOutput,t),i=n.users,r=n.token,s=n.sessionId,o=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return Cn(i,(function(e){var t=e.userId,n=e.userData,i={};Cn(n,(function(e){var t=e.key,n=e.value;i[t]=n})),c[t]=i})),{users:c,token:r,sessionId:s,roomInfo:o,kvEntries:a,offlineKickTime:u}};!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(ha||(ha={}));var _a=function(e){return[ha.DEBUG,ha.INFO,ha.WARN,ha.ERROR].some((function(t){return t===e}))},fa=Vt(),Ea=Date.now(),Ta=0,Ia=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=ha.WARN,this.debug=this._log.bind(this,ha.DEBUG),this.info=this._log.bind(this,ha.INFO),this.warn=this._log.bind(this,ha.WARN),this.error=this._log.bind(this,ha.ERROR),this.__statistics=this._log.bind(this,ha.STATISTICS)}return e.prototype._stdout=function(e,t,n,i,r){var s;if(!(e<=ha.FATAL)&&console&&!(e>this.outputLevel)){var o=["error","warn","info","debug"][e-1];null===(s=console)||void 0===s||s[o](n+"["+this._id+"]["+o.toUpperCase()+"]: "+t+" | "+i+" | "+r)}},e.prototype.setOutputLevel=function(e){_a(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,r.toISOString(),n,i),e!==ha.DEBUG&&this.flush({time:+r,sessionId:fa,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})):this._stdout(ha.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),t,i)},e.prototype.createTraceId=function(){return""+ ++Ta},e.prototype.getSessionId=function(){return fa},e}(),va=null,Ra="RC_LOGS",Ca="RC_CONF",Sa=null,ma=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(Ra,"readwrite").objectStore(Ra).index("time"),r=IDBKeyRange.upperBound(Date.now()-e),s=i.openCursor(r);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):n()},s.onerror=function(){n()}}))]:[2];case 2:return n.sent(),Sa=setTimeout((function(){return ma(e)}),6e5),[2]}}))}))},ya=function(e,t,n,i){void 0===i&&(i=168),va||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Mn(n).type?va=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var s="RC_LOGS_"+e,o=r.open(s,1);o.onerror=function(e){t.error(fe.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},o.onsuccess=function(r){var s=r.target.result;s?(s.onclose=function(e){va=null,t.warn(fe.L_LOGDB_CLOSED_S)},s.onerror=function(e){va=null,t.error(fe.L_LOGDB_ERROR_E,e.target.error)},s.onabort=function(e){t.info(fe.L_LOGDB_ABORT_S,e.target.error)},ma(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:e,db:s})):n(null)},o.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(Ra)&&t.deleteObjectStore(Ra);var n=t.createObjectStore(Ra,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Ca,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(fe.L_UNSUPPORT_INDEXDB_O))},Aa=[],Na=function(){return c(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return va?(Sa&&(clearTimeout(Sa),Sa=null),[4,va]):[2];case 1:return(e=n.sent())&&(t=e.db,Aa.push(t)),va=null,[2]}}))}))},Oa=[],Ma=!1,La=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return Ma||0===Oa.length?[2]:(Ma=!0,t=Oa.splice(0),[4,new Promise((function(n){var i=e.transaction(Ra,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Ra);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Ma=!1,0===Oa.length&&Aa.length>0&&(Aa.forEach((function(e){return e.close()})),Aa.length=0),setTimeout((function(){return La(e)})),[2]}}))}))};function Ua(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(Ca,"readonly").objectStore(Ca).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var ba,Pa,Da,wa,Va=0,Ga=function(){return{setTimestamp4RealtimeLog:function(e){Va=e},getTimestamp4RealtimeLog:function(){return Va},getLogs:function(e,t,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){switch(s.label){case 0:return[4,va];case 1:return(r=s.sent())?[2,new Promise((function(s){var o=r.db.transaction(Ra,"readonly").objectStore(Ra),a=[],u=IDBKeyRange.bound(e,t),c=o.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var r=t.value;r.level<=n&&(i?r.sessionId===fa:r.level>=0)&&a.push(r),t.continue()}else s({dbReady:!0,logs:a})},c.onerror=function(e){s({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ba="REPORT_SESSION",ka=function(e,t){return c(void 0,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return n=Ba+"_"+e,[4,Ua(Ba+"_"+e)];case 1:return i=o.sent(),r=i.success,s=i.value,r?(t===(null==s?void 0:s.sessionId)||function(e,t){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,va];case 1:return(n=r.sent())?(i=n.db,i.transaction(Ca,"readwrite").objectStore(Ca).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},xa=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){!function(e){c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(t=n.sent())?(Oa.push(e),La(t.db),[2]):[2]}}))}))}(e)},t}(Ia),Fa=function(){function e(e,t,n,i,r){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=i,this.logger=r,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Si.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(fe.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressLogs(e)];case 1:return s=l.sent(),o=s.success,a=s.data,o||this.logger.warn(fe.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(fe.L_REALTIME_LOG_O,"compress done",t),u=Ct(n)?n:"https://"+n,u+="?version=5.9.8&appkey="+this.appkey+"&userId="+this.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web",[4,this.send({url:u,body:a,method:"POST"})];case 2:return c=l.sent().status,this.logger.debug(fe.L_REALTIME_LOG_R,JSON.stringify({status:c}),t),200===c?(this.reportFailedNumber=0,r=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||Ea,s=Math.max(i-5e3,r),o=this.logger.createTraceId(),this.logger.debug(fe.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:s,level:t,itv:n}),o),[4,this.logDB.getLogs(r,s,t,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(fe.L_REALTIME_LOG_R,"db error",o),[3,4]);case 2:return c.length>0?[4,this._sendLogs2Realtime(c,o,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,s,o){return void 0===o&&(o=!1),c(this,void 0,void 0,(function(){var a,u,c,h,d,p,g,_,f,E;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(a=this.logger.createTraceId(),this.logger.info(fe.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:s,isCloudControl:o}),a),[4,this.logDB.getLogs(e,t,ha.DEBUG,!1)]);case 1:return u=l.sent(),c=u.dbReady,h=u.logs,this.logger.info(fe.L_REPORT_FULL_LOG_O,JSON.stringify({count:h.length}),a),d=Ct(i)?i:"https://"+i,d+="?version=5.9.8&appkey="+this.appkey+"&userId="+this.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web&logId="+r,c?h.length>0?[4,this.compressLogs(h)]:[3,3]:[3,5];case 2:return g=l.sent(),_=g.success,f=g.data,p=_?f:"compress failed",[3,4];case 3:p="no data",l.label=4;case 4:return[3,6];case 5:p="no database",l.label=6;case 6:return this.logger.debug(fe.L_REPORT_FULL_LOG_O,"compress done",a),o&&(d+="&source=cloud"),[4,this.send({url:d,body:p,method:"POST"})];case 7:return E=l.sent().status,this.logger.info(fe.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),a),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Ha=48,Ya=64,qa=80,Ka=96,ja="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Qa=function(e){for(var t={},n=0;n<e.length-1;n++){var i=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(i)?t[i].push(n):t[i]=[n]}for(var r=[],s=[],o=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var t=Ja(e.length),n=String.fromCharCode(qa|t.length);r.push(n+t)}else{var i=String.fromCharCode(Ka|e.length);r.push(i)}r.push(e)}},a=0;a<e.length;){var u=Wa(t,e,a);if(u.length<2)s.push(e.charAt(a++));else if(u.length<4)s.push(e.substr(a,u.length)),a+=u.length;else{var c=Ja(a-u.offset),l=Ja(u.length);if(c.length+l.length>=u.length)s.push(e.substr(a,u.length)),a+=u.length;else{o();var h=String.fromCharCode(Ya|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}o();var d=Ja(e.length),p=String.fromCharCode(Ha|d.length);return r.push(p+d),r.join("")},Wa=function(e,t,n){var i={length:0,offset:-1};if(t.length,n>=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var s=t.length-n,o=0,a=r.length;o<a;o++){var u=r[o],c=n-u;if(!(c>238327)){var l=Math.min(s,c);if(l<=i.length)break;if(!(i.length>2&&t.charAt(u+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},Ja=function(e){var t=[],n=0;do{n=e%62,t.push(ja.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")},Xa=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 s in r)if(r.hasOwnProperty(s)){var o=i.match(r[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Za=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,s=e.time,o=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return t+","+s+","+a+","+n+","+o+","+(c='"'+c.replace(/"/g,'""')+'"')+"\n"},za=function(e){function t(t,n,i,r){var s=this,o=Gt(n),a=Xa(n),u=a.type+"|"+a.version+"|"+i.getSessionId();return(s=e.call(this,t,o,u,Ga(),i)||this).runtime=n,s.clientReportLevel=r,_a(s.clientReportLevel)||(s.clientReportLevel=void 0),s}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,ka(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:Qa(e.map(Za).join(""))}]}))}))},t.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),c(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(s){switch(s.label){case 0:return[4,Ua(Ba+"_"+t)];case 1:return e=s.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,s,o,a){return void 0===a&&(a=!1),c(this,void 0,void 0,(function(){var u;return l(this,(function(c){switch(c.label){case 0:return[4,this.isReporter()];case 1:return u=c.sent(),this.userId&&!u?[2]:[2,e.prototype.report.call(this,t,n,i,r,s,o,a)]}}))}))},t.prototype.realtimeReport=function(t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Fa);!function(e){e[e.ACCEPTED=0]="ACCEPTED",e[e.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",e[e.REDIRECT=6]="REDIRECT",e[e.PACKAGE_ERROR=7]="PACKAGE_ERROR",e[e.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",e[e.BLOCK=9]="BLOCK",e[e.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",e[e.DEVICE_ERROR=11]="DEVICE_ERROR",e[e.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",e[e.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",e[e.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",e[e.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",e[e.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",e[e.OTP_USED=17]="OTP_USED",e[e.PLATFORM_ERROR=18]="PLATFORM_ERROR",e[e.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",e[e.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(ba||(ba={})),function(e){e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW",e[e.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",e[e.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",e[e.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(Pa||(Pa={}));var $a,eu=((Da={})[Pa.OTHER_DEVICE_LOGIN]=$.RC_DISCONN_KICK,Da[Pa.BLOCK]=$.RC_DISCONN_EXCEPTION,Da[Pa.BLOCK_NEW]=$.RC_DISCONN_EXCEPTION,Da[Pa.REDIRECT_NEW]=$.RC_CONN_REDIRECTED,Da[Pa.TOKEN_EXPIRED]=$.RC_CONN_TOKEN_EXPIRED,Da[Pa.ILLEGAL_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,Da[Pa.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,Da),tu=((wa={})[ba.ACCEPTED]=$.SUCCESS,wa[ba.UNACCEPTABLE_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,wa[ba.IDENTIFIER_REJECTED]=$.RC_CONN_IDENTIFIER_REJECTED,wa[ba.SERVER_UNAVAILABLE]=$.RC_CONN_SERVER_UNAVAILABLE,wa[ba.TOKEN_INCORRECT]=$.RC_CONN_TOKEN_INCORRECT,wa[ba.NOT_AUTHORIZED]=$.RC_CONN_NOT_AUTHRORIZED,wa[ba.REDIRECT]=$.RC_CONN_REDIRECTED,wa[ba.PACKAGE_ERROR]=$.RC_CONN_PACKAGE_NAME_INVALID,wa[ba.APP_BLOCK_OR_DELETE]=$.RC_CONN_APP_BLOCKED_OR_DELETED,wa[ba.BLOCK]=$.RC_CONN_USER_BLOCKED,wa[ba.TOKEN_EXPIRE]=$.RC_CONN_TOKEN_EXPIRED,wa[ba.DEVICE_ERROR]=$.RC_CONN_DEVICE_ERROR,wa[ba.HOSTNAME_ERROR]=$.RC_CONN_HOSTNAME_ERROR,wa[ba.HASOHTERSAMECLIENTONLINE]=$.RC_DISCONN_SAME_CLIENT_ON_LINE,wa[ba.OUT_OF_LIMIT]=$.RC_LISCENSE_COUNT_OUT_OF_LIMIT,wa[ba.IN_OTHER_CLUSTER]=$.RC_CONN_WRONG_CLUSTER,wa[ba.APP_AUTH_NOT_PASS]=$.RC_APP_AUTH_NOT_PASS,wa[ba.OTP_USED]=$.RC_OTP_USED,wa[ba.PLATFORM_ERROR]=$.RC_PLATFORM_ERROR,wa[ba.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,wa[ba.LICENSE_EXPIRED]=$.RC_LICENSE_EXPIRED,wa),nu=function(e){return e===$.RC_CONN_REDIRECTED},iu=function(e){return Object.keys(eu).some((function(t){return eu[t]===e}))},ru=function(e){return Object.keys(tu).some((function(t){return tu[t]===e}))};!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}($a||($a={}));var su,ou=function(){function e(e,t,n,i,r){this.appkey=e,this.navi=t,this.logger=n,this.statisticLog=i,this.listener=r,this.token="",this.curCmpUrl="",this.reconnectKick=!1,this._connectDurSwitch=!1,this.retryCount=0,this.uuid="",this.reason=0,this.connectedTime=0,this._network={status:!0,type:sn.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=$a.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus=e,this._connectDurSwitch&&e!==$a.CONNECTED&&e!==$a.CONNECTING){var n={bid:_n(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:this.uuid+"_"+this.retryCount};this.statisticLog.record(Ee.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case $a.CONNECTED:this.logger.info(fe.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case $a.CONNECTING:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),this.listener.onConnecting();break;case $a.SUSPENDED:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),nu(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:this.uuid+"_"+this.retryCount,cn:e.type,on:this._network.type};this.statisticLog.record(Ee.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._crtConnectionStatus===$a.CONNECTED?[2,{code:$.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=wt(),this.token=e,this.reconnectKick=t,this.setConnectionStatus($a.CONNECTING),r={cid:this.uuid+"_"+this.retryCount,reason:Je.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(e,t,!1,i)]);case 1:return s=u.sent(),o=s.code,a=s.data,o!==$.SUCCESS?(this.setConnectionStatus($a.DISCONNECTED,o),[2,{code:o}]):(this.setConnectionStatus($a.CONNECTED),[2,{code:o,data:a}])}}))}))},e.prototype.try2Connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),s=r.code,o=r.data,this._crtConnectionTask=null,[2,{code:s,data:o}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return r={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,i,r)];case 1:return s=l.sent(),o=s.code,a=s.data,o!==$.SUCCESS?[2,{code:o}]:1===(u=a).type?[2,{code:$.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(fe.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),u,t,i)]);case 2:return c=l.sent(),h=c.code,d=c.data,nu(h)?(this.logger.warn(fe.L_CONNECT_R,"redirect code: "+h,i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i)]):[$.RC_TCP_RESET,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(fe.L_CONNECT_R,"cmp ack timeout, code: "+h,i),this.setConnectionStatus($a.SUSPENDED,h),this.setConnectionStatus($a.CONNECTING),[2,this.createConnectionTask(e,t,!1,i)]):h!==$.SUCCESS?(this.logger.warn(fe.L_CONNECT_R,"code: "+h,i),[2,{code:h}]):(this.logger.info(fe.L_CONNECT_R,"userId: "+d,i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case $.TIMEOUT:return void(this.reason=Je.TIMEOUT);case $.RC_CONN_REDIRECTED:return void(this.reason=Je.REDIRECTED);default:this.reason=Je.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(s){return n=this.logger.createTraceId(),this.logger.debug(fe.T,"try2Reconnect -> ignoreNaviCache: "+e+", reason: "+t,n),this.stopReconnectTimer(),i=function(){return c(r,void 0,void 0,(function(){var r,s;return l(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==$a.SUSPENDED?[2]:(this.setConnectionStatus($a.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,r={cid:this.uuid+"_"+this.retryCount,reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return s=o.sent().code,this.reconnectTimer=null,s===$.SUCCESS?(this.setConnectionStatus($a.CONNECTED),[2]):[$.SERVER_UNAVAILABLE,$.TIMEOUT,$.RC_SOCKET_DISCONNECTED,$.RC_SOCKET_NOT_CREATED,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_RESET,$.RC_NAVI_REQ_FAILED,$.RC_NETWORK_DOWN,$.RC_TCP_DISCONNECTED_NO_RMTP].includes(s)?(this._crtConnectionStatus!==$a.CONNECTING||(this.setConnectionStatus($a.SUSPENDED,s),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus($a.DISCONNECTED,s),[2])}}))}))},i(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return nu(e)?(this.setConnectionStatus($a.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===$.RC_UDP_DISCONNECTED?(this.setConnectionStatus($a.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus($a.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus($a.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return c(this,void 0,void 0,(function(){var e,t,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==$a.CONNECTED?(this._failedCount=0,this.logger.debug(fe.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(fe.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===$.SUCCESS?(this.logger.info(fe.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==$a.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(fe.L_CHECK_ALIVE_IM_R,"code: "+t+", count: "+this._failedCount,e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(fe.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus($a.SUSPENDED,$.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,$.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus($a.DISCONNECTED,$.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype._getProtocol=function(e,t,n){return t?1===n?De.TLS:De.RMTP:"http"===e?De.WS:De.WSS},e.prototype.getCmpList=function(e,t){var n=this;if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var i=e.server,r=e.backupServer,s=e.serverAddr,o=e.protocol,a=e.openTLS;if(s){var u=s.filter((function(e){return e.addr}));return this.cmpWeightCache=h([],u,!0),h([],u,!0)}var c=[],l=[];return i&&l.push(i),null==r||r.split(",").forEach((function(e){l.indexOf(e)<0&&l.push(e)})),l.forEach((function(e,r){e&&c.push({addr:e,protocol:n._getProtocol(o,t,a),weight:i.length-r,race:!1})})),this.cmpWeightCache=c,h([],c,!0)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===De.QUIC:t.addr===e}));if(i)if(t){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==r&&(i.weight=r+1)}else{var s=Math.min.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==s&&(i.weight=s-1)}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e}(),au=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=ci(da);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=_t(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var i,r=this,s=e,o=((i={})[_s]=r._formatSyncMessages,i[gs]=r._formatReceivedMessage,i[ds]=r._formatSentMessage,i[Cs]=r._formatHistoryMessages,i[ms]=r._formatConversationList,i[ks]=r._formatChatRoomInfos,i[Xs]=r._formatChatRoomKVList,i[ro]=r._formatUserSetting,i[ao]=r._formatConversationStatus,i[vo]=r._formatGrpReadReceiptQryResp,i[Jo]=r._formatQueryReceiptResp,i[no]=r._formatSetUserSettingOutput,i[so]=r._formatUserSettingNotification,i[Po]=r._formatUltraMsgChangeList,i[Bo]=r._formatUltraOperateStatusNotifyList,i[Vo]=r._formatUltraMsgList,i[fo]=r._formatUltraGroupUnreadMentionedList,i[Gs]=r._formatChrmKVVersion,i[jo]=r._formatCallKVInfo,i[qo]=r._fromatCallInfoDownStream,i[ws]=r._formateSessionMsgReadInput,i)[t];try{s=e.length>0&&r._codec[t].decode(e),Tt(s)&&(s=function(e){for(var t in e)Tt(e[t])&&(e[t]=an(e[t]));return e}(s)),It(o)&&(s=o.call(this,s,n))}catch(e){this.logger.error(fe.L_PB_DECODE_E,t)}return s},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=_t(n)?new Uint8Array(n):n;return dr.readUTF(r.subarray(t,i))}catch(e){this.logger.error(fe.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(fe.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,s=e.finished;return(vt(s)||null===s)&&(e.finished=!0),e.syncTime=an(r),e.list=Sn(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,i=t.portraitUri,r=n||i;r&&(e.user.portrait=e.user.portraitUri=r)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return Cn(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,i=e.pushExt,r=e.configFlag,s={};return i&&(s=hn(t,i.pushConfigs,i.pushId)),u(u({},s),{pushTitle:null==i?void 0:i.title,pushContent:n,pushData:"",disablePushTitle:!!r&&Boolean(4&r),forceShowDetailContent:!!r&&Boolean(8&r),templateId:null==i?void 0:i.templateId})},e.prototype._formatReceivedMessage=function(e,t){var i;if(!e)return e;var r=this,s=t||{},o=s.currentUserId,a=s.connectedTime,u=s.afterDecode,c=s.customMessageTypes,l=void 0===c?{}:c,h=e.content,d=e.fromUserId,p=e.type,g=e.groupId,_=e.status,f=e.dataTime,E=e.extraContent,T=e.extStatus,I=e.clientUniqueId,v=e.busChannel,R=e.msgId,C=e.classname,S=e.toUserIds,m=e.direction||Z.RECEIVE,y=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(_),A=y.isPersited,N=y.isCounted,O=y.isMentioned,M=y.disableNotification,L=y.receivedStatus,U=y.canIncludeExpansion,b=!!(2&(T||0)),P=!!(4&(T||0)),D=!!(8&(T||0))?Be.PRIVATE:Be.PUBLIC,w=[te.GROUP,te.CHATROOM,te.RTC_ROOM,te.ULTRA_GROUP].indexOf(p)>-1?g:d,V=d,G=Z.RECEIVE;m===Z.SEND&&(V=o,G=Z.SEND);var B=an(f),k=B<a,x=p===te.CHATROOM,F=r._setExpansion(E),H=r._formatBytes(h);H=r._getUtfContent(H);var Y=r._setPushConfig(e,this.logger);x&&d===o&&(G=Z.SEND);var q={conversationType:p,targetId:w,senderUserId:V,messageType:C,messageUId:R,isPersited:A,isCounted:N,isMentioned:O,sentTime:B,messageDirection:G,receivedTime:wn.getTime(),disableNotification:M,receivedStatus:L,receivedStatusInfo:bn(L),canIncludeExpansion:U,content:H,expansion:F,pushConfig:Y,channelId:v||"",isInterrupt:b,isModifyMessage:P,messageId:an(I)||0,sentStatus:ye.SENT,isOffLineMessage:k,channelType:D,isStatusMessage:(null===(i=l[C])||void 0===i?void 0:i.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:S};return(null==u?void 0:u(q))||q},e.prototype._formatSentMessage=function(e,t){var i=this,r=e.content,s=e.classname,o=e.sessionId,a=e.msgId,c=e.extraContent,l=e.pushExt,h=e.pushContent,d=e.configFlag,p=e.extStatus,g=e.clientUniqueId,_=e.systemId,f=e.toUserIds,E=t.signal,T=t.currentUserId,I=E.date,v=E.topic,R=E.targetId,C=!!(2&(p||0)),S=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}}(o),m=S.isPersited,y=S.isCounted,A=S.disableNotification,N=S.canIncludeExpansion,O=S.isMentioned,M=nr[v]||te.PRIVATE,L=An(Ui,v),U=i._formatBytes(r),b=_||R;s===se.RECALL&&(M=U.conversationType||M,b=U.targetId||R);var P=i._setExpansion(c),D=i._setPushConfig(e,this.logger),w=u(u({},D),{pushTitle:null==l?void 0:l.title,pushContent:h,pushData:h,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==l?void 0:l.templateId});return{conversationType:M,targetId:b,messageType:s,messageUId:a,isPersited:m,isCounted:y,isStatusMessage:L,senderUserId:T,content:i._formatBytes(r),sentTime:1e3*I,receivedTime:wn.getTime(),messageDirection:Z.SEND,isOffLineMessage:!1,disableNotification:A,canIncludeExpansion:N,expansion:P,pushConfig:w,channelId:e.busChannel||"",isInterrupt:C,messageId:an(g)||0,receivedStatus:n.UNREAD,receivedStatusInfo:bn(n.UNREAD),isMentioned:O,directedUserIds:f}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,s=e.hasMsg,o=i.targetId,a=an(e.syncTime),u=[];return Cn(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===te.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,i=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,i=e.time,r=e.changeType,s=e.msgUID,o=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType,g=e.remindType;return{targetId:t,conversationType:n,changeType:r,messageUId:s,changeTime:an(i),sendTime:an(o),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:i}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,i=e.info,r=e.summary,s=[],o=[],a=!(2&~n),u=!(1&~n);return u&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,o=e.optime,a=an(o);s.push({targetId:t,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.count,r=e.opType;o.push({targetId:t,channelId:n,count:i,operationType:r})})),{conversationType:t,info:s,summary:o,hasInfo:u,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,i=e.list;return{list:i&&i.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,sentTime:an(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,i=t.unreadCount,r=t.remindCount,s=t.busChannelType,o=t.msgInfo,a=t.remindMeCount;return e.versionTime=an(n)||0,e.unreadMessageCount=this._getUnreadCount(an(i)||0),e.unreadMentionedCount=this._getUnreadCount(an(r)||0),e.unreadMentionedMeCount=this._getUnreadCount(an(a)||0),e.channelType=s||Be.PUBLIC,e.lastReadTime=0,o&&(e.firstUnreadMessage={sentTime:an(o.msgTime)},e.lastReadTime=an(o.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,i=this,r=e.info,s=t.afterDecode,o={list:(r=Sn(r,(function(e){var r=e.msg,o=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,t)).targetId=o);var h={targetId:o,conversationType:a,unreadMessageCount:an(u)||0,latestMessage:l,channelId:c||""};return a===te.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==s?void 0:s(h))||h})))||[]};return((null==t?void 0:t.conversationType)||te.NONE)===te.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:Sn(n,(function(e){var t=e.id,n=e.time;return{id:t,time:an(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=Sn(t=t||[],(function(e){var t=e.key,n=e.value,i=e.status,r=e.timestamp,s=e.uid,o=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?Ie.DELETE:Ie.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:s,timestamp:an(r),version:an(o)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return Cn(n||[],(function(e){var n=e.key,i=e.version,s=e.value;e.version=an(i),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=an(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return Cn(t,(function(e){var t=e.type,i=e.channelId,r=e.time,s=e.stateItem,o=e.busChannel,a=ae.CLOSE,u=ce.NOT_SET,c=!1,l=[];Cn(s,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case ar:a=n===sr?ae.OPEN:ae.CLOSE,u=Number(n)||ce.NOT_SET;break;case ur:c=n===sr;break;case cr:l=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:an(r),tags:l,channelId:o||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=an(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatQueryReceiptResp=function(e){var t=e.list,n=void 0===t?[]:t,i=e.num,r=e.readCnt;return{list:n.map((function(e){return{readTime:an(e.receiptTime),userId:e.userId}})),totalCount:i,readCount:r}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,i=e.memberCount,r=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:an(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype._formateSessionMsgReadInput=function(e){var t=e.busChannel,n=e.channelId,i=e.msgTime;return{conversationType:e.type,targetId:n,channelId:t||"",timestamp:i}},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(fs);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var i,r,s;return{userIdList:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.userIdList)||t,type:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.type)||n||he.ALL,mentionedContent:(null===(s=e.mentionedInfo)||void 0===s?void 0:s.mentionedContent)||""}},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,i=e.pushConfig||{},r=0;return r|=n?1:0,r|=t?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,i=e.androidConfig,r=e.templateId,s=void 0===r?"":r,o=this._codec.getModule(ps);if(t&&o.setTitle(t),n||i){var a=ln(n,i);o.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&o.setPushId(null==i?void 0:i.notificationId),o.setTemplateId(s),o},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,i=t.isMentioned,r=t.mentionedType,s=t.content,o=t.directionalUserIdList,a=t.canIncludeExpansion,u=t.expansion,c=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,p=t.mentionedUserIdList,g=void 0===p?[]:p,_=t.pushContent,f=void 0===_?"":_,E=t.messageId,T=void 0===E?0:E,I=e.conversationType,v=e.targetId,R=this._codec.getModule(ds),C=function(e){var t=e.isStatusMessage,n=e.isPersited,i=e.isCounted;t&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),e.isMentioned&&(r|=4),e.disableNotification&&(r|=32),e.canIncludeExpansion&&(r|=64),r}(t),S=c||{},m=S.pushContent,y=void 0===m?f:m,A=S.pushData,N=void 0===A?d:A;R.setSessionId(C),i&&s&&(s.mentionedInfo=this._updateMentionedInfo(s,g,r)),y&&R.setPushText(y),N&&R.setAppData(N),o&&R.setToUserIds(o);var O=this._calculateFlag(t);if(R.setConfigFlag(O),R.setClassname(n),s.user&&s.user.portraitUri&&(s.user.portrait=s.user.portraitUri),R.setContent(JSON.stringify(s)),a&&u){var M={};Cn(u,(function(e,t){M[t]={v:e}})),R.setExtraContent(JSON.stringify(M))}if(c){var L=this._getPushExtraModule(c);R.setPushExt(L)}return R.setClientUniqueId(T),vt(l)||R.setBusChannel(l),I===te.SYSTEM&&R.setSystemId(v),R},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,i=e.broadcastSyncTime,r=this._codec.getModule(Ts);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Is);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,i=t.order,r=t.timestamp,s=t.channelId,o=this._codec.getModule(Rs);return o.setTargetId(e),o.setTime(r),o.setCount(n),o.setOrder(i),o.setBusChannel(s||""),o.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Mo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var s=this._codec.getModule(Ss);return s.setType(n),s.setCount(t),s.setStartTime(i),s.setOrder(r),s.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,i=this._codec.getModule(Us);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeBatchDeleteConversation=function(e){var t=this,n=this._codec.getModule(Ms),i=[];return e.forEach((function(e){var n=e.conversationType,r=e.targetId,s=e.channelId,o=t._codec.getModule(Ls);o.setConversationType(n),o.setConversationId(r),o.setBusChannel(s||""),i.push(o)})),n.setRelation(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(bs),s=[];return Cn(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(s),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(Ps);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeBatchClearRemoteMessages=function(e){var t=this,n=this._codec.getModule(Ds),i=e.map((function(e){var n=t._codec.getModule(Ps);return n.setTargetId(e.targetId),n.setConversationType(e.conversationType),n.setBusChannel(e.channelId),n.setDataTime(e.timestamp),n}));return n.setInput(i),n.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,s=t.timestamp,o=this._codec.getModule(ws);return s=s||+new Date,o.setType(n),o.setChannelId(i),o.setMsgTime(s),o.setBusChannel(r),o.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,s=e.messageUId,o=e.sendTime,a=e.keys,u={mid:s,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(Lo);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(s),c.setMsgTime(o),c.setContent(JSON.stringify(u)),c.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,s=e.messageUId,o=e.sendTime,a=e.content,u=this._codec.getModule(Lo);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(s),u.setMsgTime(o),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(Uo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,i=e.messages,r=this._codec.getModule(Do),s=i.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return r.setTargetId(t),r.setType(n),r.setQuery(s),r.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,i=e.sentTime,r=e.count,s=this._codec.getModule(_o);return s.setGroupId(t),s.setBusChannel(n),s.setMsgTime(i),s.setSize(r),s.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,i){var r=this._codec.getModule(Go);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Vs);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Bs);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(go);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(po);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i,r){var s=this._codec.getModule(xs);return s.setType(e),s.setKey(t),s.setHttpMethod(n),s.setQueryString(i),s.setUrl(r),s.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i){var r=this._codec.getModule(e);return r.setType(t),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i=this._codec.getModule(Qs),r=t.key,s=t.value,o=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||Ie.UPDATE,h=Vn(t,l),d={key:r,value:s||"",uid:n,version:c};if(vt(h)||(d.status=h),i.setEntry(d),a){var p={conversationType:te.CHATROOM,targetId:e},g={key:r,value:s,extra:o,type:l},_=this._getUpMsgModule(p,{messageType:se.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i.setNotification(_),i.setBNotify(!0),i.setType(te.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var i=this._codec.getModule(Ws),r=t.entries,s=t.type||Ie.UPDATE,o=Vn(t,s),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};vt(o)||(t.status=o),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(eo);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(io);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(oo);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i=this._codec.getModule(lo),r=wn.getTime(),s=[];return Cn(e,(function(e){var t=n._codec.getModule(uo),i=e.conversationType,o=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(i),t.setChannelId(o),t.setTime(r),t.setBusChannel(c);var d=a===ae.OPEN,p={};vt(a)||(p[ar]=d),vt(l)||(p[ar]=l),vt(u)||(p[ur]=u),Cn(p,(function(e,t){if(!vt(e)){var i=n._codec.getModule(co);e=e?sr:or,vt(l)||Number(t)!==ar||(e=String(l)),i.setSessionStateType(Number(t)),i.setValue(e),h.push(i)}})),t.setStateItem(h),s.push(t)})),i.setVersion(t||r),i.setState(s),i.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(To);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i=this._codec.getModule(Co),r=[];return e.forEach((function(e){var t=n._codec.getModule(So);t.setTagId(e.tagId),t.setName(e.tagName),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(To);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeReadReceiptMsg=function(e,t,n){var i=this._codec.getModule(Qo),r=e.conversationType,s=e.targetId,o=e.channelId,a=void 0===o?"":o;return i.setType(r),i.setTargetId(s),i.setBusChannel(a),i.setStartMsgId(t),i.setEndMsgId(n),i.getArrayData()},e.prototype.encodeReceiptQryReq=function(e,t){var n=this._codec.getModule(Wo),i=e.targetId,r=e.channelId,s=void 0===r?"":r;return n.setTargetId(i),n.setBusChannel(s),n.setMsgId(t),n.getArrayData()},e.prototype.encodeReceiptCntQryReq=function(e,t){var n=this._codec.getModule(Zo),i=e.targetId,r=e.conversationType,s=e.channelId,o=void 0===s?"":s;return n.setChannelId(i),n.setBusChannel(o),n.setType(r),n.setMsgId(t),n.getArrayData()},e.prototype.encodeSessionMsgReadInput=function(e,t){var n=this._codec.getModule(ws),i=e.conversationType,r=e.targetId,s=e.channelId,o=void 0===s?"":s;return n.setType(i),n.setChannelId(r),n.setBusChannel(o),n.setMsgTime(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i=this._codec.getModule(mo),r=[];return e.forEach((function(e){var t=n._codec.getModule(So);t.setTagId(e),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(yo);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t,n){var i=this,r=this._codec.getModule(lo),s=[];return t.forEach((function(t){var n=i._codec.getModule(uo),r=i._codec.getModule(co),o=[];e.forEach((function(e){var t=i._codec.getModule(So);t.setTagId(e.tagId),vt(e.isTop)||t.setIsTop(e.isTop),o.push(t)})),r.setSessionStateType(cr),r.setValue(JSON.stringify(o)),r.setTags(o),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),s.push(n)})),r.setState(s),r.setVersion(n),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Ao);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(Oo);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(Fo);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(Yo);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(Ko);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeUpdateUserSubReq=function(e,t,n,i){var r=this,s=this._codec.getModule(ea);s.setSubType(e),s.setOpType(n),s.setExpiry(i);var o=[];return t.forEach((function(e){var t=r._codec.getModule(ta);t.setSubUserId(e),o.push(t)})),s.setSubUsers(o),s.getArrayData()},e.prototype.encodePullUserSubReq=function(e){var t=e.version,n=e.pageToken,i=this._codec.getModule(ra);return i.setVersion(t),i.setPageToken(n),i.getArrayData()},e.prototype.encodePullSubDataReq=function(e){var t=e.version,n=e.needAllData,i=e.pageToken,r=this._codec.getModule(oa);return r.setVersionTime(t),r.setNeedAllData(n),r.setPageToken(i),r.getArrayData()},e.prototype.encodeQrySubDataReq=function(e,t){var n=this,i=this._codec.getModule(la);i.setSubType(e);var r=[];return t.forEach((function(e){var t=n._codec.getModule(ta);t.setSubUserId(e),r.push(t)})),i.setSubUsers(r),i.getArrayData()},e}(),uu=function(e){function t(t,n,i,r,s,o){var a=e.call(this,t,n,i,r,o)||this;return a.runtime=s,a.wsListener=o,a._socket=null,a._connectedTime=0,a._socketIndex=0,a._localConnectedTime=0,a._idCount=0,a._generateMessageId=function(){return a._idCount>=65535&&(a._idCount=0),++a._idCount},a._messageIds={},a._syncMessageIds={},a.codec=new au(a.logger),a}return a(t,e),t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},t.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getDelayTime=function(){return this._localConnectedTime-this._connectedTime},t.prototype.connectWithToken=function(e,t,n,i){return c(this,void 0,void 0,(function(){var n,r,s,o,a,u,c,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=t.openAnti,r=t.type,s=this.getCmpList(t),this.logger.debug(fe.L_NAVI_CMP_R,JSON.stringify(s),i),0===(o=s.filter((function(e,t){return s.findIndex((function(t){return t.addr===e.addr}))===t})).sort((function(e,t){return e.weight>t.weight?-1:1}))).length)return this.logger.error(fe.L_NAVI_CONF_E,"no service available",i),[2,{code:$.SERVER_UNAVAILABLE}];a=1===n?Ri.V4:Ri.V3,u=function(t){var n,s,u,h,d,p,g,_,f,E,T;return l(this,(function(l){switch(l.label){case 0:return n=o[t],s=n.protocol,u=n.addr,h=n.weight,d=function(e,t,n,i,r,s,o){var a=Xa(r),u=a.type,c=a.version,l="browser"===r.tag?"|"+u+"|"+c:"||",h=o?"&protocolVer="+o:"";return e+"://"+t+"/websocket?appId="+n+"&token="+encodeURIComponent(i)+"&sdkVer="+F+"&pid="+s+"&apiVer="+(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l))+(r.connectPlatform?"&platform="+r.connectPlatform:"")+h}(s===De.WS?"ws":"wss",u,c.appkey,e,c.runtime,"",a),p=Date.now(),[4,c.connectWebSocket(d,a,i)];case 1:return g=l.sent(),_=g.code,f=g.data,E=c.cmpWeightCache.findIndex((function(e){return e.addr===u})),T={bid:_n(),ptc:Ke.WS,cod:_,net:c.getNetwork().type,dur:Date.now()-p,spr:0,pr:r||0,hos:u,idx:E,rct:c.retryCount?We.RECONNECT:We.CONNECT,cid:c.uuid+"_"+c.retryCount,v:Qe.CURRENT,rsn:c.reason,count:c.retryCount,weight:h},c.statisticLog.record(Ee.IM_WEBSOCKET,JSON.stringify(T),i),_===$.RC_SOCKET_DISCONNECTED||_===$.TIMEOUT?[2,"continue"]:_!==$.SUCCESS?[2,{value:{code:_}}]:(c._localConnectedTime=Math.floor((Date.now()+p)/2),c._socket=f.socket,c.updateCmpWeight(o[t].addr,!0),c.curCmpUrl=o[t].addr,[2,{value:{code:_,data:f.userId}}])}}))},c=this,h=0,p.label=1;case 1:return h<o.length?[5,u(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:$.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(fe.T,"connect start: "+e,n),[2,new Promise((function(r){var s=i.runtime.createWebSocket(e);i._socketIndex=s.id;var o=setTimeout((function(){i.logger.info(fe.T,"connect timeout: "+e,n),r({code:$.TIMEOUT}),s&&s.close()}),5e3);s.onOpen((function(){clearTimeout(o),i.logger.info(fe.T,"socket open",n)})),s.onMessage((function(e){if(i._socketIndex===s.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var o,a=Ur(i.logger,e,t);if(a instanceof Tr){var u=a.status;if(u!==ba.ACCEPTED)return i.logger.info(fe.T,"connect failed: "+u,n),void r({code:(o=u,tu[o])});i.logger.info(fe.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:$.SUCCESS,data:{userId:l,socket:s}})}if(a instanceof Ir){var d=a.status;return i.logger.info(fe.T,"recv disconnect signal -> status: "+d),void i.onRecvDisconnect(d,s)}i._onReceiveSignal(a)}}else i.logger.warn(fe.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:s.id}))})),s.onClose((function(){i.logger.info(fe.T,"socket close",n);var e=$.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(s,e)})),s.onError((function(e){i.logger.info(fe.T,"socket error",n);var t=$.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(s,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==Ti.AT_MOST_ONCE&&(e instanceof mr&&!e.syncMsg&&(this.logger.debug(fe.O,"send pubAck -> "+t+" "+e.topic),this.sendOnly(new Nr(t))),e instanceof Lr&&(this.logger.debug(fe.O,"send queryCon -> "+t+" "+e.topic),this.sendOnly(new Mr(t))))},t.prototype._publishReader=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s=this;return l(this,(function(o){switch(o.label){case 0:return n=e.syncMsg,i=e.topic,this.logger.debug(fe.O,"recv PublishReader -> messageId: "+t+" "+i),i===Kn?[2]:!n||function(e){return[br.ppMsgS,br.pgMsgS,br.chatMsgS].map((function(e){return br[e]})).indexOf(e)>=0}(i)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){s._syncMessageIds[t]=e}))];case 1:return r=o.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,r),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.messageId,e instanceof Rr&&this._pingResolve?(this._pingResolve($.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e,t),t>0&&(e instanceof Ar||e instanceof Lr)&&(this.logger.debug(fe.O,"recv ack -> messageId: "+t+" "+e.topic),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof mr?[4,this._publishReader(e,t)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.onRecvDisconnect=function(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(e){return eu[e]}(e)))},t.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))},t.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t($.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n($.TIMEOUT)}),e),t.sendOnly(new vr)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof yr||e instanceof Or)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),c(this,void 0,void 0,(function(){var r,s,o,a,u=this;return l(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[r]=e,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],e()}),i)}))]):[2,{code:$.RC_NET_CHANNEL_INVALID}];case 1:return(s=c.sent())?s instanceof Lr||s instanceof Ar?(o=t&&s.data&&[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,$.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT].indexOf(s.status)>=0,a=o?this.codec.decodeByPBName(s.data,t,n):s,0!==s.status?(this.logger.warn(fe.O,"send failed -> message: "+r+", respPBName: "+t+", status: "+s.status),[2,{code:s.status,data:t&&s.data?a:null}]):[2,{code:$.SUCCESS,data:a}]):[2,{code:s}]:(this.logger.warn(fe.O,"send timeout -> message: "+r+", respPBName: "+t+", timeout: "+i),[2,{code:$.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(ou);!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD"}(su||(su={}));var cu=null,lu="RC_CONF",hu="RC_STATISTICS",du=null,pu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,cu];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(hu,"readwrite").objectStore(hu).index("time"),r=IDBKeyRange.upperBound(Date.now()-e),s=i.openCursor(r);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):n()},s.onerror=function(){n()}}))]:[2];case 2:return n.sent(),du=setTimeout((function(){return pu(e)}),6e5),[2]}}))}))},gu=function(e,t,n){void 0===n&&(n=168),cu||("undefined"!=typeof window&&window&&window.indexedDB?cu=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var s="RC_STATISTIC_"+e,o=r.open(s,2);o.onerror=function(e){t.error(fe.L_LOGDB_OPEN_FAILED_E,e.target.error),i(null)},o.onsuccess=function(r){var s=r.target.result;s?(s.onclose=function(e){cu=null,t.warn(fe.L_LOGDB_CLOSED_S)},s.onerror=function(e){cu=null,t.error(fe.L_LOGDB_ERROR_E,e.target.error)},s.onabort=function(e){t.info(fe.L_LOGDB_ABORT_S,e.target.error)},pu(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:e,db:s})):i(null)},o.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(hu)&&t.deleteObjectStore(hu);var n=t.createObjectStore(hu,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(lu,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(fe.L_UNSUPPORT_INDEXDB_O))},_u=[],fu=function(){return c(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return cu?(du&&(clearTimeout(du),du=null),[4,cu]):[2];case 1:return(e=n.sent())&&(t=e.db,_u.push(t)),cu=null,[2]}}))}))};function Eu(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,cu];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(lu,"readonly").objectStore(lu).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Tu,Iu="REPORT_SESSION",vu=function(e,t){return c(void 0,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return n=Iu+"_"+e,[4,Eu(Iu+"_"+e)];case 1:return i=o.sent(),r=i.success,s=i.value,r?(t===(null==s?void 0:s.sessionId)||function(e,t){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,cu];case 1:return(n=r.sent())?(i=n.db,i.transaction(lu,"readwrite").objectStore(lu).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Ru=function(){return cu},Cu=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,s=e.time,o=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return t+","+s+","+a+","+n+","+o+","+(c='"'+c.replace(/"/g,'""')+'"')+"\n"},Su=Vt(),mu=Date.now(),yu=0,Au=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.record=this._writer.bind(this,su.STATISTICS)}return e.prototype._writer=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)&&this.flush({time:+r,sessionId:Su,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})},e.prototype.createTraceId=function(){return Su+"-"+ ++yu},e.prototype.getSessionId=function(){return Su},e}(),Nu=function(){function e(e,t,n,i,r,s){void 0===s&&(s=r),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=s,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=Si.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(fe.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressStatistics(e)];case 1:return s=l.sent(),o=s.success,a=s.data,o||this.logger.warn(fe.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(fe.L_REALTIME_LOG_O,"compress done",t),u=Ct(n)?n:"https://"+n,u+="?version=5.9.8&appkey="+this.appkey+"&userId="+this.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web",[4,this.send({url:u,body:a,method:"POST"})];case 2:return c=l.sent().status,this.logger.debug(fe.L_REALTIME_LOG_R,JSON.stringify({status:c}),t),200===c?(this.reportFailedNumber=0,r=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||mu,s=Math.max(i-5e3,r),o=this.reportClass.createTraceId(),this.logger.debug(fe.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:s,level:t}),o),[4,this.statisticDB.getStatistics(r,s,t,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(fe.L_REALTIME_LOG_R,"db error",o),[3,4]);case 2:return c.length>0?[4,this._sendLogs2Realtime(c,o,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(o=this.reportClass.createTraceId(),this.logger.info(fe.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:s}),o),[4,this.statisticDB.getStatistics(e,t,su.STATISTICS,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(fe.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),o),h=Ct(i)?i:"https://"+i,h+="?version=5.9.8&appkey="+this.appkey+"&userId="+this.userId+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web&logId="+r,u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,_=p.data,d=g?_:"compress failed",[3,4];case 3:d="no data",l.label=4;case 4:return[3,6];case 5:d="no database",l.label=6;case 6:return this.logger.debug(fe.L_REPORT_FULL_LOG_O,"compress done",o),[4,this.send({url:h,body:d,method:"POST"})];case 7:return f=l.sent().status,this.logger.info(fe.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),o),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Ou="RC_STATISTICS",Mu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){Pu(e)},t}(Au),Lu=!1,Uu=[],bu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return Lu||0===Uu.length?[2]:(Lu=!0,t=Uu.splice(0),[4,new Promise((function(n){var i=e.transaction(Ou,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Ou);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Lu=!1,0===Uu.length&&_u.length>0&&(_u.forEach((function(e){return e.close()})),_u.length=0),setTimeout((function(){return bu(e)})),[2]}}))}))},Pu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Ru()];case 1:return(t=n.sent())?(Uu.push(e),bu(t.db),[2]):[2]}}))}))},Du=0,wu=function(e){function t(t,n,i,r){var s=this,o=Gt(n),a=Xa(n),u=a.type+"|"+a.version+"|"+r.getSessionId();return s=e.call(this,t,o,u,{setTimestamp4RealtimeLog:function(e){Du=e},getTimestamp4RealtimeLog:function(){return Du},getStatistics:function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,Ru()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(Ou,"readonly").objectStore(Ou),s=[],o=IDBKeyRange.bound(e,t),a=r.index("time").openCursor(o);a.onsuccess=function(e){var t=e.target.result;if(t){var n=t.value;s.push(n),t.continue()}else i({dbReady:!0,logs:s})},a.onerror=function(e){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}},i,r)||this,s.runtime=n,s}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,vu(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:Qa(e.map(Cu).join(""))}]}))}))},t.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),c(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(s){switch(s.label){case 0:return[4,Eu(Iu+"_"+t)];case 1:return e=s.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,e.prototype.report.call(this,t,n,i,r,s,o)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Nu),Vu=function(e){function t(t,n,i){var r=e.call(this,t,n)||this;return r.appkey=t,r.logger=n,r.runtime=i,r._storageKey="",r._storageKey=Q.STATIC_CONFIG_KEY(t),r}return a(t,e),t.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},t.prototype.setCache=function(e){this.runtime.localStorage.setItem(this._storageKey,e)},t.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},t.prototype.sendRequest=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:e})];case 1:return t=r.sent(),n=t.status,i=t.data,[2,{code:n,data:i}]}}))}))},t.prototype.decryptData=function(e){return c(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,fn(e,U,b)];case 1:return t=i.sent(),[2,JSON.parse(t)];case 2:return n=i.sent(),this.logger.error(fe.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},t}(mi),Gu=function(){function e(e){this.reporter=e,this.logId="",this.uploadTask=[],this.taskLock=!0}return e.prototype.uploadLogCmdTask=function(e){this.uploadTask.push(e),this.enqueueTask()},e.prototype.reportLogCmdTask=function(e){var t,n,i,r,s=this;this.taskLock=!1;var o=null!==(t=e.startTime)&&void 0!==t?t:0,a=null!==(n=e.endTime)&&void 0!==n?n:0,u=null!==(i=e.platform)&&void 0!==i?i:"",c=null!==(r=e.uri)&&void 0!==r?r:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(o,a,u,c,e.logId,"",!0).finally((function(){s.taskLock=!0,s.uploadTask.length>0&&s.enqueueTask()})))},e.prototype.enqueueTask=function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}},e}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(Tu||(Tu={}));var Bu={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}};function ku(){return Bu}var xu=function(){function e(e,t,n,i){this.logger=e,this.appkey=t,this.reporter=n,this.statisticLog=i,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new Gu(n)}return e.prototype.init=function(){try{var e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):ku()}catch(e){this._cache=ku()}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))},e.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},e.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},e.prototype.logCmdMsgTasks=function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===se.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,St(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)},e.prototype.request=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:return!this.isEable&&t===Tu.init&&this.isExire()?(this.logger.info(fe.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===Tu.newWorkChange&&this.isOverclock()?(this.logger.info(fe.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(i=En(e),this.lastRequestTime=(new Date).getTime(),r=i+"/v1/config",s={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(s["RC-Token"]=n),o={platform:"web",version:"5.9.8",timestamp:this.timestamp},this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:r})),[4,this.httpRequest(r,rn.POST,s,o)]);case 1:return a=l.sent(),u=a.code,c=a.data,this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),u===$.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(h=c.targetRegion,this.changeAreaCode===h?[2,this.timestamp]:(d=Si.setAreaCode(h),this.logger.info(fe.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:d,originAreaCode:Si.getAreaCode(),newAreaCode:h})),this.changeAreaCode=h,(p=Si.getCloudControllerUrl(h))[0]?[2,this.request(p[0],Tu.other)]:(this.logger.info(fe.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:r,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))},e.prototype._handleMrtrData=function(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}},e}(),Fu=function(e){function t(t,n,i,r,s){var o=e.call(this,i,t,r,s)||this;o.runtime=n,o._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var a=Mn(n);return o.deviceId=Gt(n),o.model="Web|"+a.type+"|"+a.version,o.init(),o}return a(t,e),t.prototype.httpRequest=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return(r=i).deviceId=this.deviceId,r.model=this.model,s={url:e,method:t,headers:n,body:JSON.stringify(r)},this.logger.info(fe.L_REQUEST_T,JSON.stringify(s)),[4,this.runtime.httpReq(s)];case 1:o=l.sent(),a=o.status,u=o.data,c=void 0===u?"":u,this.logger.info(fe.L_REQUEST_R,JSON.stringify({status:a,data:c}));try{return h=JSON.parse(c),d=h.data,[2,{code:parseInt(h.code,10),data:d}]}catch(e){return this.logger.warn(fe.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:c,error:e})),[2,{code:a,msg:e}]}return[2]}}))}))},t.prototype.setCloudControllerCache=function(e){var t=Q.CLOUD_CONTROL_KEY(this.appkey);this.runtime.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(fe.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},t.prototype.getLocalCloudControllerCache=function(){var e=Q.CLOUD_CONTROL_KEY(this.appkey),t=this.runtime.localStorage.getItem(e);return this.logger.info(fe.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t},t.prototype.setMRTRConfig=function(e){this.logger.info(fe.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e},t.prototype.getMRTRConfig=function(){return this._mrtr},t}(xu),Hu=function(){function e(e,t,n,i){this._storage=new s(e,Q.READ_RECEIPT_KEY(t,n)),this._delayTime=i,this.clear()}return e.prototype._getConversationKey=function(e){return e.targetId+"_"+e.channelId},e.prototype._removeExcessData=function(e){for(var t=Object.keys(e).map((function(t){return{key:t,value:e[t]}})).sort((function(e,t){return e.value.t-t.value.t})).slice(-30),n={},i=0,r=t;i<r.length;i++){var s=r[i];n[s.key]=s.value}return n},e.prototype.insert=function(e,t,n,i,r){var s;if(!(i<Date.now()-this._delayTime-j)){var o=this._getConversationKey(e),a=this._storage.get(o)||{};if(!a[t]){var c={t:i,d:n};r&&(c.sId=r);var l=u(u({},a),((s={})[t]=c,s));Object.keys(l).length>30&&(l=this._removeExcessData(l)),this._storage.set(o,l)}}},e.prototype.addReadedUser=function(e,t,n){var i,r=this._getConversationKey(e),s=this._storage.get(r)||{},o=s[t];if(o){if(o.us){if(o.us.includes(n))return}else o.us=[];o.us.push(n),this._storage.set(r,u(u({},s),((i={})[t]=o,i)))}},e.prototype.getReadReceiptInfo=function(e,t){var n=this._getConversationKey(e),i=(this._storage.get(n)||{})[t];return i?{time:i.t,direction:i.d,users:i.us||[],senderId:i.sId}:null},e.prototype.getReceiptMessageDic=function(e){var t=this._getConversationKey(e),n=this._storage.get(t)||{},i={};for(var r in n){var s=n[r];s.d===Z.RECEIVE&&(i[s.sId]||(i[s.sId]=[]),i[s.sId].push(r))}return i},e.prototype.remove=function(e,t){var n=this._getConversationKey(e),i=this._storage.get(n)||{};i[t]&&(delete i[t],0===Object.keys(i).length?this._storage.remove(n):this._storage.set(n,i))},e.prototype.clear=function(){var e=this._storage.getValues(),t={};for(var n in e){var i=e[n],r={};for(var s in i){var o=i[s];Date.now()-this._delayTime-o.t<j&&(r[s]=o)}Object.keys(r).length&&(t[n]=r)}this._storage.update(t)},e}(),Yu=function(){function e(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._onLineStatusSubData={}}return e.prototype.updateRelationshipStatusVersion=function(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)},e.prototype.getRelationshipStatusVersion=function(){return this._relationshipStatusVersion},e.prototype.updateSubscribeUserStatusVersion=function(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)},e.prototype.getSubscribeUserStatusVersion=function(){return this._subUserStatusVersion},e.prototype.updateSubscribeRelation=function(e,t){var n=this;void 0===t&&(t=!1);var i=[],r=[];return t&&(this._onLineStatusSubData={}),e.reduce((function(e,t){return t.subUsers.forEach((function(n){var i=e.find((function(e){return e.subscribeType===t.subType&&e.userId===n.subUserId}));i?i.subscribeTime<t.subTime&&(i.expiry=t.expiry,i.operationType=t.opType,i.subscribeTime=t.subTime):e.push({userId:n.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e}),[]).forEach((function(e){var t=e.userId,s=e.subscribeTime,o=e.subscribeType;e.expiry;var a=e.operationType;if(o===ze.ONLINE_STATUS){if(a===$e.UNSUBSCRIBE){if(!n._onLineStatusSubData[t])return;return delete n._onLineStatusSubData[t],void r.push(e)}var c=n._onLineStatusSubData[t];if(c&&c.subscribeTime>=s)return;i.push(t),r.push(e),n._onLineStatusSubData[t]=u(u({},e),{statusMap:(null==c?void 0:c.statusMap)||{}})}})),{newSubscribeUsers:i,subscribeUserChangeList:r}},e.prototype.updateSubscribeUserStatus=function(e,t){var n=this;void 0===t&&(t=!1);var i=[];return t&&Object.keys(this._onLineStatusSubData).forEach((function(e){n._onLineStatusSubData[e].statusMap={}})),e.forEach((function(e){var t=e.subUserId,r=e.subType,s=e.data;if(r===ze.ONLINE_STATUS){var o=n._onLineStatusSubData[t];if(!o)return;var a=[];s.forEach((function(e){var t=o.statusMap[e.platformInfo];if(!(t&&t.changeTime>e.versionTime)){var n={eventValue:e.value,changeTime:e.versionTime};o.statusMap[e.platformInfo]=n,a.push(u(u({},n),{platform:e.platformInfo}))}})),i.push({userId:t,subscribeType:r,subscribeTime:o.subscribeTime,expiry:o.expiry,details:a})}})),i},e.prototype.getSubscribeUserStatus=function(e,t){var n=this,i=[];return t.forEach((function(e){var t=n._onLineStatusSubData[e];if(!t||t.expiry<(Date.now()+n._delayTime-t.subscribeTime)/1e3)delete n._onLineStatusSubData[e];else{var r=Object.keys(t.statusMap).map((function(e){return u({platform:~~e},t.statusMap[~~e])}));i.push({subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType,details:Dn(r)})}})),i},e.prototype.getSubscribeUserList=function(e,t,n){for(var i in this._onLineStatusSubData){var r=this._onLineStatusSubData[i];r.expiry<(Date.now()+this._delayTime-r.subscribeTime)/1e3&&delete this._onLineStatusSubData[i]}return Object.values(this._onLineStatusSubData).sort((function(e,t){return e.subscribeTime-t.subscribeTime})).slice(n,n+t).map((function(e){return{subscribeTime:e.subscribeTime,expiry:e.expiry,userId:e.userId,subscribeType:e.subscribeType,details:Dn(Object.keys(e.statusMap).map((function(t){return u({platform:~~t},e.statusMap[~~t])})))}}))},e}(),qu=function(){function e(e,t,n,i,r){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=i,this._logger=r,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subStore=new Yu(i)}return e.prototype.syncData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,this._syncSubscribeRelationship()];case 1:return e.sent(),[4,this.syncSubscribeUserStatus(!0)];case 2:return e.sent(),this._event.syncSubscribeUserStatusFinished(),[2]}}))}))},e.prototype.startSyncSubscribeRelationship=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship(),[2]}))}))},e.prototype._syncSubscribeRelationship=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._isPullingRelationship?[2]:(this._isPullingRelationship=!0,[4,this._pullSubscribeRelationship()]);case 1:return e.sent(),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0?(this._pullRelationshipQueue.length=0,[4,this._syncSubscribeRelationship()]):[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeRelationship=function(e){return void 0===e&&(e=""),c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return t=this._subStore.getRelationshipStatusVersion(),n=this._logger.createTraceId(),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:e}),n),i=this._connectManager.codec.encodePullUserSubReq({version:t,pageToken:e}),r=new Or(br[br.pullUserSub],i,this._currentUserId),[4,this._connectManager.send(r,ia)];case 1:return s=l.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?(this._pullRelationshipFailTime=0,u=a.list,c=a.version,h=a.hasNext,d=a.pageToken,p=a.isFull,c=an(c),u.forEach((function(e){e.subTime=an(e.subTime)})),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:o,data:a}),n),p?this._subStore.updateSubscribeRelation(u,!e):(g=this._subStore.updateSubscribeRelation(u),_=g.newSubscribeUsers,f=g.subscribeUserChangeList,this._event.subscribeRelationChanged(f),_.length>0&&this._queryAndUpdateUserStatus(ze.ONLINE_STATUS,_)),this._subStore.updateRelationshipStatusVersion(c),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((function(e){return e>c})),h?[4,this._pullSubscribeRelationship(d)]:[3,3]):(this._logger.error(fe.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:o,failTime:this._pullRelationshipFailTime}),n),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?(this._pullRelationshipFailTime=0,[2]):[2,this._pullSubscribeRelationship(e)]);case 2:l.sent(),l.label=3;case 3:return[2]}}))}))},e.prototype.startsyncSubscribeUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._pullSubUserStatusQueue.push(e),this.syncSubscribeUserStatus(),[2]}))}))},e.prototype.syncSubscribeUserStatus=function(e){return void 0===e&&(e=!1),c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._isPullingSubUserStatus?[2]:(this._isPullingSubUserStatus=!0,[4,this._pullSubscribeUserStatus(e)]);case 1:return t.sent(),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0?(this._pullSubUserStatusQueue.length=0,[4,this.syncSubscribeUserStatus(e)]):[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeUserStatus=function(e,t){return void 0===e&&(e=!1),void 0===t&&(t=""),c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h,d,p,g,_;return l(this,(function(l){switch(l.label){case 0:return n=this._subStore.getSubscribeUserStatusVersion(),i=this._logger.createTraceId(),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:n,_pageToken:t,needAllData:e}),i),r=this._connectManager.codec.encodePullSubDataReq({version:n,needAllData:e,pageToken:t}),s=new Or(br[br.pullSubData],r,this._currentUserId),[4,this._connectManager.send(s,aa)];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.SUCCESS&&u?(this._pullSubUserStatusFailTime=0,c=u.list,h=u.versionTime,d=u.hasNext,p=u.pageToken,g=u.isFull,h=an(h),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,data:u}),i),c.forEach((function(e){e.data.forEach((function(e){e.versionTime=an(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((function(e){return e>h})),this._subStore.updateSubscribeUserStatusVersion(h),_=this._subStore.updateSubscribeUserStatus(c,g&&""===t),!g&&_.length>0&&this._event.subscribeUserStatusChanged(_),d?[4,this._pullSubscribeUserStatus(e,p)]:[3,3]):(this._logger.warn(fe.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,failTime:this._pullSubUserStatusFailTime}),i),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?(this._pullSubUserStatusFailTime=0,[2]):[2,this._pullSubscribeUserStatus(e,t)]);case 2:l.sent(),l.label=3;case 3:return[2]}}))}))},e.prototype._queryAndUpdateUserStatus=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return n=this._connectManager.codec.encodeQrySubDataReq(e,t),i=new Or(br[br.qrySubData],n,this._currentUserId),[4,this._connectManager.send(i,aa)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o?(o.list.forEach((function(e){e.data.forEach((function(e){e.versionTime=an(e.versionTime)}))})),(a=(a=this._subStore.updateSubscribeUserStatus(o.list)).filter((function(e){return e.details&&e.details.length>0}))).length>0&&this._event.subscribeUserStatusChanged(a),[2]):[2]}}))}))},e.prototype.updateUserStatus=function(e){var t=this._connectManager.codec.decodeByPBName(e.data,ua);t.data.forEach((function(e){e.versionTime=an(e.versionTime)}));var n=this._subStore.updateSubscribeUserStatus([t]);n.length>0&&this._event.subscribeUserStatusChanged(n)},e.prototype.getSubscribeUserStatus=function(e,t){return this._subStore.getSubscribeUserStatus(e,t)},e.prototype.getSubscribeUserList=function(e,t,n){return this._subStore.getSubscribeUserList(e,t,n)},e.prototype.updateSubscribeRelation=function(e,t,n,i){return void 0===i&&(i=0),c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._connectManager.codec.encodeUpdateUserSubReq(t,e,n,i),s=new Or(br[br.updUserSub],r,this._currentUserId),[4,this._connectManager.send(s,na)];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&u?[2,{code:a,data:u.subUsers.map((function(e){return e.subUserId}))}]:a===$.SUCCESS&&u?(c=u.subTime,this._subStore.updateSubscribeRelation([{subType:t,subTime:c,expiry:i,opType:n,subUsers:e.map((function(e){return{subUserId:e}}))}]),t===ze.ONLINE_STATUS&&n===$e.SUBSCRIBE&&this._queryAndUpdateUserStatus(t,e),[2,{code:a}]):[2,{code:a}]}}))}))},e}(),Ku=function(e,t,i,r,s,o,a){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:Z.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:s,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:bn(n.UNREAD),pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:ye.SENT,directedUserIds:i.directionalUserIdList}},ju=function(e){return e.sort((function(e,t){var n,i,r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),e},Qu=function(e){function t(t,n,i,r){var s=e.call(this,t,n,i,r,new xa(r.appkey,"RC-E","IM"),new Mu(r.appkey,"RC-E","IM"))||this;s._customMessageType={},s._reconnectTimer=-1,s._pullOfflineFinished=!1,s.currentUserId="",s._openCallPlus=!1,s.cloudControllerUri="",s._pullingMsg=!1,s._pullQueue=[],s._chrmsQueue={},s._latestSyncTimestamp=0,s._intervalTimer=-1,s._latestPullKVMsgTimestamp=0,s._intervalTimerForChrmPull=-1,s._handleInnerMsgOptions=function(e,t,n){var i,r=n.messageType;if("RC:SRSMsg"===r&&Object.assign(n,{directionalUserIdList:[s.currentUserId]}),r===se.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){var o=null===(i=s._readReceiptManager)||void 0===i?void 0:i.getReceiptMessageDic({conversationType:e,targetId:t,channelId:n.channelId});n.content.receiptMessageDic=o||{}}for(var a in n.directionalUserIdList=[],n.content.receiptMessageDic)n.directionalUserIdList.push(a)}return n},s._lastSyncUltraMsgTimeStamp=0,s._lastSyncUltraMsgLocalTimeStamp=0,s._ultraGroupTimer=-1,s._isUltraPulling=!1,s._ultraGroupTimeQue=[],s._isUltraGroupListExist=!1,s._ultraGroupMap={},s._ultraMsgMap={},s._pullUltraChangeMessageQue=[],s._isPullingUltraChangeMessage=!1,s._lastPullingUltraChangeMessageTime=0;var o=r.appkey,a=r.logOutputLevel,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return s.logger.setOutputLevel(a),Si.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),ya(o,s.logger,t,u),s.reporter=new za(o,s.runtime,s.logger,s._options.__reportLogLevel),s.navi=new ns(o,s.logger,s.statisticLog,t,new Vu(o,s.logger,t)),gu(o,s.logger,u),s.reporterStatistic=new wu(o,s.runtime,s.logger,s.statisticLog),s._letterbox=new Pr(t,o),s._sendMessageStore=new is(t,o),s._chrmEntryHandler=new Vr(s),s._connMgr=new uu(o,s.navi,s.logger,s.statisticLog,s.runtime,{signal:s._signalHandler.bind(s),onConnected:s.onConnected.bind(s),onDisconnected:s.onDisconnected.bind(s),onConnecting:s._watcher.onConnecting,onSuspend:s.onSuspend.bind(s)}),"browser"===s.runtime.tag&&s._initCloudController(),s}return a(t,e),t.prototype._initCloudController=function(){var e=Si.getCloudControllerUrl();this.cloudControllerUri=e[0],this.cloudController=new Fu(this._appkey,this.runtime,this.logger,this.reporter,this.statisticLog),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,Tu.init)},t.prototype.onConnected=function(){var e=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),t=this._connMgr.getCurrentUserId();this.currentUserId=t,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new Gr(e.joinMChrm)),this._conversationManager||(this._conversationManager=new Xr(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new hs(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Zr(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new Hu(this.runtime,this._appkey,this.currentUserId,this._connMgr.getDelayTime())),this._initSubscribeManager(e),this._conversationManager.startPullConversationStatus(0),this._conversationManager.adaptOldStore(),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rejoinChrm(),this._startSyncInterval(),this._openCallPlus&&this._syncCallPullKVMsg(),1===e.ugMsg&&this._notificationOnline(),this._watcher.onConnected(),this.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){var t,n;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onDisconnected(e)},t.prototype.onSuspend=function(e){var t,n;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onSuspend(e)},t.prototype._initSubscribeManager=function(e){var t=this;e.subDriven&&1&e.subDriven&&(this._subscribeManager||(this._subscribeManager=new qu(this._connMgr,{syncSubscribeUserStatusFinished:function(){var e,n;null===(n=(e=t._watcher).syncSubscribedUserStatusFinished)||void 0===n||n.call(e)},subscribeUserStatusChanged:function(e){var n,i;null===(i=(n=t._watcher).subscribedUserStatusChange)||void 0===i||i.call(n,e)},subscribeRelationChanged:function(e){var n,i;null===(i=(n=t._watcher).subscribedRelationChange)||void 0===i||i.call(n,e)}},this.currentUserId,this._connMgr.getDelayTime(),this.logger)),this._subscribeManager.syncData())},t.prototype.createLogger=function(e,t){return new xa(this._appkey,e,t)},t.prototype.createStatisticLogger=function(e,t){return new Mu(this._appkey,e,t)},t.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},t.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},t.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},t.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},t.prototype.connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,i)]}))}))},t.prototype._signalHandler=function(e,t){var n,i=e.syncMsg,r=e.topic;if(i)this._receiveSyncMsg(e,t);else{var s=this.logger.createTraceId();this.logger.debug(fe.L_RECV_RMTP_O,r,s);var o=br[r];if(o)switch(o){case br.s_ntf:this._pullMsg(e);break;case br.s_msg:this._receiveMsg(e);break;case br.s_cmd:this._receiveStateNotify(e);break;case br.s_us:this._receiveSettingNotify(e);break;case br.rtc_ntf:this._receiveRtcKv(e.data);break;case br.s_opNtf:this._pullOperateStatusNotify(e);break;case br.s_pubCall:this._pubCallInfo(e);break;case br.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(fe.L_RECV_RMTP_E,r,s)}},t.prototype._receiveStateNotify=function(e){var t,n,i=this._connMgr.codec.decodeByPBName(e.data,vs),r=i.time,s=i.type,o=i.chrmId;switch(s){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime);break;case 8:null===(t=this._subscribeManager)||void 0===t||t.startsyncSubscribeUserStatus(r);break;case 9:null===(n=this._subscribeManager)||void 0===n||n.startSyncSubscribeRelationship(r)}},t.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,so).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=e.channelId,i=void 0===n?"":n,r=e.conversationType,s=e.targetId,o=t.put,a=t.del,u=t.mid;o&&this._watcher.expansion({updatedExpansion:{messageUId:u,expansion:o,channelId:i,conversationType:r,targetId:s}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:u,deletedKeys:a,channelId:i,conversationType:r,targetId:s}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,ws),i=n.targetId,r=n.channelId,s=n.timestamp,o=this._ultraGroupMap[r+"_"+i];o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.unreadMentionedMeCount=0,o.firstUnreadMessage&&(o.firstUnreadMessage=null),o.lastReadTime=s,this._watcher.conversation(Un([o]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){var n,i=this,r=((n={})[br[br.ugMsg]]=function(){i._ultraGroupTimeQue.push(t.timestamp),i._syncUltraMsg(i._lastSyncUltraMsgTimeStamp)},n[br[br.updRTime]]=function(){i._receivesyncReadStatus(e)},n[br[br.updUgRTime]]=function(){i._clearUltraGroupUnreadCount(e,t)},n[br[br.updUserSub]]=function(){var e;null===(e=i._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)},n);if(r[e.topic])r[e.topic]();else if(rs.includes(e.topic)){var s=this._connMgr.codec.decodeByPBName(e.data,ds,{currentUserId:this.currentUserId,signal:e});((s=this._handleMsgProperties(s)).conversationType!==te.CHATROOM||this._chrmsQueue[s.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||s.sentTime):(t&&(s.sentTime=t.timestamp,s.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(fe.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:s.messageUId,messgeId:s.messageId,sentTime:s.sentTime})),s.messageType!==se.EXPANSION_NOTIFY?((s.messageType===se.SYNC_READ_STATUS||s.messageType===se.READ_RECEIPT&&s.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(s.conversationType,s.targetId,s.channelId,s.sentTime),s.messageType===se.READ_RECEIPT_REQUEST&&this._processRRReqMsg(s),s.messageType===se.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(s),this._conversationManager.setConversationCacheByMessage(s,!0),this._batchMessage([s])):this._receiveMessageExpansion(s)))}},t.prototype._batchMessage=function(e){for(var t=this,n=[],i=[],r=[],s=e.length-1;s>=0;s-=1){var o=e[s];o.messageType===se.LOG_COMMAND&&o.senderUserId===K?i.unshift(o):o.messageType===se.CLOUD_CONTROL&&o.senderUserId===K?r.push(o):n.unshift(o)}this._watcher.batchMessage(n),i.forEach((function(e){var n=e.content,i=n.startTime,r=n.endTime,s=n.platform,o=n.logId,a=n.uri;t.reporter.report(parseInt(i,10),parseInt(r,10),s,a,o,e.messageUId)})),r.length>0&&this._ccMsgHandler(r)},t.prototype._ccMsgHandler=function(e){var t;return c(this,void 0,void 0,(function(){var n,i,r;return l(this,(function(s){switch(s.label){case 0:return e.shift()?(n=this._connMgr.getToken(),[4,null===(t=this.cloudController)||void 0===t?void 0:t.request(this.cloudControllerUri,Tu.other,n)]):[3,2];case 1:i=s.sent()||0,(r=e.filter((function(e){return e.sentTime>i}))).length>0&&this._ccMsgHandler(r),s.label=2;case 2:return[2]}}))}))},t.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,qo),n=t.key,i=t.dataContent,r=t.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,vs),n=t.type,i=t.chrmId,r=t.time;if(this.logger.info(fe.L_RECV_S_NTF_O,"type: "+n+", chrmId: "+n+", time: "+r),2===n){var s=this._chrmsQueue[i];if(!s)return;s.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},t.prototype._receivesyncReadStatus=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,ws),n=t.conversationType,i=t.targetId,r=t.channelId,s=t.timestamp,o=t.sentTime;this._conversationManager.clearUnreadCount(n,i,r,o),this._watcher.syncReadStatus({conversationType:n,targetId:i,channelId:r,timestamp:s})},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._syncCallPullKVMsg=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new Or(Wi,e,this.currentUserId),[4,this._connMgr.send(t,jo)]):[2];case 1:return n=s.sent(),i=n.code,r=n.data,i===$.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(t.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===$a.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._filterMessage=function(e){var t=e.messageType;return t===se.DELIVERED||t===se.DELIVERED_MSG||t===se.SYNC_READ_STATUS&&!this._processSRSMsg(e)},t.prototype._messageProcessor=function(e){var t=this,n=0,i=[],r=[],s=[],o=[],a=[];return e.forEach((function(e){var u=e.conversationType,c=e.targetId,l=e.channelId,h=e.messageDirection,d=e.messageUId,p=e.messageType,g=e.sentTime,_=e.senderUserId,f=e.content;if(i.push(d),h===Z.SEND){n=Math.max(g,n);var E=t._sendMessageStore.getSendMessageMap(),T=p===se.RECALL?"Cmd:"+f.messageUId:d;if(E[T])return void t._sendMessageStore.removeByUID(T)}if(!t._filterMessage(e))if(p!==se.EXPANSION_NOTIFY)if(g>=t._connMgr.getConnectedTime()&&t._writeMessagesLog(u,d)&&a.push(d),p===se.READ_RECEIPT&&_===t.currentUserId&&t._conversationManager.clearUnreadCount(u,c,l,g),p!==se.READ_STATE){p===se.READ_RECEIPT_REQUEST&&t._processRRReqMsg(e),p===se.READ_RECEIPT_RESPONSE&&t._processRRRspMsg(e);var I=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(I,!0),r.push(I)}else o.push(e);else s.push(e)})),{newOutboxTime:n,messageUIds:i,messages:r,messageExpansionList:s,RSMsgList:o,msgUIds2Statistic:a}},t.prototype._processSRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,s=e.senderUserId,o=e.sentTime;if(s!==this.currentUserId)return!1;var a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,i,o),1!==a.sesDriven||(o>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:i,timestamp:r.lastMessageSendTime}),!1)},t.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,s={conversationType:t,targetId:n,channelId:i};this._watcher.messageReadReceipt(t===te.PRIVATE?{privateReadReceipt:u(u({},s),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:u(u({},s),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})})},t.prototype._processRRReqMsg=function(e){var t,n=e.conversationType,i=e.channelId,r=e.targetId,s=e.content,o=e.sentTime,a=e.messageDirection,u=e.senderUserId;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:i,targetId:r},s.messageUId,a,o,u)},t.prototype._processRRRspMsg=function(e){var t,n=this,i=e.conversationType,r=e.channelId,s=e.targetId,o=e.content,a=e.senderUserId,u=o.receiptMessageDic,c=void 0===u?{}:u;if(a===this.currentUserId)for(var l in c)for(var h=0,d=c[l];h<d.length;h++){var p=d[h];null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:i,channelId:r,targetId:s},p)}else(c[this.currentUserId]||[]).forEach((function(e){var t;null===(t=n._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:i,channelId:r,targetId:s},e,a)}))},t.prototype._syncMsg=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a,u,c,h,d,p,g,_,f,E,T,I,v,R,C,S,m=this;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new Or(br[br.pullMsg],i,this.currentUserId),s=this.logger.createTraceId(),this.logger.info(fe.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),s),[4,this._connMgr.send(r,_s,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType})]):(this._pullingMsg=!1,[2]);case 1:if(o=l.sent(),a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,a!==$.SUCCESS||!u||vt(u.finished)||vt(u.list)||vt(u.syncTime))return this.logger.warn(fe.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),s),[2];c=u.list,h=u.finished,d=u.syncTime,p=u.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(fe.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:c.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),s);try{if(_=this._messageProcessor(c),f=_.newOutboxTime,E=_.messageUIds,T=_.messages,I=_.messageExpansionList,v=_.RSMsgList,(R=_.msgUIds2Statistic).length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:R.join(",")})),this._batchMessage(T),I.forEach((function(e){m._receiveMessageExpansion(e)})),v.forEach((function(e){m._processRSMsg(e)})),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),C=this._pullQueue.filter((function(e){return e>d})),this._pullQueue.length=0,(S=this._pullQueue).push.apply(S,C),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(fe.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:C}),s),!h)return this._syncMsg(),[2];this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(fe.L_PULL_MSG_E,null==e?void 0:e.stack,s)}return[2]}}))}))},t.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,gs,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(t=this._handleMsgProperties(t)).conversationType,i=t.messageType,r=t.senderUserId,s=t.messageUId,o=t.sentTime,a=t.isStatusMessage;if(this.logger.info(fe.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,s)&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:s})),n!==te.RTC_ROOM&&i!==se.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}r===this.currentUserId&&this._sendMessageStore.setMessage(s,o),a||r===this.currentUserId||this._letterbox.setInboxTime(o,this.currentUserId),this._handleNotNotifyMsg(t)||(i===se.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),i===se.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}},t.prototype._handleNotNotifyMsg=function(e){var t=e.messageType,n=e.senderUserId;return t===se.DELIVERED||(t===se.DELIVERED_MSG||(t===se.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===se.SYNC_READ_STATUS&&n!==this.currentUserId||t===se.READ_STATE&&(this._processRSMsg(e),!0)))},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isStatusMessage,s=e.isCounted,o=void 0!==s&&s,a=e.isPersited,c=void 0!==a&&a,l=i in P,h=i in this._customMessageType;if(n=l?u(u({},P[i]),{isStatusMessage:w.includes(i)}):h?this._customMessageType[i]:{isCounted:o,isPersited:c,isStatusMessage:!1},Object.assign(e,n),t&&!vt(r)&&(e.isStatusMessage=r),!t){var d=e.content.user;if(d){var p=d.portrait,g=d.portraitUri,_=p||g;_&&(d.portrait=d.portraitUri=_)}}return e},t.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},t.prototype.getHistoryMessage=function(e,t,n,i,r,s,o,a){var u;return void 0===s&&(s=""),c(this,void 0,void 0,(function(){var o,c,h,d,p,g,_,f,E,T,I,v=this;return l(this,(function(l){switch(l.label){case 0:return c=(o=this).currentUserId,h=o._connMgr,d=ir[e]||Ji,p=1===i&&0===n,h?(g=h.codec.encodeGetHistoryMsg(t,{timestamp:n,count:p?2:i,order:r,channelId:s}),this.logger.info(fe.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:s,timestamp:n,count:i,order:r}),a),[4,h.send(new Or(d,g,c),Cs,{currentUserId:c,connectedTime:h.getConnectedTime(),conversation:{targetId:t},afterDecode:function(n){var i,r=null===(i=v._readReceiptManager)||void 0===i?void 0:i.getReadReceiptInfo({conversationType:e,channelId:s,targetId:t},n.messageUId);if(r){var o=r.users;n.readReceiptInfo={isReceiptRequestMessage:!0,readerList:o}}return n}})]):[3,2];case 1:return _=l.sent(),f=_.code,E=_.data,f===$.SUCCESS&&E?(T=this._fixDownstreamData(p,E,r),I=[],null===(u=T.list)||void 0===u||u.forEach((function(e){e&&I.push(e.messageUId)})),this.logger.info(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:I.join(",")}),a),[2,{code:f,data:{list:T.list,hasMore:T.hasMore}}]):(this.logger.warn(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:""}),a),[2,{code:f}]);case 2:return[2,{code:$.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getMessages=function(e,t,n,i,r,s,o){return this.getHistoryMessage(e,t,n,i,r,s,o)},t.prototype.reportSDKInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this.logger.createTraceId(),s=JSON.stringify(e),this.logger.debug(fe.L_VER_REPORT_T,s,r),o=i.codec.encodeReportSDKInfo(s),a=new Or(br[br.reportsdk],o,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==$.SUCCESS&&this.logger.warn(fe.L_VER_REPORT_R,u,r),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,a=o.codec.encodeDeleteMessages(e,t,n,i),u=bi,e===te.ULTRA_GROUP&&(u=Pi),c=new Or(u,a,s),[4,o.send(c)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,a=o.codec.encodeClearMessages(t,n,i,e),u=rr[e],c=new Or(u,a,s),[4,o.send(c)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.batchClearRemoteHistoryMessages=function(e,t){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=i.codec.encodeBatchClearRemoteMessages(e),s=new Or(ji,r,n),[4,i.send(s)]):[2,$.RC_NET_UNAVAILABLE];case 1:return o=a.sent(),[2,o.code]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,t=t||te.PRIVATE,a=o.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),u=new Or(Fi,a,s),[4,o.send(u,ms,{currentUserId:s,connectedTime:o.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=p._conversationManager.get(t,n,i);Object.assign(e,r);var s=p._conversationManager.getDraft(t,n,i);return e.draft=s,e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==$.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),s=new Or(Hi,r,t),[4,i.send(s)]):[2,$.RC_NET_UNAVAILABLE];case 1:return o=a.sent(),[2,o.code]}}))}))},t.prototype.batchRemoveConversation=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeBatchDeleteConversation(e),i=new Or(Yi,n,this.getCurrentUserId()),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),[2,r.code]}}))}))},t.prototype.getConversation=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return e!==te.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:$.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:$.CONVER_GET_ERROR}];case 2:if(s=l.sent(),o=s.code,a=s.data,o!==$.SUCCESS)return[2,{code:$.CONVER_GET_ERROR}];u=this._conversationManager.getDraft(e,t,n),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||ae.CLOSE,notificationLevel:r.notificationLevel||ce.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0,draft:u},l.label=3;case 3:return[2,{code:$.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var i=0;if(e.includes(te.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var s=this._ultraGroupMap[r];(0===t.length||t.includes(s.notificationLevel))&&(i+=n?s.unreadMentionedCount:s.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return e===te.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve($.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve($.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getFirstUnreadMessageInfo=function(e,t,n){var i=this._conversationManager.get(e,t,n),r=i.firstUnreadMessageUid,s=i.firstUnreadTime;return Promise.resolve({code:$.SUCCESS,data:s&&r?{messageUId:r,sentTime:s}:null})},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve($.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve($.SUCCESS)},t.prototype.pullConversationStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,r=n.codec.encodeGetConversationStatus(e),s=new Or(br[br.pullSeAtts],r,i),[4,n.send(s,ao)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=l.sent(),a=o.code,u=o.data,this.logger.info(fe.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i})),a!==$.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),t===te.ULTRA_GROUP?h._setUltraConversationStatus(e):c.push(e)})),[2,{code:a,data:c}])}}))}))},t.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationStatus,i=e.notificationLevel,r=e.channelId,s=e.isTop,o=this._ultraGroupMap[r+"_"+t];return o&&void 0!==i&&(o.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(o)),o&&void 0!==n&&(o.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(o)),o&&void 0!==s&&(o.isTop=s),o},t.prototype.batchSetConversationStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,[4,this._conversationManager.pushTask((function(t){return c(r,void 0,void 0,(function(){var r,s,o,a,c,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return r=i.codec.encodeSetConversationStatus(e,t),s=new Or(qi,r,n),[4,i.send(s,ho)];case 1:return o=l.sent(),a=o.code,c=o.data,a!==$.SUCCESS?[2,{code:a}]:(h=c,this._conversationManager.setConversationUpdatedTime(h.version),d=[],e.forEach((function(e){if(e.conversationType!==te.ULTRA_GROUP)g._conversationManager.addStatus(u(u({},e),{updatedTime:h.version}),!0);else{var t=g._setUltraConversationStatus(e);t&&d.push(t)}})),d.length>0&&(p=Un(d),p=ju(p),this._watcher.conversation(p)),[2,{code:a}])}}))}))}))]):[2,$.RC_NET_UNAVAILABLE];case 1:return[2,s.sent().code]}}))}))},t.prototype.batchSetConversationToTop=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return u(u({},e),{isTop:t})})))]}))}))},t.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:i}])]}))}))},t.prototype.batchSetConversationNotificationLevel=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return u(u({},e),{notificationLevel:t})})))]}))}))},t.prototype._joinChrm=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p,g,_,f,E,T,I,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,s=r.codec.encodeJoinOrQuitChatRoom(),a=new Or(o=n?wi:Di,s,e),this.logger.info(fe.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:o}),i),[4,r.send(a,Gs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,d=c===$.SUCCESS?"info":"warn",this.logger[d](fe.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===$.SUCCESS?(g=(p=h).joinTime,_=p.createTime,f=p.memberCount,E=p.isAllChatroomBanned,T=p.isCurrentUserBanned,I=p.isCurrentChatroomBanned,v=p.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull(),[2,{code:c,data:{createTime:_,memberCount:f,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:I,isCurrentChatroomInWhitelist:v}}]):[2,{code:c}]}}))}))},t.prototype._rejoinChrm=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a,c,h;return l(this,(function(l){switch(l.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,l.label=1;case 1:return i<t.length?(r=t[i],this.logger.info(fe.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:e[r]||10,topic:wi})),s=this.logger.createTraceId(),[4,this._joinChrm(r,e[r]||10,!0,s)]):[3,4];case 2:if(o=l.sent(),a=o.code,c=o.data,h=a===$.SUCCESS?"info":"warn",this.logger[h](fe.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),s),a===$.SUCCESS)return this._watcher.chatroom({rejoinedRoom:u({chatroomId:r,count:e[r]},c)}),[2];a===$.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:a}}),l.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d,p,g,_,f,E,T=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[e],r=i.pulling,s=i.timestamp,r?[2]:(i.pulling=!0,o=this._connMgr.codec.encodeChrmSyncMsg(n?0:s,t),a=new Or(br[br.chrmPull],o,e),this.logger.info(fe.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:s})),[4,this._connMgr.send(a,_s,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=l.sent(),c=u.code,h=u.data,i.pulling=!1,c===$.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,i.timestamp=n?Math.max(p,n):p,i.queue=i.queue.filter((function(e){return e>p})),_=[],f=[],E=[],d.forEach((function(e){e.sentTime<s||(e.sentTime>=T._connMgr.getConnectedTime()&&T._writeMessagesLog(te.CHATROOM,e.messageUId)&&f.push(e.messageUId),_.push(e.messageUId),E.push(e))})),this._batchMessage(E),this.logger.info(fe.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:s,messageUIds:_.join(",")})),f.length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:f.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(fe.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:s,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(e,t,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.joinExistChatroom=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),i=new Or(Vi,n,e),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),(s=r.code)===$.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,s]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(t,n),s=new Or(br[br.queryChrmI],r,e),[4,i.send(s,ks)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),a=o.code,u=o.data,a!==$.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,s=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),o=new Or(Zi,s,e),[4,r.send(o,Cs,{conversation:{targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==$.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,s=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==s?this.getServerTime():s,o=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===Ie.UPDATE?Gi:Bi,u=new Or(a,o,e),[4,i.send(u,Gs)]):[2,$.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),(h=c.code)===$.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,i=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=i.findIndex((function(t){return e.key===t.key}));-1!==t&&i.splice(t,1)})),i},t.prototype._modifyChatroomKVS=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,c,h,d,p,g,_,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,t.entries.forEach((function(t){var n=f._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?f.getServerTime():n})),s=i.codec.encodeModifyChatRoomKVS(e,t,r),o=t.type===Ie.UPDATE?ki:xi,a=new Or(o,s,e),[4,i.send(a,Zs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,-1!==[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=u({},t)).entries,t.entries.forEach((function(e){p.push(u(u({},e),g))})),h===$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(_=c.data,d=_.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,c)),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:$.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),s=new Or(br[br.pullKV],r,e),[4,i.send(s,Xs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),(a=o.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(e){return e.key===t})),void 0!==u)?[2,{code:$.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:$.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:$.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},i=n.codec.encodePullChatRoomKV(0),r=new Or(br[br.pullKV],i,e),[4,n.send(r,Xs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=a.sent(),(o=s.data)&&o.kvEntries&&o.kvEntries.length&&o.kvEntries.forEach((function(e){e.key&&(t[e.key]=e.value||"")})),[2,{code:$.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,s=i.codec.encodePullChatRoomKV(t),o=new Or(br[br.pullKV],s,e),this.logger.info(fe.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(o,Xs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,h=u===$.SUCCESS?"info":"warn",this.logger[h](fe.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===$.SUCCESS&&c?(d=c.kvEntries,p=[],d.length>0&&(d.forEach((function(t){var n=t.key,i=t.value,r=t.type,s=t.timestamp,o=t.userId;g._chrmEntryHandler.getValue(e,n)===i&&o===g.getCurrentUserId()||p.push({key:n,value:i,type:r,timestamp:s,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,r),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._isConnected?t.forEach((function(t){e._pullChrmMsg(t),e.getNaviInfoFromCache().kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),O)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype._writeMessagesLog=function(e,t){var n,i=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!i)return!1;var r=Tn(t),s=0;switch(e){case te.PRIVATE:s=i.private;break;case te.GROUP:s=i.group;break;case te.CHATROOM:s=i.chatroom;break;case te.ULTRA_GROUP:s=i.ultraGroup}return!!s&&r%(1/s)==0},t.prototype.sendMessage=function(e,t,n,i,r){var s;return c(this,void 0,void 0,(function(){var o,a,c,h,d,p,g,_,f,E,T,I;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._handleInnerMsgOptions(e,t,n),n=this._handleMsgProperties(n,!0),o=!1,[te.PRIVATE,te.GROUP].includes(e)&&(n.isStatusMessage||(null===(s=this._customMessageType[n.messageType])||void 0===s?void 0:s.isStatusMessage))&&(o=!0),a=o?function(e){var t;return(t={},t[te.PRIVATE]=br.ppMsgS,t[te.GROUP]=br.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[te.PRIVATE]=br.ppMsgP,t[te.GROUP]=br.pgMsgP,t[te.CHATROOM]=br.chatMsg,t[te.CUSTOMER_SERVICE]=br.pcMsgP,t[te.RTC_ROOM]=br.prMsgS,t[te.SYSTEM]=br.pbMsgP,t)[e]}(e)||br.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),c=n.messageId?n.messageId:gn(),n.messageId=c,h=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(d=new yr(br[a],h,e===te.SYSTEM?this.currentUserId:t)).setHeaderQos(Ti.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(d),[2,{code:$.SUCCESS,data:Ku(e,t,u({},n),"",0,this.currentUserId,c)}]):(p=this._connMgr.getCrtServerTime(),g=Ku(e,t,u(u({},n),{isStatusMessage:o}),"",p,this.currentUserId,c),null==i||i(c),this.logger.info(fe.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),r),_=Date.now(),[4,this._connMgr.send(d)])):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return f=l.sent(),E=f.code,T=f.data,E!==$.SUCCESS?(this.logger.warn(fe.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:g.messageUId,messageId:g.messageId}),r),this._writeMessagesLog(e)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),g.sentStatus=ye.FAILED,[2,{code:E,data:g}]):(this.logger.info(fe.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:null==T?void 0:T.messageUId,messageId:null==T?void 0:T.messageId}),r),I=T,this._sendMessageSuccessHandle(g,I),this._writeMessagesLog(e,I.messageUId)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:I.messageUId,channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),[2,{code:$.SUCCESS,data:g}])}}))}))},t.prototype._sendMessageSuccessHandle=function(e,t){var n,i=this;this._sendMessageStore.setMessage(t.messageUId,t.timestamp),e.sentTime=t.timestamp,e.messageUId=t.messageUId,this._conversationManager.setConversationCacheByMessage(e,!0);var r=e.messageType,s=e.conversationType,o=e.targetId,a=e.channelId,u=e.sentTime,c=e.content,l=e.messageDirection;if(r===se.READ_RECEIPT_REQUEST){var h=c.messageUId;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:s,targetId:o,channelId:a},h,l,u)}if(r===se.READ_RECEIPT_RESPONSE){var d=c.receiptMessageDic;if(!d)return;for(var p in d)d[p].forEach((function(e){var t;null===(t=i._readReceiptManager)||void 0===t||t.remove({conversationType:s,targetId:o,channelId:a},e)}))}},t.prototype.recallMsg=function(e,t,n,i,r){var s;return c(this,void 0,void 0,(function(){var o,a,c,h,d,p,g,_,f,E,T,I,v,R,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=r.user,a=r.extra,c=r.isDelete,h=r.directionalUserIdList,d={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},o&&(d.user=o),a&&(d.extra=a),p={content:d,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(s=r.pushConfig)||void 0===s?void 0:s.pushContent)||r.pushContent||"",channelId:r.channelId},[te.GROUP,te.ULTRA_GROUP].includes(e)&&h&&(p.directionalUserIdList=h),g=br[br.recallMsg],_=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},p),(f=new yr(g,_,this.currentUserId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return E=l.sent(),T=E.code,I=E.data,e===te.ULTRA_GROUP&&this.logger.debug(fe.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:T,conversationType:e,targetId:t,channelId:r.channelId})),T!==$.SUCCESS?[2,{code:T}]:(v=I,e===te.ULTRA_GROUP?(this._ultraMsgMap[v.messageUId]=v.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:$.SUCCESS}]):(R="Cmd:"+n,this._sendMessageStore.setMessage(R,v.timestamp),C=Ku(e,t,u(u({},p),{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(C,!0),[2,{code:$.SUCCESS,data:C}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(t,n),r=new Or(br[br.rrMsg],i,e),[2,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(t,n),r=new Or(br[br.rrList],i,e),[2,this._connMgr.send(r,vo)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.sendReadReceiptMessageV4=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return i=this._connMgr.codec.encodeReadReceiptMsg(e,t,n),r=new yr(br[br.sendMsgRead],i,e.targetId),[2,this._connMgr.send(r)]}))}))},t.prototype.getMessageReadReceiptV4=function(e,t){return c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeReceiptQryReq(e,t),i=new Or(br[br.qryMsgRead],n,e.targetId),[2,this._connMgr.send(i,Jo)]}))}))},t.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(e,t),i=new Or(br[br.qryMsgReadCntBatch],n,e.targetId),[4,this._connMgr.send(i,zo)];case 1:return r=c.sent(),s=r.code,o=r.data,a=(o||{result:[]}).result,s===$.SUCCESS&&a?[2,{code:s,data:a.map((function(t){return u({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)}))}]:[2,{code:s}]}}))}))},t.prototype.updateConversationReadTime=function(e,t){return c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeSessionMsgReadInput(e,t),i=new yr(br[br.updRTime],n,this.currentUserId),[2,this._connMgr.send(i)]}))}))},t.prototype.pullUserSettings=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Or(br[br.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,ro)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=o.sent(),r=i.code,s=i.data,r===$.SUCCESS&&this._naviChangeHandler(s),[2,{code:r,data:s}]}}))}))},t.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,i=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(i){var r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var s=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(u({},s))}}else this.logger.warn(fe.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=i&&"uploads"!==i?t||"":un(e,t),o=this._connMgr.codec.encodeGetFileToken(e,s,n||"",i||"",r||""),a=new Or(br[br.qnTkn],o,this.currentUserId),[4,this._connMgr.send(a,Fs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==$.SUCCESS?[2,{code:h}]:(p=u(u({},d),{fileName:s,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),[2,{code:h,data:p}])}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",s="",o="",t===pe.QINIU?(s=Hs,o=qs):(s=Ys,o=Ks),r=t===pe.QINIU?br[br.qnUrl]:t===pe.AWS?br[br.s3Url]:t===pe.STC?br[br.stcUrl]:t===pe.MINIO?br[br.minioUrl]:br[br.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(s,e,n,i),u=new Or(r,a,this.currentUserId),[4,this._connMgr.send(u,o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,p=d,h===$.SUCCESS?[2,{code:h,data:p}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return e.sent(),this._resetMemoryState(),[2]}}))}))},t.prototype._resetMemoryState=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData(),this._joinedChrmManager&&(this._joinedChrmManager.clear(),delete this._joinedChrmManager),this._conversationManager&&delete this._conversationManager,this._ultraGroupManager&&delete this._ultraGroupManager,this._userSettingManager&&delete this._userSettingManager,this._readReceiptManager&&delete this._readReceiptManager,this._subscribeManager&&delete this._subscribeManager,this._chrmsQueue={}},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new Or(br[br.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,no)];case 1:return r=c.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o&&(a=o.version,this._userSettingManager.addTag([u(u({},e),{createdTime:a})],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeRemoveTag([e],n),i=new Or(br[br.delSeTag],t,this.currentUserId),[4,this._connMgr.send(i,no)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o&&(a=o.version,this._userSettingManager.deleteTag([e],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.updateTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new Or(br[br.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,no)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&(a=o.version,this._userSettingManager.addTag([e],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){var e,t;return l(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:$.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new Or(br[br.addTag],n,this.currentUserId),[4,this._connMgr.send(r,ho)]):[2,{code:$.TAG_NOT_EXIST}];case 1:return s=l.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a&&((u={})[e]={},t.forEach((function(e){c._conversationManager.addTagStatus(e.conversationType,e.targetId,u,e.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u=this;return l(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new Or(br[br.delTag],n,this.currentUserId),[4,this._connMgr.send(r,ho)];case 1:return s=c.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a&&(t.forEach((function(t){u._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagsForConversation=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return n=e.conversationType,r=e.targetId,s=e.channelId,o=t.map((function(e){return{tagId:e}})),a=this._connMgr.codec.encodeUpdateConversationTag(o,[e],i),u=new Or(br[br.delTag],a,this.currentUserId),[4,this._connMgr.send(u,ho)];case 1:return c=l.sent(),h=c.code,d=c.data,h===$.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(n,r,t,s),this._conversationManager.setConversationUpdatedTime(d.version)),[2,{code:h}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getConversationListByTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,s=i._connMgr,o=s.codec.encodeOldConversationList({count:n,type:te.PRIVATE,startTime:t}),a=new Or(Fi,o,r),[4,s.send(a,ms,{currentUserId:r,connectedTime:s.getConnectedTime()})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,c!==$.SUCCESS?[2,{code:c}]:(d=this._conversationHasTagFilter(e,null==h?void 0:h.list),[2,{code:c,data:d}])}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=t.channelId,c=n._conversationManager.get(s,o,a),l=c.hasMentioned,h=c.mentionedInfo,d=c.lastUnreadTime,p=c.notificationStatus,g=c.isTop,_=c.tags,f=c.unreadMessageCount,E=_&&_[e];if(E){var T=u(u({},t),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:f});E.isTop?i.push(u(u({},T),{isTopInTag:!0})):r.push(u(u({},T),{isTopInTag:!1}))}})),i.sort(s),r.sort(s),h(h([],i,!0),r,!0)},t.prototype.getUnreadCountByTag=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:$.SUCCESS,data:n}]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return c(i,void 0,void 0,(function(){var i,s,o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return i=t.targetId,s=t.conversationType,o=t.channelId,a=n.isTop,u=[{tagId:e,isTop:a}],(c=this._conversationManager.get(s,i,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(h=this._connMgr.codec.encodeUpdateConversationTag(u,[t],r),d=new Or(br[br.addTag],h,this.currentUserId),[4,this._connMgr.send(d,ho)]):[2,{code:$.NO_TAG_IN_CONVER}];case 1:return p=l.sent(),g=p.code,_=p.data,g===$.SUCCESS&&_&&((f={})[e]={},a&&(f[e].isTop=!0),this._conversationManager.addTagStatus(s,i,f,o),this._conversationManager.setConversationUpdatedTime(_.version)),[2,{code:g}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagsForConversation=function(e){var t;return c(this,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){if(!this._isConnected)return[2,{code:$.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(s in n.tags)r.push({tagId:s,tagName:null===(t=i[s])||void 0===t?void 0:t.tagName});return[2,{code:$.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:$.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===te.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.conversationType,e.targetId,e.channelId),n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===te.ULTRA_GROUP)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var i;if(!(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:$.SUCCESS,data:ce.NOT_SET});var r=i.notificationLevel;return vt(i.notificationLevel)&&!vt(i.notificationStatus)&&(r=ae.OPEN===i.notificationStatus?1:0),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:$.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:$.SUCCESS,data:ae.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,s){return this.getHistoryMessage(e,t,n,i,r,s)},t.prototype.getUltraGroupList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s=this;return l(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&&lt(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,i=e.unreadMentionedMeCount;return t=s._getUnreadCount(t),n=s._getUnreadCount(n),i=s._getUnreadCount(i),u(u({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=ju(i),r=Un(i),[2,{code:$.SUCCESS,data:r}]):[2,{code:$.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===ae.OPEN||e.notificationLevel>0)&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=t._ultraGroupMap[i];e.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:t._getUnreadCount(r.unreadMessageCount),mentionedCount:t._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:$.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 t=this._getUnreadCount(t),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),c(this,void 0,void 0,(function(){var n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:te.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new yr(br[br.updUgRTime],i,this.currentUserId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,$.RC_NET_UNAVAILABLE]:[2,Promise.resolve($.METHOD_NOT_AVAILABLE)];case 1:return(s=a.sent().code)===$.SUCCESS&&((o=this._ultraGroupMap[t+"_"+e])&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.unreadMentionedMeCount=0,o.lastReadTime=n),o&&o.firstUnreadMessage&&(o.firstUnreadMessage=null)),[2,s]}}))}))},t.prototype._getUltraGroupList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d,p,g,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Or(br[br.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,ms,{currentUserId:this.currentUserId,conversationType:te.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,s=i.data,r===$.SUCCESS&&s?(a=s.list,u=s.isFinished,a.forEach((function(e){e.notificationStatus=ae.CLOSE,e.notificationLevel=ce.NOT_SET,e.isTop=!1,_._ultraGroupMap[e.channelId+"_"+e.targetId]=e,_._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(fe.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: "+r+", try again"),o=setTimeout((function(){_._getUltraGroupList(e),clearTimeout(o)}),3e3),[2]);case 2:return this.logger.info(fe.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==$.SUCCESS&&this.logger.warn(fe.O,"pullConversationStatus fail code: "+d+", data: "+p),g=Object.values(this._ultraGroupMap),g=ju(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Un(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.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(),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._notificationOnline=function(){return c(this,void 0,void 0,(function(){var e,t,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=r.sent(),t=e.code,n=e.data,t===$.SUCCESS&&n?(this.logger.info(fe.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(fe.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Or(br[br.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(fe.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,_s,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP}})];case 1:return r=l.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o?(a=o.list,u=o.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(fe.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,messageUIds:c,timestamp:e,syncTime:u}),i)):this.logger.warn(fe.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,timestamp:e}),i),[2,{code:s,data:o}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var i,r,s,o=e.targetId,a=e.messageType,u=e.channelId,c=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,p=e.content,g=e.isMentioned,_=this._ultraGroupMap[u+"_"+o],f=_||{conversationType:te.ULTRA_GROUP,targetId:o,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ae.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==se.RECALL&&(f.unreadMessageCount+=1,f.unreadMentionedCount+=t,f.firstUnreadMessage||(f.firstUnreadMessage={sentTime:h}),g&&(null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.type)!==he.ALL&&(null===(s=null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===s?void 0:s.includes(this.currentUserId))&&(f.unreadMentionedMeCount+=1)),f.versionTime=n,f.latestMessage=e,f.channelType=l,_||(this._ultraGroupMap[u+"_"+o]=f),f},t.prototype._syncUltraMsg=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=l.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===$.SUCCESS&&i?(r=i.list,s=i.syncTime,o=i.finished,a={},u=[],r.forEach((function(e){var t,n,i,r=e.targetId,o=e.content,c=e.messageUId,l=e.channelId,d=e.isMentioned;if(h._ultraMsgMap[c])delete h._ultraMsgMap[c];else{var p=0;d&&((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===he.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(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(e,p,s);a[l+"_"+r]=g,h._ultraGroupManager.addUltraGroupStatus(g),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(fe.O,"notice ultragroups"),c=Object.values(a),c=ju(c),this._watcher.conversation(Un(c))),this.logger.debug(fe.O,"notice ultragroup message"),this._batchMessage(u),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>s})),this._lastSyncUltraMsgTimeStamp=s,o?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(s)),[2]):(this._syncUltraMsg(s),[2])):[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,c,h,d,p,g,_,f,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(fe.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=t.messageId?t.messageId:gn(),t.messageId=r,s=this._connMgr.codec.encodeUpMsg({conversationType:te.ULTRA_GROUP,targetId:e},t),(o=new yr(br[br.ugMsg],s,e)).setHeaderQos(Ti.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),c=Ku(te.ULTRA_GROUP,e,u({},t),"",a,this.currentUserId,r),n&&n(r),this.logger.info(fe.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:te.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),h=Date.now(),[4,this._connMgr.send(o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,p!==$.SUCCESS?(this.logger.warn(fe.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:c.messageUId,messageId:c.messageId}),i),this._writeMessagesLog(te.ULTRA_GROUP)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),c.sentStatus=ye.FAILED,[2,{code:p,data:c}]):(this.logger.info(fe.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),_=g,this._writeMessagesLog(te.ULTRA_GROUP,_.messageUId)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:_.messageUId,channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),c.sentTime=_.timestamp,c.messageUId=_.messageUId,this._ultraMsgMap[_.messageUId]=_.timestamp,f=t.channelId||"",(E=this._ultraGroupMap[f+"_"+e])?(E.latestMessage=c,lt(E.channelType)&&(c.channelType=E.channelType)):(E={conversationType:te.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:ae.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1},this._ultraGroupMap[f+"_"+e]=E,this._ultraGroupManager.addUltraGroupStatus(E)),this._watcher.conversation(Un([E])),[2,{code:p,data:c}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,i=e.channelId,r=e.targetId,s=this._connMgr.codec.encodeOperateStatus(r,n,i||"",t||0),(o=new yr(br[br.operate],s,r)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==$.SUCCESS?[2,{code:a,msg:$[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:$.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(i=new Or(br[br.qryMsg],n,this.currentUserId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(i,Vo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),s=r.code,o=r.data,s!==$.SUCCESS?[2,{code:s,msg:$[s]}]:(a=(o||{}).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._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,Bo),n=t.conversationType,i=t.info,r=t.summary;this.logger.debug(fe.O,"s_opNtf -> type: "+n+", info: "+i+", summary: "+r),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Or(br[br.upMsgEx],t,e.targetId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==$.SUCCESS?[2,{code:i,msg:$[i]}]:[2,{code:i}]}}))}))},t.prototype.modifyMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Or(br[br.modifyMsg],t,e.targetId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,s=i.data,r!==$.SUCCESS?[2,{code:r,msg:$[r]}]:(o=s,this._ultraMsgMap[o.messageUId]=o.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new Or(br[br.qryMsgChange],t,this.currentUserId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(n,Po)]):[2];case 1:return i=l.sent(),r=i.code,s=i.data,this._isPullingUltraChangeMessage=!1,r===$.SUCCESS&&s?(o=s.hasNext,a=s.list,u=(null==s?void 0:s.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,c),o?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},t.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=xe.CHANNEL_CHANGE,i=xe.MSG_RECALL,r=xe.MSG_EXPANSION,s=xe.MSG_MODIFY,o=xe.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[i]&&this._handleMsgRecall(t[i]),t[r]&&this._handleMsgUpdate(t[r]),t[s]&&this._handleMsgUpdate(t[s]),t[o]&&this._handleUserGroupStatus(t[o])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],i=[],r=[];e.forEach((function(e){var s=e.subChangeType,o=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l=a+"_"+o,h=t._ultraGroupMap[l];if(h){var d=Fe.PUBLIC_TO_PRIVATE,p=Fe.PRIVATE_TO_PUBLIC,g=Fe.PUBLIC_TO_PRIVATE_USER_NOT_IN,_=Fe.CHANNEL_DELETE,f=Fe.CHANNEL_USER_KICKED;switch(s){case p:h.channelType=Be.PUBLIC,n.push({targetId:o,channelId:a,changeType:ke.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Be.PRIVATE,n.push({targetId:o,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:o,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case _:i.push({targetId:o,channelId:a,channelType:h.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:o,channelId:a,userId:c,channelType:Be.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},t.prototype._handleMsgRecall=function(e){var t=this,i=[];e.forEach((function(e){var r=e.targetId,s=e.channelId,o=e.messageUId,a=e.sendTime,u=e.conversationType,c=e.operatorId,l=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,s,o,a,l),i.push({targetId:r,conversationType:u,sentTime:a,messageUId:o,senderUserId:c,channelId:s,content:{conversationType:u,targetId:r,messageUId:o,channelId:s},messageDirection:1,messageType:se.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:bn(n.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(i)},t.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,i=e.conversationType,r=e.sendTime,s=e.messageUId,o=e.channelId,a=i+"_"+n;t[a]||(t[a]=[]),t[a].push({messageUId:s,channelId:o,sendTime:r})})),t){var i=n.split("_"),r=i.shift(),s=i.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:s,conversationType:Number(r),messages:h([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(i=new Or(br[br.qryMsg],n,this.currentUserId)).setHeaderQos(Ti.AT_LEAST_ONCE),[4,this._connMgr.send(i,Vo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),s=r.code,o=r.data,s!==$.SUCCESS?[2,{code:s,msg:$[s]}]:(a=(o||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=c._ultraGroupMap[n+"_"+t];r&&r.latestMessage.messageUId===i&&(r.latestMessage=e),u.push(e)})),e===xe.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===xe.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d;return l(this,(function(l){return t=He.REMOVE_USER_GROUP,n=He.JOIN_USER_GROUP,i=He.EXIT_USER_GROUP,r=He.CHANNEL_BIND_USER_GROUP,s=He.CHANNEL_UNBIND_USER_GROUP,o=[],a=[],u=[],c=[],h=[],e.forEach((function(e){var l=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,_=e.channelId;switch(e.subChangeType){case t:o.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:u.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:c.push({conversation:{conversationType:l,targetId:d,channelId:_},channelType:g,userGroupIds:p});break;case s:h.push({conversation:{conversationType:l,targetId:d,channelId:_},channelType:g,userGroupIds:p})}})),d={},o.length>0&&(d.userGroupDisband=o),a.length>0&&(d.userAdded=a),u.length>0&&(d.userRemoved=u),c.length>0&&(d.userGroupBindChannel=c),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var i;return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(e,t),s=new Or(br[br.qryUgMsg],r,this.currentUserId),this.logger.info(fe.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:te.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(s,Cs,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP,targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),r=new Or(br[br.ugUnpushSet],i,e),[4,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return s=a.sent(),o=s.code,$.SUCCESS,[2,{code:o}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Or(br[br.ugUnpushQuery],i,e),[4,n.send(r,Eo)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return s=c.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?(u=a.unpushLevel,[2,{code:o,data:u}]):[2,{code:o}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,i,r){var s=t+"_"+e;if(this._ultraGroupMap[s]){var o=this._ultraGroupMap[s],a=o.latestMessage,u=o.lastReadTime;a&&a.messageUId===n&&(o.latestMessage=null),i&&u<i&&o.unreadMessageCount>0&&(--o.unreadMessageCount,(r===Ye.ALL||r===Ye.ME)&&o.unreadMentionedCount>0&&--o.unreadMentionedCount,r===Ye.ME&&o.unreadMentionedCount>0&&--o.unreadMentionedMeCount,this._watcher.conversation(Un([o])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:$.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Or(br[br.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,fo)]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=o.sent(),r=i.code,s=i.data,r===$.SUCCESS&&s?[2,{code:r,data:s}]:[2,{code:r}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,i=this._ultraGroupMap[n+"_"+t]||{},r=i.firstUnreadMessage||null,[2,{code:$.SUCCESS,data:r}]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.subscribeUser=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return this._isConnected?[2,this._subscribeManager.updateSubscribeRelation(e,t,$e.SUBSCRIBE,n)]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.unSubscribeUser=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return this._isConnected?[4,this._subscribeManager.updateSubscribeRelation(e,t,$e.UNSUBSCRIBE)]:[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return[2,{code:n.sent().code}]}}))}))},t.prototype.getSubscribeUserList=function(e,t,n){var i;return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){return this._isConnected?(r=null===(i=this._subscribeManager)||void 0===i?void 0:i.getSubscribeUserList(e,t,n),[2,Promise.resolve({code:$.SUCCESS,data:r})]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getSubscribeUserStatus=function(e,t){var n;return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return this._isConnected?(i=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserStatus(e,t),[2,Promise.resolve({code:$.SUCCESS,data:i})]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),i=new Or(br[br.setRtcRoomId],n,t),[4,this._connMgr.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),[2,r.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,s=n?new Or(t,r,e):new yr(t,r,e),[4,this._connMgr.send(s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),a=o.code,u=o.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=pa(this.rtcCodec,t,n),[4,this.rtcSignaling(e,br[br.rtcPing],!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s!==$.SUCCESS?[2,{code:s}]:((a=this.rtcCodec.decode(Rn.RtcOutput,o)).version=an(a.version),[2,{code:s,data:a}])}}))}))},t.prototype.getDeviceId=function(){return Gt(this.runtime)},t.prototype.getOSInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){Na(),fu()},t.prototype.callExtra=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.getContinuousMessages=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.removeFromBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.getBlacklist=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.batchClearMessagesByTimestamp=function(e){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentAndMessageType=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.searchMessagesByUser=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.getMessagesByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.updateMessageReceiptStatus=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearData=function(){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(t,n),[4,i.send(new Or(Qi,r,e),Yo)]):[3,2];case 1:return s=u.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?[2,Promise.resolve({code:o,data:{key:a.key,value:a.dataContent}})]:[2,Promise.resolve({code:o})];case 2:return[2,Promise.resolve({code:$.RC_NET_CHANNEL_INVALID})]}}))}))},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setProxy=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:$.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){var n;if(this._connMgr.setNetwork(e,t),e.status&&this.cloudControllerUri){var i=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,Tu.newWorkChange,i)}},t}(ui),Wu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.joinRTCRoom=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return o=pa(this._context.rtcCodec,t,n,i,r,s),[4,this.rtcSignaling(e,Bn,!0,o)];case 1:return a=l.sent(),u=a.code,c=a.buffer,u===$.SUCCESS&&c&&(h=ga(this._context.rtcCodec,c)),[2,{code:u,data:h}]}}))}))},t.prototype.quitRTCRoom=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(Rn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,kn,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Rn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,xn,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(s=this._context.rtcCodec.decode(Rn.RtcRoomInfoOutput,r)),[2,{code:i,data:s}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(Rn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Fn,!0,t)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(o=ga(this._context.rtcCodec,r),s={users:o.users}),[2,{code:i,data:s}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Rn.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Hn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Rn.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Yn,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o;return l(this,(function(a){switch(a.label){case 0:return o=this._context.rtcCodec.encode(Rn.RtcSetDataInput,{interior:i,target:r,key:t,value:n,objectName:null==s?void 0:s.name,content:null==s?void 0:s.content}),[4,this.rtcSignaling(e,qn,!1,o)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){var s,o;return l(this,(function(a){switch(a.label){case 0:return s={objectName:i,content:this._context.rtcCodec.encode(Rn.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(Rn.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(Rn.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},o=this._context.rtcCodec.encode(Rn.RtcUserSetDataInput,s),[4,this.rtcSignaling(e,Kn,!0,o)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Rn.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(Rn.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Kn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(Rn.RtcDataInput,{interior:n,target:i,key:t}),[4,this.rtcSignaling(e,jn,!0,r)];case 1:return s=l.sent(),o=s.code,a=s.buffer,o===$.SUCCESS&&a?(u=this._context.rtcCodec.decode(Rn.RtcQryOutput,a).outInfo,c={},u.forEach((function(e){c[e.key]=e.value})),[2,{code:o,data:c}]):[2,{code:o}]}}))}))},t.prototype.removeRTCData=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s;return l(this,(function(o){switch(o.label){case 0:return s=this._context.rtcCodec.encode(Rn.RtcDataInput,{interior:n,target:i,key:t,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(e,Qn,!1,s)];case 1:return[2,o.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=pa(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Wn,!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=this._context.rtcCodec.decode(Rn.RtcTokenOutput,o).rtcToken,[2,{code:s,data:{rtcToken:a}}]):[2,{code:s}]}}))}))},t.prototype.setRTCState=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Rn.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Jn,!0,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Rn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Xn,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(s=ga(this._context.rtcCodec,r),[2,{code:i,data:s}]):[2,{code:i}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return i=pa(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Zn,!0,i)];case 1:return r=l.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=this._context.rtcCodec.decode(Rn.RtcViewerJoinedOutput,o),u=a.rtcToken,c=a.entries,[2,{code:s,data:{token:u,kvEntries:c}}]):[2,{code:s}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return c(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return t=this._context.rtcCodec.encode(Rn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,zn,!0,t)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(Rn.RtcInput,{roomType:et.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,ei,!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=ga(this._context.rtcCodec,o),[2,{code:s,data:a}]):[2,{code:s}]}}))}))},t.prototype.requestRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteTimeout,s=e.inviteInfo,o=e.roomId,a=this._context.rtcCodec.encode(Rn.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:s}),[4,this.rtcSignaling(o,ti,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,s=e.roomId,o=this._context.rtcCodec.encode(Rn.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(s,ni,!0,o)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,r=e.content,s=e.key,o=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode(Rn.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:i,content:r,key:s,value:o,answerCode:a?1:0}),[4,this.rtcSignaling(u,ii,!0,c)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},t.prototype.endRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,s=e.roomId,o=this._context.rtcCodec.encode(Rn.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(s,ri,!0,o)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.registerRTCSignalListener=function(e){this._context.registerRTCSignalingListener(e)},t.prototype.rtcSignaling=function(e,t,n,i){return this._context.rtcSignaling(e,t,n,i)},t.prototype.getRTCJoinedUserInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Rn.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",si,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(s=this._context.rtcCodec.decode(Rn.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:s.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:an(e.joinTime)}}))}]):[2,{code:i}]}}))}))},t}(Ai);function Ju(e){return u({},e)}var Xu=function(){function e(e,t){var n,i;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[se.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[se.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[se.INTERCEPT]=this._processInterceptMessage.bind(this),n[se.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[se.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[se.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[se.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[se.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[se.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),i),this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0,messageDelivered:void 0,groupMessageDeliveredStatus:void 0,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=u({},t),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,$a.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,$a.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,$a.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,$a.DISCONNECTED),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),messageDelivered:this._messageDeliveredListerer.bind(this),groupMessageDeliveredStatus:this._groupMessageDeliveredStatusListerer.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this)};this.rtcCodec=this.createCodec(oi,ai),this._engine=On()?new RCCppEngine(e,this.rtcCodec,r,this._options):new Qu(e,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new Gn(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(fe.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(fe.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(fe.L_IMSDK_VER_O,JSON.stringify({commitId:"818915a24854e2a6959314debabd4999590e5f0d",version:"5.9.8"}));var i=this._context._engine;return t.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},e.getContext=function(){return this._context},e.prototype.getOptions=function(){return this._options},e.destroy=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(fe.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new di(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(fe.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(fe.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new Wu(this):new Ai(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(i,this._runtime,t)}catch(e){this.logger.error(fe.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[e.tag]=r),r},e.prototype._onConnectionStatusChange=function(e,t){var n,i;this.logger.warn(fe.A_CONNECT_S,"status: "+e+", code: "+t),null===(i=(n=this._watcher).connection)||void 0===i||i.call(n,e,t),this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,e,t)}))},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={},n=e.content.memberCount,i=void 0===n?0:n;Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){t[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId,memberCount:i}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(Ju(e)),this._watcher.typingState)return!0},e.prototype._processInterceptMessage=function(e){var t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===te.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===Re.MSG_EXPANSION||n===Re.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(fe.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._processChrmSyncMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBlockMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:e.content.chatroomId,operateType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBanMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:e.content.chatroomId,banType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processReadReceiptMessage=function(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)},e.prototype._processReadReceiptRequestMessage=function(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)},e.prototype._processReadReceiptResponseMessage=function(e){var t,n=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[i])},e.prototype._messageReceiver=function(e,t,n){var i,r,s,o,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[e.messageType])||void 0===r?void 0:r.call(i,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Ju(e))}catch(e){return a.logger.error(fe.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(o=(s=this._watcher).message)||void 0===o||o.call(s,Ju(e),t,n),e},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[],s=[],o=[se.READ_RECEIPT,se.READ_RECEIPT_REQUEST,se.READ_RECEIPT_RESPONSE];e.forEach((function(e){var a=i._messageReceiver(e,t,n);a&&o.includes(a.messageType)?s.push(a):a&&r.push(a)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(fe.L_BATCH_MESSAGE_O,r.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(r)),s.length&&s.forEach((function(e){i._messageProccessor[e.messageType]&&i._messageProccessor[e.messageType](e)}))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(fe.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._messageReadReceipt=function(e){var t,n;null===(n=(t=this._watcher).messageReadReceipt)||void 0===n||n.call(t,e)},e.prototype._syncReadStatus=function(e){var t,n;null===(n=(t=this._watcher).syncReadStatus)||void 0===n||n.call(t,e)},e.prototype._subscribedUserStatusChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedUserStatusChange)||void 0===n||n.call(t,e)},e.prototype._subscribedRelationChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedRelationChange)||void 0===n||n.call(t,e)},e.prototype._syncSubscribedUserStatusFinished=function(){var e,t;this.logger.info(fe.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(t=(e=this._watcher).syncSubscribedUserStatusFinished)||void 0===t||t.call(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},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]=It(i)||Tt(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,s=e.channelId,o=r.typingContentType,a=n+"#"+i+"#"+(s||"");this._typingInfo[a]||(this._typingInfo[a]=[]);var u=this._typingInfo[a].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[a][u].messageType===o?this._typingInfo[a][u].timestamp=Date.now():(u>=0&&this._typingInfo[a].splice(u,1),this._typingInfo[a].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),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.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},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._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var i,r;return c(this,void 0,void 0,(function(){var s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._token=e,[4,this._runtime.getNetworkType()];case 1:return s=l.sent(),this._engine.setNetwork({status:!0,type:s},!0),o=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(e,t,o,n)];case 2:return a=l.sent(),u=a.code,c=a.data,u!==$.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=Pt.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:u,userId:c}])}}))}))},e.prototype.disconnect=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(fe.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype._channelIdConvert=function(e,t){if(e!==te.ULTRA_GROUP)return t;var n=this.getNaviInfoFromCache();return!!(2&((null==n?void 0:n.ugDriven)||0))&&!t?"RCDefault":t},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),dt(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[e]=i),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],i={};return n&&Tt(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var r=t[e];lt(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[e]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:$.SEARCH_PROPS_LIMIT_ERROR}:{code:$.SUCCESS}},e.prototype._handleExpansioResult=function(e){var t=Lt(e),n=t.isIllgalEx,i=t.isExKeyOrValLengthExceedLimit;return t.isExceedLimit||i?$.EXPANSION_LIMIT_EXCEET:n?$.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0},e.prototype.sendMessage=function(e,t,n,i,r){var s=this.checkSearchPropsMsg(n.messageType,n.content),o=s.code,a=s.msg;if(o!==$.SUCCESS)return Promise.resolve({code:o,msg:a});if(e===te.SYSTEM&&n.messageType!==se.SYNC_READ_STATUS)return Promise.resolve({code:$.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(e!==te.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(0!==((null==u?void 0:u.grpRRVer)||0)&&n.messageType===se.READ_RECEIPT_RESPONSE)return Promise.resolve({code:$.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,h=n.expansion;if(l){var d=this._handleExpansioResult(h);if(d)return Promise.resolve({code:d})}var p,g,_=JSON.stringify(n.content);return p=_,void 0===g&&(g="utf-8"),("utf-16"===g?f(p):E(p))>N?Promise.resolve({code:$.RC_MSG_CONTENT_EXCEED_LIMIT}):e===te.ULTRA_GROUP?(n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,i,r)):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,s=e.keys,o=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=Lt(o),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:$.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:$.INVALID_PARAMETER_MESSAGE_EXPANSION})]:(d={mid:r},o&&(d.put=o),s&&(d.del=s),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:se.EXPANSION_NOTIFY,channelId:t})])):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.READ_RECEIPT_ERROR,msg:"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 c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n||"")]}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.sendReadReceiptMessageV4(e,t,n)]}))}))},e.prototype.getMessageReadReceiptV4=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getMessageReadReceiptV4(e,t)]}))}))},e.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchGetMessageReadReceiptInfoV4(e,t)]}))}))},e.prototype.updateConversationReadTime=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.updateConversationReadTime(e,t)]}))}))},e.prototype._destroy=function(){return c(this,void 0,void 0,(function(){var e=this;return l(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return t.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondestroy)try{t.ondestroy()}catch(t){e.logger.error(fe.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,i,r,s,o,a){var u={timestamp:n||0,count:i||20,order:r||0,channelId:s||""};if(e===te.ULTRA_GROUP){var c=this._channelIdConvert(e,u.channelId);return u.channelId=c,this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,u.timestamp,u.count,u.order,u.channelId,o||"",a)},e.prototype.getMessages=function(e,t,n,i,r,s,o){var a={timestamp:n||0,count:i||20,order:r||0,channelId:s||""};if(e===te.ULTRA_GROUP){var u=this._channelIdConvert(e,a.channelId);return a.channelId=u,this._engine.getUltraHistoryMsg(t,a,o)}return this._engine.getMessages(e,t,a.timestamp,a.count,a.order,a.channelId,o)},e.prototype.getContinuousMessages=function(e,t,n,i,r,s){return void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===s&&(s=""),this._engine.getContinuousMessages(e,t,n,i,r,s)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,s,o){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,s,o)},e.prototype.getConversationList=function(e,t,n,i,r){if(t===te.ULTRA_GROUP){var s=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:$[s]})}return this._engine.getConversationList(e||300,t,n,i,r||"")},e.prototype.getConversationsByPage=function(e,t,n,i,r){return this._engine.getConversationsByPage(e,t,n,i,r)},e.prototype.getConversation=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversation(e,t,i||"")},e.prototype.removeConversation=function(e,t,n){return e===te.ULTRA_GROUP?Promise.resolve($.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n||"")},e.prototype.batchRemoveConversation=function(e){return this._engine.batchRemoveConversation(e)},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){if(e===te.ULTRA_GROUP){var i=this._channelIdConvert(e,n);return this._engine.clearUltraUnreadcount(t,i||"")}return this._engine.clearConversationUnreadCount(e,t,n||"")},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationUnreadCount(e,t,i||"")},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(te.ULTRA_GROUP)){var i=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:$[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE],!!n)},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){return this._engine.getTotalUnreadCountByLevels(e,t,n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._engine.getFirstUnreadMessage(e,t,n||"")},e.prototype.getFirstUnreadMessageInfo=function(e,t,n){return this._engine.getFirstUnreadMessageInfo(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){return r=this._channelIdConvert(e,i),[2,this._engine.setConversationNotificationLevel(e,t,n,r||"")]}))}))},e.prototype.batchSetConversationNotificationLevel=function(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)},e.prototype.setConversationStatus=function(e,t,n,i,r,s){if(void 0===s&&(s=!0),e===te.ULTRA_GROUP&&void 0!==n)return Promise.resolve($.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:this._channelIdConvert(e,r)||"",isUpdateTime:s}];return this._engine.batchSetConversationStatus(o)},e.prototype.batchSetConversationToTop=function(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){var r=this._channelIdConvert(e,i);return this._engine.saveConversationMessageDraft(e,t,n,r||"")},e.prototype.getConversationMessageDraft=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationMessageDraft(e,t,i||"")},e.prototype.clearConversationMessageDraft=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.clearConversationMessageDraft(e,t,i||"")},e.prototype.recallMessage=function(e,t,n,i,r){var s=this._channelIdConvert(e,r.channelId);return r.channelId=s||"",this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){if(e===te.ULTRA_GROUP&&On())return Promise.resolve($.METHOD_NOT_SUPPORT);var r=this._channelIdConvert(e,i);return this._engine.deleteRemoteMessage(e,t,n,r||"")},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){var r=this._channelIdConvert(e,i);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r||"")},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 this._engine.getChatroomInfo(e,t||0,n||0)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return dn(n)?pn(i)?this._engine.setChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_VALUE):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n],r=i.key,s=i.value;if(!dn(r))return Promise.resolve({code:$.INVALID_PARAMETER_KEY});if(!pn(s))return Promise.resolve({code:$.INVALID_PARAMETER_VALUE})}var o=u(u({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,o)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return dn(n)?pn(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_VALUE):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return dn(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n].key;if(!dn(i))return Promise.resolve({code:$.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return dn(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return this._engine.getChatroomHistoryMessages(e,i||0,t||20,n||0)},e.prototype.getFileToken=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return s=this.getNaviInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i,r)];case 1:return c=l.sent(),h=c.code,d=c.data,h===$.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:o,qiniu:a,ossConfig:u}))]:[2,Promise.reject(h)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=pe.QINIU),c(this,void 0,void 0,(function(){var s,o,a;return l(this,(function(u){switch(u.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,r,t,n)];case 1:return s=u.sent(),o=s.code,a=s.data,o===$.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(o)]}}))}))},e.prototype.createTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n,i=this;return l(this,(function(r){return t.length>1e3?[2,Promise.resolve({code:$.CONVER_OUT_LIMIT_ERROR})]:(n=t.map((function(e){var t=e.conversationType,n=e.targetId,r=e.channelId;return{conversationType:t,targetId:n,channelId:i._channelIdConvert(t,r)}})),[2,this._engine.addTagForConversations(e,n)])}))}))},e.prototype.removeTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n,i=this;return l(this,(function(r){return n=t.map((function(e){var t=e.conversationType,n=e.targetId,r=e.channelId;return{conversationType:t,targetId:n,channelId:i._channelIdConvert(t,r)}})),[2,this._engine.removeTagForConversations(e,n)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return n=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=n,[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this._channelIdConvert(t.conversationType,t.channelId),t.channelId=i,[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=t,[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(e,t){return e&&0!==e.length||(e=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},e.prototype.getUnreadMentionedCount=function(e){var t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==te.ULTRA_GROUP){var t=$.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:$[t]})}var n=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=n,this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){var t=this,n=e.messages.map((function(n){var i=n.sendTime,r=n.messageUId,s=n.channelId;return{sendTime:i,messageUId:r,channelId:t._channelIdConvert(e.conversationType,s)}}));return e.messages=n,this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==te.ULTRA_GROUP?[2,{code:r=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[r]}]:i?(s=Lt(n),o=s.isIllgalEx,a=s.isExKeyOrValLengthExceedLimit,s.isExceedLimit||a?[2,{code:$.EXPANSION_LIMIT_EXCEET}]:o?[2,{code:$.INVALID_PARAMETER_MESSAGE_EXPANSION}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return e.conversationType!==te.ULTRA_GROUP?[2,{code:t=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e,t)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadCountByTargetId(e,t)},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.getUltraGroupUnreadMentionedMessages=function(e){var t=this._channelIdConvert(te.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){var t=this._channelIdConvert(te.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)},e.prototype.getUltraGroupUnreadInfoList=function(e){return this._engine.getUltraGroupUnreadInfoList(e)},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,h([e],n,!1))},e.prototype.getOSInfo=function(){return this._engine.getOSInfo()},e.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._engine.setCallInfo(e,t,n)},e.prototype.getGroupMessageDeliverList=function(e,t,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){return void 0===t&&(t=""),this._engine.getPrivateMessageDeliverTime(e,t)},e.prototype._isEnableSubDriven=function(){var e=this.getNaviInfoFromCache();return(null==e?void 0:e.subDriven)&&1&e.subDriven},e.prototype.subscribeUser=function(e,t,n){return this._isEnableSubDriven()?this._engine.subscribeUser(e,t,n):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.unSubscribeUser=function(e,t){return this._isEnableSubDriven()?this._engine.unSubscribeUser(e,t):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserList=function(e,t,n){return this._isEnableSubDriven()?this._engine.getSubscribeUserList(e,t,n):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserStatus=function(e,t){return this._isEnableSubDriven()?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.clearConversations=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(fe.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s;return l(this,(function(o){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,s=i.msg,r!==$.SUCCESS?[2,Promise.resolve({code:r,msg:s})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,!!i,r)]}))}))},e.prototype.batchClearMessagesByTimestamp=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.batchClearMessagesByTimestamp(e)]}))}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchClearRemoteHistoryMessages(e,t)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n||"",i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,i,r,s,o){return void 0===o&&(o=""),c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,i,r,s,o)]}))}))},e.prototype.searchMessageByContentAndMessageType=function(e,t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentAndMessageType(e,t,n,i,r,s,o)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,i,r,s){return void 0===r&&(r=5),void 0===s&&(s=""),c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessagesByUser(e,t,n,i,r,s)]}))}))},e.prototype.getMessagesByTimestamp=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getMessagesByTimestamp(e,t,n,i)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,i,r)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,i,r,s,o)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,n,i)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){var n=this._channelIdConvert(te.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){var i=this._channelIdConvert(te.ULTRA_GROUP,n);return this._engine.setUltraGroupDefaultNotificationLevel(e,t,i||"")},e.prototype.getConversationNotificationLevel=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationNotificationLevel(e,t,i||"")},e.prototype.getConversationNotificationStatus=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationNotificationStatus(e,t,i||"")},e.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,s){return this._engine.getRemoteHistoryMessages(e,t,n,i,r,s)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(e,t)},e.prototype.createStatisticLogger=function(e,t){return this._engine.createStatisticLogger(e,t)},e.prototype.setCheckDuplicateMessage=function(e){return this._engine.setCheckDuplicateMessage(e)},e.prototype.rtcSignaling=function(e,t,n,i){return this._engine.rtcSignaling(e,t,n,i)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e}(),Zu=function(){function e(e,t){var n,i;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=Xu.getContext(),this.logger=null===(n=this.context)||void 0===n?void 0:n.logger,this.option=null===(i=this.context)||void 0===i?void 0:i.getOptions()}return e.prototype.validate=function(e,t,n,i,r){if(void 0===i&&(i=!1),this.verificationFaileList.length>0)return this;n=Jt[n]||n;var s=i?n(t):vt(t)||null==t||n(t);return s||this.verificationFaileList.push({key:e,value:t,isValid:s,message:r}),this},e.prototype._getValidationResult=function(){var e;if(this.verificationFaileList.length>0){var t=this.verificationFaileList[0];e={key:t.key,value:t.value,isValid:t.isValid,message:t.message}}return e},e.prototype.ifReady=function(e){var t;if(!this.context)return Promise.resolve({code:$.BIZ_ERROR_CLIENT_NOT_INIT});var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var i=yi[n.key];null===(t=this.logger)||void 0===t||t.error(this._logTagR,JSON.stringify({code:i}));var r=""+n.value;return Promise.resolve({code:i,msg:"'"+n.key+"' is invalid: "+(n.message?n.message:r)})},e.prototype.try2do=function(e){if(!this.context)throw new Error("Not initialized yet!");return e(this.context,this.logger,this.option)},e.prototype.ifReadySync=function(e){var t;if(!this.context)return{code:$.BIZ_ERROR_CLIENT_NOT_INIT};var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var i=yi[n.key];null===(t=this.logger)||void 0===t||t.warn(this._logTagR,JSON.stringify({code:i}));var r=""+n.value;return{code:i,msg:"'"+n.key+"' is invalid: "+(n.message?n.message:r)}},e}(),zu=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-zu),void 0===n&&(n=Date.now()),c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){switch(s.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>zu&&(t=n-zu),(i=new xa(e,"RC-IM","IM")).debug(fe.T,"get logs: startTime "+t+" endTime "+n),ya(e,i,{tag:"browser"}),[4,Ga().getLogs(t,n,ha.DEBUG,!1)];case 1:return r=s.sent().logs,i.debug(fe.T,"get logs "+r.length),function(e,t){var n=t.map((function(e){return e.sessionId+","+e.time+","+e.type+","+e.level+","+e.tag+","+e.traceId+","+e.loggerId+',"'+e.content+'"\n'})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=e+".csv",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}(e+"-"+t+"-"+n,r),[2]}}))}))}}}}var $u=x;export{ou as AConnectionMgr,ui as AEngine,Xu as APIContext,s as AppStorage,hi as AreaCode,Ft as AssertRules,xu as BaseCloudController,Ia as BasicLogger,$r as BasicNavi,Fa as BasicReporter,mi as BasicStaticConfigManager,Au as BasicStatistic,Nu as BasicStatisticReporter,D as CPP_PROTOCAL_MSGTYPE_OPTION,at as CallLibMsgType,Ie as ChatroomEntryType,it as ChatroomSyncStatusReason,Ce as ChatroomUserChangeType,Pe as ChrmMemBanType,Ue as ChrmMemOperateType,Me as ChrmSyncStatus,di as Codec,Je as ConnectReason,We as ConnectType,ie as ConnectionStatus,te as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,wn as DelayTimer,De as EConnectProtocol,qe as EnterpriseType,$ as ErrorCode,yi as ErrorCodeMap,Ut as EventEmitter,F as FORMATED_VERSION,J as FileType,v as HTTP_TIMEOUT,rn as HttpMethod,O as IM_CHATROOM_PULL_INTERVAL_TIME,m as IM_PING_INTERVAL_TIME,A as IM_PING_MIN_TIMEOUT,y as IM_PING_TIMEOUT,S as IM_SIGNAL_TIMEOUT,xa as IndexDBLogger,za as IndexDBReporter,Mu as IndexDBStatistic,wu as IndexDBStatisticReporter,we as InterruptionLevel,Tu as InvokerType,Q as LOCAL_STORAGE_KEYS,nt as LiveRole,tt as LiveType,ha as LogL,ge as LogLevel,_e as LogSource,fe as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,M as MAX_MESSAGE_EXPANSION_KEY_LENGTH,L as MAX_MESSAGE_EXPANSION_VAL_LENGTH,H as MAX_UPLOAD_FILE_SIZE,he as MentionedType,Re as MessageBlockSourceType,me as MessageBlockType,Z as MessageDirection,se as MessageType,I as NAVI_CACHE_DURATION,R as NAVI_REQ_TIMEOUT,je as NaviCacheType,sn as NetworkType,ce as NotificationLevel,ae as NotificationStatus,k as ONE_LOG_SIZE_MAX,Xe as OnlineStatus,Ne as OperateStatus,Ze as PlatformInfo,Ai as PluginContext,Ke as ProtocalType,Ve as PushImportanceHonor,Xt as RCAssertError,$a as RCConnectionStatus,K as RC_DEFAULT_USER,j as READ_RECEIPT_CATCH_TIME,V as REAT_TIME_LOG_SIZE,rt as RTCApiType,st as RTCIdentityChangeType,ot as RTCJoinType,et as RTCMode,Wu as RTCPluginContext,n as ReceivedStatus,P as SEND_MESSAGE_TYPE_OPTION,q as STATIC_CONFIG_CACHE_TIME,b as STATIC_CONFIG_IV,U as STATIC_CONFIG_KEY,w as STATUS_MESSAGE,ye as SentStatus,su as StatisticL,Ee as StatisticsTag,Qe as StatisticsVersion,Ge as StoreKeys,$e as SubscribeOperationType,ze as SubscribeType,Wt as SuspendablePromise,on as TagChangeType,Y as UPLOAD_FILE_CHUNK_SIZE,ke as UltraGroupChannelChangeType,Be as UltraGroupChannelType,Ye as UltraMentionedType,xe as UltraMsgChangeType,Fe as UltraMsgSubChangeType,pe as UploadMethod,He as UserGroupChangeType,x as VERSION,Zu as ValidatorManage,Pt as VersionManage,C as WEB_SOCKET_TIMEOUT,ns as WebSocketNavi,T as appendUrl,Zt as assert,Un as clone,Nn as cloneByJSON,Dn as completeSubscriptionPlatformStatus,Na as deInitLogDB,fn as decryptCBC,En as fixUrlProtocol,Cn as forEach,Mn as getBrowser,gn as getClientMessageId,Gt as getDeviceId,Tn as getMessageUIdHash,cn as getMimeKey,wt as getUUID,Vt as getUUID22,un as getUploadFileName,_n as getbundleId,In as httpRequest,mn as indexOf,ya as initLogDB,gu as initStatisticDB,dt as isArray,_t as isArrayBuffer,ct as isBoolean,ru as isConnnectAck,iu as isDisconnectedByServer,It as isFunction,Ct as isHttpUrl,An as isInObject,yn as isInclude,ht as isInteger,pt as isLimitedArray,gt as isLimitedString,Rt as isNull,lt as isNumber,Tt as isObject,Dt as isStartCloudController,ut as isString,Ot as isTypeInConversationList,vt as isUndefined,At as isValidChannelId,dn as isValidChrmEntryKey,pn as isValidChrmEntryValue,mt as isValidConversationType,Lt as isValidExpansion,Mt as isValidFileType,yt as isValidNotificationLevel,Nt as isValidTargetId,Qt as logger,Sn as map,Et as notEmptyArray,St as notEmptyObject,ft as notEmptyString,ln as pushConfigsToJSON,hn as pushJSONToConfigs,Cu as statisticTranscsv,_ as todo,Za as transcsv,Pn as transformReceivedStatusFlag,bn as transformReceivedStatusInfo,fu as unInitStatisticDB,Si as urlCenter,On as usingCppEngine,zt as validate,Jt as validators,$u as version};
1
+ var e;!function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,i=function(e){return t||(t={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),t},r=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),s=function(){function e(e,t){var n;this._rootStorage=i(e);var s=this._rootStorage.get(t)||{};this._cache=new r(((n={})[t]=s,n)),this._storageKey=t}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e.prototype.update=function(e){void 0===e&&(e={});var t=this._storageKey;this._cache.set(t,e),this._rootStorage.set(t,e)},e}(),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=function(){return u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},u.apply(this,arguments)};function c(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))}function l(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function h(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var d,p=function(e){function t(t){return e.call(this,"TODO => "+t)||this}return a(t,e),t}(Error),_=function(e){return new p(e)},f=function(e){for(var t=0,n=0,i=e.length;n<i;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},E=function(e){for(var t,n=0,i=0,r=e.length;i<r;i++)n+=(t=e.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return n},T=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return e+"="+t[e]})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},I=72e5,v=6e4,R=1e4,C=5e3,S=3e4,m=15e3,y=15e3,A=2e3,N=131072,O=18e4,M=32,L=4096,U="cd4936151214ce45dc1d12673a59d94c",b="51ad078e5eb17a91",P={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0,searchProps:["content","title"]},"RC:FileMsg":{isCounted:!0,isPersited:!0,searchProps:["name"]},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:CombineV2Msg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:RcNtf":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:Delivered":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},D={"RC:DizNtf":{isCounted:!1,isPersited:!1}},w=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.9.9",F=x.replace(/-.+$/,""),H=5368709120,q=10485760,Y=18e5,K="rongcloudsystem",j=864e5,Q={NAVI_KEY:function(e){return"navi_"+e},CONVER_STATE_PULL_TIME_KEY:function(e,t){return"RCV4-con-s-"+e+"-"+t},OLD_CONVER_STATE_KEY:function(e,t){return"RCV4-con-"+e+"-"+t},CONVER_STATE_KEY:function(e,t){return"RCV4-CONVER-"+e+"-"+t},ULTRA_GROUP_STATE_KEY:function(e,t){return"RCV4-ultragroupconversation-"+e+"-"+t},OUTBOX_TIME_KEY:function(e,t){return"outbox_"+e+"_"+t},INBOX_TIME_KEY:function(e,t){return"inbox_"+e+"_"+t},BROADCASTBOX_TIME_KEY:function(e,t){return"broadcastbox_"+e+"_"+t},SEND_MSG_KEY:function(e,t){return"send_msg_"+e+"_"+t},USER_SETTING_TIME_KEY:function(e,t){return"us-s-"+e+"-"+t},TAG_STATE_KEY:function(e,t){return"tag-"+e+"-"+t},USER_SETTING_KEY:function(e,t){return"RC-us-"+e+"-"+t},STATIC_CONFIG_KEY:function(e){return"rc-static-config-"+e},CLOUD_CONTROL_KEY:function(e){return"RC-cc-"+e},READ_RECEIPT_KEY:function(e,t){return"RC-RR-"+e+"-"+t}};!function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var W,J=d;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(W||(W={}));var X,Z=W;!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.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.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(X||(X={}));var z,$=X;!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(z||(z={}));var ee,te=z;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(ee||(ee={}));var ne,ie=ee;!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.COMBINE_V2="RC:CombineV2Msg",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.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",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.READ_STATE="RC:RSMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg",e.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg"}(ne||(ne={}));var re,se=ne;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(re||(re={}));var oe,ae=re;!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"}(oe||(oe={}));var ue,ce=oe;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(ue||(ue={}));var le,he=ue;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(le||(le={}));var de,pe=le;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(de||(de={}));var ge,_e,fe,Ee,Te,Ie=de;!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"}(ge||(ge={})),function(e){e.IM="IM",e.RTC="RTC"}(_e||(_e={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.A_INIT_REPEAT_O="A_INIT_REPEAT_O",e.L_INIT_O="L-init-O",e.A_DESTROY_O="A_DESTROY_O",e.L_DESTROY_O="L_DESTROY_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.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",e.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",e.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",e.A_MSG_LISTENER_E="A-MSG_LISTENER-E",e.O="L-original-O",e.T="L-TEST-O",e.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",e.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",e.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",e.L_NAVI_CMP_R="L-NAVI_CPM-R",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-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_MSG_E="L-pull_msg-E",e.L_PULL_MSG_O="L-pull_msg-O",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.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",e.L_RECV_S_MSG_O="L-recv_s_msg-O",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_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_REQUEST_T="L-request-T",e.L_REQUEST_R="L-request-R",e.L_PARSE_NAVI_E="L-parse_navi-E",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_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",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_REPORT_LOG_S="G-report_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.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",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_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",e.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E",e.L_CALLBACK_E="L-callback-E",e.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",e.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",e.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",e.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",e.A_SYNC_READ_STATUS_T="A-sync_read_status-T",e.A_SYNC_READ_STATUS_R="A-sync_read_status-R",e.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",e.L_PB_ENCODE_E="L-pb-encode-E",e.L_PB_DECODE_E="L-pb-decode-E",e.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",e.L_REPORT_FULL_LOG_O="L-report_full_log-O",e.L_REPORT_FULL_LOG_T="L-report_full_log-T",e.L_REPORT_FULL_LOG_R="L-report_full_log-R",e.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",e.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",e.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",e.L_LOGDB_CLOSED_S="L-logDB_closed-S",e.L_LOGDB_ERROR_E="L-logDB_error-S",e.L_LOGDB_ABORT_S="L-logDB_abort-S",e.L_REALTIME_LOG_R="L_REALTIME_LOG_R",e.L_REALTIME_LOG_O="L_REALTIME_LOG_O",e.L_REALTIME_LOG_T="L_REALTIME_LOG_T",e.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",e.L_RECV_RMTP_O="L_RECV_RMTP_O",e.L_RECV_RMTP_E="L_RECV_RMTP_E",e.L_RECV_S_NTF_O="L-recv_s_ntf_O",e.L_VER_REPORT_T="L-VER_REPORT-T",e.L_VER_REPORT_R="L-VER_REPORT-R",e.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",e.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",e.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",e.A_REMOVE_PROXY_O="A-remove_proxy-O",e.A_SET_PROXY_O="A-set_proxy-O",e.A_TEST_PROXY_O="A-test_proxy-O",e.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",e.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",e.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",e.L_GET_STATIC_CONF_T="L-get_static_conf-T",e.L_GET_STATIC_CONF_R="L-get_static_conf-R",e.L_GET_STATIC_CONF_E="L-get_static_conf-E",e.L_CLOUD_DISABLED="L-cloud_disabled",e.L_CLOUD_EXPIRE="L-cloud_expire",e.L_CLOUD_OVERCLOCK="L-cloud_overclock",e.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",e.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",e.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",e.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",e.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",e.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",e.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",e.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",e.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",e.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",e.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",e.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",e.L_PARSE_JSON_E="L-parse_json-E"}(fe||(fe={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(Ee||(Ee={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Te||(Te={}));var ve,Re,Ce=Te;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(ve||(ve={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Re||(Re={}));var Se,me=ve;!function(e){e[e.typing=0]="typing"}(Se||(Se={}));var ye,Ae,Ne=Se;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(ye||(ye={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(Ae||(Ae={}));var Oe,Me=Ae;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Oe||(Oe={}));var Le,Ue=Oe;!function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(Le||(Le={}));var be,Pe=Le;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(be||(be={}));var De,we,Ve,Ge,Be,ke,xe,Fe,He,qe,Ye,Ke,je,Qe,We,Je,Xe,Ze,ze,$e,et,tt,nt,it=be;!function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(De||(De={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(we||(we={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(Ve||(Ve={})),function(e){e.NAVI="rc-navi",e.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(Ge||(Ge={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Be||(Be={})),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"}(ke||(ke={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(xe||(xe={})),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"}(Fe||(Fe={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(He||(He={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(qe||(qe={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Ye||(Ye={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Ke||(Ke={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(je||(je={})),function(e){e[e.CURRENT=2]="CURRENT"}(Qe||(Qe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(We||(We={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Je||(Je={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(Xe||(Xe={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini"}(Ze||(Ze={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS"}(ze||(ze={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}($e||($e={})),function(e){e[e.RTC=0]="RTC",e[e.LIVE=2]="LIVE",e[e.SIP=4]="SIP",e[e.CALL=5]="CALL",e[e.MEETING=6]="MEETING",e[e.CROSS_MUTI=7]="CROSS_MUTI",e[e.CROSS_LIVE=8]="CROSS_LIVE"}(et||(et={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO=1]="AUDIO"}(tt||(tt={})),function(e){e[e.ANCHOR=1]="ANCHOR",e[e.AUDIENCE=2]="AUDIENCE"}(nt||(nt={}));var rt,st,ot,at={"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"}(rt||(rt={})),function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(st||(st={})),function(e){e[e.KICK=0]="KICK",e[e.REFUSE=1]="REFUSE",e[e.COEXIST=2]="COEXIST"}(ot||(ot={}));var ut=function(e){return"string"==typeof e},ct=function(e){return"boolean"==typeof e},lt=function(e){return"number"==typeof e&&!Number.isNaN(e)},ht=function(e){return function(t){return Number.isInteger(t)&&(void 0===e.min||t>=e.min)&&(void 0===e.max||t<=e.max)}},dt=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},pt=function(e){return function(t){if(!dt(t)||void 0!==e.minLength&&t.length<e.minLength||void 0!==e.maxLength&&t.length>e.maxLength)return!1;if(!e.itemValidator)return!0;var n=!0;return t.every((function(t){var i=e.itemValidator&&e.itemValidator(t);return"object"==typeof i?i.errorKey?(n={errorKey:i.errorKey,valid:i.valid},!1):(n=i.valid,i.valid):(n=!!i,i)})),n}},gt=function(e){return function(t){return ut(t)&&(void 0===e.minLength||t.length>=e.minLength)&&(void 0===e.maxLength||t.length<=e.maxLength)&&(void 0===e.validator||e.validator(t))}},_t=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},ft=function(e){return ut(e)&&e.length>0},Et=function(e){return dt(e)&&e.length>0},Tt=function(e){return"[object Object]"===Object.prototype.toString.call(e)},It=function(e){return"[object Function]"===Object.prototype.toString.call(e)},vt=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Rt=function(e){return"[object Null]"===Object.prototype.toString.call(e)},Ct=function(e){return ut(e)&&/https?:\/\//.test(e)},St=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},mt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(te,e)},yt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(ce,e)},At=function(e){var t=!1;return ut(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Nt=function(e){return gt({minLength:1,maxLength:64})(e)},Ot=function(e){return[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE].includes(e)},Mt=function(e){return lt(e)&&Object.prototype.hasOwnProperty.call(J,e)},Lt=function(e){var t=!1,n=!1,i=!1;if(Tt(e)){var r=Object.keys(e).length;for(var s in t=r>20,e)if(n||(n=ut(s)&&!/^[A-Za-z0-9_=+-]+$/.test(s)),!i){var o=e[s];i=s.length>32||o.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},Ut=function(e,t){var n;return Tt(e)?(t&&!t.includes(e.conversationType)&&(n="conversationTypeNotSupport"),Nt(e.targetId)||(n="targetId"),mt(e.conversationType)||(n="conversationType"),vt(e.channelId)||At(e.channelId)||(n="channelId"),vt(n)?{valid:!0}:{valid:vt(n),errorKey:n}):{valid:!1,errorKey:"conversation"}},bt=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var i=this._map[e]||(this._map[e]=[]);i.some((function(e){return e.listener===t&&e.target===n}))||i.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var i=this._map[e];i&&((i=i.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=i:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=this._map[e];if(i)for(var r=i.length-1;r>=0;r-=1){var s=i[r],o=s.target,a=s.once,u=s.listener;a&&i.splice(r,1);try{u.call.apply(u,h([o],t,!1))}catch(e){null===console||void 0===console||console.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),Pt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Pt.engine="5.9.9";var Dt=function(){function e(){}return e.add=function(e,t){Pt[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Pt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Pt},e}();function wt(){return!0}var Vt=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)}))},Gt=function(){var e=Vt();if(e=e.replace(/-/g,"")+"a",e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,i=+e,r=[];do{var s=i%n;i=(i-s)/n,r.unshift(t[s])}while(i);return r.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e},Bt=function(e){var t="RCDeviceId",n=i(e),r="",s=n.get(t);return s?r=s:(r=Gt(),n.set(t,r)),r},kt=null;function xt(e,t,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-e];if(kt&&e<ge.FATAL)try{var s=JSON.stringify(n);kt[r](t,s)}catch(e){console.error(e)}}var Ft,Ht,qt=xt.bind(null,ge.DEBUG),Yt=xt.bind(null,ge.INFO),Kt=xt.bind(null,ge.WARN),jt=xt.bind(null,ge.ERROR),Qt=xt.bind(null,ge.FATAL),Wt=Object.freeze({__proto__:null,init:function(e){kt=e},log:xt,debug:qt,info:Yt,warn:Kt,error:jt,fatal:Qt}),Jt=function(){function e(e,t){var n=this;this._promise=new Promise((function(t){n._resolve=t,e(n._onResolve.bind(n))})),this._onCancel=t}return e.prototype._onResolve=function(e){this._resolve(e)},e.prototype.result=function(){return this._promise},e.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},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",e[e.CONVERSATION_TYPE=9]="CONVERSATION_TYPE"}(Ht||(Ht={}));var Xt=((Ft={})[Ht.STRING]=ft,Ft[Ht.ONLY_STRING]=ut,Ft[Ht.NUMBER]=lt,Ft[Ht.BOOLEAN]=function(e){return"boolean"==typeof e},Ft[Ht.OBJECT]=Tt,Ft[Ht.ARRAY]=dt,Ft[Ht.CALLBACK]=function(e){var t=!0;return Tt(e)||(t=!1),(e=e||{}).onSuccess&&!It(e.onSuccess)&&(t=!1),e.onError&&!It(e.onError)&&(t=!1),t},Ft[Ht.CHANNEL_ID]=At,Ft[Ht.CONVERSATION]=function(e){var t=!0;return Tt(e)||(t=!1),ut(e.targetId)||(t=!1),mt(e.conversationType)||(t=!1),vt(e.channelId)||At(e.channelId)||(t=!1),t},Ft[Ht.CONVERSATION_TYPE]=mt,Ft),Zt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return a(t,e),t}(Error),zt=function(e,t,n,i){if(void 0===i&&(i=!1),!$t(e,t,n,i))throw new Zt("'"+e+"' is invalid: "+JSON.stringify(t))},$t=function(e,t,n,i){void 0===i&&(i=!1),n=Xt[n]||n;var r=i?n(t):vt(t)||null==t||n(t);return r||null===console||void 0===console||console.error("'"+e+"' is invalid: "+JSON.stringify(t)),r},en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function tn(e){var t,n,i,r,s,o,a="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=en.indexOf(e.charAt(u++))<<2|(r=en.indexOf(e.charAt(u++)))>>4,n=(15&r)<<4|(s=en.indexOf(e.charAt(u++)))>>2,i=(3&s)<<6|(o=en.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==s&&(a+=String.fromCharCode(n)),64!==o&&(a+=String.fromCharCode(i));return a}function nn(e){for(var t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}var rn,sn=function(e){if(!Tt(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)},on=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),i=Vt(),r=function(e){e=e||"-";var t=new Date;return""+t.getFullYear()+e+(t.getMonth()+1)+e+t.getDate()}(),s=(new Date).getTime(),o="";if(t){var a=t.split(".");o="."+a[a.length-1]}return e+"__RC-"+r+"_"+n+"_"+s+i+o},an=function(e){var t="application/octet-stream";switch(e){case J.IMAGE:t="image/jpeg";break;case J.AUDIO:t="audio/amr";break;case J.VIDEO:t="video/3gpp";break;case J.SIGHT:t="video/mpeg4";break;case J.COMBINE_HTML:t="text/html"}return t},un=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=t.channelIdMi,i=t.channelIdHW,r=t.channelIdOPPO,s=t.typeVivo,o=t.importanceHW,a=t.categoryHW,u=t.imageUrlHW,c=t.categoryVivo,l=t.importanceHonor,h=t.imageUrlHonor,d=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,i=e.apnsCollapseId,r=e.category,s=e.richMediaUri,o=e.interruptionLevel,a=t.googleConfig,u={};u["thread-id"]=n||"",u["apns-collapse-id"]=i||"",u.category=r||"",u.richMediaUri=s||"",u["interruption-level"]=o||"active";var c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;var l=null==a?void 0:a.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),c.priority=l,{APNS:u,FCM:c}}(e,t),p=[{HW:{channelId:i||"",importance:o||"NORMAL",image:u||"",category:a||""}},{MI:{channelId:n||""}},{OPPO:{channelId:r||""}},{VIVO:{classification:s||"",category:c||""}},{APNS:d.APNS},{FCM:d.FCM},{HONOR:{importance:l||Ve.NORMAL,image:h||""}}];return JSON.stringify(p)},cn=function(e,t,n){var i={},r={notificationId:n||""};if(!t)return{iOSConfig:i,androidConfig:r};try{var s=JSON.parse(t);null==s||s.forEach((function(e){var t,n,s,o,a,u,c,l,h,d,p=Object.keys(e);if(0!==p.length){var g=p[0];switch(g){case"HW":return r.channelIdHW=null===(t=e[g])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[g])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(s=e[g])||void 0===s?void 0:s.image,void(r.categoryHW=null===(o=e[g])||void 0===o?void 0:o.category);case"MI":return void(r.channelIdMi=null===(a=e[g])||void 0===a?void 0:a.channelId);case"OPPO":return void(r.channelIdOPPO=null===(u=e[g])||void 0===u?void 0:u.channelId);case"VIVO":return r.typeVivo=null===(c=e[g])||void 0===c?void 0:c.classification,void(r.categoryVivo=null===(l=e[g])||void 0===l?void 0:l.category);case"APNS":return i.threadId=e[g]["thread-id"],i.apnsCollapseId=e[g]["apns-collapse-id"],i.category=e[g].category,i.richMediaUri=e[g].richMediaUri,void(i.interruptionLevel=e[g]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[g].collapse_key||"",imageUrl:e[g].imageUrl||"",priority:e[g].priority||""});case"HONOR":r.importanceHonor=null===(h=e[g])||void 0===h?void 0:h.importance,r.imageUrlHonor=null===(d=e[g])||void 0===d?void 0:d.image}}}))}catch(n){e.error(fe.O,"Wrong format for pushConfigs field! content: "+t)}return{iOSConfig:i,androidConfig:r}},ln=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},hn=function(e){var t=e.length;return t<=4096&&t>=1},dn=(rn=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+rn.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return rn=2047&++rn,parseInt(n,2)}),pn=function(){var e=Dt.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},gn=function(e,t,n){return c(void 0,void 0,void 0,(function(){var i,r;return l(this,(function(s){switch(s.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(t),"AES-CBC",!0,["decrypt"])];case 1:return i=s.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,nn(e))];case 2:return r=s.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function _n(e,t){var n;if(!e)return"";var i="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?i?e.replace(/^https?:\/\//i,"https://"):e:t!==De.HTTP||i?"https://"+e:"http://"+e}function fn(e){if(!e)return Math.floor(4294967296*Math.random());var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return Math.abs(t)}var En,Tn,In,vn=function(e,t){if(!e)return"";var n=e.ossConfig,i=void 0===n?"":n,r="";try{var s=JSON.parse(i);if(s.length>0){var o=s.find((function(e){return e.minio}));o&&(r=o.minio)}}catch(e){t.warn(fe.L_PARSE_JSON_E,JSON.stringify({ossConfig:i,error:e}))}return r};!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(En||(En={})),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"}(Tn||(Tn={})),function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(In||(In={}));function Rn(e){var t,n=e.method||En.GET,i=e.timeout||6e4,r=e.headers,s=e.query,o=e.body,a=e.onProgress,u=T(e.url,s),c=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),l="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(n,u),r&&c.setRequestHeader)for(var h in r)c.setRequestHeader(h,r[h]);return l?function(e,t,n){return new Jt((function(i){0!==t&&(e.timeout=t),e.onload=function(){i({data:e.responseText,status:e.status||200})},e.onerror=function(){i({status:e.status})},e.ontimeout=function(){i({status:e.status})};var r="object"==typeof n?JSON.stringify(n):n;e.send(r)}),(function(t){e.abort(),t({status:-1})}))}(c,i,o):function(e,t,n,i){return new Jt((function(r){e.onreadystatechange=function(){4===e.readyState&&r({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){r({status:e.status})},i&&(e.upload.onprogress=function(e){return i(e)}),0!==t&&setTimeout((function(){e.abort(),r({status:e.status})}),t),e.send(n)}),(function(t){e.abort(),t({status:-1})}))}(c,i,o,a)}var Cn,Sn,mn=function(e,t,n){var i=null==n?void 0:n.isReverse;Tt(e)&&function(){for(var n in e)t(e[n],n,e)}(),(dt(e)||ut(e))&&function(){if(i)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var r=0,s=e.length;r<s;r++)t(e[r],r)}()},yn=function(e,t){return mn(e,(function(n,i){e[i]=t(n,i)})),e},An=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return mn(e,(function(e,i){t===e&&(n=i)})),n},Nn=function(e,t){return-1!==An(e,t)},On=function(e,t){var n=[];return mn(e,(function(e){n.push(e)})),-1!==An(n,t)},Mn=function(e){return JSON.parse(JSON.stringify(e))},Ln=function(){return"undefined"!=typeof RCCppEngine},Un=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 s in r)if(r.hasOwnProperty(s)){var o=i.match(r[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},bn=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(bn(e[n]));else for(var n in t={},e)t[n]=bn(e[n]);else t=e;return t},Pn=function(e){var t;try{t=bn(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},Dn=function(e){return{isRead:(e&n.READ)===n.READ,isListened:(e&n.LISTENED)===n.LISTENED,isDownload:(e&n.DOWNLOADED)===n.DOWNLOADED,isRetrieved:(e&n.RETRIEVED)===n.RETRIEVED}},wn=function(e){var t=n.UNREAD;return(null==e?void 0:e.isRead)&&(t|=n.READ),(null==e?void 0:e.isListened)&&(t|=n.LISTENED),(null==e?void 0:e.isDownload)&&(t|=n.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=n.RETRIEVED),t},Vn=function(e){return[Ze.Android,Ze.iOS,Ze.Web,Ze.PC,Ze.Mini].map((function(t){var n=e.findIndex((function(e){return e.platform===t}));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]}))},Gn={_delayTime:0,setTime:function(e){var t=(new Date).getTime();Gn._delayTime=t-e},getTime:function(){var e=Gn._delayTime;return(new Date).getTime()-e}},Bn=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},kn=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o;return l(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(),s=r.code,o=r.data,s===$.SUCCESS?(this._isPulling=!1,this._pullTime=o.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}(),xn="rtcRJoin_data",Fn="rtcRExit",Hn="rtcRInfo",qn="rtcUData",Yn="rtcUPut",Kn="rtcUDel",jn="rtcSetData",Qn="userSetData",Wn="rtcQryData",Jn="rtcDelData",Xn="rtcToken",Zn="rtcUserState",zn="rtcUList",$n="viewerJoinR",ei="viewerExitR",ti="rtcPullKv",ni="rtcIdentityChange",ii="rtcInvite",ri="rtcCancelInvite",si="rtcInviteAnswer",oi="rtcEndInvite",ai="rtcQueryJoined";!function(e){e.RtcInput="RtcInput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcOutput="RtcOutput"}(Sn||(Sn={}));var ui=((Cn={})[Sn.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],Cn[Sn.RtcUserListOutput]=["users","token","sessionId","roomInfo"],Cn[Sn.SetUserStatusInput]=["status"],Cn[Sn.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Cn[Sn.RtcUserSetDataInput]=["valueInfo","objectName","content"],Cn[Sn.RtcDataInput]=["interior","target","key","objectName","content"],Cn[Sn.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Cn[Sn.MCFollowInput]=["state"],Cn[Sn.RtcTokenOutput]=["rtcToken"],Cn[Sn.RtcQryOutput]=["outInfo"],Cn[Sn.RtcQryUserOutDataInput]=["userId"],Cn[Sn.RtcUserOutDataOutput]=["user"],Cn[Sn.RtcQueryListInput]=["order"],Cn[Sn.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Cn[Sn.RtcValueInfo]=["key","value"],Cn[Sn.RtcKeyDeleteInput]=["key"],Cn[Sn.RtcNotifyMsg]=["type","time","roomId"],Cn[Sn.RtcPullKV]=["timestamp","roomId"],Cn[Sn.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Cn[Sn.RtcQueryUserJoinedInput]=["userId"],Cn[Sn.RtcQueryUserJoinedOutput]=["info"],Cn[Sn.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Cn[Sn.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Cn[Sn.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Cn[Sn.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Cn),ci="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message "+Sn.SetUserStatusInput+"\n {\n optional int32 status=1;\n }\n message "+Sn.MCFollowInput+"\n {\n required string state = 1;\n }\n message "+Sn.RtcQueryListInput+"{\n optional int32 order=1;\n }\n message "+Sn.RtcKeyDeleteInput+"{\n repeated string key=1;\n }\n message "+Sn.RtcValueInfo+"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated "+Sn.RtcValueInfo+" userData=2; //用户资源信息\n }\n message "+Sn.RtcUserListOutput+"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated "+Sn.RtcValueInfo+" roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message "+Sn.RtcInput+"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated "+Sn.RtcValueInfo+" innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated "+Sn.RtcValueInfo+" outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message "+Sn.RtcQryOutput+"{\n repeated "+Sn.RtcValueInfo+" outInfo=1;\n }\n message "+Sn.RtcDataInput+"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message "+Sn.RtcSetDataInput+"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message "+Sn.RtcUserSetDataInput+" {\n repeated "+Sn.RtcValueInfo+" valueInfo = 1;\n required string objectName = 2;\n repeated "+Sn.RtcValueInfo+" content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message "+Sn.RtcTokenOutput+"{\n required string rtcToken=1;\n }\n message "+Sn.RtcSetOutDataInput+"{\n required targetType target=1;\n repeated "+Sn.RtcValueInfo+" valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message "+Sn.RtcQryUserOutDataInput+"{\n repeated string userId = 1;\n }\n message "+Sn.RtcUserOutDataOutput+"{\n repeated RtcUserInfo user = 1;\n }\n message "+Sn.RtcNotifyMsg+" \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message "+Sn.RtcPullKV+"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message "+Sn.RtcKVOutput+"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message "+Sn.RtcQueryUserJoinedInput+"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message "+Sn.RtcQueryUserJoinedOutput+"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message "+Sn.RtcViewerJoinedOutput+"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message "+Sn.RtcInviteInput+"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message "+Sn.RtcCancelInviteInput+"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message "+Sn.RtcInviteAnswerInput+"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message "+Sn.RtcEndInviteInput+"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n}\n",li=function(){function e(e,t,n,i,r,s){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=s,this._appkey=this._options.appkey,this._rtcKVManager=new kn(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.getInnerStatisticLog=function(){return this.statisticLog},e.prototype.pullRTCRoomEntry=function(e,t){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return t=this.rtcCodec.encode(Sn.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,ti,!0,t)];case 1:return n=c.sent(),i=n.code,r=n.buffer,i!==$.SUCCESS?[2,{code:i}]:(s=this.rtcCodec.decode(Sn.RtcKVOutput,r),o=s.entries,a=s.syncTime,o=(o||[]).map((function(e){return u(u({},e),{timestamp:sn(e.timestamp)})})),this._watcher.onRTCDataChange(o,e),[2,{code:i,data:{kvEntries:o,syncTime:sn(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(Sn.RtcNotifyMsg,e),n=t.time,i=t.type,r=t.roomId;1===i&&this._rtcKVManager.pullEntry(r,sn(n))}},e.prototype.destroy=function(){},e}();function hi(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,i,s;return t?(s=(e>>>=0)>=0&&e<256)&&(i=u[e])?i:(n=r(e,(0|e)<0?-1:0,!0),s&&(u[e]=n),n):(s=(e|=0)>=-128&&e<128)&&(i=a[e])?i:(n=r(e,e<0?-1:0,!1),s&&(a[e]=n),n)}function i(e,t){if(isNaN(e)||!isFinite(e))return t?_:g;if(t){if(e<0)return _;if(e>=h)return v}else{if(-d>=e)return R;if(e+1>=d)return I}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 s(e,t,n){var r,o,a,u,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;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 s(e.substring(1),t,n).neg();for(o=i(c(n,8)),a=g,u=0;u<e.length;u+=8)l=Math.min(8,e.length-u),h=parseInt(e.substring(u,u+l),n),l<8?(d=i(c(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(o)).add(i(h));return a.unsigned=t,a}function o(t){return t instanceof e?t:"number"==typeof t?i(t):"string"==typeof t?s(t):r(t.low,t.high,t.unsigned)}var a,u,c,l,h,d,p,g,_,f,E,T,I,v,R,C;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},u={},e.fromInt=n,e.fromNumber=i,e.fromBits=r,c=Math.pow,e.fromString=s,e.fromValue=o,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,_=n(0,!0),e.UZERO=_,f=n(1),e.ONE=f,E=n(1,!0),e.UONE=E,T=n(-1),e.NEG_ONE=T,I=r(-1,2147483647,!1),e.MAX_VALUE=I,v=r(-1,-1,!0),e.MAX_UNSIGNED_VALUE=v,R=r(0,-2147483648,!1),e.MIN_VALUE=R,(C=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},C.toString=function(e){var t,n,r,s,o,a,u,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(R)?(t=i(e),r=(n=this.div(t)).mul(t).sub(this),n.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(s=i(c(e,6),this.unsigned),o=this,a="";;){if(u=o.div(s),l=(o.sub(u.mul(s)).toInt()>>>0).toString(e),(o=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(R)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},C.isZero=function(){return 0===this.high&&0===this.low},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return!(1&~this.low)},C.isEven=function(){return!(1&this.low)},C.equals=function(e){return t(e)||(e=o(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},C.eq=C.equals,C.notEquals=function(e){return!this.eq(e)},C.neq=C.notEquals,C.lessThan=function(e){return this.comp(e)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(e){return this.comp(e)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(e){return this.comp(e)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(e){return this.comp(e)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(e){if(t(e)||(e=o(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},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(f)},C.neg=C.negate,C.add=function(e){var n,i,s,a,u,c,l,h,d,p,g;return t(e)||(e=o(e)),n=this.high>>>16,i=65535&this.high,s=this.low>>>16,a=65535&this.low,u=e.high>>>16,c=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=s+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},C.subtract=function(e){return t(e)||(e=o(e)),this.add(e.neg())},C.sub=C.subtract,C.multiply=function(e){var n,s,a,u,c,l,h,d,_,f,E,T;return this.isZero()?g:(t(e)||(e=o(e)),e.isZero()?g:this.eq(R)?e.isOdd()?R:g:e.eq(R)?this.isOdd()?R:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?i(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,s=65535&this.high,a=this.low>>>16,u=65535&this.low,c=e.high>>>16,l=65535&e.high,h=e.low>>>16,_=0,f=0,E=0,T=0,E+=(T+=u*(d=65535&e.low))>>>16,f+=(E+=a*d)>>>16,E&=65535,f+=(E+=u*h)>>>16,_+=(f+=s*d)>>>16,f&=65535,_+=(f+=a*h)>>>16,f&=65535,_+=(f+=u*l)>>>16,_+=n*d+s*h+a*l+u*c,r((E&=65535)<<16|(T&=65535),(_&=65535)<<16|(f&=65535),this.unsigned)))},C.mul=C.multiply,C.divide=function(e){var n,r,s,a,u,l,h;if(t(e)||(e=o(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?_:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return _;if(e.gt(this.shru(1)))return E;s=_}else{if(this.eq(R))return e.eq(f)||e.eq(T)?R:e.eq(R)?f:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?f:T:(r=this.sub(e.mul(n)),s=n.add(r.div(e)));if(e.eq(R))return this.unsigned?_:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(r=this;r.gte(e);){for(n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(e);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(e);l.isZero()&&(l=f),s=s.add(l),r=r.sub(h)}return s},C.div=C.divide,C.modulo=function(e){return t(e)||(e=o(e)),this.sub(this.div(e).mul(e))},C.mod=C.modulo,C.not=function(){return r(~this.low,~this.high,this.unsigned)},C.and=function(e){return t(e)||(e=o(e)),r(this.low&e.low,this.high&e.high,this.unsigned)},C.or=function(e){return t(e)||(e=o(e)),r(this.low|e.low,this.high|e.high,this.unsigned)},C.xor=function(e){return t(e)||(e=o(e)),r(this.low^e.low,this.high^e.high,this.unsigned)},C.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):r(0,this.low<<e-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?r(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):r(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.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))},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},C.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},C.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]},C.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}(),n=function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function i(e,t,n,i,r){var s,o,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,p=e[t+h];for(h+=d,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+h],h+=d,l-=8);if(0===s)s=1-c;else{if(s===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)}function r(e,t,n,i,r,s){var o,a,u,c=8*s-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,g=i?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*u-1)*Math.pow(2,r),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=g,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;e[n+p]=255&o,p+=g,o/=256,c-=8);e[n+p-g]|=128*_}var s,o,a,u,c,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?o: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,(s=l.prototype).__isByteBuffer__,Object.defineProperty(s,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),o=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,s,o,a,u,c;for(("boolean"==typeof t||"string"!=typeof t)&&(i=n,n=t,t=void 0),r=0,o=0,a=e.length;a>o;++o)l.isByteBuffer(e[o])||(e[o]=l.wrap(e[o],t)),(s=e[o].limit-e[o].offset)>0&&(r+=s);if(0===r)return new l(0,n,i);for(c=new l(r,n,i),o=0;a>o;)(s=(u=e[o++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=s);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,i){var r,o;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=s.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,o=0;o<e.length;++o)r.view[o]=e[o]}return r},s.writeBitSet=function(e,t){var n,i,r,s,o,a,u=void 0===t;if(u&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(i=t,s=(r=e.length)>>3,o=0,t+=this.writeVarint32(r,t);s--;)n=1&!!e[o++]|(1&!!e[o++])<<1|(1&!!e[o++])<<2|(1&!!e[o++])<<3|(1&!!e[o++])<<4|(1&!!e[o++])<<5|(1&!!e[o++])<<6|(1&!!e[o++])<<7,this.writeByte(n,t++);if(r>o){for(a=0,n=0;r>o;)n|=(1&!!e[o++])<<a++;this.writeByte(n,t++)}return u?(this.offset=t,this):t-i},s.readBitSet=function(e){var t,n,i,r,s,o,a,u=void 0===e;for(u&&(e=this.offset),r=(i=(n=this.readVarint32(e)).value)>>3,s=0,o=[],e+=n.length;r--;)t=this.readByte(e++),o[s++]=!!(1&t),o[s++]=!!(2&t),o[s++]=!!(4&t),o[s++]=!!(8&t),o[s++]=!!(16&t),o[s++]=!!(32&t),o[s++]=!!(64&t),o[s++]=!!(128&t);if(i>s)for(a=0,t=this.readByte(e++);i>s;)o[s++]=!!(1&t>>a++);return u&&(this.offset=e),o},s.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},s.writeBytes=s.append,s.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},s.writeByte=s.writeInt8,s.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&~(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},s.readByte=s.readInt8,s.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},s.writeUInt8=s.writeUint8,s.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},s.readUInt8=s.readUint8,s.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},s.writeShort=s.writeInt16,s.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&~t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},s.readShort=s.readInt16,s.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},s.writeUInt16=s.writeUint16,s.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},s.readUInt16=s.readUint16,s.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},s.writeInt=s.writeInt32,s.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},s.readInt=s.readInt32,s.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},s.writeUInt32=s.writeUint32,s.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},s.readUInt32=s.readUint32,e&&(s.writeInt64=function(t,n){var i,r,s,o=void 0===n;if(o&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),o&&(this.offset+=8),this},s.writeLong=s.writeInt64,s.readInt64=function(t){var n,i,r,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+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),s&&(this.offset+=8),r},s.readLong=s.readInt64,s.writeUint64=function(t,n){var i,r,s,o=void 0===n;if(o&&(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,s=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&s>>>24,this.view[n+2]=255&s>>>16,this.view[n+1]=255&s>>>8,this.view[n]=255&s):(this.view[n]=255&s>>>24,this.view[n+1]=255&s>>>16,this.view[n+2]=255&s>>>8,this.view[n+3]=255&s,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),o&&(this.offset+=8),this},s.writeUInt64=s.writeUint64,s.readUint64=function(t){var n,i,r,s=void 0===t;if(s&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+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),s&&(this.offset+=8),r},s.readUInt64=s.readUint64),s.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},s.writeFloat=s.writeFloat32,s.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},s.readFloat=s.readFloat32,s.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},s.writeDouble=s.writeFloat64,s.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},s.readDouble=s.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 e>>>1^-(1&e)},s.writeVarint32=function(e,t){var n,i,r,s=void 0===t;if(s&&(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,s?(this.offset=t,this):i},s.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},s.readVarint32=function(e){var t,n,i,r,s=void 0===e;if(s&&(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(128&t);return i|=0,s?(this.offset=e,i):{value:i,length:n}},s.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()},s.writeVarint64=function(t,n){var i,r,s,o,a,u=void 0===n;if(u&&(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,s=t.shiftRightUnsigned(28).toInt()>>>0,o=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&o>>>7;case 9:this.view[n+8]=9!==i?128|o:127&o;case 8:this.view[n+7]=8!==i?128|s>>>21:127&s>>>21;case 7:this.view[n+6]=7!==i?128|s>>>14:127&s>>>14;case 6:this.view[n+5]=6!==i?128|s>>>7:127&s>>>7;case 5:this.view[n+4]=5!==i?128|s:127&s;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 u?(this.offset+=i,this):i},s.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},s.readVarint64=function(t){var n,i,r,s,o,a,u=void 0===t;if(u&&(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,s=0,o=0,i=127&(o=this.view[t++]),128&o&&(i|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(i|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(r=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<7,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<14,(128&o||this.noAssert&&void 0===o)&&(r|=(127&(o=this.view[t++]))<<21,(128&o||this.noAssert&&void 0===o)&&(s=127&(o=this.view[t++]),(128&o||this.noAssert&&void 0===o)&&(s|=(127&(o=this.view[t++]))<<7,128&o||this.noAssert&&void 0===o))))))))))throw Error("Buffer overrun");return a=e.fromBits(i|r<<28,r>>>4|s<<24,!1),u?(this.offset=t,a):{value:a,length:t-n}},s.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}),s.writeCString=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=r+1,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+1,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,o?(this.offset=n,this):r},s.readCString=function(e){var t,i,r,s=void 0===e;if(s&&(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,c.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),s?(this.offset=e,i()):{string:i(),length:e-t}},s.writeIString=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s: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,c.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 o?(this.offset=n,this):n-r},s.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",s.writeUTF8String=function(e,n){var i,r,s,o=void 0===n;if(o&&(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=c.calculateUTF16asUTF8(t(e))[1],n+=i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i,c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),o?(this.offset=n,this):n-r},s.writeString=s.writeUTF8String,l.calculateUTF8Chars=function(e){return c.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return c.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,s.readUTF8String=function(e,t,i){var r,s,o,a,u;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(o=0,a=i,t===l.METRICS_CHARS){if(s=n(),c.decodeUTF8(function(){return e>o&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++o,c.UTF8toUTF16(e,s)})),o!==e)throw RangeError("Illegal range: Truncated data, "+o+" == "+e);return r?(this.offset=i,s()):{string:s(),length:i-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}if(u=i+e,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),s=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return r?(this.offset=i,s()):{string:s(),length:i-a}}throw TypeError("Unsupported metrics: "+t)},s.readString=s.readUTF8String,s.writeVString=function(e,n){var i,r,s,o,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(s=n,i=c.calculateUTF16asUTF8(t(e),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+i,n+=this.writeVarint32(i,n),c.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==s+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-s},s.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}},s.append=function(e,t,n){var i,r,s;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)>(s=this.buffer.byteLength)&&this.resize((s*=2)>n?s:n),n-=r,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=r,i&&(this.offset+=r)),this},s.appendTo=function(e,t){return e.append(this,t),this},s.assert=function(e){return this.noAssert=!e,this},s.capacity=function(){return this.buffer.byteLength},s.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},s.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},s.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=o,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)},s.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},s.copyTo=function(e,t,n,i){var r,s,o;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(s=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===(o=i-n)?e:(e.ensureCapacity(t+o),e.view.set(this.view.subarray(n,i),t),r&&(this.offset+=o),s&&(e.offset+=o),this)},s.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},s.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},s.flip=function(){return this.limit=this.offset,this.offset=0,this},s.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},s.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},s.LE=function(e){return this.littleEndian=void 0===e||!!e,this},s.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},s.prepend=function(e,t,n){var i,r,s,o,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||((s=r-n)>0?(o=new ArrayBuffer(this.buffer.byteLength+s),(a=new Uint8Array(o)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=o,this.view=a,this.offset+=s,this.markedOffset>=0&&(this.markedOffset+=s),this.limit+=s,n+=s):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},s.prependTo=function(e,t){return e.prepend(this,t),this},s.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},s.remaining=function(){return this.limit-this.offset},s.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},s.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<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},s.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},s.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},s.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},s.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?o:(t=new ArrayBuffer(i-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,i),0),t):this.buffer},s.toArrayBuffer=s.toBuffer,s.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)}},u=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,s,o;null!==(i=e());)if(void 0===(s=r[i])&&n(i),null!==(i=e())&&(void 0===(o=r[i])&&n(i),t(s<<2>>>0|(48&o)>>4),null!==(i=e()))){if(void 0===(s=r[i])){if(61===i)break;n(i)}if(t((15&o)<<4>>>0|(60&s)>>2),null!==(i=e())){if(void 0===(o=r[i])){if(61===i)break;n(i)}t((3&s)<<6>>>0|o)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),s.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 u.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 u.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()},s.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,s=new l(r,t);r>i;){if((n=e.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);s.view[i++]=n}return s.limit=r,s},s.toDebug=function(e){for(var t,n=-1,i=this.buffer.byteLength,r="",s="",o="";i>n;){if(-1!==n&&(r+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";o+=r+s+"\n",r=s=""}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+=" ";o+=r+s+"\n"}return e?o:r},l.fromDebug=function(e,t,n){for(var i,r,s=e.length,o=new l(0|(s+1)/3,t,n),a=0,u=0,c=!1,h=!1,d=!1,p=!1,g=!1;s>a;){switch(i=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}o.offset=o.markedOffset=o.limit=u,c=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}o.offset=o.limit=u,c=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}o.offset=o.markedOffset=u,c=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}o.offset=u,c=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}o.limit=o.markedOffset=u,c=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}o.limit=u,c=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}o.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){g=!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");o.view[u++]=r,c=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(u<o.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+s)}return o},s.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var 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,s,o,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,s=new l(0|r/2,t),o=0,a=0;r>o;o+=2){if(i=parseInt(e.substring(o,o+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");s.view[a++]=i}return s.limit=a,s},c=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,s,o=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(128&n)if(192==(224&n))null===(i=e())&&o([n,i]),t((31&n)<<6|63&i);else if(224==(240&n))(null===(i=e())||null===(r=e()))&&o([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===(s=e()))&&o([n,i,r,s]),t((7&n)<<18|(63&i)<<12|(63&r)<<6|63&s)}else t(n)},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}(),s.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{c.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(c.calculateUTF16asUTF8(t(e),!0)[1],n,i),s=0;return c.encodeUTF16toUTF8(t(e),(function(e){r.view[s++]=e})),r.limit=s,r},l}(t),i=function(t,n){var i,r,s={};return s.ByteBuffer=t,s.c=t,i=t,s.Long=n||null,s.VERSION="5.0.1",s.WIRE_TYPES={},s.WIRE_TYPES.VARINT=0,s.WIRE_TYPES.BITS64=1,s.WIRE_TYPES.LDELIM=2,s.WIRE_TYPES.STARTGROUP=3,s.WIRE_TYPES.ENDGROUP=4,s.WIRE_TYPES.BITS32=5,s.PACKABLE_WIRE_TYPES=[s.WIRE_TYPES.VARINT,s.WIRE_TYPES.BITS64,s.WIRE_TYPES.BITS32],s.TYPES={int32:{name:"int32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},uint64:{name:"uint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.UZERO:void 0},sint64:{name:"sint64",wireType:s.WIRE_TYPES.VARINT,defaultValue:s.Long?s.Long.ZERO:void 0},bool:{name:"bool",wireType:s.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:s.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:s.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:s.WIRE_TYPES.BITS64,defaultValue:s.Long?s.Long.ZERO:void 0},float:{name:"float",wireType:s.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:s.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:s.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:s.WIRE_TYPES.STARTGROUP,defaultValue:null}},s.MAP_KEY_TYPES=[s.TYPES.int32,s.TYPES.sint32,s.TYPES.sfixed32,s.TYPES.uint32,s.TYPES.fixed32,s.TYPES.int64,s.TYPES.sint64,s.TYPES.sfixed64,s.TYPES.uint64,s.TYPES.fixed64,s.TYPES.bool,s.TYPES.string,s.TYPES.bytes],s.ID_MIN=1,s.ID_MAX=536870911,s.convertFieldsToCamelCase=!1,s.populateAccessors=!0,s.populateDefaults=!0,s.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.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<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var i=e.XHR();if(i.open("GET",t,!!n),i.setRequestHeader("Accept","text/plain"),"function"==typeof i.overrideMimeType&&i.overrideMimeType("text/plain"),!n)return i.send(null),200==i.status||0==i.status&&"string"==typeof i.responseText?i.responseText:null;if(i.onreadystatechange=function(){4==i.readyState&&(200==i.status||0==i.status&&"string"==typeof i.responseText?n(i.responseText):n(null))},4==i.readyState)return;i.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),s.Lang={DELIM:/[\s\{\}=;:\[\],'"\(\)<>]/g,RULE:/^(?:required|optional|repeated|map)$/,TYPE:/^(?:double|float|int32|uint32|sint32|int64|uint64|sint64|fixed32|sfixed32|fixed64|sfixed64|bool|string|bytes)$/,NAME:/^[a-zA-Z_][a-zA-Z_0-9]*$/,TYPEDEF:/^[a-zA-Z][a-zA-Z_0-9]*$/,TYPEREF:/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,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},s.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 s,o,a={},u=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._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]},c.next=function(){var e,n,i,r,s;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<this.source.length&&!t.DELIM.test(this.source.charAt(r));)++r;return('"'===(s=this.source.substring(this.index,this.index=r))||"'"===s)&&(this._stringOpen=s),s},c.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},c.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},c.omit=function(e){return this.peek()===e&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,s=function(e){this.tn=new u(e),this.proto3=!1},(o=s.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!i)throw Error("unexpected 'syntax'");this.tn.skip("="),"proto3"===(n.syntax=this._readString())&&(this.proto3=!0),this.tn.skip(";");break;case"message":this._parseMessage(n,null),i=!1;break;case"enum":this._parseEnum(n),i=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},s.parse=function(e){return new s(e).parse()},o._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},o._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return i(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},o._parseOption=function(e,n){var i,r=this.tn.next(),s=!1;if("("===r&&(s=!0,r=this.tn.next()),!t.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,s&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),t.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,i),n||this.tn.skip(";")},o._parseOptionValue=function(e,n){var i=this.tn.peek();if("{"!==i)r(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!t.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(e.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(e,n+"."+i)}},o._parseService=function(e){var n,i=this.tn.next();if(!t.NAME.test(i))throw Error("illegal service name at line "+this.tn.line+": "+i);for(n={name:i,rpc:{},options:{}},this.tn.skip("{");"}"!==(i=this.tn.next());)if("option"===i)this._parseOption(n);else{if("rpc"!==i)throw Error("illegal service token: "+i);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},o._parseServiceRPC=function(e){var n,i,r="rpc",s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal rpc service method name: "+s);if(n=s,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(i.request_stream=!0,s=this.tn.next()),!t.TYPEREF.test(s))throw Error("illegal rpc service request type: "+s);if(i.request=s,this.tn.skip(")"),"returns"!==(s=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+s);if(this.tn.skip("("),"stream"===(s=this.tn.next()).toLowerCase()&&(i.response_stream=!0,s=this.tn.next()),i.response=s,this.tn.skip(")"),"{"===(s=this.tn.peek())){for(this.tn.next();"}"!==(s=this.tn.next());){if("option"!==s)throw Error("illegal rpc service token: "+s);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[r]&&(e[r]={}),e[r][n]=i},o._parseMessage=function(e,i){var r=!!i,s=this.tn.next(),o={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(s))throw Error("illegal "+(r?"group":"message")+" name: "+s);for(o.name=s,r&&(this.tn.skip("="),i.id=n(this.tn.next()),o.isGroup=!0),"["===(s=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(s=this.tn.next());)if(t.RULE.test(s))this._parseMessageField(o,s);else if("oneof"===s)this._parseMessageOneOf(o);else if("enum"===s)this._parseEnum(o);else if("message"===s)this._parseMessage(o);else if("option"===s)this._parseOption(o);else if("service"===s)this._parseService(o);else if("extensions"===s)o.extensions=this._parseExtensionRanges();else if("reserved"===s)this._parseIgnored();else if("extend"===s)this._parseExtend(o);else{if(!t.TYPEREF.test(s))throw Error("illegal message token: "+s);if(!this.proto3)throw Error("illegal field rule: "+s);this._parseMessageField(o,"optional",s)}return this.tn.omit(";"),e.messages.push(o),o},o._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},o._parseMessageField=function(e,i,r){var s,o,a;if(!t.RULE.test(i))throw Error("illegal message field rule: "+i);if(s={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field type: "+o);if(s.keytype=o,this.tn.skip(","),o=this.tn.next(),!t.TYPE.test(o)&&!t.TYPEREF.test(o))throw Error("illegal message field: "+o);if(s.type=o,this.tn.skip(">"),o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(e,s),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);s.type=a.name,s.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(s.type=r,o=this.tn.next(),!t.NAME.test(o))throw Error("illegal message field name: "+o);s.name=o,this.tn.skip("="),s.id=n(this.tn.next()),"["===(o=this.tn.peek())&&this._parseFieldOptions(s),this.tn.skip(";")}return e.fields.push(s),s},o._parseMessageOneOf=function(e){var n,i,r,s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal oneof name: "+s);for(i=s,r=[],this.tn.skip("{");"}"!==(s=this.tn.next());)(n=this._parseMessageField(e,"optional",s)).oneof=i,r.push(n.id);this.tn.omit(";"),e.oneofs[i]=r},o._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},o._parseEnum=function(e){var i,r={name:"",values:[],options:{}},s=this.tn.next();if(!t.NAME.test(s))throw Error("illegal name: "+s);for(r.name=s,this.tn.skip("{");"}"!==(s=this.tn.next());)if("option"===s)this._parseOption(r);else{if(!t.NAME.test(s))throw Error("illegal name: "+s);this.tn.skip("="),i={name:s,id:n(this.tn.next(),!0)},"["===(s=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),e.enums.push(r)},o._parseExtensionRanges=function(){var t,n,r,s=[];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()}s.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),s},o._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},o.toString=function(){return"Parser at line "+this.tn.line},a.Parser=s,a}(s,s.Lang),s.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(),s=7&i,o=i>>>3;switch(s){case e.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(!(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(o,n);break;case e.WIRE_TYPES.ENDGROUP:if(o===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+o+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+s)}return!0}var s,o,a,u,c,l,h,d,p,g,_,f,E,T,I,v,R={},C=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},S=C.prototype;return S.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},S.toString=function(e){return(e?this.className+" ":"")+this.fqn()},S.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},R.T=C,s=function(e,t,n,i,r){C.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(o=s.prototype=Object.create(C.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},o.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},o.getChild=function(e){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},o.resolve=function(e,t){var n,i="string"==typeof e?e.split("."):e,r=this,s=0;if(""===i[s]){for(;null!==r.parent;)r=r.parent;s++}do{do{if(!(r instanceof R.Namespace)){r=null;break}if(!((n=r.getChild(i[s]))&&n instanceof R.T&&(!t||n instanceof R.Namespace))){r=null;break}r=n,s++}while(s<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=r);return r},o.qn=function(e){var t,n,i=[],r=e;do{i.unshift(r.name),r=r.parent}while(null!==r);for(t=1;t<=i.length;t++)if(n=i.slice(i.length-t),e===this.resolve(n,e instanceof R.Namespace))return n.join(".");return e.fqn()},o.build=function(){var e,t,n,i={},r=this.children;for(t=0,n=r.length;n>t;++t)(e=r[t])instanceof s&&(i[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},o.buildOpt=function(){var e,t,n,i,r={},s=Object.keys(this.options);for(e=0,t=s.length;t>e;++e)n=s[e],i=this.options[s[e]],r[n]=i;return r},o.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},R.Namespace=s,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)},u=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},u.verifyValue=function(i){var r,s,o,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(e){a(typeof i,e.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(e){a(typeof i,e.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),o=0;o<r.length;o++){if(r[o].name==i)return r[o].id;if(r[o].id==i)return r[o].id}if("proto3"===this.syntax)return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),(i>4294967295||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(o in s={},i)i.hasOwnProperty(o)&&(s[o]=i[o]);i=s}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},u.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)")},u.encodeValue=function(t,n,r){var s,o;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");s=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=s;break;case e.TYPES.message:o=(new i).LE(),this.resolvedType.encode(n,o),r.writeVarint32(o.offset),r.append(o.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},u.decode=function(t,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,s;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(s=t.readVarint32(),t.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+t.remaining());return(r=t.clone()).limit=r.offset+s,t.offset+=s,r;case e.TYPES.message:return s=t.readVarint32(),this.resolvedType.decode(t,s);case e.TYPES.group:return this.resolvedType.decode(t,-1,i)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return i.fromBinary(t)}},u.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},R.Element=a,c=function(e,t,n,i,r,o){s.call(this,e,t,n,i,o),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!r,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=c.prototype=Object.create(s.prototype)).build=function(n){var r,s,o,a;if(this.clazz&&!n)return this.clazz;for(r=function(e,n){function r(t,n,s,o){var a,u,c,l,h,d,p;if(null===t||"object"!=typeof t)return o&&o instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(o.object,t))?a:t;if(i.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return s?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return u=[],t.forEach((function(e,t){u[t]=r(e,n,s,o)})),u;if(u={},t instanceof e.Map){for(l=(c=t.entries()).next();!l.done;l=c.next())u[t.keyElem.valueToString(l.value[0])]=r(l.value[1],n,s,t.valueElem.resolvedType);return u}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(u[p]=h&&(d=h.getChild(p))?r(t[p],n,s,d.resolvedType):r(t[p],n,s));return u}var s,o,a=n.getChildren(e.Reflect.Message.Field),u=n.getChildren(e.Reflect.Message.OneOf),c=function(t){var r,s,o,l;for(e.Builder.Message.call(this),r=0,s=u.length;s>r;++r)this[u[r].name]=null;for(r=0,s=a.length;s>r;++r)this[(o=a[r]).name]=o.repeated?[]:o.map?new e.Map(o):null,!o.required&&"proto3"!==n.syntax||null===o.defaultValue||(this[o.name]=o.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof c)||Array.isArray(t)||t instanceof e.Map||i.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(r=0,s=arguments.length;s>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(t)},l=c.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,i,r){var s=n._fieldsByName[t];if(!r){if(!s)throw Error(this+"#"+t+" is undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));if(!s.repeated)throw Error(this+"#"+t+" is not a repeated field");i=s.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 s,o,a;if(t&&"object"==typeof t){for(s in r=i,t)t.hasOwnProperty(s)&&void 0!==(i=t[s])&&this.$set(s,i,r);return this}if(o=n._fieldsByName[t],r)this[t]=i;else{if(!o)throw Error(this+"#"+t+" is not a field: undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));this[o.name]=i=o.verifyValue(i)}return o&&o.oneof&&(a=this[o.oneof.name],null!==i?(null!==a&&a!==o.name&&(this[a]=null),this[o.oneof.name]=o.name):a===t&&(this[o.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,s=0;s<a.length;s++)(o=a[s])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,i,r,s=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));s=s.substring(0,1).toUpperCase()+s.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),i=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},r=function(){return this[e.name]},null===n.getChild("set"+s)&&(l["set"+s]=i),null===n.getChild("set_"+t)&&(l["set_"+t]=i),null===n.getChild("get"+s)&&(l["get"+s]=r),null===n.getChild("get_"+t)&&(l["get_"+t]=r)}(o);return l.encode=function(e,i){var r,s;"boolean"==typeof e&&(i=e,e=void 0),r=!1,e||(e=new t,r=!0),s=e.littleEndian;try{return n.encode(this,e.LE(),i),(r?e.flip():e).LE(s)}catch(t){throw e.LE(s),t}},c.encode=function(e,t,n){return new c(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,r=!1;return e||(e=new i,r=!0),t=(new i).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),r?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return r(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},c.decode=function(e,t){var r,s;"string"==typeof e&&(e=i.wrap(e,t||"base64")),r=(e=i.isByteBuffer(e)?e:i.wrap(e)).littleEndian;try{return s=n.decode(e.LE()),e.LE(r),s}catch(t){throw e.LE(r),t}},c.decodeDelimited=function(e,t){var r,s,o;if("string"==typeof e&&(e=i.wrap(e,t||"base64")),(e=i.isByteBuffer(e)?e:i.wrap(e)).remaining()<1)return null;if(r=e.offset,s=e.readVarint32(),e.remaining()<s)return e.offset=r,null;try{return o=n.decode(e.slice(e.offset,e.offset+s).LE()),e.offset+=s,o}catch(t){throw e.offset+=s,t}},c.decode64=function(e){return c.decode(e,"base64")},c.decodeHex=function(e){return c.decode(e,"hex")},c.decodeJSON=function(e){return new c(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(c,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:c.$options}),Object.defineProperty(c,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),c}(e,this),this._fields=[],this._fieldsById={},this._fieldsByName={},o=0,a=this.children.length;a>o;o++)if((s=this.children[o])instanceof _||s instanceof c||s instanceof T){if(r.hasOwnProperty(s.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+s.toString(!0)+" cannot override static property '"+s.name+"'");r[s.name]=s.build()}else if(s instanceof c.Field)s.build(),this._fields.push(s),this._fieldsById[s.id]=s,this._fieldsByName[s.name]=s;else if(!(s instanceof c.OneOf||s instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[o].toString(!0));return this.clazz=r},l.encode=function(e,t,n){var i,r,s,o,a,u=null;for(s=0,o=this._fields.length;o>s;++s)r=e[(i=this._fields[s]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),t,e);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,i=0,r=0,s=this._fields.length;s>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 s,o,a,u,c,l,h,d,p,g,_,f;for(n="number"==typeof n?n:-1,c=t.offset,l=new this.clazz;t.offset<c+n||-1===n&&t.remaining()>0;){if(a=(s=t.readVarint32())>>>3,(o=7&s)===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(u=this._fieldsById[a])u.repeated&&!u.options.packed?l[u.name].push(u.decode(o,t)):u.map?(d=u.decode(o,t),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(o,t),u.oneof&&(null!==(p=l[u.oneof.name])&&p!==u.name&&(l[p]=null),l[u.oneof.name]=u.name));else switch(o){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: "+o)}}for(g=0,_=this._fields.length;_>g;++g)if(null===l[(u=this._fields[g]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(f=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,f;e.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},R.Message=c,h=function(t,n,i,r,s,o,a,u,l,h){C.call(this,t,n,o),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=s,this.resolvedType=null,this.id=a,this.options=u||{},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 c.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(C.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,s;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]),s=[],r=0;r<t.length;r++)s.push(this.element.verifyValue(t[r]));return s}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||i(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&i(typeof t,"no array expected"),this.element.verifyValue(t))},d.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},d.encode=function(t,n,r){var s,o,a,u,c;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),o=n.offset,s=0;s<t.length;s++)this.element.encodeValue(this.id,t[s],n);a=n.offset-o,(u=i.calculateVarint32(a))>1&&(c=n.slice(o,n.offset),o+=u-1,n.offset=o,n.append(c)),n.writeVarint32(a,o-u)}else for(s=0;s<t.length;s++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[s],n);else this.map?t.forEach((function(t,r){var s=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(s),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var r,s,o;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),o=0,s=0;s<t.length;s++)o+=this.element.calculateLength(this.id,t[s]);r+=i.calculateVarint32(o),r+=o}else for(s=0;s<t.length;s++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t[s]);else this.map?t.forEach((function(t,n){var s=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);r+=i.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(s),r+=s}),this):this.hasWirePresence(t,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return r},d.decode=function(t,n,i){var r,s,o,u,c,l,h;if(!(!this.map&&t==this.type.wireType||!i&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!i){for(s=n.readVarint32(),s=n.offset+s,o=[];n.offset<s;)o.push(this.decode(this.type.wireType,n,!0));return o}if(this.map){if(u=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),s=n.readVarint32(),n.remaining()<s)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+s+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+s,n.offset+=s;c.remaining()>0;)if(t=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,t,h)}return[u,r]}return this.element.decode(n,t,this.id)},R.Message.Field=h,p=function(e,t,n,i,r,s,o){h.call(this,e,t,n,null,i,r,s,o),this.extension},p.prototype=Object.create(h.prototype),R.Message.ExtensionField=p,g=function(e,t,n){C.call(this,e,t,n),this.fields=[]},R.Message.OneOf=g,_=function(e,t,n,i,r){s.call(this,e,t,n,i,r),this.className="Enum",this.object=null},_.getName=function(e,t){var n,i,r=Object.keys(e);for(i=0;i<r.length;++i)if(e[n=r[i]]===t)return n;return null},(_.prototype=Object.create(s.prototype)).build=function(t){var n,i,r,s;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,r=0,s=(i=this.getChildren(_.Value)).length;s>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},R.Enum=_,f=function(e,t,n,i){C.call(this,e,t,n),this.className="Enum.Value",this.id=i},f.prototype=Object.create(C.prototype),R.Enum.Value=f,E=function(e,t,n,i){C.call(this,e,t,n),this.field=i},E.prototype=Object.create(C.prototype),R.Extension=E,T=function(e,t,n,i){s.call(this,e,t,n,i),this.className="Service",this.clazz=null},(T.prototype=Object.create(s.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)}},s=r.prototype=Object.create(e.Builder.Service.prototype),o=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<o.length;n++)!function(e){s[e.name]=function(n,r){try{try{n=e.resolvedRequestType.clazz.decode(i.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,i){if(!n){try{i=e.resolvedResponseType.clazz.decode(i)}catch(e){}return i&&i instanceof e.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+t.name+"#"+e.name))}r(n)}))}catch(e){setTimeout(r.bind(this,e),0)}},r[e.name]=function(t,n,i){new r(t)[e.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(s[e.name],"$options",{value:r[e.name].$options}))}(o[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:t.buildOpt()}),Object.defineProperty(s,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:t}),Object.defineProperty(s,"$type",{value:t})),r}(e,this)},R.Service=T,I=function(e,t,n,i){C.call(this,e,t,n),this.className="Service.Method",this.options=i||{}},(I.prototype=Object.create(C.prototype)).buildOpt=o.buildOpt,R.Service.Method=I,v=function(e,t,n,i,r,s,o,a){I.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=s,this.responseStream=o,this.resolvedRequestType=null,this.resolvedResponseType=null},v.prototype=Object.create(I.prototype),R.Service.RPCMethod=v,R}(s),s.Builder=function(e,t,n){function i(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,i(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var r=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},s=r.prototype;return r.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},r.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},r.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},r.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},r.isExtend=function(e){return"string"==typeof e.ref},s.reset=function(){return this.ptr=this.ns,this},s.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},s.create=function(t){var i,s,o,a,u;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(i=[t];i.length>0;){if(t=i.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(s=t.shift(),r.isMessage(s)){if(o=new n.Message(this,this.ptr,s.name,s.options,s.isGroup,s.syntax),a={},s.oneofs&&Object.keys(s.oneofs).forEach((function(e){o.addChild(a[e]=new n.Message.OneOf(this,o,e))}),this),s.fields&&s.fields.forEach((function(e){if(null!==o.getChild(0|e.id))throw Error("duplicate or invalid field id in "+o.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+o.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+o.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,o,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,s.syntax),t&&t.fields.push(e),o.addChild(e)}),this),u=[],s.enums&&s.enums.forEach((function(e){u.push(e)})),s.messages&&s.messages.forEach((function(e){u.push(e)})),s.services&&s.services.forEach((function(e){u.push(e)})),s.extensions&&(o.extensions="number"==typeof s.extensions[0]?[s.extensions]:s.extensions),this.ptr.addChild(o),u.length>0){i.push(t),t=u,u=null,this.ptr=o,o=null;continue}u=null}else if(r.isEnum(s))o=new n.Enum(this,this.ptr,s.name,s.options,s.syntax),s.values.forEach((function(e){o.addChild(new n.Enum.Value(this,o,e.name,e.id))}),this),this.ptr.addChild(o);else if(r.isService(s))o=new n.Service(this,this.ptr,s.name,s.options),Object.keys(s.rpc).forEach((function(e){var t=s.rpc[e];o.addChild(new n.Service.RPCMethod(this,o,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(o);else{if(!r.isExtend(s))throw Error("not a valid definition: "+JSON.stringify(s));if(o=this.ptr.resolve(s.ref,!0))s.fields.forEach((function(t){var i,r,s,a;if(null!==o.getChild(0|t.id))throw Error("duplicate extended field id in "+o.name+": "+t.id);if(o.extensions&&(i=!1,o.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+o.name+": "+t.id+" (not within valid ranges)");r=t.name,this.options.convertFieldsToCamelCase&&(r=e.Util.toCamelCase(r)),s=new n.Message.ExtensionField(this,o,t.rule,t.type,this.ptr.fqn()+"."+r,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,s),s.extension=a,this.ptr.addChild(a),o.addChild(s)}),this);else if(!/\.?google\.protobuf\./.test(s.ref))throw Error("extended message "+s.ref+" is not defined")}s=null,o=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},s.import=function(t,n){var r,s,o,a,u,c,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="\\"),s=r+d+n.file,!0===this.files[s])return this.reset();this.files[s]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,o=this.importRoot,n=n.file,(o.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?o=this.importRoot:n.indexOf("/")>=0?""===(o=n.replace(/\/[^\/]*$/,""))&&(o="/"):n.indexOf("\\")>=0?(o=n.replace(/\\[^\\]*$/,""),d="\\"):o=".":o=null,u=0;u<t.imports.length;u++)if("string"==typeof t.imports[u]){if(!o)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=t.imports[u]))continue;if(c=o+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!e.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(c)))throw Error("failed to import '"+c+"' in '"+n+"': file not found");/\.json$/i.test(c)?this.import(JSON.parse(l+""),c):this.import(e.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+u+"."+n}))):this.import(t.imports[u],n+"_import"+u):this.import(t.imports[u]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&i(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},s.resolveAll=function(){var i;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(i=(this.ptr instanceof n.Message.ExtensionField?this.ptr.extension.parent:this.ptr.parent).resolve(this.ptr.type,!0)))throw Error("unresolvable type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(this.ptr.resolvedType=i,i instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==i.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(i instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=i.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((i=this.ptr.parent.resolve(this.ptr.requestName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=i,!((i=this.ptr.parent.resolve(this.ptr.responseName,!0))&&i instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},s.build=function(e){var t,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,i=0;i<t.length;i++){if(!n[t[i]]){n=null;break}n=n[t[i]]}return n},s.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},s.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(s,s.Lang,s.Reflect),s.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var i=function(e,n){var i,r,s,o;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(i=Object.keys(n),r=0;r<i.length;r++)s=this.keyElem.valueFromString(i[r]),o=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(s)]={key:s,value:o}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},r.entries=function(){var e,t,i=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)i.push([(e=this.map[r[t]]).key,e.value]);return n(i)},r.keys=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].key);return n(t)},r.values=function(){var e,t=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)t.push(this.map[i[e]].value);return n(t)},r.forEach=function(e,t){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)e.call(t,(n=this.map[r[i]]).value,n.key,this)},r.set=function(e,t){var n=this.keyElem.verifyValue(e),i=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},r.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},i}(0,s.Reflect),s.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),s.loadJson(s.DotProto.Parser.parse(e),t,n)},s.protoFromString=s.loadProto,s.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,s.loadProto(i,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:s.loadProto(i,n,e)},s.protoFromFile=s.loadProtoFile,s.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=s.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=s.populateAccessors),new s.Builder(e)},s.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=s.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},s.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return s.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(i){if(null!==i)try{t(null,s.loadJson(JSON.parse(i),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var i=s.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===i?null:s.loadJson(JSON.parse(i),n,e)},r=e,s.loadProto(r,void 0,"").build("Modules").probuf}(n,t);return i}var di,pi,gi=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=hi(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var i=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&i["set"+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()}))}(e,0,1)](n)}))}catch(t){var r="pbname: "+e+", stack: "+t.stack;this.logger?this.logger.error(fe.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(fe.L_PB_ENCODE_E,r)}return n?i:i.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!Tt(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{"+n.length+"}$"),n),16)}for(var i in e)e[i]=this.fixInt64Values(e[i]);return e},e}();!function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA"}(pi||(pi={}));var _i=((di={})[pi.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},di[pi.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1saWdodC1lZGdlLmNvbQ==",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},di[pi.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi51cy1saWdodC1lZGdlLmNvbQ==",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},di[pi.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},di[pi.SA]={naviUrlBase64:["bmF2LnNhdS1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zYXUtbGlnaHQtZWRnZS5jb20=",protocol:De.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2F1LWxpZ2h0LWVkZ2UuY29t","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNhdS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},di);function fi(e){return pi[e]?e:pi.BJ}var Ei,Ti,Ii,vi,Ri,Ci,Si,mi=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e,t){var n,i=this.initOption||{},r=i.areaCode,s=i.navigators,o=(n=r,void 0===n&&(n=pi.BJ),_i[fi(n)].naviUrlBase64).map((function(e){return tn(e)})),a=[],u=e.split("@")[1];t&&(a=u?u.split(";"):[]);var c=s&&s.length>0?h(h([],a,!0),s,!0):h(h([],a,!0),o,!0);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return _n(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,i=e||{},r=i.log,s=i.logPolicy,o=this.initOption||{},a=o.areaCode,c=o.logServerUrl,l=(n=a,void 0===n&&(n=pi.BJ),_i[fi(n)].logUrlBase64).map((function(e){return u(u({},e),{addr:tn(e.addr)})})),d=[],p={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(p,r.policy);else if(s)try{var g=JSON.parse(s);d.push({addr:g.url,protocol:De.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){t.warn(fe.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var _=c?h([{addr:c,protocol:De.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,addrs:_.filter((function(e,t){return _.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return u(u({},e),{addr:_n(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=pi.BJ),_i[fi(t)].miniCmpBase64).map((function(e){return tn(e)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},e.prototype.getStaticConfigUrl=function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=pi.BJ),_i[fi(t)].staticConfigUrlBase64).map((function(e){return tn(e)}))},e.prototype.getCloudControllerUrl=function(e){var t,n,i=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(n=i,void 0===n&&(n=pi.BJ),_i[fi(n)].cloudControllerUrlBase64).map((function(e){return tn(e)}))},e.prototype.getAreaCode=function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:pi.BJ},e.prototype.setAreaCode=function(e){return!(!e||!pi[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e}(),yi=new mi,Ai=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:if(!(t=this.getCache()))return[3,6];c.label=1;case 1:return c.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<Y?[4,this.decryptData(n.val)]:[3,3];case 2:return i=c.sent(),(r=i.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:r.map((function(e){return _n(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return s=c.sent(),this.logger.error(fe.L_GET_STATIC_CONF_E,JSON.stringify({error:null==s?void 0:s.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(o=c.sent())?[4,this.decryptData(o)]:[2];case 8:return(null==(a=c.sent())?void 0:a.areaCode)!==yi.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:o})),this.staticUrls=(null==a?void 0:a.bootstrap)||[],(u=null===(e=null==a?void 0:a.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:u.map((function(e){return _n(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:e=(e=h(h([],this.staticUrls,!0),yi.getStaticConfigUrl(),!0).map((function(e){return _n(e)}))).filter((function(t,n){return e.indexOf(t)===n})),t=0,n=e,u.label=1;case 1:return t<n.length?(i=n[t],this.logger.info(fe.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest(i+"/"+this.appkey)]):[3,4];case 2:if(s=u.sent(),o=s.code,a=s.data,200===o)return this.logger.info(fe.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:o,duration:Date.now()-r})),[2,a];this.logger.warn(fe.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:o,duration:Date.now()-r})),u.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},e}(),Ni={"set.proxy":$.INVALID_PARAMETER_PROXY,"test.proxy":$.INVALID_PARAMETER_TESTHOST,"test.proxy.socksHost":$.INVALID_PARAMETER_TESTHOST,"test.proxy.socksPort":$.INVALID_PARAMETER_TESTHOST,channelId:$.INVALID_PARAMETER_CHANNEL_ID,count:$.INVALID_PARAMETER_COUNT,startTime:$.INVALID_PARAMETER_START_TIME,endTime:$.INVALID_PARAMETER_END_TIME,offset:$.INVALID_PARAMETER_OFFSET,limit:$.INVALID_PARAMETER_LIMIT,keyword:$.INVALID_PARAMETER_KEYWORD,messageTypes:$.INVALID_PARAMETER_MESSAGE_TYPE,messageType:$.INVALID_PARAMETER_MESSAGE_TYPE,typingContentType:$.INVALID_PARAMETER_MESSAGE_TYPE,conversation:$.INVALID_PARAMETER_CONVERSATION,conversationType:$.INVALID_PARAMETER_CONVERSATION_TYPE,targetId:$.INVALID_PARAMETER_TARGET_ID,targetIds:$.INVALID_PARAMETER_TARGET_ID,userId:$.INVALID_PARAMETER_USER_ID,senderUserId:$.INVALID_PARAMETER_USER_ID,timestamp:$.INVALID_PARAMETER_TIMESTAMP,order:$.INVALID_PARAMETER_ORDER,messageId:$.INVALID_PARAMETER_MESSAGE_ID,receivedStatus:$.INVALID_PARAMETER_RECEIVED_STATUS,receivedStatusInfo:$.INVALID_PARAMETER_RECEIVED_STATUS,sentStatus:$.INVALID_PARAMETER_SENT_STATUS,content:$.INVALID_PARAMETER_MESSAGE_CONTENT,messageIds:$.INVALID_PARAMETER_MESSAGE_ARRAY,cleanSpace:$.INVALID_PARAMETER_CLEAN_SPACE,messageDirection:$.INVALID_MESSAGE_DIRECTION,canIncludeExpansion:$.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION,expansion:$.INVALID_PARAMETER_MESSAGE_EXPANSION,disableNotification:$.INVALID_PARAMETER_DISABLE_NOTIFICATION,messages:$.MSG_LIMIT_ERROR,checkDuplicate:$.INVALID_PARAMETER_CHECK_DUPLICATE,messageUId:$.INVALID_PARAMETER_MESSAGE_UID,key:$.INVALID_PARAMETER_KEY,keys:$.INVALID_PARAMETER_KEYS,value:$.INVALID_PARAMETER_VALUE,isAutoDelete:$.INVALID_PARAMETER_IS_AUTO_DELETE,isSendNotification:$.INVALID_PARAMETER_IS_SEND_NOTIFICATION,notificationExtra:$.INVALID_PARAMETER_NOTIFICATION_EXTRA,entries:$.INVALID_PARAMETER_ENTRIES,isForce:$.INVALID_PARAMETER_IS_FORCE,rtcRoomId:$.INVALID_PARAMETER_RTCROOMID,token:$.RC_CONN_TOKEN_INCORRECT,conversations:$.INVALID_PARAMETER_CONVERSATIONS,draft:$.INVALID_PARAMETER_DRAFT,conversationTypes:$.INVALID_PARAMETER_CONVERSATION_TYPE_LIST,levels:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevel:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationLevels:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,notificationStatus:$.INVALID_PARAMETER_NOTIFICATION_LEVEL,isTop:$.INVALID_PARAMETER_IS_TOP,isUpdateTime:$.INVALID_PARAMETER_IS_UPDATE_TIME,message:$.INVALID_PARAMETER_MESSAGE,mentionedUserIdList:$.INVALID_PARAMETER_USERIDLIST,directionalUserIdList:$.INVALID_PARAMETER_USERIDLIST,directedUserIds:$.INVALID_PARAMETER_USERIDLIST,isStatusMessage:$.INVALID_PARAMETER_IS_STATUS_MESSAGE,pushContent:$.INVALID_PARAMETER_PUSH_CONTENT,pushData:$.INVALID_PARAMETER_PUSH_DATA,isMentioned:$.INVALID_PARAMETER_IS_MENTIONED,mentionedType:$.INVALID_PARAMETER_MENTIONED_TYPE,isVoipPush:$.INVALID_PARAMETER_IS_VOIP_PUSH,pushConfig:$.INVALID_PARAMETER_PUSH_CONFIG,startMsgUId:$.INVALID_PARAMETER_START_MESSAGE_UID,endMsgUId:$.INVALID_PARAMETER_END_MESSAGE_UID,sentTime:$.INVALID_PARAMETER_TIMESTAMP,clearMessageOption:$.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST,searchContent:$.SEARCH_PROPS_LIMIT_ERROR,tagId:$.INVALID_PARAMETER_TAG_ID,tagIds:$.INVALID_PARAMETER_TAG_ID,tagName:$.INVALID_PARAMETER_TAG_NAME,containMuted:$.INVALID_PARAMETER_CONTAIN_MUTED,channelType:$.INVALID_PARAMETER_CHANNEL_TYPE,file:$.MEDIA_EXCEPTION,fileType:$.INVALID_PARAMETER_MEDIA_TYPE,contentDisposition:$.INVALID_PARAMETER_CONTENT_DISPOSITION,mediaUrl:$.INVALID_PARAMETER_MEDIA_URL,filename:$.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME,saveName:$.INVALID_PARAMETER_SAVE_NAME,serverType:$.INVALID_PARAMETER_SERVER_TYPE,subscribeType:$.INVALID_PARAMETER_SUBSCRIBE_TYPE,expiry:$.INVALID_PARAMETER_SUBSCRIBE_EXPIRY,subscribeUserIds:$.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS,subscribePageSize:$.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE,beforeCount:$.INVALID_PARAMETER_BEFORE,afterCount:$.INVALID_PARAMETER_AFTER,conversationList:$.INVALID_PARAMETER_CONVERSATION_LIST,conversationTypeNotSupport:$.CONVERSATION_TYPE_NOT_SUPPORT},Oi=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return this._context.createCodec(e,t)},e.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.9.9"},e.prototype.getAPIVersion=function(){return"5.9.9"},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.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e.prototype.createStatisticLogger=function(e,t){return this._context.createStatisticLogger(e,t)},e}(),Mi="pgMsgP",Li="chatMsg",Ui="pcMsgP",bi="pbMsgP",Pi={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Di="delMsg",wi="delUgMsg",Vi="joinChrm",Gi="joinChrmR",Bi="exitChrm",ki="setKV",xi="delKV",Fi="setKVS",Hi="delKVS",qi="qryRelationR",Yi="delRelation",Ki="delRelationBatch",ji="setSeAtt",Qi={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg",APP_PUBLIC_SERVICE:"cleanMCMsg",PUBLIC_SERVICE:"cleanMPMsg"},Wi="cleanMsgBatch",Ji="reqCall",Xi="pullKvMsg",Zi="qryPMsg",zi="qryGMsg",$i="qryCHMsg",er="qryCMsg",tr="qrySMsg",nr="qryMCMsg",ir="qryMPMsg",rr=((Ei={})["ppMsgP"]=te.PRIVATE,Ei[Mi]=te.GROUP,Ei[Li]=te.CHATROOM,Ei[Ui]=te.CUSTOMER_SERVICE,Ei[bi]=te.SYSTEM,Ei),sr=((Ti={})[te.PRIVATE]=Zi,Ti[te.GROUP]=zi,Ti[te.CHATROOM]=$i,Ti[te.CUSTOMER_SERVICE]=er,Ti[te.SYSTEM]=tr,Ti[te.APP_PUBLIC_SERVICE]=nr,Ti[te.PUBLIC_SERVICE]=ir,Ti),or=((Ii={})[te.PRIVATE]=Qi.PRIVATE,Ii[te.GROUP]=Qi.GROUP,Ii[te.ULTRA_GROUP]=Qi.ULTRA_GROUP,Ii[te.CUSTOMER_SERVICE]=Qi.CUSTOMER_SERVICE,Ii[te.SYSTEM]=Qi.SYSTEM,Ii[te.APP_PUBLIC_SERVICE]=Qi.APP_PUBLIC_SERVICE,Ii[te.PUBLIC_SERVICE]=Qi.PUBLIC_SERVICE,Ii),ar="1",ur="0",cr=1,lr=2,hr=3;!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(vi||(vi={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(Ri||(Ri={})),function(e){e.PUB="pub",e.QUERY="qry"}(Ci||(Ci={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Si||(Si={}));var dr,pr=function(){function e(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=vi.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=vi.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,e&&e>0&&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&~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}(),gr=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),i=n.back,r=n.byteSize,s=0,o=i.length;s<o;s++)i[s]>255&&(i[s]&=255);return t?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},e._getBackAndByteSize=function(e){var t=[],n=0;if(ut(e))for(var i=0,r=e.length;i<r;i++){var s=e.charCodeAt(i);s>=0&&s<=127?(n+=1,t.push(s)):s>=128&&s<=2047?(n+=2,t.push(192|31&s>>6),t.push(128|63&s)):s>=2048&&s<=65535&&(n+=3,t.push(224|15&s>>12),t.push(128|63&s>>6),t.push(128|63&s))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,i=[],r=-1,s=e,o="";++r<s.length;){var a=Number(s[r]);if(a===(127&a)||(240&~a?224&~a?192&~a||(a=(a^=192)<<6|128^s[++r]):a=(a=(a^=224)<<6|128^s[++r])<<6|128^s[++r]:a=(a=(a=(a^=240)<<6|128^s[++r])<<6|128^s[++r])<<6|128^s[++r]),!Number.isFinite(a)||a<0||a>1114111||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===s.length||i.length>16384)&&(o+=String.fromCharCode.apply(null,i),i.length=0)}return o},e}(),_r=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._position;this._position+=e;var n=this._pool.subarray(t,this._position);return gr.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),fr=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=gr.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),Er=function(e,t){return e&&t?t+"_"+e:e||Date.now()},Tr=function(){function e(e){this.header=e,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Er(e,t)},e.prototype.read=function(e,t,n,i){this.readMessage(e,t,n,i)},e.prototype.readMessage=function(e,t,n,i){return{stream:t,length:n}},e}(),Ir=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new pr(e,!1,vi.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return Er(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 fr;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),vr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=null,t.userId=null,t.timestamp=0,t}return a(t,e),t.prototype.readMessage=function(e,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=t.MESSAGE_LENGTH)return{stream:n,length:i};if(r===Si.V4){var s=n.readByte();1&s&&(this.userId=n.readUTF()),2&s&&n.readUTF(),4&s&&(this.timestamp=n.readLong()),8&s&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var o=n.readUTF();e.debug(fe.O,"server sessionId -> "+o),this.timestamp=n.readLong()}return{stream:n,length:i}},t.MESSAGE_LENGTH=2,t}(Tr),Rr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){return t.readByte(),this.status=+t.readByte(),{stream:t,length:n}},t.MESSAGE_LENGTH=2,t}(Tr),Cr=function(e){function t(){return e.call(this,Ri.PING_REQ)||this}return a(t,e),t.prototype.writeMessage=function(e){},t}(Ir),Sr=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t}(Tr),mr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){var i=256*t.readByte()+t.readByte();return this.messageId=parseInt(i.toString(),10),{stream:t,length:n}},t}(Tr),yr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(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}(Ir),Ar=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=Ci.PUB,t}return a(t,e),t.prototype.readMessage=function(t,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,i),this.data=n.readAll(),{stream:n,length:i}},t}(mr),Nr=function(e){function t(t,n,i){var r=e.call(this,Ri.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Ci.PUB,r.topic=t,r.data=ut(n)?gr.writeUTF(n):n,r.targetId=i,r}return a(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}(yr),Or=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=Ci.PUB,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.millisecond=256*n.readByte()+n.readByte(),this.timestamp=1e3*this.date+this.millisecond,this.messageUId=n.readUTF(),{stream:n,length:i}},t}(mr),Mr=function(e){function t(t){var n=e.call(this,Ri.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return a(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(yr),Lr=function(e){function t(t,n,i){var r=e.call(this,Ri.QUERY)||this;return r.identifier=Ci.QUERY,r.topic=t,r.data=ut(n)?gr.writeUTF(n):n,r.targetId=i,r}return a(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}(yr),Ur=function(e){function t(t){var n=e.call(this,Ri.QUERY_CONFIRM)||this;return n.messageId=t,n}return a(t,e),t}(yr),br=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=Ci.QUERY,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,i){return e.prototype.readMessage.call(this,t,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},t}(mr),Pr=function(e,t,n){var i=new Uint8Array(t),r=new _r(i),s=r.readByte(),o=function(e,t){var n,i=e.type;switch(i){case Ri.CONN_ACK:n=new vr(e);break;case Ri.PUBLISH:(n=new Ar(e)).syncMsg=e.syncMsg;break;case Ri.PUB_ACK:n=new Or(e);break;case Ri.QUERY_ACK:n=new br(e);break;case Ri.SUB_ACK:case Ri.UNSUB_ACK:case Ri.PING_RESP:n=new Sr(e);break;case Ri.DISCONNECT:n=new Rr(e);break;default:n=new Tr(e),t.error(fe.O,"No support for deserializing "+i+" messages")}return n}(new pr(s),e);return o.read(e,r,i.length-1,n),o};!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.pbMsgP=14]="pbMsgP",e[e.rrMsg=15]="rrMsg",e[e.rrList=16]="rrList",e[e.s_ntf=17]="s_ntf",e[e.s_msg=18]="s_msg",e[e.s_stat=19]="s_stat",e[e.s_cmd=20]="s_cmd",e[e.s_us=21]="s_us",e[e.pullUS=22]="pullUS",e[e.sendMsgRead=23]="sendMsgRead",e[e.qryMsgRead=24]="qryMsgRead",e[e.qryMsgReadCntBatch=25]="qryMsgReadCntBatch",e[e.updRTime=26]="updRTime",e[e.pgMsgS=27]="pgMsgS",e[e.chatMsgS=28]="chatMsgS",e[e.qrySessionsAtt=29]="qrySessionsAtt",e[e.pullMsg=30]="pullMsg",e[e.qrySessions=31]="qrySessions",e[e.delSessions=32]="delSessions",e[e.delMsg=33]="delMsg",e[e.updRRTime=34]="updRRTime",e[e.setTypeUnpush=35]="setTypeUnpush",e[e.chrmPull=36]="chrmPull",e[e.joinChrm=37]="joinChrm",e[e.joinChrmR=38]="joinChrmR",e[e.exitChrm=39]="exitChrm",e[e.queryChrmI=40]="queryChrmI",e[e.setKV=41]="setKV",e[e.delKV=42]="delKV",e[e.pullKV=43]="pullKV",e[e.qryRelation=44]="qryRelation",e[e.delRelation=45]="delRelation",e[e.pullSeAtts=46]="pullSeAtts",e[e.setSeAtt=47]="setSeAtt",e[e.qnTkn=48]="qnTkn",e[e.qnUrl=49]="qnUrl",e[e.aliUrl=50]="aliUrl",e[e.s3Url=51]="s3Url",e[e.stcUrl=52]="stcUrl",e[e.minioUrl=53]="minioUrl",e[e.cleanPMsg=54]="cleanPMsg",e[e.cleanGMsg=55]="cleanGMsg",e[e.cleanCMsg=56]="cleanCMsg",e[e.cleanSMsg=57]="cleanSMsg",e[e.rtcPing=58]="rtcPing",e[e.rtc_ntf=59]="rtc_ntf",e[e.rtcSetOutData=60]="rtcSetOutData",e[e.rtcQryUserOutData=61]="rtcQryUserOutData",e[e.addSeTag=62]="addSeTag",e[e.delSeTag=63]="delSeTag",e[e.addTag=64]="addTag",e[e.delTag=65]="delTag",e[e.disTag=66]="disTag",e[e.reportsdk=67]="reportsdk",e[e.pullUgSes=68]="pullUgSes",e[e.pullUgMsg=69]="pullUgMsg",e[e.ugMsg=70]="ugMsg",e[e.qryUgMsg=71]="qryUgMsg",e[e.updUgRTime=72]="updUgRTime",e[e.upMsgEx=73]="upMsgEx",e[e.modifyMsg=74]="modifyMsg",e[e.qryMsgChange=75]="qryMsgChange",e[e.qryMsg=76]="qryMsg",e[e.operate=77]="operate",e[e.s_opNtf=78]="s_opNtf",e[e.ugUnpushQuery=79]="ugUnpushQuery",e[e.ugUnpushSet=80]="ugUnpushSet",e[e.setRtcRoomId=81]="setRtcRoomId",e[e.qryUgUal=82]="qryUgUal",e[e.s_pubCall=83]="s_pubCall",e[e.updUserSub=84]="updUserSub",e[e.pullUserSub=85]="pullUserSub",e[e.pullSubData=86]="pullSubData",e[e.qrySubData=87]="qrySubData"}(dr||(dr={}));var Dr=dr,wr=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},this._users[e]},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var i=Q.INBOX_TIME_KEY(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=Q.INBOX_TIME_KEY(this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||vt(e))){n.broadcastSyncTime=e;var i=Q.BROADCASTBOX_TIME_KEY(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=Q.BROADCASTBOX_TIME_KEY(this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var i=Q.OUTBOX_TIME_KEY(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=Q.OUTBOX_TIME_KEY(this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),Vr={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},Gr=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}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,s=e.userId,o=this._getSetUserId(n),a=i===Ie.DELETE,u=o===s,c=!this._isExisted(n),l=a?this._remove:this._add;(t||r||u||c)&&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)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),Br=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o;return l(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=Vr.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,i)]);case 1:return r=a.sent(),s=r.code,o=r.data,this._isPulling=!1,s===$.SUCCESS?(Vr.set(t,o.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Vr.clear(e);var t=this._storeCaches[e];null==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];St(i)||(i=new Gr(this._engine.getInnerLogger(),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}(),kr=function(){function e(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t},e.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e]},e.prototype.clear=function(){this._joinedChrmsInfo={}},e}(),xr=function(){function e(){this._callerQueue=[],this._isCalling=!1,this._retryCount=0}return e.prototype.pushTask=function(e){var t=this;return new Promise((function(n){t._callerQueue.push({task:e,resolve:n}),t._startCall()}))},e.prototype._startCall=function(){return c(this,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return this._isCalling||0===this._callerQueue.length?[2]:(this._isCalling=!0,e=this._callerQueue.shift(),[4,this._callHandler(e)]);case 1:return t=n.sent(),e.resolve(t),this._isCalling=!1,this._startCall(),[2]}}))}))},e.prototype._callHandler=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.task,n=this.getVersion(),[4,t(n)];case 1:return(i=r.sent()).code===$.USER_SETTING_SYNCED_ERROR&&this._retryCount<5?(this._retryCount++,[4,this._triggerPull(n)]):[3,3];case 2:return r.sent(),[2,this._callHandler(e)];case 3:return this._retryCount=0,[2,i]}}))}))},e.prototype.stopAllTask=function(){this._callerQueue.forEach((function(e){e.resolve({code:$.RC_NET_UNAVAILABLE})})),this._callerQueue=[]},e}(),Fr="converStatusChanged",Hr=function(e){function t(t,n,r){var o=e.call(this)||this;return o._eventEmitter=new bt,o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storagePullTimeKey="con-s-"+n+"-"+r,o._oldStorage=i(t.runtime),o._storage=new s(t.runtime,Q.CONVER_STATE_PULL_TIME_KEY(n,r)),o._appkey=n,o._currentUserId=r,o._engine=t,o.adaptOldStatus(),o}return a(t,e),t.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){this._engine.getInnerLogger().error(fe.A_CALLBACK_E,"adaptOldStatus error: "+e.message)}},t.prototype._set=function(e){var t=this;if(!vt(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,i=e.length;e.forEach((function(e,r){var s=e.updatedTime||0;n=s>n?s:n,e.conversationType=e.type,t._eventEmitter.emit(Fr,{statusItem:e,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n),this._pullQueue=this._pullQueue.filter((function(e){return e>n}))}},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullConversationStatus(e),[4,this._pullPromise]);case 1:return t=r.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n===$.SUCCESS&&this._set(i),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},t.prototype._startCall=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pull=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.watch=function(e){this._eventEmitter.on(Fr,(function(t){e(t)}))},t.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},t.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(xr),qr={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},fut:{keyName:"firstUnreadTime",defaultVal:0},fuid:{keyName:"firstUnreadMessageUid",defaultVal:""},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},Yr={};for(var Kr in qr){var jr=qr[Kr].keyName;Yr[jr]=Kr}var Qr,Wr=function(){function e(e,t,n,i){this._appkey=t,this._currentUserId=n,this.logger=i,this.storage=new s(e,Q.OLD_CONVER_STATE_KEY(t,n)),this._localStore=new s(e,Q.CONVER_STATE_KEY(t,n))}return e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+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:te.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var i=this,r=e.conversationType,s=e.messageType,o=e.isMentioned,a=e.senderUserId;o&&r===te.GROUP&&((n.userIdList||[]).forEach((function(e){e===i._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===he.ALL&&t.indexOf(a)<0&&t.push(a));if(s===se.RECALL&&r===te.GROUP){var u=t.indexOf(a);u>=0&&t.splice(u,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,i=e.content,r=e.channelId,s=e.senderUserId,o=i.mentionedInfo;if(o&&s!==this._currentUserId){var a=this._getStoreKey(t,n,r),u=this._localStore.get(a)||{},c=Yr.mentionedInfo,l=Yr.hasMentioned,h=u[c]||{},d=h.userIdList||[];o={userIdList:d=this._updateMentionedUserList(e,d,o),type:(null==o?void 0:o.type)||h.type},0!==d.length?(u[c]=o,u[l]=!0):(delete u[c],delete u[l]),St(u)?this._localStore.set(a,u):this._localStore.remove(a)}},e.prototype._setLocal=function(e,t){if("tags"===e)for(var n in t)t[n].isTop||delete t[n].isTop;return t},e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),s=this._localStore.get(r)||{};for(var o in n){var a=Yr[o],u=n[o];if(!vt(a)&&!vt(u)&&"hasMentioned"!==o&&"MentionedInfo"!==o)u===qr[a].defaultVal||"tags"===o&&!St(u)?delete s[a]:s[a]=this._setLocal(o,u),s.c||(delete s.t,delete s.fut,delete s.fuid,delete s.hm,delete s.m,delete s.mc)}var c=Object.keys(s);1===c.length&&c.includes("st")&&delete s.st,St(s)?this._localStore.set(r,s):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)||{},s={};for(var o in qr){var a=qr[o],u=a.keyName,c=a.defaultVal;s[u]=r[o]||Mn(c)}return s},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var i in t){var r=this._getConOptionByKey(i),s={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},o=t[i];for(var a in o)if(qr[a]){var u=qr[a],c=u.keyName,l=u.defaultVal;s[c]=o[a]||Mn(l)}s=e?e(s):s,n.push(s)}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,s=i.targetId,o={},a=e[n];for(var c in a){var l=qr[c],h=l.keyName,d=l.defaultVal;o[h]=a[c]||Mn(d)}for(var p in o.tags){vt(t[p])&&(t[p]=[]);var g=u(u({},o),{conversationType:r,targetId:s});delete g.tags,t[p].push(g)}}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="_"+t;this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(fe.O,"adaptOldStore error: "+e.message)}},e.prototype.remove=function(e,t,n){var i=this._getStoreKey(e,t,n);this._localStore.remove(i)},e}(),Jr=[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE,te.APP_PUBLIC_SERVICE],Xr="conversationChanged",Zr="conTagStatusChanged",zr=function(){function e(e,t,n,i,r){var s=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new bt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new Wr(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new Hr(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;s.addStatus(t,n)})),this._eventEmitter.on(Xr,(function(e){i(e)})),this._eventEmitter.on(Zr,(function(){r()}));var o=this._store.getValue();o.length>1e3&&(o=o.sort((function(e,t){var n=e.lastMessageSentTime,i=void 0===n?0:n,r=t.lastMessageSentTime;return(void 0===r?0:r)-i})),o.splice(1e3,o.length).forEach((function(e){s._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,i){var r=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===i.sentTime})),s=t>=i.sentTime;return n&&(s=n<i.sentTime),{isNotRead:s,isNotRepeadRecallSendTime:r}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,i=e.messageType,r=e.sentTime,s=e.isCounted,o=e.messageDirection,a=e.senderUserId,u=e.messageUId,c=o===Z.SEND&&a===this._loginUserId,l=i===se.RECALL,h=Tt(n),d=!1,p={},g=t.lastUnreadTime,_=t.lastReadTime,f=t.unreadMessageCount;if(g>r||c)return{hasChanged:d,localConversation:t,updateItems:p};if(s&&(0===t.unreadMessageCount&&(t.firstUnreadMessageUid=u,t.firstUnreadTime=r),t.unreadMessageCount=f+1,t.lastUnreadTime=r,d=!0),l&&h){var E=this._handleRecall2UnreadCount(e,g,_,f,d),T=E.unreadMessageCount,I=E.hasChanged;t.unreadMessageCount=T,d=I,0===t.unreadMessageCount&&(t.firstUnreadMessageUid="",t.firstUnreadTime=0)}return d&&(p.unreadMessageCount={val:t.unreadMessageCount||0,time:r}),{hasChanged:d,localConversation:t,updateItems:p}},e.prototype._handleRecall2UnreadCount=function(e,t,n,i,r){var s=e.conversationType+"_"+e.channelId+"_"+e.targetId,o=this._calcMsg(s,t,n,e.content),a=o.isNotRead,u=o.isNotRepeadRecallSendTime;return a&&i&&u?(this._recallMsgTimeMap[s]||(this._recallMsgTimeMap[s]=[]),this._recallMsgTimeMap[s].push(e.content.sentTime),{unreadMessageCount:i-1,hasChanged:!0}):{unreadMessageCount:i,hasChanged:r}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,i=e.messageDirection,r=e.isMentioned,s=e.sentTime,o=i===Z.SEND,a=Tt(n),u=!1,c={};return!o&&r&&a&&n.mentionedInfo&&(t.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:s},c.mentionedInfo={val:n.mentionedInfo,time:s}),{hasChanged:u,localConversation:t,updateItems:c}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,i=e.messageDirection,r=!1;if(e.isMentioned&&i===Z.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var s=n.mentionedInfo,o=s.type,a=s.userIdList;if(o===he.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=t.unreadMentionedCount||0;t.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Tt(e)){var t=e.conversationType,n=e.targetId,i=e.channelId,r=t+"_"+n,s=this._store.get(t,n,i)||{};this._updatedConversations[r]=Object.assign(s,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,i){var r=(this._store.get(e,t,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var s in r)if(!n[s]||!!r[s].isTop!=!!n[s].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,i=e.targetId,r=e.updatedTime,s=e.notificationStatus,o=e.notificationLevel,a=e.isTop,u=e.tags,c=e.channelId,l={},h={};if(n!==te.ULTRA_GROUP){vt(s)||(h.notificationStatus={time:r,val:s}),vt(o)||(h.notificationLevel={time:r,val:o}),vt(a)||(h.isTop={time:r,val:a}),vt(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,i,l,c);var d=this._store.get(n,i,c).lastMessageSentTime||(new Date).getTime();this._store.set(n,i,{notificationStatus:s,notificationLevel:o,isTop:a,tags:l,lastMessageSentTime:d},c),i&&(this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),t&&this._notifyConversationChanged())}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(Xr,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Zr),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,i=e.conversationType,r=e.isPersited,s=e.targetId,o=e.channelId,a=e.sentTime;if(Jr.indexOf(i)>=0){var c=!1,l=this._store.get(i,s,o),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var i=t.call(n,e,l),r=i.hasChanged,s=i.localConversation,o=i.updateItems;c=c||r,h=u(u({},h),o),l=Mn(s)})),this._store.set(i,s,l,o),this._store.updateMentionedData(e),r){var d=this._store.get(i,s,o);d.updatedItems=u({latestMessage:{time:e.sentTime,val:e}},h),d.latestMessage=e;var p=Object.assign(d,{conversationType:i,targetId:s,channelId:o});this._setUpdatedConversation(p)}(c||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,s=e.notificationStatus,o=e.notificationLevel,a=e.conversationType;i=i||0,(n||void 0!==o&&o<=0||void 0===o&&s!==ae.OPEN)&&(t.length>0?t.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var s=i.unreadMessageCount,o=i.notificationLevel,a=void 0===o?0:o,u=i.conversationType,c=i.unreadMentionedCount;e.includes(u)&&(0===t.length||t.includes(a))&&(r+=(n?c:s)||0)})),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,s=e.notificationLevel;(t||1!==r||-1===s||0===s)&&(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,r){void 0===r&&(r=!0);var s=this._store.get(e,t,n);s.lastReadTime=s.lastUnreadTime,this._recallMsgTimeMap[e+"_"+n+"_"+t]=[];var o=s.unreadMessageCount,a=s.hasMentioned,u={};if(o&&(s.unreadMessageCount=0,u.unreadMessageCount={val:0,time:i}),a&&(s.hasMentioned=!1,s.unreadMentionedCount=0,s.mentionedInfo=void 0,u.hasMentioned={val:!1,time:i},u.mentionedInfo={val:void 0,time:i}),this._store.set(e,t,s,n),r&&0!==Object.keys(u).length){var c=Object.assign(s,{conversationType:e,targetId:t,channelId:n,updatedItems:u});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=e+"_"+t+"_"+i;this._draftMap[r]=n},e.prototype.getDraft=function(e,t,n){var i=e+"_"+t+"_"+n;return this._draftMap[i]},e.prototype.clearDraft=function(e,t,n){var i=e+"_"+t+"_"+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),s=r.tags;s=Object.assign(s,n);var o=r.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:s,lastMessageSentTime:o},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===ae.OPEN||e.notificationLevel&&e.notificationLevel>0})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,notificationLevel:e.notificationLevel||0,notificationStatus:e.notificationStatus||2}}))},e.prototype.getTopConversationList=function(e,t){var n=this;return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(vt(t)||t===n.channelId)&&n.isTop})).map((function(e){return n._buildConversation(e)}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===n&&(n=""),this.get(e,t,n).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.prototype.getUnreadConversationList=function(e){var t=this;return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){return t._buildConversation(e)}))},e.prototype._buildConversation=function(e){var t=this.getDraft(e.conversationType,e.targetId,e.channelId);return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel||0,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0,draft:t}},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getVersion()},e.prototype.pushTask=function(e){return this._statusManager.pushTask(e)},e.prototype.stopAllTask=function(){this._statusManager.stopAllTask()},e}(),$r=function(e){function t(t,n,i,r){var o=e.call(this)||this;return o._tagKey="tags",o._versionKey="version",o._pullQueue=[],o._isPulling=!1,o._pullPromise=null,o._storageKey=Q.USER_SETTING_KEY(n,i),o._storage=new s(t.runtime,o._storageKey),o._engine=t,o._tagWatcherFunc=r,o}return a(t,e),t.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._tagKey,n),this._tagWatcherFunc()},t.prototype.addTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){var t,n=(null===(t=i[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;i[e.tagId]={tagName:e.tagName,createdTime:n}})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.deleteTag=function(e,t){var n,i=this._storage.get(this._tagKey)||{};e.forEach((function(e){delete i[e]})),this._storage.update(((n={})[this._tagKey]=i,n[this._versionKey]=t,n))},t.prototype.getTagsInfo=function(){return this._storage.get(this._tagKey)||{}},t.prototype.getTags=function(){var e=this._storage.get(this._tagKey)||{},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)}))},t.prototype.getTagById=function(e){var t=this._storage.get(this._tagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2,this._pullPromise]:(this._isPulling=!0,this._pullQueue.shift(),e=this.getVersion(),this._pullPromise=this._engine.pullUserSettings(e),[4,this._pullPromise]);case 1:return t=u.sent(),n=t.code,i=t.data,this._isPulling=!1,this._pullPromise=null,n!==$.SUCCESS||vt(i)||(s=(r=i).settings,o=r.version,a=s.Tag,vt(a)||this._updateTag(a),this._storage.set(this._versionKey,o),this._pullQueue=this._pullQueue.filter((function(e){return e>o}))),0===this._pullQueue.length?this._startCall():this._startPull(),[2]}}))}))},t.prototype._startCall=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._isPulling||e.prototype._startCall.call(this),[2]}))}))},t.prototype.pullUserSettings=function(e){var t=this.getVersion();(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},t.prototype._triggerPull=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._pullQueue.push(e),[4,this._startPull()];case 1:return t.sent(),[2]}}))}))},t.prototype.getVersion=function(){return this._storage.get(this._versionKey)||0},t.prototype.updateVersion=function(e){this._storage.set(this._versionKey,e)},t}(xr),es=function(e){return e.replace(/@.+$/,"@")},ts=function(){function e(e,t,n,i,r,s){void 0===r&&(r=!0),void 0===s&&(s=!0),this.appkey=e,this.logger=t,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.isUseDynamicNaviUrl=s,this.crtRequest=null,this._environment="default"}return e.prototype.getCatchKey=function(e){return e+(this._environment?"-"+this._environment:"")},e.prototype.request=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a;return l(this,(function(u){switch(u.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,i,r),[4,this.crtRequest]);case 1:return s=u.sent(),o=s.code,a=s.data,this.crtRequest=null,[2,{code:o,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c,h,d,p,g,_,f,E,T;return l(this,(function(l){switch(l.label){case 0:return s=es(e),!t&&(o=this.getNaviCache(s))&&(a=o.timestamp,u=o.naviInfo,n||Date.now()-a<I)?(this.logger.info(fe.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:u}),i),c={bid:pn(),ptc:Ke.NAVI,cod:$.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:u.type||0,hos:"",cache:je.LOCAL,v:Qe.CURRENT,rsn:null==r?void 0:r.reason,cid:(null==r?void 0:r.uuid)+"_"+(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.statisticLog.record(Ee.IM_NAVI,JSON.stringify(c),i),[2,{code:$.SUCCESS,data:u}]):(h=yi.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(fe.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),i),[4,this.requestHandler(h,e,i,r)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===$.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(_=l.sent())?void 0:_.navi)&&(null==_?void 0:_.navi.length)>0?(f=_.navi,[4,this.requestHandler(f,e,i,r)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==$.SUCCESS?(this.logger.warn(fe.L_GET_NAVI_R,p,i),[2,{code:p}]):(T=g).code&&200!==T.code?(this.logger.warn(fe.L_GET_NAVI_R,T.code,i),[2,{code:this.transHttpCode(T.code)}]):(this.logger.info(fe.L_GET_NAVI_R,JSON.stringify({naviInfo:T}),i),this.setNaviCache(s,T),[2,{code:p,data:T}])}}))}))},e.prototype.requestHandler=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:r=0,s=e.length,l.label=1;case 1:return r<s?(o=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,o)]):[3,4];case 2:if(c=l.sent(),h=c.code,d=c.data,p={bid:pn(),ptc:Ke.NAVI,cod:h,net:null==i?void 0:i.type,dur:Date.now()-u,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[r],cache:je.REQUEST,v:Qe.CURRENT,rsn:null==i?void 0:i.reason,cid:(null==i?void 0:i.uuid)+"_"+(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.record(Ee.IM_NAVI,JSON.stringify(p),n),[$.SUCCESS,$.RC_CONN_TOKEN_INCORRECT,$.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return r+=1,[3,1];case 4:return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return $.RC_CONN_TOKEN_INCORRECT;case 416:return $.RC_LICENSE_EXPIRED;default:return $.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(es(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(es(e),u(u({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,i=e.token,r=e.platform,s=e.protocol,o=e.mac;t=n+"/v2/navi.json?cloud=0";var a="token="+encodeURIComponent(i)+"&version=5.9.9&platfrom="+r;return o&&(a+="&m="+o),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn="+s+";rtc=4;log=2"},body:a,url:t,timeout:R}},e.prototype.useV2Navi=function(){return!0},e}(),ns={},is={code:200,protocol:"https",server:"",voipCallInfo:"",kvStorage:0,openHttpDNS:!1,historyMsg:!1,chatroomMsg:!1,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:yi.getMiniCmpUrlList().join(",")},rs=function(e){function t(t,n,i,r,s,o){void 0===o&&(o="default");var a=e.call(this,t,n,i,s,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol),r.useNavi)||this;return a.runtime=r,a._environment=o,a}return a(t,e),t.prototype.httpRequest=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return s=e+"/navi.js?appId="+t+"&token="+encodeURIComponent(n)+"&callBack=x&v="+F+"&r="+Date.now()+"&env="+this._environment,this.logger.debug(fe.L_REQUEST_T,"req navi => "+s,i),[4,this.runtime.httpReq({url:s,timeout:R,dataType:"text"})];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(fe.L_REQUEST_R,"request navi failed: "+o.status,i),!this.runtime.useNavi&&r?[2,{code:$.SUCCESS,data:is}]:[2,{code:this.transHttpCode(o.status)}];try{return 0===(a=o.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'+a+'"')),(u=JSON.parse(a)).protocol=/^https/.test(s)?"https":"http",u.code&&200!==u.code?[2,{code:this.transHttpCode(u.code)}]:(this.runtime.useNavi||(u.server="",u.backupServer=yi.getMiniCmpUrlList().join(","),u.logSwitch=0),[2,{code:$.SUCCESS,data:u}])}catch(e){this.logger.error(fe.L_PARSE_NAVI_E,o.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return s=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?De.WSS:De.WS).toString()}),this.logger.debug(fe.L_REQUEST_T,"req navi => "+s.url,i),[4,this.runtime.httpReq(s)];case 1:if(200!==(o=l.sent()).status)return this.logger.debug(fe.L_REQUEST_R,"request navi failed: "+o.status,i),!this.runtime.useNavi&&r?[2,{code:$.SUCCESS,data:is}]:[2,{code:this.transHttpCode(o.status)}];try{return a=o.data,(u="object"!=typeof a?JSON.parse(a):a).protocol=/^https/.test(s.url)?"https":"http",this.runtime.useNavi||(u.logSwitch=0,c=yi.getMiniCmpUrlList(),u.serverAddr=c.map((function(e,t){return{addr:e,protocol:/^https/.test(s.url)?De.WSS:De.WS,weight:c.length-t}}))),[2,{code:$.SUCCESS,data:u}]}catch(e){this.logger.error(fe.L_PARSE_NAVI_E,o.data,i)}return[2,{code:$.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){var t=this,n=this.getCatchKey(e);if(ns[n])return ns[n];var i,r=Q.NAVI_KEY(this.appkey),s=this.runtime.localStorage;try{var o=s.getItem(r);i=o?JSON.parse(o):[]}catch(e){i=[]}if(0===i.length)return null;var a=i.find((function(n){return n.token===e&&n.environment===t._environment}))||null;return ns[n]=a,a},t.prototype.setNaviCache=function(e,t){var n,i=this,r=Q.NAVI_KEY(this.appkey),s=this.runtime.localStorage;try{var o=s.getItem(r);n=o?JSON.parse(o):[]}catch(e){n=[]}var a=Date.now();n.length>0&&(n=n.filter((function(t){return a-t.timestamp<I&&(e!==t.token||i._environment!==t.environment)})));var u={timestamp:a,naviInfo:t,token:e,environment:this._environment};n.push(u),s.setItem(r,JSON.stringify(n)),ns[this.getCatchKey(e)]=u},t}(ts),ss=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=Q.SEND_MSG_KEY(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=Q.SEND_MSG_KEY(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=Q.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))},e}();(Qr={})[te.PRIVATE]=Dr.qryPMsg,Qr[te.GROUP]=Dr.qryGMsg,Qr[te.CHATROOM]=Dr.qryCHMsg,Qr[te.CUSTOMER_SERVICE]=Dr.qryCMsg,Qr[te.SYSTEM]=Dr.qrySMsg;var os=[Dr[Dr.recallMsg],Dr[Dr.ppMsgS],Dr[Dr.pgMsgS],Dr[Dr.ppMsgP],Dr[Dr.pgMsgP],Dr[Dr.chatMsg],Dr[Dr.pcMsgP],Dr[Dr.prMsgS],Dr[Dr.pbMsgP]],as=function(){function e(e,t,n){this._localStore=new s(e,Q.ULTRA_GROUP_STATE_KEY(t,n))}return e.prototype.set=function(e,t,n,i){var r=this._getStoreKey(e,t,i),s=this._localStore.get(r)||{};for(var o in n){var a=cs[o],u=n[o];if(!vt(a)&&!vt(u))u===us[a].defaultVal?delete s[a]:s[a]=u}St(s)?this._localStore.set(r,s):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)||{},s={};for(var o in us){var a=us[o],u=a.keyName,c=a.defaultVal;s[u]=r[o]||Mn(c)}return s},e.prototype._getStoreKey=function(e,t,n){return n+"_"+e+"_"+t},e}(),us={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},cs={};for(var ls in us){var hs=us[ls].keyName;cs[hs]=ls}var ds,ps=function(){function e(e,t,n){this._store=new as(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,i=e.notificationStatus,r=e.notificationLevel,s=e.channelId;t===te.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:i,notificationLevel:r},s)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),gs="UpStreamMessage",_s="PushExtra",fs="DownStreamMessage",Es="DownStreamMessages",Ts="SessionsAttQryInput",Is="SessionsAttOutput",vs="SyncRequestMsg",Rs="ChrmPullMsg",Cs="NotifyMsg",Ss="HistoryMsgInput",ms="HistoryMsgOuput",ys="RelationQryInput",As="RelationsOutput",Ns="UnreadMsgInfo",Os="DeleteSessionsInput",Ms="SessionInfo",Ls="DeleteSessionsOutput",Us="RelationDelBatchReq",bs="RelationOpInput",Ps="RelationsInput",Ds="DeleteMsgInput",ws="CleanHisMsgInput",Vs="CleanMsgBatchReq",Gs="SessionMsgReadInput",Bs="ChrmInput",ks="ChrmOutput",xs="QueryChatRoomInfoInput",Fs="QueryChatRoomInfoOutput",Hs="GetQNupTokenInput",qs="GetQNupTokenOutput",Ys="GetQNdownloadUrlInput",Ks="GetDownloadUrlInput",js="GetQNdownloadUrlOutput",Qs="GetDownloadUrlOutput",Ws="ChrmKVEntity",Js="SetChrmKV",Xs="SetChrmKVS",Zs="DeleteChrmKVS",zs="ChrmKVOutput",$s="ChrmKVSOutput",eo="ChrmKVSVersionEntity",to="ChrmKVSOutputEntity",no="QueryChrmKV",io="SetUserSettingInput",ro="SetUserSettingOutput",so="PullUserSettingInput",oo="PullUserSettingOutput",ao="UserSettingNotification",uo="SessionReq",co="SessionStates",lo="SessionState",ho="SessionStateItem",po="SessionStateModifyReq",go="SessionStateModifyResp",_o="TypeUnpushInput",fo="TypeUnpushOutput",Eo="GroupUnpushQuery",To="GroupUnpushSet",Io="QryRemindListReq",vo="QryRemindListResp",Ro="GroupUnpushResult",Co="GrpReadReceiptMsg",So="GrpReadReceiptQryReq",mo="GrpReadReceiptQryResp",yo="GrpMsgReadUser",Ao="SessionTagAddInput",No="SessionTagItem",Oo="SessionTagDelInput",Mo="SessionDisTagReq",Lo="ReportSDKInput",Uo="ReportSDKOutput",bo="UltraGrpPullSes",Po="UltraGrpPullMsg",Do="MsgChangeReq",wo="QueryMsgChange",Vo="MsgChange",Go="MsgChangeList",Bo="MsgQuery",ko="MessageQueryInfo",xo="MsgQueryAck",Fo="OperateStatus",Ho="OperateStatusNotify",qo="OperateInfo",Yo="OperateSummary",Ko="SetRtcRoomIdInput",jo="SetRtcRoomIdOutput",Qo="CallInfoUpStream",Wo="CallInfoDownStream",Jo="KvInput",Xo="KvOutput",Zo="ReadReceiptMsg",zo="ReceiptQryReq",$o="QueryReceiptResp",ea="ReceiptUser",ta="ReceiptCntQryReq",na="ReceiptCntQryResp",ia="MsgReadCnt",ra="UpdateUserSubReq",sa="UserSubDetail",oa="UpdateUserSubResp",aa="PUllUserSubResp",ua="PullUserSubReq",ca="UserSubList",la="PullSubDataReq",ha="PullSubDataResp",da="SubDataDetail",pa="SubData",ga="QrySubDataReq";(ds={})[gs]=["sessionId","classname","content","pushText","toUserIds","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],ds[Es]=["list","syncTime","finished","broadcastSyncTime"],ds[fs]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserIds","groupUnpush"],ds[_s]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],ds[Ts]=["nothing"],ds[Is]=["inboxTime","sendboxTime","totalUnreadCount"],ds[vs]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],ds[Rs]=["syncTime","count"],ds[Cs]=["type","time","chrmId"],ds[Ss]=["targetId","time","count","order","busChannel"],ds[ms]=["list","syncTime","hasMsg"],ds[ys]=["type","count","startTime","order"],ds[As]=["info","isFinished"],ds[Ns]=["msgId","msgTime","remindType","className"],ds[Os]=["sessions"],ds[Us]=["RelationOpInput"],ds[bs]=["conversationId","conversationType","busChannel"],ds[Ms]=["type","channelId","busChannel"],ds[Ls]=["nothing"],ds[Ps]=["type","msg","count","busChannel","startTime","endTime"],ds[Ds]=["type","conversationId","msgs","busChannel"],ds[ws]=["targetId","dataTime","conversationType","busChannel"],ds[Vs]=["CleanHisMsgInput"],ds[Gs]=["type","msgTime","channelId","busChannel"],ds[Bs]=["nothing"],ds[ks]=["nothing","sessionId","joinTime"],ds[xs]=["count","order"],ds[Fs]=["userTotalNums","userInfos"],ds[Hs]=["type","key","httpMethod","queryString","url","ext"],ds[Ys]=["type","key","fileName"],ds[Ks]=["type","key","fileName","ext"],ds[qs]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],ds[js]=["downloadUrl"],ds[Qs]=["downloadUrl"],ds[Ws]=["key","value","status","timestamp","uid","version"],ds[Js]=["entry","bNotify","notification","type"],ds[Xs]=["entry","bNotify","notification","type"],ds[Zs]=["entry","bNotify","notification","type"],ds[zs]=["entries","bFullUpdate","syncTime"],ds[$s]=["timestamp","errorKeys","keysVersion"],ds[eo]=["version","key"],ds[to]=["key","errorCode"],ds[no]=["timestamp"],ds[io]=["version","value"],ds[ro]=["version","reserve"],ds[so]=["version","reserve"],ds[oo]=["items","version"],ds.UserSettingItem=["targetId","type","key","value","version","status","tags"],ds[uo]=["time"],ds[co]=["version","state"],ds[lo]=["type","channelId","time","stateItem","busChannel"],ds[ho]=["sessionStateType","value","tags"],ds[po]=["version","state"],ds[go]=["version"],ds[_o]=["type","version","unpushLevel"],ds[fo]=["version"],ds[To]=["busChannel","unpushLevel"],ds[Io]=["groupId","busChannel","msgTime","size"],ds[Eo]=["busChannel"],ds[Ro]=["groupId","busChannel","unpushLevel"],ds[Co]=["msgId","busChannel"],ds[So]=["msgId","busChannel"],ds[mo]=["totalMemberNum","list"],ds[yo]=["readTime","userId"],ds[Ao]=["version","tags"],ds[No]=["tagId","name","createdTime","isTop"],ds[Oo]=["version","tags"],ds[Mo]=["tagId"],ds[ao]=["version","reserve"],ds[Lo]=["sdkInfo"],ds[Uo]=["nothing"],ds[bo]=["syncTime","isEraseMsgContent"],ds[Po]=["syncTime"],ds[Do]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],ds[wo]=["syncTime"],ds[Go]=["list","syncTime","hasNext"],ds[Vo]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],ds[Bo]=["targetId","type","query"],ds[ko]=["msgTime","msgUID","busChannel"],ds[xo]=["list"],ds[Fo]=["targetId","type","opType","busChannel"],ds[Ho]=["type","notifyType","info","summary"],ds[qo]=["targetId","busChannel","userId","opType","optime"],ds[Yo]=["targetId","busChannel","count","opType"],ds[Ko]=["rtcRoomId"],ds[jo]=["nothing"],ds[Zo]=["targetId","type","busChannel","startMsgId","endMsgId"],ds[zo]=["msgId","busChannel","targetId"],ds[$o]=["num","list"],ds[ea]=["receiptTime","userId"],ds[ta]=["type","channelId","busChannel","msgId"],ds[na]=["result"],ds[ia]=["msgId","cnt","tmn"],ds[ra]=["subType","subUsers","opType","expiry"],ds[sa]=["subUserId"],ds[oa]=["subUsers","subTime"],ds[ua]=["version","pageToken"],ds[aa]=["list","version","hasNext","pageToken","isFull"],ds[ca]=["subUsers","subType","subTime","expiry","opType"],ds[la]=["versionTime","needAllData","pageToken"],ds[ha]=["list","versionTime","hasNext","pageToken","isFull"],ds[da]=["statusStr","subUserId","data","subType"],ds[pa]=["platformInfo","value","versionTime"],ds[ga]=["subType","subUsers"];var _a,fa="\npackage Modules;\nmessage probuf {\n message SetUserStatusOutput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusInput\n {\n optional int32 nothing=1;\n }\n\n message GetUserStatusOutput\n {\n optional string status=1;\n optional string subUserId=2;\n }\n\n message SubUserStatusInput\n {\n repeated string userid =1;\n }\n\n message SubUserStatusOutput\n {\n optional int32 nothing=1;\n }\n message VoipDynamicInput\n {\n required int32 engineType = 1;\n required string channelName = 2;\n optional string channelExtra = 3;\n }\n\n message VoipDynamicOutput\n {\n required string dynamicKey=1;\n }\n message "+Cs+" {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message "+vs+" {\n required int64 syncTime = 1;\n required bool ispolling = 2;\n optional bool isweb=3;\n optional bool isPullSend=4;\n optional bool isKeeping=5;\n optional int64 sendBoxSyncTime=6;\n optional int64 broadcastSyncTime=7;\n }\n message "+gs+" {\n required int32 sessionId = 1;\n required string classname = 2;\n required bytes content = 3;\n optional string pushText = 4;\n optional string appData = 5;\n repeated string toUserIds = 6;\n optional int64 delMsgTime = 7;\n optional string delMsgId = 8;\n optional int32 configFlag = 9;\n optional int64 clientUniqueId = 10;\n optional string extraContent = 11;\n optional PushExtra pushExt = 12;\n optional string busChannel = 13; // 该消息所属会话的业务标识\n optional string systemId = 16; // 系统会话消息时需填该字段为 targetId, 其他类型无需传\n }\n message "+_s+" {\n optional string title = 1;\n optional int32 templateIdNoUse= 2;\n optional string pushId = 3;\n optional string pushConfigs = 4;\n optional string templateId = 5;\n }\n message "+Es+" {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message "+fs+" {\n required string fromUserId = 1;\n required ChannelType type = 2;\n optional string groupId = 3;\n required string classname = 4;\n required bytes content = 5;\n required int64 dataTime = 6;\n required int64 status = 7;\n optional int64 extra = 8;\n optional string msgId = 9;\n optional int32 direction = 10;\n optional int32 plantform =11;\n optional int32 isRemoved = 12;\n optional string source = 13;\n optional int64 clientUniqueId = 14;\n optional string extraContent = 15;\n optional string pushContent = 16;\n optional int32 configFlag = 17;\n optional PushExtra pushExt = 18;\n optional string busChannel = 19; // 该消息所属会话的业务标识,限制20字符以内\n // 消息的扩展标记\n // 第0位,表示送达状态: 0x01 表示已送达;\n // 断档: 0x02 表示是否需要执行断档策略;\n // 消息修改: 0x04 拉取历史消息时表示该消息是否修改过\n // 0x08 每条消息携带的频道类型\n optional int64 extStatus = 20;\n repeated string toUserIds = 21; //指定接收者(限定群, 讨论组, 超级群)//增加聊天室定向成员\n optional int32 groupUnpush = 22; //群聊默认免打扰级别\n }\n enum ChannelType {\n PERSON = 1;\n PERSONS = 2;\n GROUP = 3;\n TEMPGROUP = 4;\n CUSTOMERSERVICE = 5;\n NOTIFY = 6;\n MC=7;\n MP=8;\n ULTRAGROUP = 10;\n }\n message CreateDiscussionInput {\n optional string name = 1;\n }\n message CreateDiscussionOutput {\n required string id = 1;\n }\n message ChannelInvitationInput {\n repeated string users = 1;\n }\n message LeaveChannelInput {\n required int32 nothing = 1;\n }\n message ChannelEvictionInput {\n required string user = 1;\n }\n message RenameChannelInput {\n required string name = 1;\n }\n message ChannelInfoInput {\n required int32 nothing = 1;\n }\n message ChannelInfoOutput {\n required ChannelType type = 1;\n required string channelId = 2;\n required string channelName = 3;\n required string adminUserId = 4;\n repeated string firstTenUserIds = 5;\n required int32 openStatus = 6;\n }\n message ChannelInfosInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message ChannelInfosOutput {\n repeated ChannelInfoOutput channels = 1;\n required int32 total = 2;\n }\n message MemberInfo {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n required string extension = 4;\n }\n message GroupMembersInput {\n required int32 page = 1;\n optional int32 number = 2;\n }\n message GroupMembersOutput {\n repeated MemberInfo members = 1;\n required int32 total = 2;\n }\n message GetUserInfoInput {\n required int32 nothing = 1;\n }\n message GetUserInfoOutput {\n required string userId = 1;\n required string userName = 2;\n required string userPortrait = 3;\n }\n message GetSessionIdInput {\n required int32 nothing = 1;\n }\n message GetSessionIdOutput {\n required int32 sessionId = 1;\n }\n enum FileType {\n image = "+J.IMAGE+";\n audio = "+J.AUDIO+";\n video = "+J.VIDEO+";\n file = "+J.FILE+";\n sight = "+J.SIGHT+";\n html = "+J.COMBINE_HTML+";\n }\n message "+Hs+" {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5; // url, sdk 设置下载地址\n optional string ext = 6; // 扩展字段,SDK 与 服务自定义字段,格式 json\n }\n message "+Ys+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message "+Ks+" {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4; // 扩展字段,SDK 与 服务自定义字段,格式 json\n }\n message "+qs+" {\n required int64 deadline = 1;\n required string token = 2;\n optional string bosToken = 3;\n optional string bosDate = 4;\n optional string path = 5;\n optional string osskeyId = 6;\n optional string ossPolicy = 7;\n optional string ossSign = 8;\n optional string ossBucketName = 9;\n optional string s3Credential = 10;\n optional string s3Algorithm = 11;\n optional string s3Date = 12;\n optional string s3Policy = 13;\n optional string s3Signature = 14;\n optional string s3BucketName = 15;\n optional string stcAuthorization = 16;\n optional string stcContentSha256 = 17;\n optional string stcDate = 18;\n optional string stcBucketName = 19;\n\n // 兼容 minio 协议\n optional string minioAuthorization = 20;\n optional string minioContentSha256 = 21;\n optional string minioDate = 22;\n optional string minioBucketName = 23;\n\n optional string downloadAuthInfo = 24; // 下载鉴权信息,格式为 Json 格式\n }\n message "+js+" {\n required string downloadUrl = 1;\n }\n message "+Qs+" {\n required string downloadUrl = 1;\n }\n message Add2BlackListInput {\n required string userId = 1;\n }\n message RemoveFromBlackListInput {\n required string userId = 1;\n }\n message QueryBlackListInput {\n required int32 nothing = 1;\n }\n message QueryBlackListOutput {\n repeated string userIds = 1;\n }\n message BlackListStatusInput {\n required string userId = 1;\n }\n message BlockPushInput {\n required string blockeeId = 1;\n }\n message ModifyPermissionInput {\n required int32 openStatus = 1;\n }\n message GroupInput {\n repeated GroupInfo groupInfo = 1;\n }\n message GroupOutput {\n required int32 nothing = 1;\n }\n message GroupInfo {\n required string id = 1;\n required string name = 2;\n }\n message GroupHashInput {\n required string userId = 1;\n required string groupHashCode = 2;\n }\n message GroupHashOutput {\n required GroupHashType result = 1;\n }\n enum GroupHashType {\n group_success = 0x00;\n group_failure = 0x01;\n }\n message "+Bs+" {\n required int32 nothing = 1;\n }\n message "+ks+" {\n required int32 nothing = 1;\n optional string sessionId = 2;\n optional int64 joinTime = 3;\n optional int64 createTime = 4;\n optional int32 memberCount = 5;\n optional int32 chatroomBanState = 6;\n optional int32 whiteListState = 7;\n }\n message "+Rs+" {\n required int64 syncTime = 1;\n required int32 count = 2;\n }\n\n message ChrmPullMsgNew\n {\n required int32 count = 1;\n required int64 syncTime = 2;\n optional string chrmId=3;\n }\n message "+ys+"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message "+Ps+"\n {\n required ChannelType type = 1;\n optional DownStreamMessage msg =2;\n optional int32 count = 3;\n repeated string busChannel = 4;\n optional int64 startTime = 5;\n optional int64 endTime = 6;\n }\n message "+As+"\n {\n repeated RelationInfo info = 1;\n optional bool isFinished = 2;//是否结束\n }\n message RelationInfo\n {\n required ChannelType type = 1;\n required string userId = 2;\n optional DownStreamMessage msg =3;\n optional int64 readMsgTime= 4;\n optional int64 unreadCount= 5;\n optional string busChannel = 6;//该消息所属会话的业务标识\n optional int64 versionTime = 7;//会话项变更时间戳,注意:非排序时间戳\n optional int64 remindCount = 8;//被@的未读数\n optional int32 busChannelType = 9; // 0: 公有频道; 1: 私有频道;\n optional "+Ns+" msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message "+Ns+" //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message "+Io+" // 新增 查询未读@列表入参\n {\n required string groupId = 1; // 群 ID\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int64 msgTime = 3; // 消息时间戳\n optional int32 size = 4; // 单页长度,默认20,最大20\n }\n message "+vo+" //查询未读@列表出参\n {\n repeated "+Ns+" msgInfo = 1; //未读@消息摘要列表\n }\n message RelationInfoReadTime\n {\n required ChannelType type = 1;\n required int64 readMsgTime= 2;\n required string targetId = 3;\n }\n message "+ws+"\n {\n required string targetId = 1;\n required int64 dataTime = 2;\n optional int32 conversationType= 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message "+Vs+"\n {\n repeated CleanHisMsgInput input = 1;\n }\n message HistoryMessageInput\n {\n required string targetId = 1;\n required int64 dataTime =2;\n required int32 size = 3;\n }\n\n message HistoryMessagesOuput\n {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n required int32 hasMsg = 3;\n }\n message "+xs+"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message "+Fs+"\n {\n optional int32 userTotalNums = 1;\n repeated ChrmMember userInfos = 2;\n }\n message ChrmMember\n {\n required int64 time = 1;\n required string id = 2;\n }\n message MPFollowInput\n {\n required string id = 1;\n }\n\n message MPFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MCFollowOutput\n {\n required int32 nothing = 1;\n optional MpInfo info =2;\n }\n\n message MpInfo\n {\n required string mpid=1;\n required string name = 2;\n required string type = 3;\n required int64 time=4;\n optional string portraitUrl=5;\n optional string extra =6;\n }\n\n message SearchMpInput\n {\n required int32 type=1;\n required string id=2;\n }\n\n message SearchMpOutput\n {\n required int32 nothing=1;\n repeated MpInfo info = 2;\n }\n\n message PullMpInput\n {\n required int64 time=1;\n required string mpid=2;\n }\n\n message PullMpOutput\n {\n required int32 status=1;\n repeated MpInfo info = 2;\n }\n message "+Ss+"\n {\n optional string targetId = 1;\n optional int64 time = 2;\n optional int32 count = 3;\n optional int32 order = 4;\n optional string busChannel = 5; //该消息所属会话的业务标识,限制20字符以内\n }\n\n message "+ms+"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message "+Ts+"{\n required int32 nothing = 1;\n }\n message "+Is+"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message "+Gs+"\n {\n required ChannelType type = 1;\n required int64 msgTime = 2;\n required string channelId = 3;\n optional string busChannel = 4;//该消息所属会话的业务标识\n }\n message SessionMsgReadOutput\n {\n optional int32 nothing=1;\n }\n message "+Os+"\n {\n repeated SessionInfo sessions = 1;\n }\n message "+Ms+"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message "+Ls+"\n {\n optional int32 nothing=1;\n }\n message "+Us+" \n {\n repeated RelationOpInput relation = 1;\n }\n message "+bs+"\n {\n required string conversationId = 1;//会话ID\n required ChannelType conversationType = 2;//会话类型,比如单聊、群等\n optional string busChannel = 3;//该消息所属会话的业务标识,限制20字符以内\n }\n message "+Ds+"\n {\n optional ChannelType type = 1;\n optional string conversationId = 2;\n repeated DeleteMsg msgs = 3;\n optional string busChannel = 4; //该消息所属会话的业务标识,限制20字符以内\n }\n message DeleteMsg\n {\n optional string msgId = 1;\n optional int64 msgDataTime = 2;\n optional int32 direct = 3;\n }\n message ChrmKVEntity {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n optional int64 version = 6;\n }\n message "+Js+" {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+Xs+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+Zs+" {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message "+zs+" {\n repeated ChrmKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3;\n }\n message ChrmKVSVersionEntity {\n optional int64 version = 1;\n optional string key = 2;\n }\n\n message "+$s+" {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message "+to+"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message "+no+" {\n required int64 timestamp = 1;\n }\n message "+io+" {\n required int64 version=1;\n required string value=2;\n }\n message "+ro+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+so+" {\n required int64 version=1;\n optional bool reserve=2;\n }\n message "+oo+" {\n repeated UserSettingItem items = 1;\n required int64 version=2;\n }\n message UserSettingItem {\n required string targetId= 1;\n required ChannelType type = 2;\n required string key = 4;\n required bytes value = 5;\n required int64 version=6;\n required int32 status=7;\n repeated SessionTagItem tags= 8;\n }\n message "+uo+" {\n required int64 time = 1;\n }\n message "+co+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+lo+" {\n required ChannelType type = 1;\n required string channelId = 2;\n optional int64 time = 3;\n repeated SessionStateItem stateItem = 4;\n optional string busChannel = 5;//该消息所属会话的业务标识\n }\n message "+ho+" {\n required SessionStateType sessionStateType = 1;\n required string value = 2;\n repeated SessionTagItem tags = 3;\n }\n enum SessionStateType {\n IsSilent = 1;\n IsTop = 2;\n Tags = 3;\n }\n message "+po+" {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message "+Eo+" {\n optional string busChannel = 1;\n }\n message "+To+"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message "+Ro+" {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message "+go+" {\n required int64 version=1;\n }\n message "+_o+" {\n required ChannelType type = 1; // 会话类型\n required int64 version = 2;\n required int32 unpushLevel = 3; // 免打扰级别\n }\n message "+fo+" {\n required int64 version = 1;\n }\n message "+Co+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+So+" {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message "+mo+" {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message "+yo+" {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message "+Ao+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+No+" {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message "+Oo+" {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message "+Mo+" {\n repeated string tagId=1;\n }\n message "+ao+" {\n required int64 version=1;\n required bool reserve=2;\n }\n message "+Lo+' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message '+Uo+"\n {\n optional int32 nothing=1; //占位\n }\n message "+bo+"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message "+Po+"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message "+Do+"\n {\n required string fromUserId = 1;//(谁发的)\n required string targetId = 2;// 目标Id(超级群Id)\n required ChannelType type = 3;//发送类型如:(P2P,GROUP,ULTRAGROUP)\n required string msgUID = 4; // 扩展消息的内容体\n required int64 msgTime = 5; //原始消息时间\n optional string busChannel = 6; // 该消息所属会话的业务标识,限制20字符以内\n optional string content = 7; // 即extraContent消息扩展内容,下表格说明\n }\n message "+wo+" //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message "+Go+" //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message "+Vo+" //变更详情\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n required int64 time = 3; // 变更时间\n required int32 changeType = 4; // 消息变更类型(1:扩展,2:修改,3:撤回,4:频道变更,5:用户组变更)\n required string msgUID = 5; // 消息ID\n required int64 msgTime = 6; // 消息时间\n optional string busChannel = 7; // 频道ID\n optional bool isAdmin = 8; //是否为管理员,默认为 0, 设为 1 时, IMKit 收到此条消息后,小灰条默认显示为“管理员 撤回了一条消息”。\n optional bool isDel = 9; //默认为 0 撤回该条消息同时,用户端将该条消息删除并替换为一条小灰条撤回提示消息;为 1 时,该条消息删除后,不替换为小灰条提示消息。\n optional string operatorId = 10; // 消息变更的操作人 Id; subChangeType 为 5 时,operatorId 表示被踢出超级群私有频道白名单的用户\n // subChangeType 的意义由 changeType 的值来决定\n // 当 changeType 为 4 时;\n // 1: 删除频道;\n // 2: 公有频道变为私有频道;\n // 3: 私有频道变为公有频道;\n // 4: 私有频道成员变更-加入, SDK 不通知业务层;\n // 5: 私有频道成员变更-退出;\n // 6: 公有频道变为私有频道,当前用户不在白名单中;\n // 当 changeType 为 5 时;\n // 1: 删除用户组 (通知到 用户组下所有用户)\n // 2: 用户组增加用户 (仅通知到该用户)\n // 3: 用户组删除用户 (仅通知到该用户)\n // 4: 频道绑定用户组 (通知到 用户组下所有用户)\n // 5: 频道解绑用户组 (通知到 用户组下所有用户)\n optional int32 subChangeType = 11;\n optional int32 busChannelType = 12; // 0:公有频道; 1:私有频道\n optional bool isRemindMe = 13;// 是否为@我的消息, 消息撤回时, 该字段有意义, 用于客户端计算是否未读数总数-1,未读@消息数-1 -- server 暂未支持\n repeated string userGroupIds = 14; //用户组id列表,用于用户组增删成员或频道绑定解绑用户组的通知中\n optional int32 remindType = 15; // @类型:0非@我消息,1@所有人消息,2@我单人的消息\n }\n message "+Bo+" //请求\n {\n required string targetId = 1; // 目标Id(超级群Id)\n required ChannelType type = 2; // 会话类型\n repeated MessageQueryInfo query = 3; //\n }\n message MessageQueryInfo\n {\n required int64 msgTime = 1; // 消息时间\n required string msgUID = 2; // 消息ID\n optional string busChannel = 3; // 频道ID\n }\n message "+xo+" //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message "+Fo+" //客户端发送\n {\n optional string targetId = 1;// targetId\n optional ChannelType type = 2;//发送会话类型如:(P2P,GROUP) \n optional int32 opType = 3; //0 , 正在输入, 1 正在XXX \n optional string busChannel = 4; // 频道(channelId,可以为空)\n }\n message "+Ho+" //服务端发送\n {\n optional ChannelType type = 1;//发送会话类型如(P2P,GROUP) \n optional int64 notifyType = 2; //0x1 表示明细, 0x2 表示汇总 0x3 表示明细+汇总\n repeated OperateInfo info = 3 ; //明细列表 当notifyType 为 1和3时,有效\n repeated OperateSummary summary = 4 ; //汇总列表, 当notifyType 为2和3 时,有效\n }\n message "+qo+" {\n // XX 正在做什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional string userId = 3; // userId\n optional int32 opType = 4; //0 , 正在输入, 1 正在XX \n optional int64 optime = 5; //服务端收到用户操作的上行时间. \n }\n \n message "+Yo+" {\n // 几个人 正在干什么\n optional string targetId = 1; // 超级群Id 会话id\n optional string busChannel = 2; // 频道(channelId,可以为空)\n optional int32 count = 3; // 操作人数\n optional int32 opType = 4; //0, 正在输入, 1 正在XX \n }\n\n message "+Ko+"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message "+jo+"\n {\n required int32 nothing = 1; //用于占位\n }\n message "+Qo+"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message "+Wo+"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message "+Jo+"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message "+Xo+"\n {\n required int64 maxTime = 1; //最大时间戳\n repeated KvInfo info = 2; //kv对象\n }\n \n message KvInfo{\n required string key =1; //健名\n required string value =2; //健值\n }\n message "+Zo+"\n {\n required string targetId = 1;\n required ChannelType type = 2; //会话类型:单聊1、群聊3\n optional string busChannel = 3; //该消息所属会话的业务标识\n optional string startMsgId = 4; //已读消息ID区间开始(单聊极端场景下,无此属性或为空字符串)\n optional string endMsgId = 5; //已读消息ID区间结束(对应RC:RRMsg 中 endMsgId)\n }\n message "+zo+"\n {\n required string msgId = 1;//已读 消息ID \n optional string busChannel = 2; //该消息所属会话的业务标识\n required string targetId = 3; //群聊:群id\n }\n message "+$o+"\n {\n optional int32 num = 1;// 群总人数\n repeated ReceiptUser list = 2;//已读用户列表(list复类型)\n optional int32 readCnt = 3; //已读人数\n }\n message "+ea+"\n {\n required int64 receiptTime = 1;//已读 时间。已做归并,SDK 向上层返回应最多只精确到分钟 \n required string userId = 2;//已读 用户id\n }\n message "+ta+"\n {\n optional ChannelType type = 1; //发送类型如:(GROUP)\n optional string channelId = 2; //会话id\n optional string busChannel = 3; //该消息所属会话的业务标识\n repeated string msgId = 4; //消息id列表\n }\n message "+na+"\n {\n repeated MsgReadCnt result= 1; //已读状态列表\n }\n\n message "+ia+"\n {\n optional string msgId = 1; //消息id\n optional int32 cnt = 2; //已读人数\n optional int32 tmn = 3; //群人数\n }\n message "+ra+"\n {\n optional int32 subType = 1;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n repeated UserSubDetail subUsers = 2;//订阅用户列表(单次请求最大 200)\n optional int32 opType = 3; //操作类型(0订阅(且自动过期,需携带订阅有效期),1 取消订阅)\n optional int32 expiry = 4; //订阅有效期(秒),默认 xx秒待产品定义\n }\n message "+sa+" {\n optional string subUserId = 1;//被订阅用户ID\n }\n message "+oa+" {\n repeated UserSubDetail subUsers = 1; //被订阅达到上限用户ID列表\n optional int64 subTime = 2;//订阅时间\n }\n message "+ua+" {\n optional int64 version = 1;//用于增量拉取,卸载重装后使用0,后续使用 Resp.subTime\n optional string pageToken = 2;//用于分页,首页请求为空字符串,第二页及后续请求时 使用 Resp.pageToken\n }\n message "+aa+" {\n repeated UserSubList list = 1;//订阅用户列表(单次请求最大 200)\n optional int64 version = 2;//数据版本时间(用于分页,返回后 用于SDK 请求下一页携带)\n optional bool hasNext = 3;//是否还有下一页\n optional string pageToken = 4; //分页Token(返回后 用于SDK 请求下一页携带)\n optional bool isFull = 5; // true->全量的数据; false 增量的数据\n }\n message "+ca+" {\n repeated UserSubDetail subUsers = 1;//被订阅用户ID列表\n optional int32 subType = 2;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n optional int64 subTime = 3;//订阅时间\n optional int32 expiry = 4;// 订阅有效期(秒),默认 xx秒待产品定义\n optional int32 opType = 5;// 增量拉取时返回 操作类型(0主动订阅(且自动过期,需携带订阅有效期),1主动取消订阅)\n } \n message "+la+" {\n optional int64 versionTime = 1; // 用于增量拉取,卸载重装后使用0,后续使用 Resp.versionTime\n optional bool needAllData = 2; // 是否查询全量订阅数据(初始化时 为 true,s_cmd触发增量拉取 为false)\n optional string pageToken = 3; // 用于分页,首页请求为空字符串,第二页及后续请求时 使用 Resp.pageToken\n }\n message "+ha+" {\n repeated SubDataDetail list = 1; //数据列表\n optional int64 versionTime = 2; //数据版本时间(用于分页)\n optional bool hasNext = 3; //是否还有下一页\n optional string pageToken = 4; //分页Token(返回后 用于SDK 请求下一页携带)\n optional bool isFull = 5; // true->全量的数据; false 增量的数据\n }\n message "+da+" {\n optional string statusStr = 1;//兼容旧版s_stat,字段废弃\n optional string subUserId = 2;//被订阅用户ID\n repeated SubData data = 3;// 订阅数据\n optional int32 subType = 4; //类型(1:在线状态订阅, 2:用户信息托管订阅)\n }\n\n message "+pa+" {\n optional int32 platformInfo = 1;//设备类型枚举值\n optional int32 value = 2;//具体数据(在线状态订阅表示:0离线,1上线)\n optional int64 versionTime = 3;//数据生成时间\n }\n message "+ga+" {\n optional int32 subType = 1;//订阅类型(1:在线状态订阅,2:用户信息托管订阅)\n repeated UserSubDetail subUsers = 2;//订阅用户列表(单次请求最大 200)\n }\n}\n",Ea=function(e,t,n,i,r,s){var o=r?Object.keys(r).map((function(t){return e.encode(Sn.RtcValueInfo,{key:t,value:r[t]},!0)})):void 0,a=s?Object.keys(s).map((function(t){return e.encode(Sn.RtcValueInfo,{key:t,value:s[t]},!0)})):void 0;return e.encode(Sn.RtcInput,{roomType:t,broadcastType:n,joinType:i,innerDatas:o,outerDatas:a})},Ta=function(e,t){var n=e.decode(Sn.RtcUserListOutput,t),i=n.users,r=n.token,s=n.sessionId,o=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return mn(i,(function(e){var t=e.userId,n=e.userData,i={};mn(n,(function(e){var t=e.key,n=e.value;i[t]=n})),c[t]=i})),{users:c,token:r,sessionId:s,roomInfo:o,kvEntries:a,offlineKickTime:u}};!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(_a||(_a={}));var Ia=function(e){return[_a.DEBUG,_a.INFO,_a.WARN,_a.ERROR].some((function(t){return t===e}))},va=Gt(),Ra=Date.now(),Ca=0,Sa=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=_a.WARN,this.debug=this._log.bind(this,_a.DEBUG),this.info=this._log.bind(this,_a.INFO),this.warn=this._log.bind(this,_a.WARN),this.error=this._log.bind(this,_a.ERROR),this.__statistics=this._log.bind(this,_a.STATISTICS)}return e.prototype._stdout=function(e,t,n,i,r){var s;if(!(e<=_a.FATAL)&&console&&!(e>this.outputLevel)){var o=["error","warn","info","debug"][e-1];null===(s=console)||void 0===s||s[o](n+"["+this._id+"]["+o.toUpperCase()+"]: "+t+" | "+i+" | "+r)}},e.prototype.setOutputLevel=function(e){Ia(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,r.toISOString(),n,i),e!==_a.DEBUG&&this.flush({time:+r,sessionId:va,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})):this._stdout(_a.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),t,i)},e.prototype.createTraceId=function(){return""+ ++Ca},e.prototype.getSessionId=function(){return va},e}(),ma=null,ya="RC_LOGS",Aa="RC_CONF",Na=null,Oa=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ma];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(ya,"readwrite").objectStore(ya).index("time"),r=IDBKeyRange.upperBound(Date.now()-e),s=i.openCursor(r);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):n()},s.onerror=function(){n()}}))]:[2];case 2:return n.sent(),Na=setTimeout((function(){return Oa(e)}),6e5),[2]}}))}))},Ma=function(e,t,n,i){void 0===i&&(i=168),ma||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Un(n).type?ma=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var s="RC_LOGS_"+e,o=r.open(s,1);o.onerror=function(e){t.error(fe.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},o.onsuccess=function(r){var s=r.target.result;s?(s.onclose=function(e){ma=null,t.warn(fe.L_LOGDB_CLOSED_S)},s.onerror=function(e){ma=null,t.error(fe.L_LOGDB_ERROR_E,e.target.error)},s.onabort=function(e){t.info(fe.L_LOGDB_ABORT_S,e.target.error)},Oa(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:e,db:s})):n(null)},o.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(ya)&&t.deleteObjectStore(ya);var n=t.createObjectStore(ya,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),t.objectStoreNames.contains(Aa)&&t.deleteObjectStore(Aa),(n=t.createObjectStore(Aa,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(fe.L_UNSUPPORT_INDEXDB_O))},La=[],Ua=function(){return c(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return ma?(Na&&(clearTimeout(Na),Na=null),[4,ma]):[2];case 1:return(e=n.sent())&&(t=e.db,La.push(t)),ma=null,[2]}}))}))},ba=[],Pa=!1,Da=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return Pa||0===ba.length?[2]:(Pa=!0,t=ba.splice(0),[4,new Promise((function(n){var i=e.transaction(ya,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(ya);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Pa=!1,0===ba.length&&La.length>0&&(La.forEach((function(e){return e.close()})),La.length=0),setTimeout((function(){return Da(e)})),[2]}}))}))};function wa(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ma];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(Aa,"readonly").objectStore(Aa).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Va,Ga,Ba,ka,xa=0,Fa=function(){return{setTimestamp4RealtimeLog:function(e){xa=e},getTimestamp4RealtimeLog:function(){return xa},getLogs:function(e,t,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){switch(s.label){case 0:return[4,ma];case 1:return(r=s.sent())?[2,new Promise((function(s){var o=r.db.transaction(ya,"readonly").objectStore(ya),a=[],u=IDBKeyRange.bound(e,t),c=o.index("time").openCursor(u);c.onsuccess=function(e){var t=e.target.result;if(t){var r=t.value;r.level<=n&&(i?r.sessionId===va:r.level>=0)&&a.push(r),t.continue()}else s({dbReady:!0,logs:a})},c.onerror=function(e){s({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ha="REPORT_SESSION",qa=function(e,t){return c(void 0,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return n=Ha+"_"+e,[4,wa(Ha+"_"+e)];case 1:return i=o.sent(),r=i.success,s=i.value,r?(t===(null==s?void 0:s.sessionId)||function(e,t){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,ma];case 1:return(n=r.sent())?(i=n.db,i.transaction(Aa,"readwrite").objectStore(Aa).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},Ya=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){!function(e){c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ma];case 1:return(t=n.sent())?(ba.push(e),Da(t.db),[2]):[2]}}))}))}(e)},t}(Sa),Ka=function(){function e(e,t,n,i,r){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=i,this.logger=r,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=yi.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(fe.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressLogs(e)];case 1:return s=l.sent(),o=s.success,a=s.data,o||this.logger.warn(fe.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(fe.L_REALTIME_LOG_O,"compress done",t),u=Ct(n)?n:"https://"+n,u+="?version=5.9.9&appkey="+this.appkey+"&userId="+encodeURIComponent(this.userId)+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web",[4,this.send({url:u,body:a,method:"POST"})];case 2:return c=l.sent().status,this.logger.debug(fe.L_REALTIME_LOG_R,JSON.stringify({status:c}),t),200===c?(this.reportFailedNumber=0,r=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||Ra,s=Math.max(i-5e3,r),o=this.logger.createTraceId(),this.logger.debug(fe.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:s,level:t,itv:n}),o),[4,this.logDB.getLogs(r,s,t,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(fe.L_REALTIME_LOG_R,"db error",o),[3,4]);case 2:return c.length>0?[4,this._sendLogs2Realtime(c,o,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,s,o){return void 0===o&&(o=!1),c(this,void 0,void 0,(function(){var a,u,c,h,d,p,g,_,f,E;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(a=this.logger.createTraceId(),this.logger.info(fe.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:s,isCloudControl:o}),a),[4,this.logDB.getLogs(e,t,_a.DEBUG,!1)]);case 1:return u=l.sent(),c=u.dbReady,h=u.logs,this.logger.info(fe.L_REPORT_FULL_LOG_O,JSON.stringify({count:h.length}),a),d=Ct(i)?i:"https://"+i,d+="?version=5.9.9&appkey="+this.appkey+"&userId="+encodeURIComponent(this.userId)+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web&logId="+r,c?h.length>0?[4,this.compressLogs(h)]:[3,3]:[3,5];case 2:return g=l.sent(),_=g.success,f=g.data,p=_?f:"compress failed",[3,4];case 3:p="no data",l.label=4;case 4:return[3,6];case 5:p="no database",l.label=6;case 6:return this.logger.debug(fe.L_REPORT_FULL_LOG_O,"compress done",a),o&&(d+="&source=cloud"),[4,this.send({url:d,body:p,method:"POST"})];case 7:return E=l.sent().status,this.logger.info(fe.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),a),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),ja=48,Qa=64,Wa=80,Ja=96,Xa="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Za=function(e){for(var t={},n=0;n<e.length-1;n++){var i=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(i)?t[i].push(n):t[i]=[n]}for(var r=[],s=[],o=function(){if(s.length>0){var e=s.join("");if(s=[],e.length>26){var t=$a(e.length),n=String.fromCharCode(Wa|t.length);r.push(n+t)}else{var i=String.fromCharCode(Ja|e.length);r.push(i)}r.push(e)}},a=0;a<e.length;){var u=za(t,e,a);if(u.length<2)s.push(e.charAt(a++));else if(u.length<4)s.push(e.substr(a,u.length)),a+=u.length;else{var c=$a(a-u.offset),l=$a(u.length);if(c.length+l.length>=u.length)s.push(e.substr(a,u.length)),a+=u.length;else{o();var h=String.fromCharCode(Qa|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}o();var d=$a(e.length),p=String.fromCharCode(ja|d.length);return r.push(p+d),r.join("")},za=function(e,t,n){var i={length:0,offset:-1};if(t.length,n>=t.length-1)return i;var r=e[t.charAt(n)+t.charAt(n+1)];if(r[0]===n)return i;for(var s=t.length-n,o=0,a=r.length;o<a;o++){var u=r[o],c=n-u;if(!(c>238327)){var l=Math.min(s,c);if(l<=i.length)break;if(!(i.length>2&&t.charAt(u+i.length-1)!==t.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&t.charAt(u+d)===t.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},$a=function(e){var t=[],n=0;do{n=e%62,t.push(Xa.charAt(n)),e=(e-n)/62}while(e>0);return t.join("")},eu=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 s in r)if(r.hasOwnProperty(s)){var o=i.match(r[s]);if(o){n=s,t=o[1]||o[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},tu=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,s=e.time,o=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return t+","+s+","+a+","+n+","+o+","+(c='"'+c.replace(/"/g,'""')+'"')+"\n"},nu=function(e){function t(t,n,i,r){var s=this,o=Bt(n),a=eu(n),u=a.type+"|"+a.version+"|"+i.getSessionId();return(s=e.call(this,t,o,u,Fa(),i)||this).runtime=n,s.clientReportLevel=r,Ia(s.clientReportLevel)||(s.clientReportLevel=void 0),s}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,qa(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:Za(e.map(tu).join(""))}]}))}))},t.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),c(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(s){switch(s.label){case 0:return[4,wa(Ha+"_"+t)];case 1:return e=s.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,s,o,a){return void 0===a&&(a=!1),c(this,void 0,void 0,(function(){var u;return l(this,(function(c){switch(c.label){case 0:return[4,this.isReporter()];case 1:return u=c.sent(),this.userId&&!u?[2]:[2,e.prototype.report.call(this,t,n,i,r,s,o,a)]}}))}))},t.prototype.realtimeReport=function(t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Ka);!function(e){e[e.ACCEPTED=0]="ACCEPTED",e[e.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",e[e.REDIRECT=6]="REDIRECT",e[e.PACKAGE_ERROR=7]="PACKAGE_ERROR",e[e.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",e[e.BLOCK=9]="BLOCK",e[e.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",e[e.DEVICE_ERROR=11]="DEVICE_ERROR",e[e.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",e[e.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",e[e.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",e[e.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",e[e.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",e[e.OTP_USED=17]="OTP_USED",e[e.PLATFORM_ERROR=18]="PLATFORM_ERROR",e[e.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",e[e.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(Va||(Va={})),function(e){e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW",e[e.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",e[e.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",e[e.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(Ga||(Ga={}));var iu,ru=((Ba={})[Ga.OTHER_DEVICE_LOGIN]=$.RC_DISCONN_KICK,Ba[Ga.BLOCK]=$.RC_DISCONN_EXCEPTION,Ba[Ga.BLOCK_NEW]=$.RC_DISCONN_EXCEPTION,Ba[Ga.REDIRECT_NEW]=$.RC_CONN_REDIRECTED,Ba[Ga.TOKEN_EXPIRED]=$.RC_CONN_TOKEN_EXPIRED,Ba[Ga.ILLEGAL_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,Ba[Ga.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,Ba),su=((ka={})[Va.ACCEPTED]=$.SUCCESS,ka[Va.UNACCEPTABLE_PROTOCOL_VERSION]=$.RC_CONN_PROTO_VERSION_ERROR,ka[Va.IDENTIFIER_REJECTED]=$.RC_CONN_IDENTIFIER_REJECTED,ka[Va.SERVER_UNAVAILABLE]=$.RC_CONN_SERVER_UNAVAILABLE,ka[Va.TOKEN_INCORRECT]=$.RC_CONN_TOKEN_INCORRECT,ka[Va.NOT_AUTHORIZED]=$.RC_CONN_NOT_AUTHRORIZED,ka[Va.REDIRECT]=$.RC_CONN_REDIRECTED,ka[Va.PACKAGE_ERROR]=$.RC_CONN_PACKAGE_NAME_INVALID,ka[Va.APP_BLOCK_OR_DELETE]=$.RC_CONN_APP_BLOCKED_OR_DELETED,ka[Va.BLOCK]=$.RC_CONN_USER_BLOCKED,ka[Va.TOKEN_EXPIRE]=$.RC_CONN_TOKEN_EXPIRED,ka[Va.DEVICE_ERROR]=$.RC_CONN_DEVICE_ERROR,ka[Va.HOSTNAME_ERROR]=$.RC_CONN_HOSTNAME_ERROR,ka[Va.HASOHTERSAMECLIENTONLINE]=$.RC_DISCONN_SAME_CLIENT_ON_LINE,ka[Va.OUT_OF_LIMIT]=$.RC_LISCENSE_COUNT_OUT_OF_LIMIT,ka[Va.IN_OTHER_CLUSTER]=$.RC_CONN_WRONG_CLUSTER,ka[Va.APP_AUTH_NOT_PASS]=$.RC_APP_AUTH_NOT_PASS,ka[Va.OTP_USED]=$.RC_OTP_USED,ka[Va.PLATFORM_ERROR]=$.RC_PLATFORM_ERROR,ka[Va.ACCOUNT_CANCELLATION]=$.RC_ACCOUNT_CANCELLATION,ka[Va.LICENSE_EXPIRED]=$.RC_LICENSE_EXPIRED,ka),ou=function(e){return e===$.RC_CONN_REDIRECTED},au=function(e){return Object.keys(ru).some((function(t){return ru[t]===e}))},uu=function(e){return Object.keys(su).some((function(t){return su[t]===e}))};!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(iu||(iu={}));var cu,lu=function(){function e(e,t,n,i,r){this.appkey=e,this.navi=t,this.logger=n,this.statisticLog=i,this.listener=r,this.token="",this.curCmpUrl="",this.reconnectKick=!1,this._connectDurSwitch=!1,this.retryCount=0,this.uuid="",this.reason=0,this.connectedTime=0,this._network={status:!0,type:Tn.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=iu.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus=e,this._connectDurSwitch&&e!==iu.CONNECTED&&e!==iu.CONNECTING){var n={bid:pn(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:this.uuid+"_"+this.retryCount};this.statisticLog.record(Ee.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case iu.CONNECTED:this.logger.info(fe.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case iu.CONNECTING:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),this.listener.onConnecting();break;case iu.SUSPENDED:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),ou(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(fe.L_CONNECT_S,"status: "+e+", code: "+t),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:this.uuid+"_"+this.retryCount,cn:e.type,on:this._network.type};this.statisticLog.record(Ee.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._crtConnectionStatus===iu.CONNECTED?[2,{code:$.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=Vt(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(iu.CONNECTING),r={cid:this.uuid+"_"+this.retryCount,reason:Je.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(e,t,!1,i)]);case 1:return s=u.sent(),o=s.code,a=s.data,o!==$.SUCCESS?(this.setConnectionStatus(iu.DISCONNECTED,o),[2,{code:o}]):(this.setConnectionStatus(iu.CONNECTED),[2,{code:o,data:a}])}}))}))},e.prototype.try2Connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),s=r.code,o=r.data,this._crtConnectionTask=null,[2,{code:s,data:o}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return r={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,i,r)];case 1:return s=l.sent(),o=s.code,a=s.data,o!==$.SUCCESS?[2,{code:o}]:1===(u=a).type?[2,{code:$.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(fe.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),i),[4,this.connectWithToken(e.replace(/@.+$/,"@"),u,t,i)]);case 2:return c=l.sent(),h=c.code,d=c.data,ou(h)?(this.logger.warn(fe.L_CONNECT_R,"redirect code: "+h,i),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,i)]):[$.RC_TCP_RESET,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(fe.L_CONNECT_R,"cmp ack timeout, code: "+h,i),this.setConnectionStatus(iu.SUSPENDED,h),this.setConnectionStatus(iu.CONNECTING),[2,this.createConnectionTask(e,t,!1,i)]):h!==$.SUCCESS?(this.logger.warn(fe.L_CONNECT_R,"code: "+h,i),[2,{code:h}]):(this.logger.info(fe.L_CONNECT_R,"userId: "+d,i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case $.TIMEOUT:return void(this.reason=Je.TIMEOUT);case $.RC_CONN_REDIRECTED:return void(this.reason=Je.REDIRECTED);default:this.reason=Je.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(s){return n=this.logger.createTraceId(),this.logger.debug(fe.T,"try2Reconnect -> ignoreNaviCache: "+e+", reason: "+t,n),this.stopReconnectTimer(),i=function(){return c(r,void 0,void 0,(function(){var r,s;return l(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==iu.SUSPENDED?[2]:(this.setConnectionStatus(iu.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,r={cid:this.uuid+"_"+this.retryCount,reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.record(Ee.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return s=o.sent().code,this.reconnectTimer=null,s===$.SUCCESS?(this.setConnectionStatus(iu.CONNECTED),[2]):[$.SERVER_UNAVAILABLE,$.TIMEOUT,$.RC_SOCKET_DISCONNECTED,$.RC_SOCKET_NOT_CREATED,$.RC_CONN_ACK_TIMEOUT,$.RC_TCP_RESET,$.RC_NAVI_REQ_FAILED,$.RC_NETWORK_DOWN,$.RC_TCP_DISCONNECTED_NO_RMTP].includes(s)?(this._crtConnectionStatus!==iu.CONNECTING||(this.setConnectionStatus(iu.SUSPENDED,s),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(iu.DISCONNECTED,s),[2])}}))}))},i(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return ou(e)?(this.setConnectionStatus(iu.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===$.RC_UDP_DISCONNECTED?(this.setConnectionStatus(iu.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(iu.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(iu.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return c(this,void 0,void 0,(function(){var e,t,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==iu.CONNECTED?(this._failedCount=0,this.logger.debug(fe.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(fe.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=i.sent())===$.SUCCESS?(this.logger.info(fe.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==iu.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(fe.L_CHECK_ALIVE_IM_R,"code: "+t+", count: "+this._failedCount,e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(fe.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(iu.SUSPENDED,$.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,$.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(iu.DISCONNECTED,$.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype._getProtocol=function(e,t,n){return t?1===n?De.TLS:De.RMTP:"http"===e?De.WS:De.WSS},e.prototype.getCmpList=function(e,t){var n=this;if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var i=e.server,r=e.backupServer,s=e.serverAddr,o=e.protocol,a=e.openTLS;if(s){var u=s.filter((function(e){return e.addr}));return this.cmpWeightCache=h([],u,!0),h([],u,!0)}var c=[],l=[];return i&&l.push(i),null==r||r.split(",").forEach((function(e){l.indexOf(e)<0&&l.push(e)})),l.forEach((function(e,r){e&&c.push({addr:e,protocol:n._getProtocol(o,t,a),weight:i.length-r,race:!1})})),this.cmpWeightCache=c,h([],c,!0)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===De.QUIC:t.addr===e}));if(i)if(t){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==r&&(i.weight=r+1)}else{var s=Math.min.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));i.weight!==s&&(i.weight=s-1)}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e}(),hu=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=hi(fa);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=_t(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var i,r=this,s=e,o=((i={})[Es]=r._formatSyncMessages,i[fs]=r._formatReceivedMessage,i[gs]=r._formatSentMessage,i[ms]=r._formatHistoryMessages,i[As]=r._formatConversationList,i[Fs]=r._formatChatRoomInfos,i[zs]=r._formatChatRoomKVList,i[oo]=r._formatUserSetting,i[co]=r._formatConversationStatus,i[mo]=r._formatGrpReadReceiptQryResp,i[$o]=r._formatQueryReceiptResp,i[ro]=r._formatSetUserSettingOutput,i[ao]=r._formatUserSettingNotification,i[Go]=r._formatUltraMsgChangeList,i[Ho]=r._formatUltraOperateStatusNotifyList,i[xo]=r._formatUltraMsgList,i[vo]=r._formatUltraGroupUnreadMentionedList,i[ks]=r._formatChrmKVVersion,i[Xo]=r._formatCallKVInfo,i[Wo]=r._fromatCallInfoDownStream,i[Gs]=r._formateSessionMsgReadInput,i)[t];try{s=e.length>0&&r._codec[t].decode(e),Tt(s)&&(s=function(e){for(var t in e)Tt(e[t])&&(e[t]=sn(e[t]));return e}(s)),It(o)&&(s=o.call(this,s,n))}catch(e){this.logger.error(fe.L_PB_DECODE_E,t)}return s},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,i=e.limit;if(t)try{var r=_t(n)?new Uint8Array(n):n;return gr.readUTF(r.subarray(t,i))}catch(e){this.logger.error(fe.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(fe.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,i=e.list,r=e.syncTime,s=e.finished;return(vt(s)||null===s)&&(e.finished=!0),e.syncTime=sn(r),e.list=yn(i,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,i=t.portraitUri,r=n||i;r&&(e.user.portrait=e.user.portraitUri=r)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return mn(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,i=e.pushExt,r=e.configFlag,s={};return i&&(s=cn(t,i.pushConfigs,i.pushId)),u(u({},s),{pushTitle:null==i?void 0:i.title,pushContent:n,pushData:"",disablePushTitle:!!r&&Boolean(4&r),forceShowDetailContent:!!r&&Boolean(8&r),templateId:null==i?void 0:i.templateId})},e.prototype._formatReceivedMessage=function(e,t){var i;if(!e)return e;var r=this,s=t||{},o=s.currentUserId,a=s.connectedTime,u=s.afterDecode,c=s.customMessageTypes,l=void 0===c?{}:c,h=e.content,d=e.fromUserId,p=e.type,g=e.groupId,_=e.status,f=e.dataTime,E=e.extraContent,T=e.extStatus,I=e.clientUniqueId,v=e.busChannel,R=e.msgId,C=e.classname,S=e.toUserIds,m=e.direction||Z.RECEIVE,y=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(_),A=y.isPersited,N=y.isCounted,O=y.isMentioned,M=y.disableNotification,L=y.receivedStatus,U=y.canIncludeExpansion,b=!!(2&(T||0)),P=!!(4&(T||0)),D=!!(8&(T||0))?Be.PRIVATE:Be.PUBLIC,w=[te.GROUP,te.CHATROOM,te.RTC_ROOM,te.ULTRA_GROUP].indexOf(p)>-1?g:d,V=d,G=Z.RECEIVE;m===Z.SEND&&(V=o,G=Z.SEND);var B=sn(f),k=B<a,x=p===te.CHATROOM,F=r._setExpansion(E),H=r._formatBytes(h);H=r._getUtfContent(H);var q=r._setPushConfig(e,this.logger);x&&d===o&&(G=Z.SEND);var Y={conversationType:p,targetId:w,senderUserId:V,messageType:C,messageUId:R,isPersited:A,isCounted:N,isMentioned:O,sentTime:B,messageDirection:G,receivedTime:Gn.getTime(),disableNotification:M,receivedStatus:L,receivedStatusInfo:Dn(L),canIncludeExpansion:U,content:H,expansion:F,pushConfig:q,channelId:v||"",isInterrupt:b,isModifyMessage:P,messageId:sn(I)||0,sentStatus:ye.SENT,isOffLineMessage:k,channelType:D,isStatusMessage:(null===(i=l[C])||void 0===i?void 0:i.isStatusMessage)||!1,readReceiptInfo:void 0,directedUserIds:S};return(null==u?void 0:u(Y))||Y},e.prototype._formatSentMessage=function(e,t){var i=this,r=e.content,s=e.classname,o=e.sessionId,a=e.msgId,c=e.extraContent,l=e.pushExt,h=e.pushContent,d=e.configFlag,p=e.extStatus,g=e.clientUniqueId,_=e.systemId,f=e.toUserIds,E=t.signal,T=t.currentUserId,I=E.date,v=E.topic,R=E.targetId,C=!!(2&(p||0)),S=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e),isMentioned:!!(4&e)}}(o),m=S.isPersited,y=S.isCounted,A=S.disableNotification,N=S.canIncludeExpansion,O=S.isMentioned,M=rr[v]||te.PRIVATE,L=On(Pi,v),U=i._formatBytes(r),b=_||R;s===se.RECALL&&(M=U.conversationType||M,b=U.targetId||R);var P=i._setExpansion(c),D=i._setPushConfig(e,this.logger),w=u(u({},D),{pushTitle:null==l?void 0:l.title,pushContent:h,pushData:h,disablePushTitle:!!d&&Boolean(4&d),forceShowDetailContent:!!d&&Boolean(8&d),templateId:null==l?void 0:l.templateId});return{conversationType:M,targetId:b,messageType:s,messageUId:a,isPersited:m,isCounted:y,isStatusMessage:L,senderUserId:T,content:i._formatBytes(r),sentTime:1e3*I,receivedTime:Gn.getTime(),messageDirection:Z.SEND,isOffLineMessage:!1,disableNotification:A,canIncludeExpansion:N,expansion:P,pushConfig:w,channelId:e.busChannel||"",isInterrupt:C,messageId:sn(g)||0,receivedStatus:n.UNREAD,receivedStatusInfo:Dn(n.UNREAD),isMentioned:O,directedUserIds:f}},e.prototype._formatHistoryMessages=function(e,t){var n=this,i=t.conversation||{},r=e.list,s=e.hasMsg,o=i.targetId,a=sn(e.syncTime),u=[];return mn(r,(function(e){var r=n._formatReceivedMessage(e,t);i.conversationType===te.ULTRA_GROUP?r.targetId=e.groupId||i.targetId:r.targetId=o,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!s}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,i=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,i=e.time,r=e.changeType,s=e.msgUID,o=e.msgTime,a=e.busChannel,u=e.isAdmin,c=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType,g=e.remindType;return{targetId:t,conversationType:n,changeType:r,messageUId:s,changeTime:sn(i),sendTime:sn(o),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:i}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,i=e.info,r=e.summary,s=[],o=[],a=!(2&~n),u=!(1&~n);return u&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.userId,r=e.opType,o=e.optime,a=sn(o);s.push({targetId:t,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,i=e.count,r=e.opType;o.push({targetId:t,channelId:n,count:i,operationType:r})})),{conversationType:t,info:s,summary:o,hasInfo:u,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,i=e.list;return{list:i&&i.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,sentTime:sn(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,i=t.unreadCount,r=t.remindCount,s=t.busChannelType,o=t.msgInfo,a=t.remindMeCount;return e.versionTime=sn(n)||0,e.unreadMessageCount=this._getUnreadCount(sn(i)||0),e.unreadMentionedCount=this._getUnreadCount(sn(r)||0),e.unreadMentionedMeCount=this._getUnreadCount(sn(a)||0),e.channelType=s||Be.PUBLIC,e.lastReadTime=0,o&&(e.firstUnreadMessage={sentTime:sn(o.msgTime)},e.lastReadTime=sn(o.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,i=this,r=e.info,s=t.afterDecode,o={list:(r=yn(r,(function(e){var r=e.msg,o=e.userId,a=e.type,u=e.unreadCount,c=e.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,t)).targetId=o);var h={targetId:o,conversationType:a,unreadMessageCount:sn(u)||0,latestMessage:l,channelId:c||""};return a===te.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==s?void 0:s(h))||h})))||[]};return((null==t?void 0:t.conversationType)||te.NONE)===te.ULTRA_GROUP&&(o.isFinished=e.isFinished),o},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:yn(n,(function(e){var t=e.id,n=e.time;return{id:t,time:sn(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,i=e.syncTime;return t=yn(t=t||[],(function(e){var t=e.key,n=e.value,i=e.status,r=e.timestamp,s=e.uid,o=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?Ie.DELETE:Ie.UPDATE}}(i);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:s,timestamp:sn(r),version:sn(o)}})),{kvEntries:t,isFullUpdate:n,syncTime:i}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,i=e.version,r={};return mn(n||[],(function(e){var n=e.key,i=e.version,s=e.value;e.version=sn(i),e.value=t._readBytes(s),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=sn(e.createdTime),e.tagName=e.name})),r[n]=e})),{settings:r,version:i}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return mn(t,(function(e){var t=e.type,i=e.channelId,r=e.time,s=e.stateItem,o=e.busChannel,a=ae.CLOSE,u=ce.NOT_SET,c=!1,l=[];mn(s,(function(e){var t=e.sessionStateType,n=e.value,i=e.tags;switch(t){case cr:a=n===ar?ae.OPEN:ae.CLOSE,u=Number(n)||ce.NOT_SET;break;case lr:c=n===ar;break;case hr:l=i}})),n.push({conversationType:t,type:t,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:sn(r),tags:l,channelId:o||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=sn(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatQueryReceiptResp=function(e){var t=e.list,n=void 0===t?[]:t,i=e.num,r=e.readCnt;return{list:n.map((function(e){return{readTime:sn(e.receiptTime),userId:e.userId}})),totalCount:i,readCount:r}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,i=e.memberCount,r=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:sn(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype._formateSessionMsgReadInput=function(e){var t=e.busChannel,n=e.channelId,i=e.msgTime;return{conversationType:e.type,targetId:n,channelId:t||"",timestamp:i}},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(Ts);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var i,r,s;return{userIdList:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.userIdList)||t,type:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.type)||n||he.ALL,mentionedContent:(null===(s=e.mentionedInfo)||void 0===s?void 0:s.mentionedContent)||""}},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,i=e.pushConfig||{},r=0;return r|=n?1:0,r|=t?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,i=e.androidConfig,r=e.templateId,s=void 0===r?"":r,o=this._codec.getModule(_s);if(t&&o.setTitle(t),n||i){var a=un(n,i);o.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&o.setPushId(null==i?void 0:i.notificationId),o.setTemplateId(s),o},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,i=t.isMentioned,r=t.mentionedType,s=t.content,o=t.directionalUserIdList,a=t.canIncludeExpansion,u=t.expansion,c=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,p=t.mentionedUserIdList,g=void 0===p?[]:p,_=t.pushContent,f=void 0===_?"":_,E=t.messageId,T=void 0===E?0:E,I=e.conversationType,v=e.targetId,R=this._codec.getModule(gs),C=function(e){var t=e.isStatusMessage,n=e.isPersited,i=e.isCounted;t&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),e.isMentioned&&(r|=4),e.disableNotification&&(r|=32),e.canIncludeExpansion&&(r|=64),r}(t),S=c||{},m=S.pushContent,y=void 0===m?f:m,A=S.pushData,N=void 0===A?d:A;R.setSessionId(C),i&&s&&(s.mentionedInfo=this._updateMentionedInfo(s,g,r)),y&&R.setPushText(y),N&&R.setAppData(N),o&&R.setToUserIds(o);var O=this._calculateFlag(t);if(R.setConfigFlag(O),R.setClassname(n),s.user&&s.user.portraitUri&&(s.user.portrait=s.user.portraitUri),R.setContent(JSON.stringify(s)),a&&u){var M={};mn(u,(function(e,t){M[t]={v:e}})),R.setExtraContent(JSON.stringify(M))}if(c){var L=this._getPushExtraModule(c);R.setPushExt(L)}return R.setClientUniqueId(T),vt(l)||R.setBusChannel(l),I===te.SYSTEM&&R.setSystemId(v),R},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,i=e.broadcastSyncTime,r=this._codec.getModule(vs);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(t),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(Rs);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,i=t.order,r=t.timestamp,s=t.channelId,o=this._codec.getModule(Ss);return o.setTargetId(e),o.setTime(r),o.setCount(n),o.setOrder(i),o.setBusChannel(s||""),o.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(Po);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,i=e.startTime,r=e.order;t=t||0,i=i||0,r=r||0;var s=this._codec.getModule(ys);return s.setType(n),s.setCount(t),s.setStartTime(i),s.setOrder(r),s.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,i=this._codec.getModule(Ps);return i.setType(t),n&&i.setBusChannel([n]),i.getArrayData()},e.prototype.encodeBatchDeleteConversation=function(e){var t=this,n=this._codec.getModule(Us),i=[];return e.forEach((function(e){var n=e.conversationType,r=e.targetId,s=e.channelId,o=t._codec.getModule(bs);o.setConversationType(n),o.setConversationId(r),o.setBusChannel(s||""),i.push(o)})),n.setRelation(i),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,i){var r=this._codec.getModule(Ds),s=[];return mn(n,(function(e){s.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),r.setType(e),r.setConversationId(t),r.setMsgs(s),r.setBusChannel(i),r.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,i){var r=this._codec.getModule(ws);return t=t||(new Date).getTime(),r.setDataTime(t),r.setTargetId(e),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},e.prototype.encodeBatchClearRemoteMessages=function(e){var t=this,n=this._codec.getModule(Vs),i=e.map((function(e){var n=t._codec.getModule(ws);return n.setTargetId(e.targetId),n.setConversationType(e.conversationType),n.setBusChannel(e.channelId),n.setDataTime(e.timestamp),n}));return n.setInput(i),n.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,i=e.targetId,r=e.channelId,s=t.timestamp,o=this._codec.getModule(Gs);return s=s||+new Date,o.setType(n),o.setChannelId(i),o.setMsgTime(s),o.setBusChannel(r),o.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,s=e.messageUId,o=e.sendTime,a=e.keys,u={mid:s,put:e.expansion,del:a,clear:e.removeAll?1:0},c=this._codec.getModule(Do);return c.setFromUserId(t),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(s),c.setMsgTime(o),c.setContent(JSON.stringify(u)),c.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,i=e.conversationType,r=e.channelId,s=e.messageUId,o=e.sendTime,a=e.content,u=this._codec.getModule(Do);return u.setFromUserId(t),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(s),u.setMsgTime(o),u.setContent(JSON.stringify(a)),u.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(wo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,i=e.messages,r=this._codec.getModule(Bo),s=i.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return r.setTargetId(t),r.setType(n),r.setQuery(s),r.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,i=e.sentTime,r=e.count,s=this._codec.getModule(Io);return s.setGroupId(t),s.setBusChannel(n),s.setMsgTime(i),s.setSize(r),s.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,i){var r=this._codec.getModule(Fo);return r.setTargetId(e),r.setType(t),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Bs);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(xs);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(To);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(Eo);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,i,r,s){var o=this._codec.getModule(Hs);return o.setType(e),o.setKey(t),o.setHttpMethod(n),o.setQueryString(i),o.setUrl(r),s&&o.setExt(s),o.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,i,r){var s=this._codec.getModule(e);return s.setType(t),s.setKey(n),r&&s.setExt(r),i&&s.setFileName(i),s.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var i=this._codec.getModule(Js),r=t.key,s=t.value,o=t.notificationExtra,a=t.isSendNotification,u=t.type,c=t.timestamp,l=u||Ie.UPDATE,h=Bn(t,l),d={key:r,value:s||"",uid:n,version:c};if(vt(h)||(d.status=h),i.setEntry(d),a){var p={conversationType:te.CHATROOM,targetId:e},g={key:r,value:s,extra:o,type:l},_=this._getUpMsgModule(p,{messageType:se.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});i.setNotification(_),i.setBNotify(!0),i.setType(te.CHATROOM)}return i.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var i=this._codec.getModule(Xs),r=t.entries,s=t.type||Ie.UPDATE,o=Bn(t,s),a=[];return r.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};vt(o)||(t.status=o),a.push(t)})),i.setEntry(a),i.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(no);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(so);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(uo);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,i=this._codec.getModule(po),r=Gn.getTime(),s=[];return mn(e,(function(e){var t=n._codec.getModule(lo),i=e.conversationType,o=e.targetId,a=e.notificationStatus,u=e.isTop,c=e.channelId,l=e.notificationLevel,h=[];t.setType(i),t.setChannelId(o),t.setTime(r),t.setBusChannel(c);var d=a===ae.OPEN,p={};vt(a)||(p[cr]=d),vt(l)||(p[cr]=l),vt(u)||(p[lr]=u),mn(p,(function(e,t){if(!vt(e)){var i=n._codec.getModule(ho);e=e?ar:ur,vt(l)||Number(t)!==cr||(e=String(l)),i.setSessionStateType(Number(t)),i.setValue(e),h.push(i)}})),t.setStateItem(h),s.push(t)})),i.setVersion(t||r),i.setState(s),i.getArrayData()},e.prototype.encodeSetConversationTypeLevel=function(e,t,n){var i=this._codec.getModule(_o);return i.setType(e),i.setVersion(t),i.setUnpushLevel(n),i.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(Co);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,i=this._codec.getModule(Ao),r=[];return e.forEach((function(e){var t=n._codec.getModule(No);t.setTagId(e.tagId),t.setName(e.tagName),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(Co);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeReadReceiptMsg=function(e,t,n){var i=this._codec.getModule(Zo),r=e.conversationType,s=e.targetId,o=e.channelId,a=void 0===o?"":o;return i.setType(r),i.setTargetId(s),i.setBusChannel(a),i.setStartMsgId(t),i.setEndMsgId(n),i.getArrayData()},e.prototype.encodeReceiptQryReq=function(e,t){var n=this._codec.getModule(zo),i=e.targetId,r=e.channelId,s=void 0===r?"":r;return n.setTargetId(i),n.setBusChannel(s),n.setMsgId(t),n.getArrayData()},e.prototype.encodeReceiptCntQryReq=function(e,t){var n=this._codec.getModule(ta),i=e.targetId,r=e.conversationType,s=e.channelId,o=void 0===s?"":s;return n.setChannelId(i),n.setBusChannel(o),n.setType(r),n.setMsgId(t),n.getArrayData()},e.prototype.encodeSessionMsgReadInput=function(e,t){var n=this._codec.getModule(Gs),i=e.conversationType,r=e.targetId,s=e.channelId,o=void 0===s?"":s;return n.setType(i),n.setChannelId(r),n.setBusChannel(o),n.setMsgTime(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,i=this._codec.getModule(Oo),r=[];return e.forEach((function(e){var t=n._codec.getModule(No);t.setTagId(e),r.push(t)})),i.setTags(r),i.setVersion(t),i.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(Mo);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t,n){var i=this,r=this._codec.getModule(po),s=[];return t.forEach((function(t){var n=i._codec.getModule(lo),r=i._codec.getModule(ho),o=[];e.forEach((function(e){var t=i._codec.getModule(No);t.setTagId(e.tagId),vt(e.isTop)||t.setIsTop(e.isTop),o.push(t)})),r.setSessionStateType(hr),r.setValue(JSON.stringify(o)),r.setTags(o),n.setType(t.conversationType),n.setChannelId(t.targetId),n.setTime(Date.now()),n.setStateItem([r]),s.push(n)})),r.setState(s),r.setVersion(n),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(Lo);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(bo);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(Ko);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(Qo);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(Jo);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeUpdateUserSubReq=function(e,t,n,i){var r=this,s=this._codec.getModule(ra);s.setSubType(e),s.setOpType(n),s.setExpiry(i);var o=[];return t.forEach((function(e){var t=r._codec.getModule(sa);t.setSubUserId(e),o.push(t)})),s.setSubUsers(o),s.getArrayData()},e.prototype.encodePullUserSubReq=function(e){var t=e.version,n=e.pageToken,i=this._codec.getModule(ua);return i.setVersion(t),i.setPageToken(n),i.getArrayData()},e.prototype.encodePullSubDataReq=function(e){var t=e.version,n=e.needAllData,i=e.pageToken,r=this._codec.getModule(la);return r.setVersionTime(t),r.setNeedAllData(n),r.setPageToken(i),r.getArrayData()},e.prototype.encodeQrySubDataReq=function(e,t){var n=this,i=this._codec.getModule(ga);i.setSubType(e);var r=[];return t.forEach((function(e){var t=n._codec.getModule(sa);t.setSubUserId(e),r.push(t)})),i.setSubUsers(r),i.getArrayData()},e}(),du=function(e){function t(t,n,i,r,s,o){var a=e.call(this,t,n,i,r,o)||this;return a.runtime=s,a.wsListener=o,a._socket=null,a._connectedTime=0,a._socketIndex=0,a._localConnectedTime=0,a._idCount=0,a._generateMessageId=function(){return a._idCount>=65535&&(a._idCount=0),++a._idCount},a._messageIds={},a._syncMessageIds={},a.codec=new hu(a.logger),a}return a(t,e),t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},t.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.getDelayTime=function(){return this._localConnectedTime-this._connectedTime},t.prototype.connectWithToken=function(e,t,n,i){return c(this,void 0,void 0,(function(){var n,r,s,o,a,u,c,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=t.openAnti,r=t.type,s=this.getCmpList(t),this.logger.debug(fe.L_NAVI_CMP_R,JSON.stringify(s),i),0===(o=s.filter((function(e,t){return s.findIndex((function(t){return t.addr===e.addr}))===t})).sort((function(e,t){return e.weight>t.weight?-1:1}))).length)return this.logger.error(fe.L_NAVI_CONF_E,"no service available",i),[2,{code:$.SERVER_UNAVAILABLE}];a=1===n?Si.V4:Si.V3,u=function(t){var n,s,u,h,d,p,g,_,f,E,T;return l(this,(function(l){switch(l.label){case 0:return n=o[t],s=n.protocol,u=n.addr,h=n.weight,d=function(e,t,n,i,r,s,o){var a=eu(r),u=a.type,c=a.version,l="browser"===r.tag?"|"+u+"|"+c:"||",h=o?"&protocolVer="+o:"";return e+"://"+t+"/websocket?appId="+n+"&token="+encodeURIComponent(i)+"&sdkVer="+F+"&pid="+s+"&apiVer="+(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l))+(r.connectPlatform?"&platform="+r.connectPlatform:"")+h}(s===De.WS?"ws":"wss",u,c.appkey,e,c.runtime,"",a),p=Date.now(),[4,c.connectWebSocket(d,a,i)];case 1:return g=l.sent(),_=g.code,f=g.data,E=c.cmpWeightCache.findIndex((function(e){return e.addr===u})),T={bid:pn(),ptc:Ke.WS,cod:_,net:c.getNetwork().type,dur:Date.now()-p,spr:0,pr:r||0,hos:u,idx:E,rct:c.retryCount?We.RECONNECT:We.CONNECT,cid:c.uuid+"_"+c.retryCount,v:Qe.CURRENT,rsn:c.reason,count:c.retryCount,weight:h},c.statisticLog.record(Ee.IM_WEBSOCKET,JSON.stringify(T),i),_===$.RC_SOCKET_DISCONNECTED||_===$.TIMEOUT?[2,"continue"]:_!==$.SUCCESS?[2,{value:{code:_}}]:(c._localConnectedTime=Math.floor((Date.now()+p)/2),c._socket=f.socket,c.updateCmpWeight(o[t].addr,!0),c.curCmpUrl=o[t].addr,[2,{value:{code:_,data:f.userId}}])}}))},c=this,h=0,p.label=1;case 1:return h<o.length?[5,u(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:$.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(fe.T,"connect start: "+e,n),[2,new Promise((function(r){var s=i.runtime.createWebSocket(e);i._socketIndex=s.id;var o=setTimeout((function(){i.logger.info(fe.T,"connect timeout: "+e,n),r({code:$.TIMEOUT}),s&&s.close()}),5e3);s.onOpen((function(){clearTimeout(o),i.logger.info(fe.T,"socket open",n)})),s.onMessage((function(e){if(i._socketIndex===s.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var o,a=Pr(i.logger,e,t);if(a instanceof vr){var u=a.status;if(u!==Va.ACCEPTED)return i.logger.info(fe.T,"connect failed: "+u,n),void r({code:(o=u,su[o])});i.logger.info(fe.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:$.SUCCESS,data:{userId:l,socket:s}})}if(a instanceof Rr){var d=a.status;return i.logger.info(fe.T,"recv disconnect signal -> status: "+d),void i.onRecvDisconnect(d,s)}i._onReceiveSignal(a)}}else i.logger.warn(fe.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:s.id}))})),s.onClose((function(){i.logger.info(fe.T,"socket close",n);var e=$.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(s,e)})),s.onError((function(e){i.logger.info(fe.T,"socket error",n);var t=$.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(s,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==vi.AT_MOST_ONCE&&(e instanceof Ar&&!e.syncMsg&&(this.logger.debug(fe.O,"send pubAck -> "+t+" "+e.topic),this.sendOnly(new Mr(t))),e instanceof br&&(this.logger.debug(fe.O,"send queryCon -> "+t+" "+e.topic),this.sendOnly(new Ur(t))))},t.prototype._publishReader=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s=this;return l(this,(function(o){switch(o.label){case 0:return n=e.syncMsg,i=e.topic,this.logger.debug(fe.O,"recv PublishReader -> messageId: "+t+" "+i),i===Qn?[2]:!n||function(e){return[Dr.ppMsgS,Dr.pgMsgS,Dr.chatMsgS].map((function(e){return Dr[e]})).indexOf(e)>=0}(i)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){s._syncMessageIds[t]=e}))];case 1:return r=o.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,r),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return t=e.messageId,e instanceof Sr&&this._pingResolve?(this._pingResolve($.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e,t),t>0&&(e instanceof Or||e instanceof br)&&(this.logger.debug(fe.O,"recv ack -> messageId: "+t+" "+e.topic),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(i=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],i(e))),e instanceof Ar?[4,this._publishReader(e,t)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.onRecvDisconnect=function(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(e){return ru[e]}(e)))},t.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))},t.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t($.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n($.TIMEOUT)}),e),t.sendOnly(new Cr)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof Nr||e instanceof Lr)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,i){return void 0===i&&(i=3e4),c(this,void 0,void 0,(function(){var r,s,o,a,u=this;return l(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),e.messageId=r,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){u._messageIds[r]=e,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],e()}),i)}))]):[2,{code:$.RC_NET_CHANNEL_INVALID}];case 1:return(s=c.sent())?s instanceof br||s instanceof Or?(o=t&&s.data&&[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS,$.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT].indexOf(s.status)>=0,a=o?this.codec.decodeByPBName(s.data,t,n):s,0!==s.status?(this.logger.warn(fe.O,"send failed -> message: "+r+", respPBName: "+t+", status: "+s.status),[2,{code:s.status,data:t&&s.data?a:null}]):[2,{code:$.SUCCESS,data:a}]):[2,{code:s}]:(this.logger.warn(fe.O,"send timeout -> message: "+r+", respPBName: "+t+", timeout: "+i),[2,{code:$.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(lu);!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD"}(cu||(cu={}));var pu=null,gu="RC_CONF",_u="RC_STATISTICS",fu=null,Eu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,pu];case 1:return(t=n.sent())?[4,new Promise((function(n){var i=t.db.transaction(_u,"readwrite").objectStore(_u).index("time"),r=IDBKeyRange.upperBound(Date.now()-e),s=i.openCursor(r);s.onsuccess=function(e){var t=e.target.result;t?(t.delete(),t.continue()):n()},s.onerror=function(){n()}}))]:[2];case 2:return n.sent(),fu=setTimeout((function(){return Eu(e)}),6e5),[2]}}))}))},Tu=function(e,t,n){void 0===n&&(n=168),pu||("undefined"!=typeof window&&window&&window.indexedDB?pu=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var s="RC_STATISTIC_"+e,o=r.open(s,2);o.onerror=function(e){t.error(fe.L_LOGDB_OPEN_FAILED_E,e.target.error),i(null)},o.onsuccess=function(r){var s=r.target.result;s?(s.onclose=function(e){pu=null,t.warn(fe.L_LOGDB_CLOSED_S)},s.onerror=function(e){pu=null,t.error(fe.L_LOGDB_ERROR_E,e.target.error)},s.onabort=function(e){t.info(fe.L_LOGDB_ABORT_S,e.target.error)},Eu(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:e,db:s})):i(null)},o.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(_u)&&t.deleteObjectStore(_u);var n=t.createObjectStore(_u,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),t.objectStoreNames.contains(gu)&&t.deleteObjectStore(gu),(n=t.createObjectStore(gu,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(fe.L_UNSUPPORT_INDEXDB_O))},Iu=[],vu=function(){return c(void 0,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return pu?(fu&&(clearTimeout(fu),fu=null),[4,pu]):[2];case 1:return(e=n.sent())&&(t=e.db,Iu.push(t)),pu=null,[2]}}))}))};function Ru(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,pu];case 1:return(t=n.sent())?[2,new Promise((function(n){var i=t.db.transaction(gu,"readonly").objectStore(gu).get(e);i.onsuccess=function(e){var t;n({value:null===(t=i.result)||void 0===t?void 0:t.value,success:!0})},i.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Cu,Su="REPORT_SESSION",mu=function(e,t){return c(void 0,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return n=Su+"_"+e,[4,Ru(Su+"_"+e)];case 1:return i=o.sent(),r=i.success,s=i.value,r?(t===(null==s?void 0:s.sessionId)||function(e,t){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,pu];case 1:return(n=r.sent())?(i=n.db,i.transaction(gu,"readwrite").objectStore(gu).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},yu=function(){return pu},Au=function(e){var t=e.sessionId,n=e.level,i=e.loggerId,r=e.traceId,s=e.time,o=e.tag,a=e.type,u=e.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return t+","+s+","+a+","+n+","+o+","+(c='"'+c.replace(/"/g,'""')+'"')+"\n"},Nu=Gt(),Ou=Date.now(),Mu=0,Lu=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.record=this._writer.bind(this,cu.STATISTICS)}return e.prototype._writer=function(e,t,n,i){var r=new Date;/^[\w-]+$/.test(t)&&this.flush({time:+r,sessionId:Nu,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:i})},e.prototype.createTraceId=function(){return Nu+"-"+ ++Mu},e.prototype.getSessionId=function(){return Nu},e}(),Uu=function(){function e(e,t,n,i,r,s){void 0===s&&(s=r),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=s,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=yi.getLogUrlPolicyList(e,this.logger),n=t.policy,i=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this.logger.debug(fe.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=i,[4,this.compressStatistics(e)];case 1:return s=l.sent(),o=s.success,a=s.data,o||this.logger.warn(fe.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(fe.L_REALTIME_LOG_O,"compress done",t),u=Ct(n)?n:"https://"+n,u+="?version=5.9.9&appkey="+this.appkey+"&userId="+encodeURIComponent(this.userId)+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web",[4,this.send({url:u,body:a,method:"POST"})];case 2:return c=l.sent().status,this.logger.debug(fe.L_REALTIME_LOG_R,JSON.stringify({status:c}),t),200===c?(this.reportFailedNumber=0,r=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++),[2,r]}}))}))},e.prototype.realtimeReport=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||Ou,s=Math.max(i-5e3,r),o=this.reportClass.createTraceId(),this.logger.debug(fe.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:s,level:t}),o),[4,this.statisticDB.getStatistics(r,s,t,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(fe.L_REALTIME_LOG_R,"db error",o),[3,4]);case 2:return c.length>0?[4,this._sendLogs2Realtime(c,o,e,n)]:[3,4];case 3:h=l.sent(),n=h,l.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return d.realtimeReport(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(o=this.reportClass.createTraceId(),this.logger.info(fe.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:s}),o),[4,this.statisticDB.getStatistics(e,t,cu.STATISTICS,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(fe.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),o),h=Ct(i)?i:"https://"+i,h+="?version=5.9.9&appkey="+this.appkey+"&userId="+encodeURIComponent(this.userId)+"&deviceId="+this.deviceId+"&deviceInfo="+this.deviceInfo+"&platform=Web&logId="+r,u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,_=p.data,d=g?_:"compress failed",[3,4];case 3:d="no data",l.label=4;case 4:return[3,6];case 5:d="no database",l.label=6;case 6:return this.logger.debug(fe.L_REPORT_FULL_LOG_O,"compress done",o),[4,this.send({url:h,body:d,method:"POST"})];case 7:return f=l.sent().status,this.logger.info(fe.L_REPORT_FULL_LOG_R,JSON.stringify({status:f}),o),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),bu="RC_STATISTICS",Pu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){Gu(e)},t}(Lu),Du=!1,wu=[],Vu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return Du||0===wu.length?[2]:(Du=!0,t=wu.splice(0),[4,new Promise((function(n){var i=e.transaction(bu,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(bu);t.forEach((function(e){try{r.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Du=!1,0===wu.length&&Iu.length>0&&(Iu.forEach((function(e){return e.close()})),Iu.length=0),setTimeout((function(){return Vu(e)})),[2]}}))}))},Gu=function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,yu()];case 1:return(t=n.sent())?(wu.push(e),Vu(t.db),[2]):[2]}}))}))},Bu=0,ku=function(e){function t(t,n,i,r){var s=this,o=Bt(n),a=eu(n),u=a.type+"|"+a.version+"|"+r.getSessionId();return s=e.call(this,t,o,u,{setTimestamp4RealtimeLog:function(e){Bu=e},getTimestamp4RealtimeLog:function(){return Bu},getStatistics:function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,yu()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(bu,"readonly").objectStore(bu),s=[],o=IDBKeyRange.bound(e,t),a=r.index("time").openCursor(o);a.onsuccess=function(e){var t=e.target.result;if(t){var n=t.value;s.push(n),t.continue()}else i({dbReady:!0,logs:s})},a.onerror=function(e){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}},i,r)||this,s.runtime=n,s}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,mu(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:Za(e.map(Au).join(""))}]}))}))},t.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),c(void 0,void 0,void 0,(function(){var e,i,r;return l(this,(function(s){switch(s.label){case 0:return[4,Ru(Su+"_"+t)];case 1:return e=s.sent(),i=e.success,r=e.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,e.prototype.report.call(this,t,n,i,r,s,o)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,e.prototype.realtimeReport.call(this,t,n,i)]}))}))},t}(Uu),xu=function(e){function t(t,n,i){var r=e.call(this,t,n)||this;return r.appkey=t,r.logger=n,r.runtime=i,r._storageKey="",r._storageKey=Q.STATIC_CONFIG_KEY(t),r}return a(t,e),t.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},t.prototype.setCache=function(e){this.runtime.localStorage.setItem(this._storageKey,e)},t.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},t.prototype.sendRequest=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:e})];case 1:return t=r.sent(),n=t.status,i=t.data,[2,{code:n,data:i}]}}))}))},t.prototype.decryptData=function(e){return c(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,gn(e,U,b)];case 1:return t=i.sent(),[2,JSON.parse(t)];case 2:return n=i.sent(),this.logger.error(fe.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},t}(Ai),Fu=function(){function e(e){this.reporter=e,this.logId="",this.uploadTask=[],this.taskLock=!0}return e.prototype.uploadLogCmdTask=function(e){this.uploadTask.push(e),this.enqueueTask()},e.prototype.reportLogCmdTask=function(e){var t,n,i,r,s=this;this.taskLock=!1;var o=null!==(t=e.startTime)&&void 0!==t?t:0,a=null!==(n=e.endTime)&&void 0!==n?n:0,u=null!==(i=e.platform)&&void 0!==i?i:"",c=null!==(r=e.uri)&&void 0!==r?r:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(o,a,u,c,e.logId,"",!0).finally((function(){s.taskLock=!0,s.uploadTask.length>0&&s.enqueueTask()})))},e.prototype.enqueueTask=function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}},e}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(Cu||(Cu={}));var Hu={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}};function qu(){return Hu}var Yu=function(){function e(e,t,n,i){this.logger=e,this.appkey=t,this.reporter=n,this.statisticLog=i,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new Fu(n)}return e.prototype.init=function(){try{var e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):qu()}catch(e){this._cache=qu()}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))},e.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},e.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},e.prototype.logCmdMsgTasks=function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===se.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,St(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)},e.prototype.request=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:return!this.isEable&&t===Cu.init&&this.isExire()?(this.logger.info(fe.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===Cu.newWorkChange&&this.isOverclock()?(this.logger.info(fe.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(i=_n(e),this.lastRequestTime=(new Date).getTime(),r=i+"/v1/config",s={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(s["RC-Token"]=n),o={platform:"web",version:"5.9.9",timestamp:this.timestamp},this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:r})),[4,this.httpRequest(r,En.POST,s,o)]);case 1:return a=l.sent(),u=a.code,c=a.data,this.statisticLog.record(Ee.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),u===$.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(h=c.targetRegion,this.changeAreaCode===h?[2,this.timestamp]:(d=yi.setAreaCode(h),this.logger.info(fe.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:d,originAreaCode:yi.getAreaCode(),newAreaCode:h})),this.changeAreaCode=h,(p=yi.getCloudControllerUrl(h))[0]?[2,this.request(p[0],Cu.other)]:(this.logger.info(fe.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:r,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))},e.prototype._handleMrtrData=function(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}},e}(),Ku=function(e){function t(t,n,i,r,s){var o=e.call(this,i,t,r,s)||this;o.runtime=n,o._mrtr={chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1};var a=Un(n);return o.deviceId=Bt(n),o.model="Web|"+a.type+"|"+a.version,o.init(),o}return a(t,e),t.prototype.httpRequest=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return(r=i).deviceId=this.deviceId,r.model=this.model,s={url:e,method:t,headers:n,body:JSON.stringify(r)},this.logger.info(fe.L_REQUEST_T,JSON.stringify(s)),[4,this.runtime.httpReq(s)];case 1:o=l.sent(),a=o.status,u=o.data,c=void 0===u?"":u,this.logger.info(fe.L_REQUEST_R,JSON.stringify({status:a,data:c}));try{return h=JSON.parse(c),d=h.data,[2,{code:parseInt(h.code,10),data:d}]}catch(e){return this.logger.warn(fe.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:c,error:e})),[2,{code:a,msg:e}]}return[2]}}))}))},t.prototype.setCloudControllerCache=function(e){var t=Q.CLOUD_CONTROL_KEY(this.appkey);this.runtime.localStorage.setItem(t,JSON.stringify(e)),this.logger.info(fe.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},t.prototype.getLocalCloudControllerCache=function(){var e=Q.CLOUD_CONTROL_KEY(this.appkey),t=this.runtime.localStorage.getItem(e);return this.logger.info(fe.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:e,data:t})),t},t.prototype.setMRTRConfig=function(e){this.logger.info(fe.L_CLOUD_SET_MRTR_O,JSON.stringify(e)),this._mrtr=e},t.prototype.getMRTRConfig=function(){return this._mrtr},t}(Yu),ju=function(){function e(e,t,n,i){this._storage=new s(e,Q.READ_RECEIPT_KEY(t,n)),this._delayTime=i,this.clear()}return e.prototype._getConversationKey=function(e){return e.targetId+"_"+e.channelId},e.prototype._removeExcessData=function(e){for(var t=Object.keys(e).map((function(t){return{key:t,value:e[t]}})).sort((function(e,t){return e.value.t-t.value.t})).slice(-30),n={},i=0,r=t;i<r.length;i++){var s=r[i];n[s.key]=s.value}return n},e.prototype.insert=function(e,t,n,i,r){var s;if(!(i<Date.now()-this._delayTime-j)){var o=this._getConversationKey(e),a=this._storage.get(o)||{};if(!a[t]){var c={t:i,d:n};r&&(c.sId=r);var l=u(u({},a),((s={})[t]=c,s));Object.keys(l).length>30&&(l=this._removeExcessData(l)),this._storage.set(o,l)}}},e.prototype.addReadedUser=function(e,t,n){var i,r=this._getConversationKey(e),s=this._storage.get(r)||{},o=s[t];if(o){if(o.us){if(o.us.includes(n))return}else o.us=[];o.us.push(n),this._storage.set(r,u(u({},s),((i={})[t]=o,i)))}},e.prototype.getReadReceiptInfo=function(e,t){var n=this._getConversationKey(e),i=(this._storage.get(n)||{})[t];return i?{time:i.t,direction:i.d,users:i.us||[],senderId:i.sId}:null},e.prototype.getReceiptMessageDic=function(e){var t=this._getConversationKey(e),n=this._storage.get(t)||{},i={};for(var r in n){var s=n[r];s.d===Z.RECEIVE&&(i[s.sId]||(i[s.sId]=[]),i[s.sId].push(r))}return i},e.prototype.remove=function(e,t){var n=this._getConversationKey(e),i=this._storage.get(n)||{};i[t]&&(delete i[t],0===Object.keys(i).length?this._storage.remove(n):this._storage.set(n,i))},e.prototype.clear=function(){var e=this._storage.getValues(),t={};for(var n in e){var i=e[n],r={};for(var s in i){var o=i[s];Date.now()-this._delayTime-o.t<j&&(r[s]=o)}Object.keys(r).length&&(t[n]=r)}this._storage.update(t)},e}(),Qu=function(){function e(e){this._delayTime=e,this._relationshipStatusVersion=0,this._subUserStatusVersion=0,this._onLineStatusSubData={}}return e.prototype.updateRelationshipStatusVersion=function(e){e>this._relationshipStatusVersion&&(this._relationshipStatusVersion=e)},e.prototype.getRelationshipStatusVersion=function(){return this._relationshipStatusVersion},e.prototype.updateSubscribeUserStatusVersion=function(e){e>this._subUserStatusVersion&&(this._subUserStatusVersion=e)},e.prototype.getSubscribeUserStatusVersion=function(){return this._subUserStatusVersion},e.prototype.updateSubscribeRelation=function(e,t){var n=this;void 0===t&&(t=!1);var i=[],r=[];return t&&(this._onLineStatusSubData={}),e.reduce((function(e,t){return t.subUsers.forEach((function(n){var i=e.find((function(e){return e.subscribeType===t.subType&&e.userId===n.subUserId}));i?i.subscribeTime<t.subTime&&(i.expiry=t.expiry,i.operationType=t.opType,i.subscribeTime=t.subTime):e.push({userId:n.subUserId,subscribeTime:t.subTime,subscribeType:t.subType,expiry:t.expiry,operationType:t.opType})})),e}),[]).forEach((function(e){var t=e.userId,s=e.subscribeTime,o=e.subscribeType;e.expiry;var a=e.operationType;if(o===ze.ONLINE_STATUS){if(a===$e.UNSUBSCRIBE){if(!n._onLineStatusSubData[t])return;return delete n._onLineStatusSubData[t],void r.push(e)}var c=n._onLineStatusSubData[t];if(c&&c.subscribeTime>=s)return;i.push(t),r.push(e),n._onLineStatusSubData[t]=u(u({},e),{statusMap:(null==c?void 0:c.statusMap)||{}})}})),{newSubscribeUsers:i,subscribeUserChangeList:r}},e.prototype.updateSubscribeUserStatus=function(e,t){var n=this;void 0===t&&(t=!1);var i=[];return t&&Object.keys(this._onLineStatusSubData).forEach((function(e){n._onLineStatusSubData[e].statusMap={}})),e.forEach((function(e){var t=e.subUserId,r=e.subType,s=e.data;if(r===ze.ONLINE_STATUS){var o=n._onLineStatusSubData[t];if(!o)return;var a=[];s.forEach((function(e){var t=o.statusMap[e.platformInfo];if(!(t&&t.changeTime>e.versionTime)){var n={eventValue:e.value,changeTime:e.versionTime};o.statusMap[e.platformInfo]=n,a.push(u(u({},n),{platform:e.platformInfo}))}})),i.push({userId:t,subscribeType:r,subscribeTime:o.subscribeTime,expiry:o.expiry,details:a})}})),i},e.prototype.getSubscribeUserStatus=function(e,t){var n=this,i=[];return t.forEach((function(e){var t=n._onLineStatusSubData[e];if(!t||t.expiry<(Date.now()+n._delayTime-t.subscribeTime)/1e3)delete n._onLineStatusSubData[e];else{var r=Object.keys(t.statusMap).map((function(e){return u({platform:~~e},t.statusMap[~~e])}));i.push({subscribeTime:t.subscribeTime,expiry:t.expiry,userId:t.userId,subscribeType:t.subscribeType,details:Vn(r)})}})),i},e.prototype.getSubscribeUserList=function(e,t,n){for(var i in this._onLineStatusSubData){var r=this._onLineStatusSubData[i];r.expiry<(Date.now()+this._delayTime-r.subscribeTime)/1e3&&delete this._onLineStatusSubData[i]}return Object.values(this._onLineStatusSubData).sort((function(e,t){return e.subscribeTime-t.subscribeTime})).slice(n,n+t).map((function(e){return{subscribeTime:e.subscribeTime,expiry:e.expiry,userId:e.userId,subscribeType:e.subscribeType,details:Vn(Object.keys(e.statusMap).map((function(t){return u({platform:~~t},e.statusMap[~~t])})))}}))},e}(),Wu=function(){function e(e,t,n,i,r){this._connectManager=e,this._event=t,this._currentUserId=n,this._delayTime=i,this._logger=r,this._isPullingRelationship=!1,this._pullRelationshipQueue=[],this._pullRelationshipFailTime=0,this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue=[],this._pullSubUserStatusFailTime=0,this._subStore=new Qu(i)}return e.prototype.syncData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,this._syncSubscribeRelationship()];case 1:return e.sent(),[4,this.syncSubscribeUserStatus(!0)];case 2:return e.sent(),this._event.syncSubscribeUserStatusFinished(),[2]}}))}))},e.prototype.startSyncSubscribeRelationship=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._pullRelationshipQueue.push(e),this._syncSubscribeRelationship(),[2]}))}))},e.prototype._syncSubscribeRelationship=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._isPullingRelationship?[2]:(this._isPullingRelationship=!0,[4,this._pullSubscribeRelationship()]);case 1:return e.sent(),this._isPullingRelationship=!1,this._pullRelationshipQueue.length>0?(this._pullRelationshipQueue.length=0,[4,this._syncSubscribeRelationship()]):[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeRelationship=function(e){return void 0===e&&(e=""),c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return t=this._subStore.getRelationshipStatusVersion(),n=this._logger.createTraceId(),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_RELATION_T,JSON.stringify({version:t,_pageToken:e}),n),i=this._connectManager.codec.encodePullUserSubReq({version:t,pageToken:e}),r=new Lr(Dr[Dr.pullUserSub],i,this._currentUserId),[4,this._connectManager.send(r,aa)];case 1:return s=l.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?(this._pullRelationshipFailTime=0,u=a.list,c=a.version,h=a.hasNext,d=a.pageToken,p=a.isFull,c=sn(c),u.forEach((function(e){e.subTime=sn(e.subTime)})),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:o,data:a}),n),p?this._subStore.updateSubscribeRelation(u,!e):(g=this._subStore.updateSubscribeRelation(u),_=g.newSubscribeUsers,f=g.subscribeUserChangeList,this._event.subscribeRelationChanged(f),_.length>0&&this._queryAndUpdateUserStatus(ze.ONLINE_STATUS,_)),this._subStore.updateRelationshipStatusVersion(c),this._pullRelationshipQueue=this._pullRelationshipQueue.filter((function(e){return e>c})),h?[4,this._pullSubscribeRelationship(d)]:[3,3]):(this._logger.error(fe.L_PULL_SUBSCRIBED_USER_RELATION_R,JSON.stringify({code:o,failTime:this._pullRelationshipFailTime}),n),this._pullRelationshipFailTime++,this._pullRelationshipFailTime>5?(this._pullRelationshipFailTime=0,[2]):[2,this._pullSubscribeRelationship(e)]);case 2:l.sent(),l.label=3;case 3:return[2]}}))}))},e.prototype.startsyncSubscribeUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this._pullSubUserStatusQueue.push(e),this.syncSubscribeUserStatus(),[2]}))}))},e.prototype.syncSubscribeUserStatus=function(e){return void 0===e&&(e=!1),c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._isPullingSubUserStatus?[2]:(this._isPullingSubUserStatus=!0,[4,this._pullSubscribeUserStatus(e)]);case 1:return t.sent(),this._isPullingSubUserStatus=!1,this._pullSubUserStatusQueue.length>0?(this._pullSubUserStatusQueue.length=0,[4,this.syncSubscribeUserStatus(e)]):[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},e.prototype._pullSubscribeUserStatus=function(e,t){return void 0===e&&(e=!1),void 0===t&&(t=""),c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h,d,p,g,_;return l(this,(function(l){switch(l.label){case 0:return n=this._subStore.getSubscribeUserStatusVersion(),i=this._logger.createTraceId(),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_STATUS_T,JSON.stringify({version:n,_pageToken:t,needAllData:e}),i),r=this._connectManager.codec.encodePullSubDataReq({version:n,needAllData:e,pageToken:t}),s=new Lr(Dr[Dr.pullSubData],r,this._currentUserId),[4,this._connectManager.send(s,ha)];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.SUCCESS&&u?(this._pullSubUserStatusFailTime=0,c=u.list,h=u.versionTime,d=u.hasNext,p=u.pageToken,g=u.isFull,h=sn(h),this._logger.info(fe.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,data:u}),i),c.forEach((function(e){e.data.forEach((function(e){e.versionTime=sn(e.versionTime)}))})),this._pullSubUserStatusQueue=this._pullSubUserStatusQueue.filter((function(e){return e>h})),this._subStore.updateSubscribeUserStatusVersion(h),_=this._subStore.updateSubscribeUserStatus(c,g&&""===t),!g&&_.length>0&&this._event.subscribeUserStatusChanged(_),d?[4,this._pullSubscribeUserStatus(e,p)]:[3,3]):(this._logger.warn(fe.L_PULL_SUBSCRIBED_USER_STATUS_R,JSON.stringify({code:a,failTime:this._pullSubUserStatusFailTime}),i),this._pullSubUserStatusFailTime++,this._pullSubUserStatusFailTime>5?(this._pullSubUserStatusFailTime=0,[2]):[2,this._pullSubscribeUserStatus(e,t)]);case 2:l.sent(),l.label=3;case 3:return[2]}}))}))},e.prototype._queryAndUpdateUserStatus=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return n=this._connectManager.codec.encodeQrySubDataReq(e,t),i=new Lr(Dr[Dr.qrySubData],n,this._currentUserId),[4,this._connectManager.send(i,ha)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o?(o.list.forEach((function(e){e.data.forEach((function(e){e.versionTime=sn(e.versionTime)}))})),(a=(a=this._subStore.updateSubscribeUserStatus(o.list)).filter((function(e){return e.details&&e.details.length>0}))).length>0&&this._event.subscribeUserStatusChanged(a),[2]):[2]}}))}))},e.prototype.updateUserStatus=function(e){var t=this._connectManager.codec.decodeByPBName(e.data,da);t.data.forEach((function(e){e.versionTime=sn(e.versionTime)}));var n=this._subStore.updateSubscribeUserStatus([t]);n.length>0&&this._event.subscribeUserStatusChanged(n)},e.prototype.getSubscribeUserStatus=function(e,t){return this._subStore.getSubscribeUserStatus(e,t)},e.prototype.getSubscribeUserList=function(e,t,n){return this._subStore.getSubscribeUserList(e,t,n)},e.prototype.updateSubscribeRelation=function(e,t,n,i){return void 0===i&&(i=0),c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._connectManager.codec.encodeUpdateUserSubReq(t,e,n,i),s=new Lr(Dr[Dr.updUserSub],r,this._currentUserId),[4,this._connectManager.send(s,oa)];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT&&u?[2,{code:a,data:u.subUsers.map((function(e){return e.subUserId}))}]:a===$.SUCCESS&&u?(c=u.subTime,this._subStore.updateSubscribeRelation([{subType:t,subTime:c,expiry:i,opType:n,subUsers:e.map((function(e){return{subUserId:e}}))}]),t===ze.ONLINE_STATUS&&n===$e.SUBSCRIBE&&this._queryAndUpdateUserStatus(t,e),[2,{code:a}]):[2,{code:a}]}}))}))},e}(),Ju=function(e,t,i,r,s,o,a){return{conversationType:e,targetId:t,senderUserId:o,messageDirection:Z.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:s,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Dn(n.UNREAD),pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:ye.SENT,directedUserIds:i.directionalUserIdList}},Xu=function(e){return e.sort((function(e,t){var n,i,r=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=t.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),e},Zu=function(e){function t(t,n,i,r){var s=e.call(this,t,n,i,r,new Ya(r.appkey,"RC-E","IM"),new Pu(r.appkey,"RC-E","IM"))||this;s._customMessageType={},s._reconnectTimer=-1,s._pullOfflineFinished=!1,s.currentUserId="",s._openCallPlus=!1,s.cloudControllerUri="",s._pullingMsg=!1,s._pullQueue=[],s._chrmsQueue={},s._latestSyncTimestamp=0,s._intervalTimer=-1,s._latestPullKVMsgTimestamp=0,s._intervalTimerForChrmPull=-1,s._handleInnerMsgOptions=function(e,t,n){var i,r=n.messageType;if("RC:SRSMsg"===r&&Object.assign(n,{directionalUserIdList:[s.currentUserId]}),r===se.READ_RECEIPT_RESPONSE){if(!n.content.receiptMessageDic||0===Object.keys(n.content.receiptMessageDic).length){var o=null===(i=s._readReceiptManager)||void 0===i?void 0:i.getReceiptMessageDic({conversationType:e,targetId:t,channelId:n.channelId});n.content.receiptMessageDic=o||{}}for(var a in n.directionalUserIdList=[],n.content.receiptMessageDic)n.directionalUserIdList.push(a)}return n},s._lastSyncUltraMsgTimeStamp=0,s._lastSyncUltraMsgLocalTimeStamp=0,s._ultraGroupTimer=-1,s._isUltraPulling=!1,s._ultraGroupTimeQue=[],s._isUltraGroupListExist=!1,s._ultraGroupMap={},s._ultraMsgMap={},s._pullUltraChangeMessageQue=[],s._isPullingUltraChangeMessage=!1,s._lastPullingUltraChangeMessageTime=0;var o=r.appkey,a=r.logOutputLevel,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy,p=r.environment;return s._environment=p||"default",s.logger.setOutputLevel(a),yi.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),Ma(o,s.logger,t,u),s.reporter=new nu(o,s.runtime,s.logger,s._options.__reportLogLevel),s.navi=new rs(o,s.logger,s.statisticLog,t,new xu(o,s.logger,t),s._environment),Tu(o,s.logger,u),s.reporterStatistic=new ku(o,s.runtime,s.logger,s.statisticLog),s._letterbox=new wr(t,o),s._sendMessageStore=new ss(t,o),s._chrmEntryHandler=new Br(s),s._connMgr=new du(o,s.navi,s.logger,s.statisticLog,s.runtime,{signal:s._signalHandler.bind(s),onConnected:s.onConnected.bind(s),onDisconnected:s.onDisconnected.bind(s),onConnecting:s._watcher.onConnecting,onSuspend:s.onSuspend.bind(s)}),"browser"===s.runtime.tag&&s._initCloudController(),s}return a(t,e),t.prototype._initCloudController=function(){var e=yi.getCloudControllerUrl();this.cloudControllerUri=e[0],this.cloudController=new Ku(this._appkey,this.runtime,this.logger,this.reporter,this.statisticLog),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,Cu.init)},t.prototype.onConnected=function(){var e=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),t=this._connMgr.getCurrentUserId();this.currentUserId=t,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new kr(e.joinMChrm)),this._conversationManager||(this._conversationManager=new zr(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new ps(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new $r(this,this._appkey,this.currentUserId,this._watcher.tag)),this._readReceiptManager||(this._readReceiptManager=new ju(this.runtime,this._appkey,this.currentUserId,this._connMgr.getDelayTime())),this._initSubscribeManager(e),this._conversationManager.startPullConversationStatus(0),this._conversationManager.adaptOldStore(),this._userSettingManager.pullUserSettings(0),this._sendMessageStore.init(this.currentUserId),this._rejoinChrm(),this._startSyncInterval(),this._openCallPlus&&this._syncCallPullKVMsg(),1===e.ugMsg&&this._notificationOnline(),this._watcher.onConnected(),this.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){var t,n;this._resetMemoryState(),null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onDisconnected(e)},t.prototype.onSuspend=function(e){var t,n;null===(t=this._userSettingManager)||void 0===t||t.stopAllTask(),null===(n=this._conversationManager)||void 0===n||n.stopAllTask(),this._watcher.onSuspend(e)},t.prototype._initSubscribeManager=function(e){var t=this;e.subDriven&&1&e.subDriven&&(this._subscribeManager||(this._subscribeManager=new Wu(this._connMgr,{syncSubscribeUserStatusFinished:function(){var e,n;null===(n=(e=t._watcher).syncSubscribedUserStatusFinished)||void 0===n||n.call(e)},subscribeUserStatusChanged:function(e){var n,i;null===(i=(n=t._watcher).subscribedUserStatusChange)||void 0===i||i.call(n,e)},subscribeRelationChanged:function(e){var n,i;null===(i=(n=t._watcher).subscribedRelationChange)||void 0===i||i.call(n,e)}},this.currentUserId,this._connMgr.getDelayTime(),this.logger)),this._subscribeManager.syncData())},t.prototype.createLogger=function(e,t){return new Ya(this._appkey,e,t)},t.prototype.createStatisticLogger=function(e,t){return new Pu(this._appkey,e,t)},t.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},t.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},t.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},t.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},t.prototype.connect=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,i)]}))}))},t.prototype._signalHandler=function(e,t){var n,i=e.syncMsg,r=e.topic;if(i)this._receiveSyncMsg(e,t);else{var s=this.logger.createTraceId();this.logger.debug(fe.L_RECV_RMTP_O,r,s);var o=Dr[r];if(o)switch(o){case Dr.s_ntf:this._pullMsg(e);break;case Dr.s_msg:this._receiveMsg(e);break;case Dr.s_cmd:this._receiveStateNotify(e);break;case Dr.s_us:this._receiveSettingNotify(e);break;case Dr.rtc_ntf:this._receiveRtcKv(e.data);break;case Dr.s_opNtf:this._pullOperateStatusNotify(e);break;case Dr.s_pubCall:this._pubCallInfo(e);break;case Dr.s_stat:null===(n=this._subscribeManager)||void 0===n||n.updateUserStatus(e)}else this.logger.error(fe.L_RECV_RMTP_E,r,s)}},t.prototype._receiveStateNotify=function(e){var t,n,i=this._connMgr.codec.decodeByPBName(e.data,Cs),r=i.time,s=i.type,o=i.chrmId;switch(s){case 2:this._chrmEntryHandler.pullEntry(o,r);break;case 3:this._conversationManager.startPullConversationStatus(r);break;case 4:this._chrmEntryHandler.reset(o),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(r),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(r),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime);break;case 8:null===(t=this._subscribeManager)||void 0===t||t.startsyncSubscribeUserStatus(r);break;case 9:null===(n=this._subscribeManager)||void 0===n||n.startSyncSubscribeRelationship(r)}},t.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,ao).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=e.channelId,i=void 0===n?"":n,r=e.conversationType,s=e.targetId,o=t.put,a=t.del,u=t.mid;o&&this._watcher.expansion({updatedExpansion:{messageUId:u,expansion:o,channelId:i,conversationType:r,targetId:s}}),a&&this._watcher.expansion({deletedExpansion:{messageUId:u,deletedKeys:a,channelId:i,conversationType:r,targetId:s}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,Gs),i=n.targetId,r=n.channelId,s=n.timestamp,o=this._ultraGroupMap[r+"_"+i];o&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.unreadMentionedMeCount=0,o.firstUnreadMessage&&(o.firstUnreadMessage=null),o.lastReadTime=s,this._watcher.conversation(Pn([o]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){var n,i=this,r=((n={})[Dr[Dr.ugMsg]]=function(){i._ultraGroupTimeQue.push(t.timestamp),i._syncUltraMsg(i._lastSyncUltraMsgTimeStamp)},n[Dr[Dr.updRTime]]=function(){i._receivesyncReadStatus(e)},n[Dr[Dr.updUgRTime]]=function(){i._clearUltraGroupUnreadCount(e,t)},n[Dr[Dr.updUserSub]]=function(){var e;null===(e=i._subscribeManager)||void 0===e||e.startSyncSubscribeRelationship(t.timestamp)},n);if(r[e.topic])r[e.topic]();else if(os.includes(e.topic)){var s=this._connMgr.codec.decodeByPBName(e.data,gs,{currentUserId:this.currentUserId,signal:e});((s=this._handleMsgProperties(s)).conversationType!==te.CHATROOM||this._chrmsQueue[s.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||s.sentTime):(t&&(s.sentTime=t.timestamp,s.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(fe.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:s.messageUId,messgeId:s.messageId,sentTime:s.sentTime})),s.messageType!==se.EXPANSION_NOTIFY?((s.messageType===se.SYNC_READ_STATUS||s.messageType===se.READ_RECEIPT&&s.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(s.conversationType,s.targetId,s.channelId,s.sentTime),s.messageType===se.READ_RECEIPT_REQUEST&&this._processRRReqMsg(s),s.messageType===se.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(s),this._conversationManager.setConversationCacheByMessage(s,!0),this._batchMessage([s])):this._receiveMessageExpansion(s)))}},t.prototype._batchMessage=function(e){for(var t=this,n=[],i=[],r=[],s=e.length-1;s>=0;s-=1){var o=e[s];o.messageType===se.LOG_COMMAND&&o.senderUserId===K?i.unshift(o):o.messageType===se.CLOUD_CONTROL&&o.senderUserId===K?r.push(o):n.unshift(o)}this._watcher.batchMessage(n),i.forEach((function(e){var n=e.content,i=n.startTime,r=n.endTime,s=n.platform,o=n.logId,a=n.uri;t.reporter.report(parseInt(i,10),parseInt(r,10),s,a,o,e.messageUId)})),r.length>0&&this._ccMsgHandler(r)},t.prototype._ccMsgHandler=function(e){var t;return c(this,void 0,void 0,(function(){var n,i,r;return l(this,(function(s){switch(s.label){case 0:return e.shift()?(n=this._connMgr.getToken(),[4,null===(t=this.cloudController)||void 0===t?void 0:t.request(this.cloudControllerUri,Cu.other,n)]):[3,2];case 1:i=s.sent()||0,(r=e.filter((function(e){return e.sentTime>i}))).length>0&&this._ccMsgHandler(r),s.label=2;case 2:return[2]}}))}))},t.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Wo),n=t.key,i=t.dataContent,r=t.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Cs),n=t.type,i=t.chrmId,r=t.time;if(this.logger.info(fe.L_RECV_S_NTF_O,"type: "+n+", chrmId: "+n+", time: "+r),2===n){var s=this._chrmsQueue[i];if(!s)return;s.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},t.prototype._receivesyncReadStatus=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Gs),n=t.conversationType,i=t.targetId,r=t.channelId,s=t.timestamp,o=t.sentTime;this._conversationManager.clearUnreadCount(n,i,r,o),this._watcher.syncReadStatus({conversationType:n,targetId:i,channelId:r,timestamp:s})},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._syncCallPullKVMsg=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new Lr(Xi,e,this.currentUserId),[4,this._connMgr.send(t,Xo)]):[2];case 1:return n=s.sent(),i=n.code,r=n.data,i===$.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(t.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===iu.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._filterMessage=function(e){var t=e.messageType;return t===se.DELIVERED||t===se.DELIVERED_MSG||t===se.SYNC_READ_STATUS&&!this._processSRSMsg(e)},t.prototype._messageProcessor=function(e){var t=this,n=0,i=[],r=[],s=[],o=[],a=[];return e.forEach((function(e){var u=e.conversationType,c=e.targetId,l=e.channelId,h=e.messageDirection,d=e.messageUId,p=e.messageType,g=e.sentTime,_=e.senderUserId,f=e.content;if(i.push(d),h===Z.SEND){n=Math.max(g,n);var E=t._sendMessageStore.getSendMessageMap(),T=p===se.RECALL?"Cmd:"+f.messageUId:d;if(E[T])return void t._sendMessageStore.removeByUID(T)}if(!t._filterMessage(e))if(p!==se.EXPANSION_NOTIFY)if(g>=t._connMgr.getConnectedTime()&&t._writeMessagesLog(u,d)&&a.push(d),p===se.READ_RECEIPT&&_===t.currentUserId&&t._conversationManager.clearUnreadCount(u,c,l,g),p!==se.READ_STATE){p===se.READ_RECEIPT_REQUEST&&t._processRRReqMsg(e),p===se.READ_RECEIPT_RESPONSE&&t._processRRRspMsg(e);var I=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(I,!0),r.push(I)}else o.push(e);else s.push(e)})),{newOutboxTime:n,messageUIds:i,messages:r,messageExpansionList:s,RSMsgList:o,msgUIds2Statistic:a}},t.prototype._processSRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,s=e.senderUserId,o=e.sentTime;if(s!==this.currentUserId)return!1;var a=this.getNaviInfoFromCache();return this._conversationManager.clearUnreadCount(t,n,i,o),1!==a.sesDriven||(o>this.getConnectedTime()||this._watcher.syncReadStatus({conversationType:t,targetId:n,channelId:i,timestamp:r.lastMessageSendTime}),!1)},t.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=e.content,s={conversationType:t,targetId:n,channelId:i};this._watcher.messageReadReceipt(t===te.PRIVATE?{privateReadReceipt:u(u({},s),{endMsgTime:r.endMsgTime})}:{groupReadReceipt:u(u({},s),{totalCount:r.tmn,readedCount:r.rrn,messageUId:r.msgId})})},t.prototype._processRRReqMsg=function(e){var t,n=e.conversationType,i=e.channelId,r=e.targetId,s=e.content,o=e.sentTime,a=e.messageDirection,u=e.senderUserId;null===(t=this._readReceiptManager)||void 0===t||t.insert({conversationType:n,channelId:i,targetId:r},s.messageUId,a,o,u)},t.prototype._processRRRspMsg=function(e){var t,n=this,i=e.conversationType,r=e.channelId,s=e.targetId,o=e.content,a=e.senderUserId,u=o.receiptMessageDic,c=void 0===u?{}:u;if(a===this.currentUserId)for(var l in c)for(var h=0,d=c[l];h<d.length;h++){var p=d[h];null===(t=this._readReceiptManager)||void 0===t||t.remove({conversationType:i,channelId:r,targetId:s},p)}else(c[this.currentUserId]||[]).forEach((function(e){var t;null===(t=n._readReceiptManager)||void 0===t||t.addReadedUser({conversationType:i,channelId:r,targetId:s},e,a)}))},t.prototype._syncMsg=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a,u,c,h,d,p,g,_,f,E,T,I,v,R,C,S,m=this;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),r=new Lr(Dr[Dr.pullMsg],i,this.currentUserId),s=this.logger.createTraceId(),this.logger.info(fe.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),s),[4,this._connMgr.send(r,Es,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId,customMessageTypes:this._customMessageType})]):(this._pullingMsg=!1,[2]);case 1:if(o=l.sent(),a=o.code,u=o.data,this._latestSyncTimestamp=Date.now(),this._pullingMsg=!1,a!==$.SUCCESS||!u||vt(u.finished)||vt(u.list)||vt(u.syncTime))return this.logger.warn(fe.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),s),[2];c=u.list,h=u.finished,d=u.syncTime,p=u.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(fe.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:c.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),s);try{if(_=this._messageProcessor(c),f=_.newOutboxTime,E=_.messageUIds,T=_.messages,I=_.messageExpansionList,v=_.RSMsgList,(R=_.msgUIds2Statistic).length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:R.join(",")})),this._batchMessage(T),I.forEach((function(e){m._receiveMessageExpansion(e)})),v.forEach((function(e){m._processRSMsg(e)})),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(f,this.currentUserId),this._letterbox.setBroadcastSyncTime(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(f),C=this._pullQueue.filter((function(e){return e>d})),this._pullQueue.length=0,(S=this._pullQueue).push.apply(S,C),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(fe.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:C}),s),!h)return this._syncMsg(),[2];this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg())}catch(e){this.logger.error(fe.L_PULL_MSG_E,null==e?void 0:e.stack,s)}return[2]}}))}))},t.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,fs,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()}),n=(t=this._handleMsgProperties(t)).conversationType,i=t.messageType,r=t.senderUserId,s=t.messageUId,o=t.sentTime,a=t.isStatusMessage;if(this.logger.info(fe.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),this._writeMessagesLog(n,s)&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:s})),n!==te.RTC_ROOM&&i!==se.INTERCEPT){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}r===this.currentUserId&&this._sendMessageStore.setMessage(s,o),a||r===this.currentUserId||this._letterbox.setInboxTime(o,this.currentUserId),this._handleNotNotifyMsg(t)||(i===se.READ_RECEIPT_REQUEST&&this._processRRReqMsg(t),i===se.READ_RECEIPT_RESPONSE&&this._processRRRspMsg(t),this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t]))}},t.prototype._handleNotNotifyMsg=function(e){var t=e.messageType,n=e.senderUserId;return t===se.DELIVERED||(t===se.DELIVERED_MSG||(t===se.EXPANSION_NOTIFY?(this._receiveMessageExpansion(e),!0):t===se.SYNC_READ_STATUS&&n!==this.currentUserId||t===se.READ_STATE&&(this._processRSMsg(e),!0)))},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,i=e.messageType,r=e.isStatusMessage,s=e.isCounted,o=void 0!==s&&s,a=e.isPersited,c=void 0!==a&&a,l=i in P,h=i in this._customMessageType;if(n=l?u(u({},P[i]),{isStatusMessage:w.includes(i)}):h?this._customMessageType[i]:{isCounted:o,isPersited:c,isStatusMessage:!1},Object.assign(e,n),t&&!vt(r)&&(e.isStatusMessage=r),!t){var d=e.content.user;if(d){var p=d.portrait,g=d.portraitUri,_=p||g;_&&(d.portrait=d.portraitUri=_)}}return e},t.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},t.prototype.getHistoryMessage=function(e,t,n,i,r,s,o,a){var u;return void 0===s&&(s=""),c(this,void 0,void 0,(function(){var o,c,h,d,p,g,_,f,E,T,I,v=this;return l(this,(function(l){switch(l.label){case 0:return c=(o=this).currentUserId,h=o._connMgr,d=sr[e]||Zi,p=1===i&&0===n,h?(g=h.codec.encodeGetHistoryMsg(t,{timestamp:n,count:p?2:i,order:r,channelId:s}),this.logger.info(fe.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:s,timestamp:n,count:i,order:r}),a),[4,h.send(new Lr(d,g,c),ms,{currentUserId:c,connectedTime:h.getConnectedTime(),conversation:{targetId:t},afterDecode:function(n){var i,r=null===(i=v._readReceiptManager)||void 0===i?void 0:i.getReadReceiptInfo({conversationType:e,channelId:s,targetId:t},n.messageUId);if(r){var o=r.users;n.readReceiptInfo={isReceiptRequestMessage:!0,readerList:o}}return n}})]):[3,2];case 1:return _=l.sent(),f=_.code,E=_.data,f===$.SUCCESS&&E?(T=this._fixDownstreamData(p,E,r),I=[],null===(u=T.list)||void 0===u||u.forEach((function(e){e&&I.push(e.messageUId)})),this.logger.info(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:I.join(",")}),a),[2,{code:f,data:{list:T.list,hasMore:T.hasMore}}]):(this.logger.warn(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:f,messageUIds:""}),a),[2,{code:f}]);case 2:return[2,{code:$.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getMessages=function(e,t,n,i,r,s,o){return this.getHistoryMessage(e,t,n,i,r,s,o)},t.prototype.reportSDKInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=this.logger.createTraceId(),s=JSON.stringify(e),this.logger.debug(fe.L_VER_REPORT_T,s,r),o=i.codec.encodeReportSDKInfo(s),a=new Lr(Dr[Dr.reportsdk],o,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==$.SUCCESS&&this.logger.warn(fe.L_VER_REPORT_R,u,r),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,a=o.codec.encodeDeleteMessages(e,t,n,i),u=Di,e===te.ULTRA_GROUP&&(u=wi),c=new Lr(u,a,s),[4,o.send(c)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,a=o.codec.encodeClearMessages(t,n,i,e),u=or[e],c=new Lr(u,a,s),[4,o.send(c)]):[2,$.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.batchClearRemoteHistoryMessages=function(e,t){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,r=i.codec.encodeBatchClearRemoteMessages(e),s=new Lr(Wi,r,n),[4,i.send(s)]):[2,$.RC_NET_UNAVAILABLE];case 1:return o=a.sent(),[2,o.code]}}))}))},t.prototype.getConversationList=function(e,t,n,i,r){return void 0===e&&(e=300),c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=(r=this).currentUserId,o=r._connMgr,t=t||te.PRIVATE,a=o.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:i}),u=new Lr(qi,a,s),[4,o.send(u,As,{currentUserId:s,connectedTime:o.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,i=e.channelId,r=p._conversationManager.get(t,n,i);Object.assign(e,r);var s=p._conversationManager.getDraft(t,n,i);return e.draft=s,e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==$.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),s=new Lr(Yi,r,t),[4,i.send(s)]):[2,$.RC_NET_UNAVAILABLE];case 1:return o=a.sent(),[2,o.code]}}))}))},t.prototype.batchRemoveConversation=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeBatchDeleteConversation(e),i=new Lr(Ki,n,this.getCurrentUserId()),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),[2,r.code]}}))}))},t.prototype.getConversation=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return e!==te.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap[n+"_"+t])?[3,3]:[2,{code:$.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:$.CONVER_GET_ERROR}];case 2:if(s=l.sent(),o=s.code,a=s.data,o!==$.SUCCESS)return[2,{code:$.CONVER_GET_ERROR}];u=this._conversationManager.getDraft(e,t,n),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||ae.CLOSE,notificationLevel:r.notificationLevel||ce.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0,draft:u},l.label=3;case 3:return[2,{code:$.SUCCESS,data:i}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var i=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var i=0;if(e.includes(te.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var s=this._ultraGroupMap[r];(0===t.length||t.includes(s.notificationLevel))&&(i+=n?s.unreadMentionedCount:s.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.getConversationUnreadCount=function(e,t,n){var i,r;return e===te.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap[n+"_"+t])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,this.getServerTime(),!1),Promise.resolve($.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve($.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getFirstUnreadMessageInfo=function(e,t,n){var i=this._conversationManager.get(e,t,n),r=i.firstUnreadMessageUid,s=i.firstUnreadTime;return Promise.resolve({code:$.SUCCESS,data:s&&r?{messageUId:r,sentTime:s}:null})},t.prototype.saveConversationMessageDraft=function(e,t,n,i){return this._conversationManager.setDraft(e,t,n,i),Promise.resolve($.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var i=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:$.SUCCESS,data:i})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve($.SUCCESS)},t.prototype.pullConversationStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this)._connMgr,i=t.currentUserId,r=n.codec.encodeGetConversationStatus(e),s=new Lr(Dr[Dr.pullSeAtts],r,i),[4,n.send(s,co)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=l.sent(),a=o.code,u=o.data,this.logger.info(fe.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:i})),a!==$.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),t===te.ULTRA_GROUP?h._setUltraConversationStatus(e):c.push(e)})),[2,{code:a,data:c}])}}))}))},t.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationStatus,i=e.notificationLevel,r=e.channelId,s=e.isTop,o=e.conversationType;if(""!==t||void 0===i){var a=this._ultraGroupMap[r+"_"+t];return a&&void 0!==i&&(a.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==n&&(a.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(a)),a&&void 0!==s&&(a.isTop=s),a}this._ultraGroupManager.addUltraGroupStatus({conversationType:o,targetId:"",channelId:"",notificationLevel:i})},t.prototype.batchSetConversationStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=(t=this).currentUserId,i=t._connMgr,[4,this._conversationManager.pushTask((function(t){return c(r,void 0,void 0,(function(){var r,s,o,a,c,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return r=i.codec.encodeSetConversationStatus(e,t),s=new Lr(ji,r,n),[4,i.send(s,go)];case 1:return o=l.sent(),a=o.code,c=o.data,a!==$.SUCCESS?[2,{code:a}]:(h=c,this._conversationManager.setConversationUpdatedTime(h.version),d=[],e.forEach((function(e){if(e.conversationType!==te.ULTRA_GROUP)g._conversationManager.addStatus(u(u({},e),{updatedTime:h.version}),!0);else{var t=g._setUltraConversationStatus(e);t&&d.push(t)}})),d.length>0&&(p=Pn(d),p=Xu(p),this._watcher.conversation(p)),[2,{code:a}])}}))}))}))]):[2,$.RC_NET_UNAVAILABLE];case 1:return[2,s.sent().code]}}))}))},t.prototype.batchSetConversationToTop=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return u(u({},e),{isTop:t})})))]}))}))},t.prototype.setConversationNotificationLevel=function(e,t,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:i}])]}))}))},t.prototype.batchSetConversationNotificationLevel=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this.batchSetConversationStatus(e.map((function(e){return u(u({},e),{notificationLevel:t})})))]}))}))},t.prototype._joinChrm=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p,g,_,f,E,T,I,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,s=r.codec.encodeJoinOrQuitChatRoom(),a=new Lr(o=n?Gi:Vi,s,e),this.logger.info(fe.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:o}),i),[4,r.send(a,ks)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,d=c===$.SUCCESS?"info":"warn",this.logger[d](fe.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===$.SUCCESS?(g=(p=h).joinTime,_=p.createTime,f=p.memberCount,E=p.isAllChatroomBanned,T=p.isCurrentUserBanned,I=p.isCurrentChatroomBanned,v=p.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull(),[2,{code:c,data:{createTime:_,memberCount:f,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:I,isCurrentChatroomInWhitelist:v}}]):[2,{code:c}]}}))}))},t.prototype._rejoinChrm=function(){return c(this,void 0,void 0,(function(){var e,t,n,i,r,s,o,a,c,h;return l(this,(function(l){switch(l.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);i=0,l.label=1;case 1:return i<t.length?(r=t[i],this.logger.info(fe.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:e[r]||10,topic:Gi})),s=this.logger.createTraceId(),[4,this._joinChrm(r,e[r]||10,!0,s)]):[3,4];case 2:if(o=l.sent(),a=o.code,c=o.data,h=a===$.SUCCESS?"info":"warn",this.logger[h](fe.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),s),a===$.SUCCESS)return this._watcher.chatroom({rejoinedRoom:u({chatroomId:r,count:e[r]},c)}),[2];a===$.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(r),delete this._chrmsQueue[r]),this._watcher.chatroom({rejoinedRoom:{chatroomId:r,errorCode:a}}),l.label=3;case 3:return i++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d,p,g,_,f,E,T=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[e],r=i.pulling,s=i.timestamp,r?[2]:(i.pulling=!0,o=this._connMgr.codec.encodeChrmSyncMsg(n?0:s,t),a=new Lr(Dr[Dr.chrmPull],o,e),this.logger.info(fe.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:s})),[4,this._connMgr.send(a,Es,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=l.sent(),c=u.code,h=u.data,i.pulling=!1,c===$.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,i.timestamp=n?Math.max(p,n):p,i.queue=i.queue.filter((function(e){return e>p})),_=[],f=[],E=[],d.forEach((function(e){e.sentTime<s||(e.sentTime>=T._connMgr.getConnectedTime()&&T._writeMessagesLog(te.CHATROOM,e.messageUId)&&f.push(e.messageUId),_.push(e.messageUId),E.push(e))})),this._batchMessage(E),this.logger.info(fe.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:s,messageUIds:_.join(",")})),f.length>0&&this.statisticLog.record(Ee.IM_MSG_RECEIVE,JSON.stringify({client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),msg_ids:f.join(",")})),(!g||i.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(fe.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:s,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(e,t,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.joinExistChatroom=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),i=new Lr(Bi,n,e),[4,t.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),(s=r.code)===$.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,s]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(t,n),s=new Lr(Dr[Dr.queryChrmI],r,e),[4,i.send(s,Fs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),a=o.code,u=o.data,a!==$.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,s=r.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:i}),o=new Lr($i,s,e),[4,r.send(o,ms,{conversation:{targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==$.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,s=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==s?this.getServerTime():s,o=i.codec.encodeModifyChatRoomKV(e,t,r),a=t.type===Ie.UPDATE?ki:xi,u=new Lr(a,o,e),[4,i.send(u,ks)]):[2,$.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),(h=c.code)===$.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,i=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=i.findIndex((function(t){return e.key===t.key}));-1!==t&&i.splice(t,1)})),i},t.prototype._modifyChatroomKVS=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,c,h,d,p,g,_,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,t.entries.forEach((function(t){var n=f._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?f.getServerTime():n})),s=i.codec.encodeModifyChatRoomKVS(e,t,r),o=t.type===Ie.UPDATE?Fi:Hi,a=new Lr(o,s,e),[4,i.send(a,$s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,-1!==[$.SUCCESS,$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=u({},t)).entries,t.entries.forEach((function(e){p.push(u(u({},e),g))})),h===$.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(_=c.data,d=_.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,c)),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=Ie.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:$.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),s=new Lr(Dr[Dr.pullKV],r,e),[4,i.send(s,zs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),(a=o.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(e){return e.key===t})),void 0!==u)?[2,{code:$.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:$.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:$.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},i=n.codec.encodePullChatRoomKV(0),r=new Lr(Dr[Dr.pullKV],i,e),[4,n.send(r,zs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return s=a.sent(),(o=s.data)&&o.kvEntries&&o.kvEntries.length&&o.kvEntries.forEach((function(e){e.key&&(t[e.key]=e.value||"")})),[2,{code:$.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,s=i.codec.encodePullChatRoomKV(t),o=new Lr(Dr[Dr.pullKV],s,e),this.logger.info(fe.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,i.send(o,zs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,h=u===$.SUCCESS?"info":"warn",this.logger[h](fe.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:t})),u===$.SUCCESS&&c?(d=c.kvEntries,p=[],d.length>0&&(d.forEach((function(t){var n=t.key,i=t.value,r=t.type,s=t.timestamp,o=t.userId;g._chrmEntryHandler.getValue(e,n)===i&&o===g.getCurrentUserId()||p.push({key:n,value:i,type:r,timestamp:s,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,c,r),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._isConnected?t.forEach((function(t){e._pullChrmMsg(t),e.getNaviInfoFromCache().kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),O)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype._writeMessagesLog=function(e,t){var n,i=null===(n=this.cloudController)||void 0===n?void 0:n.getMRTRConfig();if(!i)return!1;var r=fn(t),s=0;switch(e){case te.PRIVATE:s=i.private;break;case te.GROUP:s=i.group;break;case te.CHATROOM:s=i.chatroom;break;case te.ULTRA_GROUP:s=i.ultraGroup}return!!s&&r%(1/s)==0},t.prototype.sendMessage=function(e,t,n,i,r){var s;return c(this,void 0,void 0,(function(){var o,a,c,h,d,p,g,_,f,E,T,I;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._handleInnerMsgOptions(e,t,n),n=this._handleMsgProperties(n,!0),o=!1,[te.PRIVATE,te.GROUP].includes(e)&&(n.isStatusMessage||(null===(s=this._customMessageType[n.messageType])||void 0===s?void 0:s.isStatusMessage))&&(o=!0),a=o?function(e){var t;return(t={},t[te.PRIVATE]=Dr.ppMsgS,t[te.GROUP]=Dr.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[te.PRIVATE]=Dr.ppMsgP,t[te.GROUP]=Dr.pgMsgP,t[te.CHATROOM]=Dr.chatMsg,t[te.CUSTOMER_SERVICE]=Dr.pcMsgP,t[te.RTC_ROOM]=Dr.prMsgS,t[te.SYSTEM]=Dr.pbMsgP,t)[e]}(e)||Dr.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),c=n.messageId?n.messageId:dn(),n.messageId=c,h=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(d=new Nr(Dr[a],h,e===te.SYSTEM?this.currentUserId:t)).setHeaderQos(vi.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(d),[2,{code:$.SUCCESS,data:Ju(e,t,u({},n),"",0,this.currentUserId,c)}]):(p=this._connMgr.getCrtServerTime(),g=Ju(e,t,u(u({},n),{isStatusMessage:o}),"",p,this.currentUserId,c),null==i||i(c),this.logger.info(fe.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),r),_=Date.now(),[4,this._connMgr.send(d)])):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return f=l.sent(),E=f.code,T=f.data,E!==$.SUCCESS?(this.logger.warn(fe.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:g.messageUId,messageId:g.messageId}),r),this._writeMessagesLog(e)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),g.sentStatus=ye.FAILED,[2,{code:E,data:g}]):(this.logger.info(fe.L_SEND_MSG_R,JSON.stringify({code:E,messageUId:null==T?void 0:T.messageUId,messageId:null==T?void 0:T.messageId}),r),I=T,this._sendMessageSuccessHandle(g,I),this._writeMessagesLog(e,I.messageUId)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:I.messageUId,channel:e,start_ts:_,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:E})),[2,{code:$.SUCCESS,data:g}])}}))}))},t.prototype._sendMessageSuccessHandle=function(e,t){var n,i=this;this._sendMessageStore.setMessage(t.messageUId,t.timestamp),e.sentTime=t.timestamp,e.messageUId=t.messageUId,this._conversationManager.setConversationCacheByMessage(e,!0);var r=e.messageType,s=e.conversationType,o=e.targetId,a=e.channelId,u=e.sentTime,c=e.content,l=e.messageDirection;if(r===se.READ_RECEIPT_REQUEST){var h=c.messageUId;null===(n=this._readReceiptManager)||void 0===n||n.insert({conversationType:s,targetId:o,channelId:a},h,l,u)}if(r===se.READ_RECEIPT_RESPONSE){var d=c.receiptMessageDic;if(!d)return;for(var p in d)d[p].forEach((function(e){var t;null===(t=i._readReceiptManager)||void 0===t||t.remove({conversationType:s,targetId:o,channelId:a},e)}))}},t.prototype.recallMsg=function(e,t,n,i,r){var s;return c(this,void 0,void 0,(function(){var o,a,c,h,d,p,g,_,f,E,T,I,v,R,C;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=r.user,a=r.extra,c=r.isDelete,h=r.directionalUserIdList,d={conversationType:e,targetId:t,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},o&&(d.user=o),a&&(d.extra=a),p={content:d,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(s=r.pushConfig)||void 0===s?void 0:s.pushContent)||r.pushContent||"",channelId:r.channelId},[te.GROUP,te.ULTRA_GROUP].includes(e)&&h&&(p.directionalUserIdList=h),g=Dr[Dr.recallMsg],_=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},p),(f=new Nr(g,_,this.currentUserId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return E=l.sent(),T=E.code,I=E.data,e===te.ULTRA_GROUP&&this.logger.debug(fe.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:T,conversationType:e,targetId:t,channelId:r.channelId})),T!==$.SUCCESS?[2,{code:T}]:(v=I,e===te.ULTRA_GROUP?(this._ultraMsgMap[v.messageUId]=v.timestamp,this._updateUltraGroupWhenRecallMsg(t,r.channelId||"",n),[2,{code:$.SUCCESS}]):(R="Cmd:"+n,this._sendMessageStore.setMessage(R,v.timestamp),C=Ju(e,t,u(u({},p),{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(C,!0),[2,{code:$.SUCCESS,data:C}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(t,n),r=new Lr(Dr[Dr.rrMsg],i,e),[2,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(t,n),r=new Lr(Dr[Dr.rrList],i,e),[2,this._connMgr.send(r,mo)]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.sendReadReceiptMessageV4=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){return i=this._connMgr.codec.encodeReadReceiptMsg(e,t,n),r=new Nr(Dr[Dr.sendMsgRead],i,e.targetId),[2,this._connMgr.send(r)]}))}))},t.prototype.getMessageReadReceiptV4=function(e,t){return c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeReceiptQryReq(e,t),i=new Lr(Dr[Dr.qryMsgRead],n,e.targetId),[2,this._connMgr.send(i,$o)]}))}))},t.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeReceiptCntQryReq(e,t),i=new Lr(Dr[Dr.qryMsgReadCntBatch],n,e.targetId),[4,this._connMgr.send(i,na)];case 1:return r=c.sent(),s=r.code,o=r.data,a=(o||{result:[]}).result,s===$.SUCCESS&&a?[2,{code:s,data:a.map((function(t){return u({messageUId:t.msgId,readedCount:t.cnt,totalCount:t.tmn},e)}))}]:[2,{code:s}]}}))}))},t.prototype.updateConversationReadTime=function(e,t){return c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){return n=this._connMgr.codec.encodeSessionMsgReadInput(e,t),i=new Nr(Dr[Dr.updRTime],n,this.currentUserId),[2,this._connMgr.send(i)]}))}))},t.prototype.pullUserSettings=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new Lr(Dr[Dr.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,oo)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=o.sent(),r=i.code,s=i.data,r===$.SUCCESS&&this._naviChangeHandler(s),[2,{code:r,data:s}]}}))}))},t.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,i=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(i){var r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var s=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(u({},s))}}else this.logger.warn(fe.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=i&&"uploads"!==i?t||"":on(e,t),o=this.getNaviInfoFromCache(),a=vn(o,this.logger),c={uploadDomain:a},h=this._connMgr.codec.encodeGetFileToken(e,s,n||"",i||"",r||"",JSON.stringify(c)),d=new Lr(Dr[Dr.qnTkn],h,this.currentUserId),[4,this._connMgr.send(d,qs)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return p=l.sent(),g=p.code,_=p.data,g!==$.SUCCESS?[2,{code:g}]:(f=u(u({},_),{fileName:s,downloadAuthInfo:_.downloadAuthInfo?JSON.parse(_.downloadAuthInfo):null}),[2,{code:g,data:f}])}}))}))},t.prototype.getFileUrl=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c,h,d,p,g,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",s="",o="",a="",t===pe.QINIU?(s=Ys,o=js):(s=Ks,o=Qs),t===pe.QINIU?r=Dr[Dr.qnUrl]:t===pe.AWS?r=Dr[Dr.s3Url]:t===pe.STC?r=Dr[Dr.stcUrl]:t===pe.MINIO?(r=Dr[Dr.minioUrl],a=vn(this.getNaviInfoFromCache(),this.logger),u=JSON.stringify({url:a})):r=Dr[Dr.aliUrl],c=this._connMgr.codec.encodeGetFileUrl(s,e,n,i,u),h=new Lr(r,c,this.currentUserId),[4,this._connMgr.send(h,o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,_=g,p===$.SUCCESS?[2,{code:p,data:_}]:[2,{code:p}]}}))}))},t.prototype.disconnect=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return e.sent(),this._resetMemoryState(),[2]}}))}))},t.prototype._resetMemoryState=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData(),this._joinedChrmManager&&(this._joinedChrmManager.clear(),delete this._joinedChrmManager),this._conversationManager&&delete this._conversationManager,this._ultraGroupManager&&delete this._ultraGroupManager,this._userSettingManager&&delete this._userSettingManager,this._readReceiptManager&&delete this._readReceiptManager,this._subscribeManager&&delete this._subscribeManager,this._chrmsQueue={}},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.registerMessageType=function(e,t,n,i,r){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:r}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(c){switch(c.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new Lr(Dr[Dr.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,ro)];case 1:return r=c.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o&&(a=o.version,this._userSettingManager.addTag([u(u({},e),{createdTime:a})],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeRemoveTag([e],n),i=new Lr(Dr[Dr.delSeTag],t,this.currentUserId),[4,this._connMgr.send(i,ro)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o&&(a=o.version,this._userSettingManager.deleteTag([e],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.updateTag=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this._isConnected?[2,this._userSettingManager.pushTask((function(n){return c(t,void 0,void 0,(function(){var t,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=this._connMgr.codec.encodeCreateTag([e],n),i=new Lr(Dr[Dr.addSeTag],t,this.currentUserId),[4,this._connMgr.send(i,ro)];case 1:return r=u.sent(),s=r.code,o=r.data,s===$.SUCCESS&&(a=o.version,this._userSettingManager.addTag([e],a)),[2,{code:s}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){var e,t;return l(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:$.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new Lr(Dr[Dr.addTag],n,this.currentUserId),[4,this._connMgr.send(r,go)]):[2,{code:$.TAG_NOT_EXIST}];case 1:return s=l.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a&&((u={})[e]={},t.forEach((function(e){c._conversationManager.addTagStatus(e.conversationType,e.targetId,u,e.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u=this;return l(this,(function(c){switch(c.label){case 0:return n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t,i),r=new Lr(Dr[Dr.delTag],n,this.currentUserId),[4,this._connMgr.send(r,go)];case 1:return s=c.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a&&(t.forEach((function(t){u._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),this._conversationManager.setConversationUpdatedTime(a.version)),[2,{code:o}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.removeTagsForConversation=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return this._isConnected?[2,this._conversationManager.pushTask((function(i){return c(n,void 0,void 0,(function(){var n,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return n=e.conversationType,r=e.targetId,s=e.channelId,o=t.map((function(e){return{tagId:e}})),a=this._connMgr.codec.encodeUpdateConversationTag(o,[e],i),u=new Lr(Dr[Dr.delTag],a,this.currentUserId),[4,this._connMgr.send(u,go)];case 1:return c=l.sent(),h=c.code,d=c.data,h===$.SUCCESS&&d&&(this._conversationManager.deleteTagStatus(n,r,t,s),this._conversationManager.setConversationUpdatedTime(d.version)),[2,{code:h}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getConversationListByTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,s=i._connMgr,o=s.codec.encodeOldConversationList({count:n,type:te.PRIVATE,startTime:t}),a=new Lr(qi,o,r),[4,s.send(a,As,{currentUserId:r,connectedTime:s.getConnectedTime()})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,c!==$.SUCCESS?[2,{code:c}]:(d=this._conversationHasTagFilter(e,null==h?void 0:h.list),[2,{code:c,data:d}])}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,i=[],r=[];function s(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var s=t.conversationType,o=t.targetId,a=t.channelId,c=n._conversationManager.get(s,o,a),l=c.hasMentioned,h=c.mentionedInfo,d=c.lastUnreadTime,p=c.notificationStatus,g=c.isTop,_=c.tags,f=c.unreadMessageCount,E=_&&_[e];if(E){var T=u(u({},t),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:f});E.isTop?i.push(u(u({},T),{isTopInTag:!0})):r.push(u(u({},T),{isTopInTag:!1}))}})),i.sort(s),r.sort(s),h(h([],i,!0),r,!0)},t.prototype.getUnreadCountByTag=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:$.SUCCESS,data:n}]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this._isConnected?[2,this._conversationManager.pushTask((function(r){return c(i,void 0,void 0,(function(){var i,s,o,a,u,c,h,d,p,g,_,f;return l(this,(function(l){switch(l.label){case 0:return i=t.targetId,s=t.conversationType,o=t.channelId,a=n.isTop,u=[{tagId:e,isTop:a}],(c=this._conversationManager.get(s,i,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(h=this._connMgr.codec.encodeUpdateConversationTag(u,[t],r),d=new Lr(Dr[Dr.addTag],h,this.currentUserId),[4,this._connMgr.send(d,go)]):[2,{code:$.NO_TAG_IN_CONVER}];case 1:return p=l.sent(),g=p.code,_=p.data,g===$.SUCCESS&&_&&((f={})[e]={},a&&(f[e].isTop=!0),this._conversationManager.addTagStatus(s,i,f,o),this._conversationManager.setConversationUpdatedTime(_.version)),[2,{code:g}]}}))}))}))]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getTagsForConversation=function(e){var t;return c(this,void 0,void 0,(function(){var n,i,r,s;return l(this,(function(o){if(!this._isConnected)return[2,{code:$.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(s in n.tags)r.push({tagId:s,tagName:null===(t=i[s])||void 0===t?void 0:t.tagName});return[2,{code:$.SUCCESS,data:r}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:$.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===te.ULTRA_GROUP?(null===(t=this._ultraGroupMap[e.channelId+"_"+e.targetId])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.conversationType,e.targetId,e.channelId),n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:$.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===te.ULTRA_GROUP)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var i;if(!(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:$.SUCCESS,data:ce.NOT_SET});var r=i.notificationLevel;return vt(i.notificationLevel)&&!vt(i.notificationStatus)&&(r=ae.OPEN===i.notificationStatus?1:0),Promise.resolve({code:$.SUCCESS,data:r})},t.prototype.getConversationNotificationStatus=function(e,t,n){var i;return(i=e===te.ULTRA_GROUP?this._ultraGroupManager.get(te.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:$.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:$.SUCCESS,data:ae.CLOSE})},t.prototype.setConversationTypeNotificationLevel=function(e,t){var n;return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,s=i._connMgr,o=this._conversationManager.getConversationUpdatedTime(),a=s.codec.encodeSetConversationTypeLevel(e,o,t),u=new Lr(Dr[Dr.setTypeUnpush],a,r),[4,s.send(u,fo)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==$.SUCCESS?[2,{code:h}]:(p=d,this._conversationManager.setConversationUpdatedTime(p.version),e===te.ULTRA_GROUP?null===(n=this._ultraGroupManager)||void 0===n||n.addUltraGroupStatus({conversationType:e,targetId:"",notificationLevel:t,channelId:""}):this._conversationManager.addStatus({conversationType:e,targetId:"",channelId:"",updatedTime:p.version,notificationLevel:t},!0),[2,{code:$.SUCCESS}])}}))}))},t.prototype.getConversationTypeNotificationLevel=function(e){if(e===te.ULTRA_GROUP){var t=this._ultraGroupManager.get(e,"","");return Promise.resolve({code:$.SUCCESS,data:t.notificationLevel||0})}var n=this._conversationManager.get(e,"","");return Promise.resolve({code:$.SUCCESS,data:n.notificationLevel||0})},t.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,s){return this.getHistoryMessage(e,t,n,i,r,s)},t.prototype.getUltraGroupList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s=this;return l(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&&lt(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,i=e.unreadMentionedMeCount;return t=s._getUnreadCount(t),n=s._getUnreadCount(n),i=s._getUnreadCount(i),u(u({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Xu(i),r=Pn(i),[2,{code:$.SUCCESS,data:r}]):[2,{code:$.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===ae.OPEN||e.notificationLevel>0)&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:te.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:$.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=t._ultraGroupMap[i];e.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:t._getUnreadCount(r.unreadMessageCount),mentionedCount:t._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:$.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:$.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 t=this._getUnreadCount(t),Promise.resolve({code:$.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),c(this,void 0,void 0,(function(){var n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:te.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(r=new Nr(Dr[Dr.updUgRTime],i,this.currentUserId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,$.RC_NET_UNAVAILABLE]:[2,Promise.resolve($.METHOD_NOT_AVAILABLE)];case 1:return(s=a.sent().code)===$.SUCCESS&&((o=this._ultraGroupMap[t+"_"+e])&&(o.unreadMessageCount=0,o.unreadMentionedCount=0,o.unreadMentionedMeCount=0,o.lastReadTime=n),o&&o.firstUnreadMessage&&(o.firstUnreadMessage=null)),[2,s]}}))}))},t.prototype._getUltraGroupList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d,p,g,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new Lr(Dr[Dr.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,As,{currentUserId:this.currentUserId,conversationType:te.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,s=i.data,r===$.SUCCESS&&s?(a=s.list,u=s.isFinished,a.forEach((function(e){e.notificationStatus=ae.CLOSE,e.notificationLevel=ce.NOT_SET,e.isTop=!1,_._ultraGroupMap[e.channelId+"_"+e.targetId]=e,_._ultraGroupManager.addUltraGroupStatus(e)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(fe.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: "+r+", try again"),o=setTimeout((function(){_._getUltraGroupList(e),clearTimeout(o)}),3e3),[2]);case 2:return this.logger.info(fe.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==$.SUCCESS&&this.logger.warn(fe.O,"pullConversationStatus fail code: "+d+", data: "+p),g=Object.values(this._ultraGroupMap),g=Xu(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Pn(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.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(),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._notificationOnline=function(){return c(this,void 0,void 0,(function(){var e,t,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=r.sent(),t=e.code,n=e.data,t===$.SUCCESS&&n?(this.logger.info(fe.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(fe.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new Lr(Dr[Dr.pullUgMsg],t,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(fe.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),i),[4,this._connMgr.send(n,Es,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP}})];case 1:return r=l.sent(),s=r.code,o=r.data,s===$.SUCCESS&&o?(a=o.list,u=o.syncTime,c=a.map((function(e){return e.messageUId})).join(","),this.logger.info(fe.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,messageUIds:c,timestamp:e,syncTime:u}),i)):this.logger.warn(fe.L_PULL_ULTRA_MSG_R,JSON.stringify({code:s,timestamp:e}),i),[2,{code:s,data:o}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var i,r,s,o=e.targetId,a=e.messageType,u=e.channelId,c=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,p=e.content,g=e.isMentioned,_=this._ultraGroupMap[u+"_"+o],f=_||{conversationType:te.ULTRA_GROUP,targetId:o,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ae.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==se.RECALL&&(f.unreadMessageCount+=1,f.unreadMentionedCount+=t,f.firstUnreadMessage||(f.firstUnreadMessage={sentTime:h}),g&&(null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.type)!==he.ALL&&(null===(s=null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===s?void 0:s.includes(this.currentUserId))&&(f.unreadMentionedMeCount+=1)),f.versionTime=n,f.latestMessage=e,f.channelType=l,_||(this._ultraGroupMap[u+"_"+o]=f),f},t.prototype._syncUltraMsg=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=l.sent(),n=t.code,i=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===$.SUCCESS&&i?(r=i.list,s=i.syncTime,o=i.finished,a={},u=[],r.forEach((function(e){var t,n,i,r=e.targetId,o=e.content,c=e.messageUId,l=e.channelId,d=e.isMentioned;if(h._ultraMsgMap[c])delete h._ultraMsgMap[c];else{var p=0;d&&((null===(t=null==o?void 0:o.mentionedInfo)||void 0===t?void 0:t.type)===he.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(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(e,p,s);a[l+"_"+r]=g,h._ultraGroupManager.addUltraGroupStatus(g),u.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(fe.O,"notice ultragroups"),c=Object.values(a),c=Xu(c),this._watcher.conversation(Pn(c))),this.logger.debug(fe.O,"notice ultragroup message"),this._batchMessage(u),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>s})),this._lastSyncUltraMsgTimeStamp=s,o?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(s)),[2]):(this._syncUltraMsg(s),[2])):[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,c,h,d,p,g,_,f,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(fe.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),r=t.messageId?t.messageId:dn(),t.messageId=r,s=this._connMgr.codec.encodeUpMsg({conversationType:te.ULTRA_GROUP,targetId:e},t),(o=new Nr(Dr[Dr.ugMsg],s,e)).setHeaderQos(vi.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),c=Ju(te.ULTRA_GROUP,e,u({},t),"",a,this.currentUserId,r),n&&n(r),this.logger.info(fe.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:te.ULTRA_GROUP,targetId:e,channelId:t.channelId}),i),h=Date.now(),[4,this._connMgr.send(o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,p!==$.SUCCESS?(this.logger.warn(fe.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:c.messageUId,messageId:c.messageId}),i),this._writeMessagesLog(te.ULTRA_GROUP)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),c.sentStatus=ye.FAILED,[2,{code:p,data:c}]):(this.logger.info(fe.L_SEND_MSG_R,JSON.stringify({code:p,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),_=g,this._writeMessagesLog(te.ULTRA_GROUP,_.messageUId)&&this.statisticLog.record(Ee.IM_MSG_SEND,JSON.stringify({msg_id:_.messageUId,channel:te.ULTRA_GROUP,start_ts:h,client_ts:Date.now(),server_deltatime:Date.now()-this._connMgr.getCrtServerTime(),cod:p})),c.sentTime=_.timestamp,c.messageUId=_.messageUId,this._ultraMsgMap[_.messageUId]=_.timestamp,f=t.channelId||"",(E=this._ultraGroupMap[f+"_"+e])?(E.latestMessage=c,lt(E.channelType)&&(c.channelType=E.channelType)):(E={conversationType:te.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:ae.CLOSE,notificationLevel:ce.NOT_SET,isTop:!1},this._ultraGroupMap[f+"_"+e]=E,this._ultraGroupManager.addUltraGroupStatus(E)),this._watcher.conversation(Pn([E])),[2,{code:p,data:c}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,i=e.channelId,r=e.targetId,s=this._connMgr.codec.encodeOperateStatus(r,n,i||"",t||0),(o=new Nr(Dr[Dr.operate],s,r)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(o)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==$.SUCCESS?[2,{code:a,msg:$[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:$.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(i=new Lr(Dr[Dr.qryMsg],n,this.currentUserId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(i,xo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),s=r.code,o=r.data,s!==$.SUCCESS?[2,{code:s,msg:$[s]}]:(a=(o||{}).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._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,Ho),n=t.conversationType,i=t.info,r=t.summary;this.logger.debug(fe.O,"s_opNtf -> type: "+n+", info: "+i+", summary: "+r),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new Lr(Dr[Dr.upMsgEx],t,e.targetId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==$.SUCCESS?[2,{code:i,msg:$[i]}]:[2,{code:i}]}}))}))},t.prototype.modifyMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new Lr(Dr[Dr.modifyMsg],t,e.targetId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,s=i.data,r!==$.SUCCESS?[2,{code:r,msg:$[r]}]:(o=s,this._ultraMsgMap[o.messageUId]=o.timestamp,[2,{code:r}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new Lr(Dr[Dr.qryMsgChange],t,this.currentUserId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(n,Go)]):[2];case 1:return i=l.sent(),r=i.code,s=i.data,this._isPullingUltraChangeMessage=!1,r===$.SUCCESS&&s?(o=s.hasNext,a=s.list,u=(null==s?void 0:s.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(e){return e>u})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,c),o?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},t.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=xe.CHANNEL_CHANGE,i=xe.MSG_RECALL,r=xe.MSG_EXPANSION,s=xe.MSG_MODIFY,o=xe.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[i]&&this._handleMsgRecall(t[i]),t[r]&&this._handleMsgUpdate(t[r]),t[s]&&this._handleMsgUpdate(t[s]),t[o]&&this._handleUserGroupStatus(t[o])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],i=[],r=[];e.forEach((function(e){var s=e.subChangeType,o=e.targetId,a=e.channelId,u=e.sendTime,c=e.operatorId,l=a+"_"+o,h=t._ultraGroupMap[l];if(h){var d=Fe.PUBLIC_TO_PRIVATE,p=Fe.PRIVATE_TO_PUBLIC,g=Fe.PUBLIC_TO_PRIVATE_USER_NOT_IN,_=Fe.CHANNEL_DELETE,f=Fe.CHANNEL_USER_KICKED;switch(s){case p:h.channelType=Be.PUBLIC,n.push({targetId:o,channelId:a,changeType:ke.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Be.PRIVATE,n.push({targetId:o,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:o,channelId:a,changeType:ke.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case _:i.push({targetId:o,channelId:a,channelType:h.channelType,deleteTime:u}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:o,channelId:a,userId:c,channelType:Be.PRIVATE}),c===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},t.prototype._handleMsgRecall=function(e){var t=this,i=[];e.forEach((function(e){var r=e.targetId,s=e.channelId,o=e.messageUId,a=e.sendTime,u=e.conversationType,c=e.operatorId,l=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,s,o,a,l),i.push({targetId:r,conversationType:u,sentTime:a,messageUId:o,senderUserId:c,channelId:s,content:{conversationType:u,targetId:r,messageUId:o,channelId:s},messageDirection:1,messageType:se.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:n.UNREAD,receivedStatusInfo:Dn(n.UNREAD)})})),this._watcher.ultraGroupMessageRecalled(i)},t.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,i=e.conversationType,r=e.sendTime,s=e.messageUId,o=e.channelId,a=i+"_"+n;t[a]||(t[a]=[]),t[a].push({messageUId:s,channelId:o,sendTime:r})})),t){var i=n.split("_"),r=i.shift(),s=i.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:s,conversationType:Number(r),messages:h([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(i=new Lr(Dr[Dr.qryMsg],n,this.currentUserId)).setHeaderQos(vi.AT_LEAST_ONCE),[4,this._connMgr.send(i,xo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),s=r.code,o=r.data,s!==$.SUCCESS?[2,{code:s,msg:$[s]}]:(a=(o||{}).list,u=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,i=e.messageUId,r=c._ultraGroupMap[n+"_"+t];r&&r.latestMessage.messageUId===i&&(r.latestMessage=e),u.push(e)})),e===xe.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),e===xe.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d;return l(this,(function(l){return t=He.REMOVE_USER_GROUP,n=He.JOIN_USER_GROUP,i=He.EXIT_USER_GROUP,r=He.CHANNEL_BIND_USER_GROUP,s=He.CHANNEL_UNBIND_USER_GROUP,o=[],a=[],u=[],c=[],h=[],e.forEach((function(e){var l=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,_=e.channelId;switch(e.subChangeType){case t:o.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:u.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:c.push({conversation:{conversationType:l,targetId:d,channelId:_},channelType:g,userGroupIds:p});break;case s:h.push({conversation:{conversationType:l,targetId:d,channelId:_},channelType:g,userGroupIds:p})}})),d={},o.length>0&&(d.userGroupDisband=o),a.length>0&&(d.userAdded=a),u.length>0&&(d.userRemoved=u),c.length>0&&(d.userGroupBindChannel=c),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var i;return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(e,t),s=new Lr(Dr[Dr.qryUgMsg],r,this.currentUserId),this.logger.info(fe.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:te.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(s,ms,{currentUserId:this.currentUserId,conversation:{conversationType:te.ULTRA_GROUP,targetId:e}})]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=l.sent(),a=o.code,u=o.data,a===$.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(e){e&&c.push(e.messageUId)})),this.logger.info(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(fe.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),r=new Lr(Dr[Dr.ugUnpushSet],i,e),[4,this._connMgr.send(r)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return s=a.sent(),o=s.code,$.SUCCESS,[2,{code:o}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),r=new Lr(Dr[Dr.ugUnpushQuery],i,e),[4,n.send(r,Ro)]):[2,{code:$.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})];case 1:return s=c.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?(u=a.unpushLevel,[2,{code:o,data:u}]):[2,{code:o}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,i,r){var s=t+"_"+e;if(this._ultraGroupMap[s]){var o=this._ultraGroupMap[s],a=o.latestMessage,u=o.lastReadTime;a&&a.messageUId===n&&(o.latestMessage=null),i&&u<i&&o.unreadMessageCount>0&&(--o.unreadMessageCount,(r===qe.ALL||r===qe.ME)&&o.unreadMentionedCount>0&&--o.unreadMentionedCount,r===qe.ME&&o.unreadMentionedCount>0&&--o.unreadMentionedMeCount,this._watcher.conversation(Pn([o])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:$.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new Lr(Dr[Dr.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,vo)]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return i=o.sent(),r=i.code,s=i.data,r===$.SUCCESS&&s?[2,{code:r,data:s}]:[2,{code:r}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,i=this._ultraGroupMap[n+"_"+t]||{},r=i.firstUnreadMessage||null,[2,{code:$.SUCCESS,data:r}]):[2,Promise.resolve({code:$.METHOD_NOT_AVAILABLE})]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.subscribeUser=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return this._isConnected?[2,this._subscribeManager.updateSubscribeRelation(e,t,$e.SUBSCRIBE,n)]:[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.unSubscribeUser=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return this._isConnected?[4,this._subscribeManager.updateSubscribeRelation(e,t,$e.UNSUBSCRIBE)]:[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return[2,{code:n.sent().code}]}}))}))},t.prototype.getSubscribeUserList=function(e,t,n){var i;return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){return this._isConnected?(r=null===(i=this._subscribeManager)||void 0===i?void 0:i.getSubscribeUserList(e,t,n),[2,Promise.resolve({code:$.SUCCESS,data:r})]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getSubscribeUserStatus=function(e,t){var n;return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return this._isConnected?(i=null===(n=this._subscribeManager)||void 0===n?void 0:n.getSubscribeUserStatus(e,t),[2,Promise.resolve({code:$.SUCCESS,data:i})]):[2,{code:$.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),i=new Lr(Dr[Dr.setRtcRoomId],n,t),[4,this._connMgr.send(i)]):[2,$.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),[2,r.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(r=i instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(i)):i,s=n?new Lr(t,r,e):new Nr(t,r,e),[4,this._connMgr.send(s)]):[2,{code:$.RC_NET_UNAVAILABLE}];case 1:return o=c.sent(),a=o.code,u=o.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=Ea(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Dr[Dr.rtcPing],!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s!==$.SUCCESS?[2,{code:s}]:((a=this.rtcCodec.decode(Sn.RtcOutput,o)).version=sn(a.version),[2,{code:s,data:a}])}}))}))},t.prototype.getDeviceId=function(){return Bt(this.runtime)},t.prototype.getOSInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:$.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){Ua(),vu()},t.prototype.callExtra=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.getContinuousMessages=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.removeFromBlacklist=function(e){return Promise.resolve($.NOT_SUPPORT)},t.prototype.getBlacklist=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.batchClearMessagesByTimestamp=function(e){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentAndMessageType=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.searchMessagesByUser=function(e,t,n,i,r,s){throw new Error("Method not implemented.")},t.prototype.getMessagesByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,s,o){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.updateMessageReceiptStatus=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearData=function(){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(t,n),[4,i.send(new Lr(Ji,r,e),Qo)]):[3,2];case 1:return s=u.sent(),o=s.code,a=s.data,o===$.SUCCESS&&a?[2,Promise.resolve({code:o,data:{key:a.key,value:a.dataContent}})]:[2,Promise.resolve({code:o})];case 2:return[2,Promise.resolve({code:$.RC_NET_CHANNEL_INVALID})]}}))}))},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setCheckChatRoomDuplicateMessage=function(e){throw new Error("Method not implemented.")},t.prototype.getConversations=function(e){throw new Error("Method not implemented.")},t.prototype.setProxy=function(e){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:$.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:$.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){var n;if(this._connMgr.setNetwork(e,t),e.status&&this.cloudControllerUri){var i=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,Cu.newWorkChange,i)}},t}(li),zu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.joinRTCRoom=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return o=Ea(this._context.rtcCodec,t,n,i,r,s),[4,this.rtcSignaling(e,xn,!0,o)];case 1:return a=l.sent(),u=a.code,c=a.buffer,u===$.SUCCESS&&c&&(h=Ta(this._context.rtcCodec,c)),[2,{code:u,data:h}]}}))}))},t.prototype.quitRTCRoom=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(Sn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Fn,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Sn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Hn,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(s=this._context.rtcCodec.decode(Sn.RtcRoomInfoOutput,r)),[2,{code:i,data:s}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o;return l(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(Sn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,qn,!0,t)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r&&(o=Ta(this._context.rtcCodec,r),s={users:o.users}),[2,{code:i,data:s}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Sn.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Yn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Sn.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,Kn,!1,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,i,r,s){return c(this,void 0,void 0,(function(){var o;return l(this,(function(a){switch(a.label){case 0:return o=this._context.rtcCodec.encode(Sn.RtcSetDataInput,{interior:i,target:r,key:t,value:n,objectName:null==s?void 0:s.name,content:null==s?void 0:s.content}),[4,this.rtcSignaling(e,jn,!1,o)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){var s,o;return l(this,(function(a){switch(a.label){case 0:return s={objectName:i,content:this._context.rtcCodec.encode(Sn.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(Sn.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(Sn.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},o=this._context.rtcCodec.encode(Sn.RtcUserSetDataInput,s),[4,this.rtcSignaling(e,Qn,!0,o)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){switch(r.label){case 0:return i=this._context.rtcCodec.encode(Sn.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(Sn.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,Qn,!0,i)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(Sn.RtcDataInput,{interior:n,target:i,key:t}),[4,this.rtcSignaling(e,Wn,!0,r)];case 1:return s=l.sent(),o=s.code,a=s.buffer,o===$.SUCCESS&&a?(u=this._context.rtcCodec.decode(Sn.RtcQryOutput,a).outInfo,c={},u.forEach((function(e){c[e.key]=e.value})),[2,{code:o,data:c}]):[2,{code:o}]}}))}))},t.prototype.removeRTCData=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s;return l(this,(function(o){switch(o.label){case 0:return s=this._context.rtcCodec.encode(Sn.RtcDataInput,{interior:n,target:i,key:t,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(e,Jn,!1,s)];case 1:return[2,o.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=Ea(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,Xn,!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=this._context.rtcCodec.decode(Sn.RtcTokenOutput,o).rtcToken,[2,{code:s,data:{rtcToken:a}}]):[2,{code:s}]}}))}))},t.prototype.setRTCState=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return n=this._context.rtcCodec.encode(Sn.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,Zn,!0,n)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Sn.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,zn,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(s=Ta(this._context.rtcCodec,r),[2,{code:i,data:s}]):[2,{code:i}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a,u,c;return l(this,(function(l){switch(l.label){case 0:return i=Ea(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,$n,!0,i)];case 1:return r=l.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=this._context.rtcCodec.decode(Sn.RtcViewerJoinedOutput,o),u=a.rtcToken,c=a.entries,[2,{code:s,data:{token:u,kvEntries:c}}]):[2,{code:s}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return c(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:return t=this._context.rtcCodec.encode(Sn.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,ei,!0,t)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(Sn.RtcInput,{roomType:et.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,ni,!0,i)];case 1:return r=u.sent(),s=r.code,o=r.buffer,s===$.SUCCESS&&o?(a=Ta(this._context.rtcCodec,o),[2,{code:s,data:a}]):[2,{code:s}]}}))}))},t.prototype.requestRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u;return l(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteTimeout,s=e.inviteInfo,o=e.roomId,a=this._context.rtcCodec.encode(Sn.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:s}),[4,this.rtcSignaling(o,ii,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},t.prototype.cancelRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,i=e.inviteSessionId,r=e.inviteInfo,s=e.roomId,o=this._context.rtcCodec.encode(Sn.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(s,ri,!0,o)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,i=e.inviteSessionId,r=e.content,s=e.key,o=e.value,a=e.agree,u=e.roomId,c=this._context.rtcCodec.encode(Sn.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:i,content:r,key:s,value:o,answerCode:a?1:0}),[4,this.rtcSignaling(u,si,!0,c)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},t.prototype.endRoomPK=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.endRoomId,n=e.sessionId,i=e.content,r=e.keys,s=e.roomId,o=this._context.rtcCodec.encode(Sn.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(s,oi,!0,o)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.registerRTCSignalListener=function(e){this._context.registerRTCSignalingListener(e)},t.prototype.rtcSignaling=function(e,t,n,i){return this._context.rtcSignaling(e,t,n,i)},t.prototype.getRTCJoinedUserInfo=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s;return l(this,(function(o){switch(o.label){case 0:return t=this._context.rtcCodec.encode(Sn.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",ai,!0,t)];case 1:return n=o.sent(),i=n.code,r=n.buffer,i===$.SUCCESS&&r?(s=this._context.rtcCodec.decode(Sn.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:s.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:sn(e.joinTime)}}))}]):[2,{code:i}]}}))}))},t}(Oi);function $u(e){return u({},e)}var ec=function(){function e(e,t){var n,i;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[se.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[se.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[se.INTERCEPT]=this._processInterceptMessage.bind(this),n[se.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[se.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[se.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[se.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[se.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[se.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),i),this._watcher={message:void 0,batchMessage:void 0,conversationState:void 0,chatroomState:void 0,connection:void 0,expansion:void 0,tag:void 0,conversationTagChanged:void 0,pullFinished:void 0,readReceiptReceived:void 0,messageReceiptRequest:void 0,messageReceiptResponse:void 0,typingState:void 0,messageBlocked:void 0,ultraGroupEnable:void 0,operateStatus:void 0,ultraGroupMessageExpansionUpdated:void 0,ultraGroupMessageModified:void 0,ultraGroupMessageRecalled:void 0,messageDelivered:void 0,groupMessageDeliveredStatus:void 0,ultraGroupChannelChangeType:void 0,ultraGroupChannelUserKicked:void 0,ultraGroupChannelDelete:void 0,userGroupStatus:void 0,messageReadReceipt:void 0,syncReadStatus:void 0,subscribedUserStatusChange:void 0,subscribedRelationChange:void 0,syncSubscribedUserStatusFinished:void 0},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=u({},t),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,iu.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,iu.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,iu.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,iu.DISCONNECTED),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),messageDelivered:this._messageDeliveredListerer.bind(this),groupMessageDeliveredStatus:this._groupMessageDeliveredStatusListerer.bind(this),callInfo:this._callInfoListener.bind(this),ultraGroupChannelChangeType:this._ultraGroupChannelChangeTypeListener.bind(this),ultraGroupChannelUserKicked:this._ultraGroupChannelUserKickedListener.bind(this),ultraGroupChannelDelete:this._ultraGroupChannelDeleteListener.bind(this),onNaviDataChange:this._naviDataChange.bind(this),userGroupStatus:this._userGroupStatusListener.bind(this),messageReadReceipt:this._messageReadReceipt.bind(this),syncReadStatus:this._syncReadStatus.bind(this),subscribedUserStatusChange:this._subscribedUserStatusChange.bind(this),subscribedRelationChange:this._subscribedRelationChange.bind(this),syncSubscribedUserStatusFinished:this._syncSubscribedUserStatusFinished.bind(this)};this.rtcCodec=this.createCodec(ui,ci),this._engine=Ln()?new RCCppEngine(e,this.rtcCodec,r,this._options):new Zu(e,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new kn(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(fe.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(fe.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(fe.L_IMSDK_VER_O,JSON.stringify({commitId:"ac04313edeb4b97f5b9015d75bbe9396b2781d95",version:"5.9.9"}));var i=this._context._engine;return t.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},e.getContext=function(){return this._context},e.prototype.getOptions=function(){return this._options},e.destroy=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(fe.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new gi(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(fe.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(fe.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var i="RCRTC"===e.tag?new zu(this):new Oi(this),r=null;try{if(!e.verify(this._runtime))return null;r=e.setup(i,this._runtime,t)}catch(e){this.logger.error(fe.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[e.tag]=r),r},e.prototype._onConnectionStatusChange=function(e,t){var n,i;this.logger.warn(fe.A_CONNECT_S,"status: "+e+", code: "+t),null===(i=(n=this._watcher).connection)||void 0===i||i.call(n,e,t),this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,e,t)}))},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={},n=e.content.memberCount,i=void 0===n?0:n;Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){t[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId,memberCount:i}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo($u(e)),this._watcher.typingState)return!0},e.prototype._processInterceptMessage=function(e){var t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===te.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===Re.MSG_EXPANSION||n===Re.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(fe.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._processChrmSyncMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBlockMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:e.content.chatroomId,operateType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBanMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:e.content.chatroomId,banType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processReadReceiptMessage=function(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime,e.senderUserId)},e.prototype._processReadReceiptRequestMessage=function(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)},e.prototype._processReadReceiptResponseMessage=function(e){var t,n=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[i])},e.prototype._messageReceiver=function(e,t,n){var i,r,s,o,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[e.messageType])||void 0===r?void 0:r.call(i,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage($u(e))}catch(e){return a.logger.error(fe.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}})))return null===(o=(s=this._watcher).message)||void 0===o||o.call(s,$u(e),t,n),e},e.prototype._batchMessageReceiver=function(e,t,n){var i=this,r=[],s=[],o=[se.READ_RECEIPT,se.READ_RECEIPT_REQUEST,se.READ_RECEIPT_RESPONSE];e.forEach((function(e){var a=i._messageReceiver(e,t,n);a&&o.includes(a.messageType)?s.push(a):a&&r.push(a)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(fe.L_BATCH_MESSAGE_O,r.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(r)),s.length&&s.forEach((function(e){i._messageProccessor[e.messageType]&&i._messageProccessor[e.messageType](e)}))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(fe.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._messageReadReceipt=function(e){var t,n;null===(n=(t=this._watcher).messageReadReceipt)||void 0===n||n.call(t,e)},e.prototype._syncReadStatus=function(e){var t,n;null===(n=(t=this._watcher).syncReadStatus)||void 0===n||n.call(t,e)},e.prototype._subscribedUserStatusChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedUserStatusChange)||void 0===n||n.call(t,e)},e.prototype._subscribedRelationChange=function(e){var t,n;null===(n=(t=this._watcher).subscribedRelationChange)||void 0===n||n.call(t,e)},e.prototype._syncSubscribedUserStatusFinished=function(){var e,t;this.logger.info(fe.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S),null===(t=(e=this._watcher).syncSubscribedUserStatusFinished)||void 0===t||t.call(e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},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]=It(i)||Tt(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,s=e.channelId,o=r.typingContentType,a=n+"#"+i+"#"+(s||"");this._typingInfo[a]||(this._typingInfo[a]=[]);var u=this._typingInfo[a].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[a][u].messageType===o?this._typingInfo[a][u].timestamp=Date.now():(u>=0&&this._typingInfo[a].splice(u,1),this._typingInfo[a].push({userId:t,messageType:o,timestamp:Date.now()}),this._typingChangedList.includes(a)||this._typingChangedList.push(a),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.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},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._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var i,r;return c(this,void 0,void 0,(function(){var s,o,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._token=e,[4,this._runtime.getNetworkType()];case 1:return s=l.sent(),this._engine.setNetwork({status:!0,type:s},!0),o=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(e,t,o,n)];case 2:return a=l.sent(),u=a.code,c=a.data,u!==$.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=Dt.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:u,userId:c}])}}))}))},e.prototype.disconnect=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(fe.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype._channelIdConvert=function(e,t){if(e!==te.ULTRA_GROUP)return t;var n=this.getNaviInfoFromCache();return!!(2&((null==n?void 0:n.ugDriven)||0))&&!t?"RCDefault":t},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),dt(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[e]=i),this._engine.registerMessageType(e,t,n,i,r)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],i={};return n&&Tt(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var r=t[e];lt(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[e]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:$.SEARCH_PROPS_LIMIT_ERROR}:{code:$.SUCCESS}},e.prototype._handleExpansioResult=function(e){var t=Lt(e),n=t.isIllgalEx,i=t.isExKeyOrValLengthExceedLimit;return t.isExceedLimit||i?$.EXPANSION_LIMIT_EXCEET:n?$.INVALID_PARAMETER_MESSAGE_EXPANSION:void 0},e.prototype.sendMessage=function(e,t,n,i,r){var s=this.checkSearchPropsMsg(n.messageType,n.content),o=s.code,a=s.msg;if(o!==$.SUCCESS)return Promise.resolve({code:o,msg:a});if(e===te.SYSTEM&&n.messageType!==se.SYNC_READ_STATUS)return Promise.resolve({code:$.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(e!==te.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(0!==((null==u?void 0:u.grpRRVer)||0)&&n.messageType===se.READ_RECEIPT_RESPONSE)return Promise.resolve({code:$.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,h=n.expansion;if(l){var d=this._handleExpansioResult(h);if(d)return Promise.resolve({code:d})}var p,g,_=JSON.stringify(n.content);return p=_,void 0===g&&(g="utf-8"),("utf-16"===g?f(p):E(p))>N?Promise.resolve({code:$.RC_MSG_CONTENT_EXCEED_LIMIT}):e===te.ULTRA_GROUP?(n.channelId=this._channelIdConvert(e,n.channelId),this._engine.sendUltraMessage(t,n,i,r)):this._engine.sendMessage(e,t,n,i,r)},e.prototype.sendExpansionMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return t=e.channelId,n=e.conversationType,i=e.targetId,r=e.messageUId,s=e.keys,o=e.expansion,a=e.removeAll,e.canIncludeExpansion?(u=Lt(o),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:$.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:$.INVALID_PARAMETER_MESSAGE_EXPANSION})]:(d={mid:r},o&&(d.put=o),s&&(d.del=s),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:se.EXPANSION_NOTIFY,channelId:t})])):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.READ_RECEIPT_ERROR,msg:"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 c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),1!==((null==i?void 0:i.grpRRVer)||0)?[2,{code:$.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n||"")]}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.sendReadReceiptMessageV4(e,t,n)]}))}))},e.prototype.getMessageReadReceiptV4=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getMessageReadReceiptV4(e,t)]}))}))},e.prototype.batchGetMessageReadReceiptInfoV4=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchGetMessageReadReceiptInfoV4(e,t)]}))}))},e.prototype.updateConversationReadTime=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.updateConversationReadTime(e,t)]}))}))},e.prototype._destroy=function(){return c(this,void 0,void 0,(function(){var e=this;return l(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return t.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondestroy)try{t.ondestroy()}catch(t){e.logger.error(fe.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,i,r,s,o,a){var u={timestamp:n||0,count:i||20,order:r||0,channelId:s||""};if(e===te.ULTRA_GROUP){var c=this._channelIdConvert(e,u.channelId);return u.channelId=c,this._engine.getUltraHistoryMsg(t,u,a)}return this._engine.getHistoryMessage(e,t,u.timestamp,u.count,u.order,u.channelId,o||"",a)},e.prototype.getMessages=function(e,t,n,i,r,s,o){var a={timestamp:n||0,count:i||20,order:r||0,channelId:s||""};if(e===te.ULTRA_GROUP){var u=this._channelIdConvert(e,a.channelId);return a.channelId=u,this._engine.getUltraHistoryMsg(t,a,o)}return this._engine.getMessages(e,t,a.timestamp,a.count,a.order,a.channelId,o)},e.prototype.getContinuousMessages=function(e,t,n,i,r,s){return void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===s&&(s=""),this._engine.getContinuousMessages(e,t,n,i,r,s)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,i,r,s,o){return this._engine.getHistoryMessagesByObjectNames(e,t,n,i,r,s,o)},e.prototype.getConversationList=function(e,t,n,i,r){if(t===te.ULTRA_GROUP){var s=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:s,msg:$[s]})}return this._engine.getConversationList(e||300,t,n,i,r||"")},e.prototype.getConversationsByPage=function(e,t,n,i,r){return this._engine.getConversationsByPage(e,t,n,i,r)},e.prototype.getConversation=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversation(e,t,i||"")},e.prototype.removeConversation=function(e,t,n){return e===te.ULTRA_GROUP?Promise.resolve($.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n||"")},e.prototype.batchRemoveConversation=function(e){return this._engine.batchRemoveConversation(e)},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){if(e===te.ULTRA_GROUP){var i=this._channelIdConvert(e,n);return this._engine.clearUltraUnreadcount(t,i||"")}return this._engine.clearConversationUnreadCount(e,t,n||"")},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationUnreadCount(e,t,i||"")},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(te.ULTRA_GROUP)){var i=$.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:$[i]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[te.PRIVATE,te.GROUP,te.SYSTEM,te.PUBLIC_SERVICE],!!n)},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){return this._engine.getTotalUnreadCountByLevels(e,t,n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._engine.getFirstUnreadMessage(e,t,n||"")},e.prototype.getFirstUnreadMessageInfo=function(e,t,n){return this._engine.getFirstUnreadMessageInfo(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(s){return r=this._channelIdConvert(e,i),[2,this._engine.setConversationNotificationLevel(e,t,n,r||"")]}))}))},e.prototype.batchSetConversationNotificationLevel=function(e,t){return this._engine.batchSetConversationNotificationLevel(e,t)},e.prototype.setConversationStatus=function(e,t,n,i,r,s){if(void 0===s&&(s=!0),e===te.ULTRA_GROUP&&void 0!==n)return Promise.resolve($.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:i,channelId:this._channelIdConvert(e,r)||"",isUpdateTime:s}];return this._engine.batchSetConversationStatus(o)},e.prototype.batchSetConversationToTop=function(e,t,n){return this._engine.batchSetConversationToTop(e,t,!!n)},e.prototype.saveConversationMessageDraft=function(e,t,n,i){var r=this._channelIdConvert(e,i);return this._engine.saveConversationMessageDraft(e,t,n,r||"")},e.prototype.getConversationMessageDraft=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationMessageDraft(e,t,i||"")},e.prototype.clearConversationMessageDraft=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.clearConversationMessageDraft(e,t,i||"")},e.prototype.recallMessage=function(e,t,n,i,r){var s=this._channelIdConvert(e,r.channelId);return r.channelId=s||"",this._engine.recallMsg(e,t,n,i,r)},e.prototype.deleteRemoteMessage=function(e,t,n,i){if(e===te.ULTRA_GROUP&&Ln())return Promise.resolve($.METHOD_NOT_SUPPORT);var r=this._channelIdConvert(e,i);return this._engine.deleteRemoteMessage(e,t,n,r||"")},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,i){var r=this._channelIdConvert(e,i);return this._engine.deleteRemoteMessageByTimestamp(e,t,n,r||"")},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 this._engine.getChatroomInfo(e,t||0,n||0)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,i=t.value;return ln(n)?hn(i)?this._engine.setChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_VALUE):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n],r=i.key,s=i.value;if(!ln(r))return Promise.resolve({code:$.INVALID_PARAMETER_KEY});if(!hn(s))return Promise.resolve({code:$.INVALID_PARAMETER_VALUE})}var o=u(u({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,o)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,i=t.value;return ln(n)?hn(i)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_VALUE):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return ln(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var i=t.entries[n].key;if(!ln(i))return Promise.resolve({code:$.INVALID_PARAMETER_KEY})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return ln(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve($.INVALID_PARAMETER_KEY)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,i){return this._engine.getChatroomHistoryMessages(e,i||0,t||20,n||0)},e.prototype.getFileToken=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){var s,o,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return s=this.getNaviInfoFromCache(),o=(null==s?void 0:s.bosAddr)||"",a=(null==s?void 0:s.uploadServer)||"",u=(null==s?void 0:s.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,i,r)];case 1:return c=l.sent(),h=c.code,d=c.data,h===$.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:o,qiniu:a,ossConfig:u}))]:[2,Promise.reject(h)]}}))}))},e.prototype.getFileUrl=function(e,t,n,i,r){return void 0===r&&(r=pe.QINIU),c(this,void 0,void 0,(function(){var s,o,a;return l(this,(function(u){switch(u.label){case 0:return(null==i?void 0:i.isBosRes)?[2,Promise.resolve(i)]:[4,this._engine.getFileUrl(e,r,t,n)];case 1:return s=u.sent(),o=s.code,a=s.data,o===$.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(o)]}}))}))},e.prototype.createTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n,i=this;return l(this,(function(r){return t.length>1e3?[2,Promise.resolve({code:$.CONVER_OUT_LIMIT_ERROR})]:(n=t.map((function(e){var t=e.conversationType,n=e.targetId,r=e.channelId;return{conversationType:t,targetId:n,channelId:i._channelIdConvert(t,r)}})),[2,this._engine.addTagForConversations(e,n)])}))}))},e.prototype.removeTagForConversations=function(e,t){return c(this,void 0,void 0,(function(){var n,i=this;return l(this,(function(r){return n=t.map((function(e){var t=e.conversationType,n=e.targetId,r=e.channelId;return{conversationType:t,targetId:n,channelId:i._channelIdConvert(t,r)}})),[2,this._engine.removeTagForConversations(e,n)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return n=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=n,[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(e,t,n,i)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this._channelIdConvert(t.conversationType,t.channelId),t.channelId=i,[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._channelIdConvert(e.conversationType,e.channelId),e.channelId=t,[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(e,t){return e&&0!==e.length||(e=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t||"")},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[te.PRIVATE,te.CHATROOM,te.GROUP,te.SYSTEM,te.APP_PUBLIC_SERVICE,te.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},e.prototype.getUnreadMentionedCount=function(e){var t=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=t,this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==te.ULTRA_GROUP){var t=$.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:$[t]})}var n=this._channelIdConvert(e.conversationType,e.channelId);return e.channelId=n,this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){var t=this,n=e.messages.map((function(n){var i=n.sendTime,r=n.messageUId,s=n.channelId;return{sendTime:i,messageUId:r,channelId:t._channelIdConvert(e.conversationType,s)}}));return e.messages=n,this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,s,o,a;return l(this,(function(u){switch(u.label){case 0:return t=e.conversationType,n=e.expansion,i=e.canIncludeExpansion,t!==te.ULTRA_GROUP?[2,{code:r=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[r]}]:i?(s=Lt(n),o=s.isIllgalEx,a=s.isExKeyOrValLengthExceedLimit,s.isExceedLimit||a?[2,{code:$.EXPANSION_LIMIT_EXCEET}]:o?[2,{code:$.INVALID_PARAMETER_MESSAGE_EXPANSION}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:$.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return e.conversationType!==te.ULTRA_GROUP?[2,{code:t=$.CONVERSATION_TYPE_NOT_SUPPORT,msg:$[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e,t)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadCountByTargetId(e,t)},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.getUltraGroupUnreadMentionedMessages=function(e){var t=this._channelIdConvert(te.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){var t=this._channelIdConvert(te.ULTRA_GROUP,e.channelId);return e.channelId=t,this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)},e.prototype.getUltraGroupUnreadInfoList=function(e){return this._engine.getUltraGroupUnreadInfoList(e)},e.prototype.callExtra=function(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(t=this._engine).callExtra.apply(t,h([e],n,!1))},e.prototype.getOSInfo=function(){return this._engine.getOSInfo()},e.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._engine.setCallInfo(e,t,n)},e.prototype.getGroupMessageDeliverList=function(e,t,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){return void 0===t&&(t=""),this._engine.getPrivateMessageDeliverTime(e,t)},e.prototype._isEnableSubDriven=function(){var e=this.getNaviInfoFromCache();return(null==e?void 0:e.subDriven)&&1&e.subDriven},e.prototype.subscribeUser=function(e,t,n){return this._isEnableSubDriven()?this._engine.subscribeUser(e,t,n):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.unSubscribeUser=function(e,t){return this._isEnableSubDriven()?this._engine.unSubscribeUser(e,t):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserList=function(e,t,n){return this._isEnableSubDriven()?this._engine.getSubscribeUserList(e,t,n):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.getSubscribeUserStatus=function(e,t){return this._isEnableSubDriven()?this._engine.getSubscribeUserStatus(e,t):Promise.resolve({code:$.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE})},e.prototype.clearConversations=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(fe.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return c(this,void 0,void 0,(function(){var i,r,s;return l(this,(function(o){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,s=i.msg,r!==$.SUCCESS?[2,Promise.resolve({code:r,msg:s})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,!!i,r)]}))}))},e.prototype.batchClearMessagesByTimestamp=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.batchClearMessagesByTimestamp(e)]}))}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.batchClearRemoteHistoryMessages(e,t)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(e,t,n,i)]}))}))},e.prototype.setUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,i){return void 0===t&&(t=[]),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(e,t,n||"",i)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,i,r,s,o){return void 0===o&&(o=""),c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,i,r,s,o)]}))}))},e.prototype.searchMessageByContentAndMessageType=function(e,t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentAndMessageType(e,t,n,i,r,s,o)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,i,r,s){return void 0===r&&(r=5),void 0===s&&(s=""),c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessagesByUser(e,t,n,i,r,s)]}))}))},e.prototype.getMessagesByTimestamp=function(e,t,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getMessagesByTimestamp(e,t,n,i)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,i,r){return c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,i,r)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,i,r,s,o){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,i,r,s,o)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(e,t,n,i)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){var n=this._channelIdConvert(te.ULTRA_GROUP,t);return this._engine.getUltraGroupDefaultNotificationLevel(e,n||"")},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){var i=this._channelIdConvert(te.ULTRA_GROUP,n);return this._engine.setUltraGroupDefaultNotificationLevel(e,t,i||"")},e.prototype.getConversationNotificationLevel=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationNotificationLevel(e,t,i||"")},e.prototype.setConversationTypeNotificationLevel=function(e,t){return this._engine.setConversationTypeNotificationLevel(e,t)},e.prototype.getConversationTypeNotificationLevel=function(e){return this._engine.getConversationTypeNotificationLevel(e)},e.prototype.getConversationNotificationStatus=function(e,t,n){var i=this._channelIdConvert(e,n);return this._engine.getConversationNotificationStatus(e,t,i||"")},e.prototype.getRemoteHistoryMessages=function(e,t,n,i,r,s){return this._engine.getRemoteHistoryMessages(e,t,n,i,r,s)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(e,t)},e.prototype.createStatisticLogger=function(e,t){return this._engine.createStatisticLogger(e,t)},e.prototype.getConversations=function(e){return this._engine.getConversations(e)},e.prototype.setCheckDuplicateMessage=function(e){return this._engine.setCheckDuplicateMessage(e)},e.prototype.setCheckChatRoomDuplicateMessage=function(e){return this._engine.setCheckChatRoomDuplicateMessage(e)},e.prototype.rtcSignaling=function(e,t,n,i){return this._engine.rtcSignaling(e,t,n,i)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e}(),tc=function(){function e(e,t){var n,i;this._logTagT=e,this._logTagR=t,this.verificationFaileList=[],this.context=ec.getContext(),this.logger=null===(n=this.context)||void 0===n?void 0:n.logger,this.option=null===(i=this.context)||void 0===i?void 0:i.getOptions()}return e.prototype.validate=function(e,t,n,i,r){if(void 0===i&&(i=!1),this.verificationFaileList.length>0)return this;(n=Xt[n]||n)(t);var s=i?n(t):vt(t)||null==t||n(t);if("object"==typeof s){var o=s.valid,a=s.errorKey;return!o&&a&&this.verificationFaileList.push({key:a,value:t,isValid:!1,message:r}),this}return s||this.verificationFaileList.push({key:e,value:t,isValid:s,message:r}),this},e.prototype._getValidationResult=function(){var e;if(this.verificationFaileList.length>0){var t=this.verificationFaileList[0];e={key:t.key,value:t.value,isValid:t.isValid,message:t.message}}return e},e.prototype.ifReady=function(e){var t;if(!this.context)return Promise.resolve({code:$.BIZ_ERROR_CLIENT_NOT_INIT});var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var i=Ni[n.key];null===(t=this.logger)||void 0===t||t.error(this._logTagR,JSON.stringify({code:i}));var r=""+n.value;return Promise.resolve({code:i,msg:"'"+n.key+"' is invalid: "+(n.message?n.message:r)})},e.prototype.try2do=function(e){if(!this.context)throw new Error("Not initialized yet!");return e(this.context,this.logger,this.option)},e.prototype.ifReadySync=function(e){var t;if(!this.context)return{code:$.BIZ_ERROR_CLIENT_NOT_INIT};var n=this._getValidationResult();if(!n)return e(this.context,this.logger,this.option);var i=Ni[n.key];null===(t=this.logger)||void 0===t||t.warn(this._logTagR,JSON.stringify({code:i}));var r=""+n.value;return{code:i,msg:"'"+n.key+"' is invalid: "+(n.message?n.message:r)}},e}(),nc=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-nc),void 0===n&&(n=Date.now()),c(this,void 0,void 0,(function(){var i,r;return l(this,(function(s){switch(s.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>nc&&(t=n-nc),(i=new Ya(e,"RC-IM","IM")).debug(fe.T,"get logs: startTime "+t+" endTime "+n),Ma(e,i,{tag:"browser"}),[4,Fa().getLogs(t,n,_a.DEBUG,!1)];case 1:return r=s.sent().logs,i.debug(fe.T,"get logs "+r.length),function(e,t){var n=t.map((function(e){return e.sessionId+","+e.time+","+e.type+","+e.level+","+e.tag+","+e.traceId+","+e.loggerId+',"'+e.content+'"\n'})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=e+".csv",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)}(e+"-"+t+"-"+n,r),[2]}}))}))}}}}var ic=x;export{lu as AConnectionMgr,li as AEngine,ec as APIContext,s as AppStorage,pi as AreaCode,Ht as AssertRules,Yu as BaseCloudController,Sa as BasicLogger,ts as BasicNavi,Ka as BasicReporter,Ai as BasicStaticConfigManager,Lu as BasicStatistic,Uu as BasicStatisticReporter,D as CPP_PROTOCAL_MSGTYPE_OPTION,at as CallLibMsgType,Ie as ChatroomEntryType,it as ChatroomSyncStatusReason,Ce as ChatroomUserChangeType,Pe as ChrmMemBanType,Ue as ChrmMemOperateType,Me as ChrmSyncStatus,gi as Codec,Je as ConnectReason,We as ConnectType,ie as ConnectionStatus,te as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,Gn as DelayTimer,De as EConnectProtocol,Ye as EnterpriseType,$ as ErrorCode,Ni as ErrorCodeMap,bt as EventEmitter,F as FORMATED_VERSION,J as FileType,v as HTTP_TIMEOUT,En as HttpMethod,O as IM_CHATROOM_PULL_INTERVAL_TIME,m as IM_PING_INTERVAL_TIME,A as IM_PING_MIN_TIMEOUT,y as IM_PING_TIMEOUT,S as IM_SIGNAL_TIMEOUT,Ya as IndexDBLogger,nu as IndexDBReporter,Pu as IndexDBStatistic,ku as IndexDBStatisticReporter,we as InterruptionLevel,Cu as InvokerType,Q as LOCAL_STORAGE_KEYS,nt as LiveRole,tt as LiveType,_a as LogL,ge as LogLevel,_e as LogSource,fe as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,M as MAX_MESSAGE_EXPANSION_KEY_LENGTH,L as MAX_MESSAGE_EXPANSION_VAL_LENGTH,H as MAX_UPLOAD_FILE_SIZE,he as MentionedType,Re as MessageBlockSourceType,me as MessageBlockType,Z as MessageDirection,se as MessageType,I as NAVI_CACHE_DURATION,R as NAVI_REQ_TIMEOUT,je as NaviCacheType,Tn as NetworkType,ce as NotificationLevel,ae as NotificationStatus,k as ONE_LOG_SIZE_MAX,Xe as OnlineStatus,Ne as OperateStatus,Ze as PlatformInfo,Oi as PluginContext,Ke as ProtocalType,Ve as PushImportanceHonor,Zt as RCAssertError,iu as RCConnectionStatus,K as RC_DEFAULT_USER,j as READ_RECEIPT_CATCH_TIME,V as REAT_TIME_LOG_SIZE,rt as RTCApiType,st as RTCIdentityChangeType,ot as RTCJoinType,et as RTCMode,zu as RTCPluginContext,n as ReceivedStatus,P as SEND_MESSAGE_TYPE_OPTION,Y as STATIC_CONFIG_CACHE_TIME,b as STATIC_CONFIG_IV,U as STATIC_CONFIG_KEY,w as STATUS_MESSAGE,ye as SentStatus,cu as StatisticL,Ee as StatisticsTag,Qe as StatisticsVersion,Ge as StoreKeys,$e as SubscribeOperationType,ze as SubscribeType,Jt as SuspendablePromise,In as TagChangeType,q as UPLOAD_FILE_CHUNK_SIZE,ke as UltraGroupChannelChangeType,Be as UltraGroupChannelType,qe as UltraMentionedType,xe as UltraMsgChangeType,Fe as UltraMsgSubChangeType,pe as UploadMethod,He as UserGroupChangeType,x as VERSION,tc as ValidatorManage,Dt as VersionManage,C as WEB_SOCKET_TIMEOUT,rs as WebSocketNavi,T as appendUrl,zt as assert,Pn as clone,Mn as cloneByJSON,Vn as completeSubscriptionPlatformStatus,Ua as deInitLogDB,gn as decryptCBC,_n as fixUrlProtocol,mn as forEach,Un as getBrowser,dn as getClientMessageId,Bt as getDeviceId,fn as getMessageUIdHash,an as getMimeKey,vn as getMinionURL,Vt as getUUID,Gt as getUUID22,on as getUploadFileName,pn as getbundleId,Rn as httpRequest,An as indexOf,Ma as initLogDB,Tu as initStatisticDB,dt as isArray,_t as isArrayBuffer,ct as isBoolean,uu as isConnnectAck,au as isDisconnectedByServer,It as isFunction,Ct as isHttpUrl,On as isInObject,Nn as isInclude,ht as isInteger,pt as isLimitedArray,gt as isLimitedString,Rt as isNull,lt as isNumber,Tt as isObject,wt as isStartCloudController,ut as isString,Ot as isTypeInConversationList,vt as isUndefined,At as isValidChannelId,ln as isValidChrmEntryKey,hn as isValidChrmEntryValue,Ut as isValidConversation,mt as isValidConversationType,Lt as isValidExpansion,Mt as isValidFileType,yt as isValidNotificationLevel,Nt as isValidTargetId,Wt as logger,yn as map,Et as notEmptyArray,St as notEmptyObject,ft as notEmptyString,un as pushConfigsToJSON,cn as pushJSONToConfigs,Au as statisticTranscsv,_ as todo,tu as transcsv,wn as transformReceivedStatusFlag,Dn as transformReceivedStatusInfo,vu as unInitStatisticDB,yi as urlCenter,Ln as usingCppEngine,$t as validate,Xt as validators,ic as version};