@rongcloud/engine 5.8.4-alpha.6 → 5.8.4-alpha.8

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 t;!function(t){t[t.READ=1]="READ",t[t.LISTENED=2]="LISTENED",t[t.DOWNLOADED=4]="DOWNLOADED",t[t.RETRIEVED=8]="RETRIEVED",t[t.UNREAD=0]="UNREAD"}(t||(t={}));var e,n=t,i=function(t){return e||(e={set:function(e,n){t.localStorage.setItem(e,JSON.stringify(n))},get:function(e){var n;try{n=JSON.parse(t.localStorage.getItem(e))}catch(t){n=null}return n},remove:function(e){return t.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var n in t.localStorage)e.push(n);return e}}),e},r=function(){function t(t){this._caches={},t&&(this._caches=t)}return t.prototype.set=function(t,e){this._caches[t]=e},t.prototype.remove=function(t){var e=this.get(t);return delete this._caches[t],e},t.prototype.get=function(t){return this._caches[t]},t.prototype.getKeys=function(){var t=[];for(var e in this._caches)t.push(e);return t},t}(),o=function(){function t(t,e){var n;this._rootStorage=i(t);var o=this._rootStorage.get(e)||{};this._cache=new r(((n={})[e]=o,n)),this._storageKey=e}return t.prototype._get=function(){var t=this._storageKey;return this._cache.get(t)||{}},t.prototype._set=function(t){var e=this._storageKey;t=t||{},this._cache.set(e,t),this._rootStorage.set(e,t)},t.prototype.set=function(t,e){var n=this._get();n[t]=e,this._set(n)},t.prototype.remove=function(t){var e=this._get();delete e[t],this._set(e)},t.prototype.clear=function(){var t=this._storageKey;this._rootStorage.remove(t),this._cache.remove(t)},t.prototype.get=function(t){return this._get()[t]},t.prototype.getKeys=function(){var t=this._get(),e=[];for(var n in t)e.push(n);return e},t.prototype.getValues=function(){return this._get()||{}},t}(),s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},s(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return u=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},u.apply(this,arguments)};function c(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))}function l(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)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 s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],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(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var d,p=function(t){function e(e){return t.call(this,"TODO => ".concat(e))||this}return a(e,t),e}(Error),f=function(t){return new p(t)},_=function(t){for(var e=0,n=0,i=t.length;n<i;n++)e+=t.charCodeAt(n)<=65535?2:4;return e},E=function(t){for(var e,n=0,i=0,r=t.length;i<r;i++)n+=(e=t.charCodeAt(i))<127?1:e<=2047?2:e<=65535?3:4;return n},T=function(t,e){if(t=t.replace(/\?$/,""),!e)return t;var n=Object.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).filter((function(t){return!!t}));return n.length?[t,n.join("&")].join("?"):t},v=72e5,y=6e4,C=1e4,m=5e3,I=3e4,R=15e3,S=15e3,O=2e3,N=131072,M=18e4,U=32,L=4096,A="cd4936151214ce45dc1d12673a59d94c",w="51ad078e5eb17a91",b={"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},"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}},P={"RC:DizNtf":{isCounted:!1,isPersited:!1}},D=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.8.4-alpha.6",F=x.replace(/-.+$/,""),K=5368709120,H=10485760,q=18e5,Y={NAVI_KEY:function(t){return"navi_".concat(t)},CONVER_STATE_PULL_TIME_KEY:function(t,e){return"RCV4-con-s-".concat(t,"-").concat(e)},OLD_CONVER_STATE_KEY:function(t,e){return"RCV4-con-".concat(t,"-").concat(e)},CONVER_STATE_KEY:function(t,e){return"RCV4-CONVER-".concat(t,"-").concat(e)},ULTRA_GROUP_STATE_KEY:function(t,e){return"RCV4-ultragroupconversation-".concat(t,"-").concat(e)},OUTBOX_TIME_KEY:function(t,e){return"outbox_".concat(t,"_").concat(e)},INBOX_TIME_KEY:function(t,e){return"inbox_".concat(t,"_").concat(e)},BROADCASTBOX_TIME_KEY:function(t,e){return"broadcastbox_".concat(t,"_").concat(e)},SEND_MSG_KEY:function(t,e){return"send_msg_".concat(t,"_").concat(e)},USER_SETTING_TIME_KEY:function(t,e){return"us-s-".concat(t,"-").concat(e)},TAG_STATE_KEY:function(t,e){return"tag-".concat(t,"-").concat(e)},STATIC_CONFIG_KEY:function(t){return"rc-static-config-".concat(t)}};!function(t){t[t.IMAGE=1]="IMAGE",t[t.AUDIO=2]="AUDIO",t[t.VIDEO=3]="VIDEO",t[t.FILE=4]="FILE",t[t.SIGHT=5]="SIGHT",t[t.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var j,Q=d;!function(t){t[t.SEND=1]="SEND",t[t.RECEIVE=2]="RECEIVE"}(j||(j={}));var W,J=j;!function(t){t[t.TIMEOUT=-1]="TIMEOUT",t[t.SUCCESS=0]="SUCCESS",t[t.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",t[t.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",t[t.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",t[t.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",t[t.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",t[t.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",t[t.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",t[t.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",t[t.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",t[t.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",t[t.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",t[t.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",t[t.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",t[t.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",t[t.NOT_IN_GROUP=22406]="NOT_IN_GROUP",t[t.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",t[t.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",t[t.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",t[t.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",t[t.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",t[t.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",t[t.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",t[t.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",t[t.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",t[t.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",t[t.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",t[t.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",t[t.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",t[t.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",t[t.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",t[t.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",t[t.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",t[t.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",t[t.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",t[t.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",t[t.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",t[t.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",t[t.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",t[t.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",t[t.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",t[t.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",t[t.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",t[t.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",t[t.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",t[t.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",t[t.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",t[t.RECALL_MESSAGE=25101]="RECALL_MESSAGE",t[t.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",t[t.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",t[t.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",t[t.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",t[t.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",t[t.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",t[t.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",t[t.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",t[t.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",t[t.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",t[t.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",t[t.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",t[t.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",t[t.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",t[t.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",t[t.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",t[t.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",t[t.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",t[t.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",t[t.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",t[t.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",t[t.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",t[t.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",t[t.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",t[t.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",t[t.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",t[t.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",t[t.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",t[t.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",t[t.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",t[t.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",t[t.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",t[t.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",t[t.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",t[t.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",t[t.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",t[t.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",t[t.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",t[t.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",t[t.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",t[t.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",t[t.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",t[t.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",t[t.RC_OTP_USED=31027]="RC_OTP_USED",t[t.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",t[t.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",t[t.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",t[t.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",t[t.RC_TCP_RESET=32054]="RC_TCP_RESET",t[t.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",t[t.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",t[t.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",t[t.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",t[t.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",t[t.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",t[t.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",t[t.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",t[t.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",t[t.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",t[t.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",t[t.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",t[t.TAG_EXISTS=33101]="TAG_EXISTS",t[t.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",t[t.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",t[t.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",t[t.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",t[t.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",t[t.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",t[t.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",t[t.UPLOAD_FAIL=34011]="UPLOAD_FAIL",t[t.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",t[t.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",t[t.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",t[t.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",t[t.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",t[t.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",t[t.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",t[t.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",t[t.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",t[t.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",t[t.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",t[t.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",t[t.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",t[t.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",t[t.NOT_SUPPORT=35004]="NOT_SUPPORT",t[t.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",t[t.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",t[t.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",t[t.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",t[t.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",t[t.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",t[t.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",t[t.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",t[t.UNKNOWN=-2]="UNKNOWN",t[t.PARAMETER_ERROR=-3]="PARAMETER_ERROR",t[t.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",t[t.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",t[t.CANCEL=1]="CANCEL",t[t.REJECT=2]="REJECT",t[t.HANGUP=3]="HANGUP",t[t.BUSYLINE=4]="BUSYLINE",t[t.NO_RESPONSE=5]="NO_RESPONSE",t[t.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",t[t.NETWORK_ERROR=7]="NETWORK_ERROR",t[t.REMOTE_CANCEL=11]="REMOTE_CANCEL",t[t.REMOTE_REJECT=12]="REMOTE_REJECT",t[t.REMOTE_HANGUP=13]="REMOTE_HANGUP",t[t.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",t[t.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",t[t.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",t[t.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",t[t.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",t[t.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",t[t.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",t[t.INVITE_DICUSSION=21409]="INVITE_DICUSSION",t[t.HAVNODEVICEID=24001]="HAVNODEVICEID",t[t.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",t[t.FEILD=24009]="FEILD",t[t.VOIPISNULL=24013]="VOIPISNULL",t[t.NOENGINETYPE=24010]="NOENGINETYPE",t[t.NULLCHANNELNAME=24011]="NULLCHANNELNAME",t[t.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",t[t.NOVOIP=24014]="NOVOIP",t[t.INTERNALERRROR=24015]="INTERNALERRROR",t[t.VOIPCLOSE=24016]="VOIPCLOSE",t[t.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",t[t.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",t[t.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",t[t.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",t[t.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",t[t.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",t[t.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",t[t.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",t[t.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",t[t.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",t[t.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",t[t.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",t[t.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",t[t.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",t[t.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",t[t.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",t[t.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",t[t.COOKIE_ENABLE=51001]="COOKIE_ENABLE"}(W||(W={}));var X,Z=W;!function(t){t[t.NONE=0]="NONE",t[t.PRIVATE=1]="PRIVATE",t[t.DISCUSSION=2]="DISCUSSION",t[t.GROUP=3]="GROUP",t[t.CHATROOM=4]="CHATROOM",t[t.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",t[t.SYSTEM=6]="SYSTEM",t[t.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",t[t.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",t[t.ULTRA_GROUP=10]="ULTRA_GROUP",t[t.RTC_ROOM=12]="RTC_ROOM"}(X||(X={}));var z,$=X;!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",t[t.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",t[t.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",t[t.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",t[t.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",t[t.BLOCKED=9]="BLOCKED",t[t.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",t[t.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",t[t.REDIRECT=14]="REDIRECT",t[t.USER_LOGOUT=19]="USER_LOGOUT",t[t.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",t[t.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",t[t.ULTRALIMIT=1101]="ULTRALIMIT",t[t.REQUEST_NAVI=201]="REQUEST_NAVI",t[t.RESPONSE_NAVI=202]="RESPONSE_NAVI",t[t.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",t[t.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(z||(z={}));var tt,et=z;!function(t){t.TextMessage="RC:TxtMsg",t.VOICE="RC:VcMsg",t.HQ_VOICE="RC:HQVCMsg",t.IMAGE="RC:ImgMsg",t.GIF="RC:GIFMsg",t.RICH_CONTENT="RC:ImgTextMsg",t.LOCATION="RC:LBSMsg",t.FILE="RC:FileMsg",t.SIGHT="RC:SightMsg",t.COMBINE="RC:CombineMsg",t.COMBINE_V2="RC:CombineV2Msg",t.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",t.LOG_COMMAND="RC:LogCmdMsg",t.EXPANSION_NOTIFY="RC:MsgExMsg",t.REFERENCE="RC:ReferenceMsg",t.RECALL="RC:RcCmd",t.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",t.READ_RECEIPT="RC:ReadNtf",t.READ_RECEIPT_REQUEST="RC:RRReqMsg",t.READ_RECEIPT_RESPONSE="RC:RRRspMsg",t.SYNC_READ_STATUS="RC:SRSMsg",t.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",t.DELIVERED="RC:Delivered",t.DELIVERED_MSG="RC:DRMsg",t.CHATROOM_JOIN="RC:ChrmJoinNtf",t.CHATROOM_LEFT="RC:ChrmQuitNtf",t.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",t.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",t.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",t.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",t.TYPING_STATUS="RC:TypSts",t.INTERCEPT="RC:InterceptMsg"}(tt||(tt={}));var nt,it=tt;!function(t){t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE"}(nt||(nt={}));var rt,ot=nt;!function(t){t[t.ALL_MESSAGE=-1]="ALL_MESSAGE",t[t.NOT_SET=0]="NOT_SET",t[t.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",t[t.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",t[t.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",t[t.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(rt||(rt={}));var st,at=rt;!function(t){t[t.ALL=1]="ALL",t[t.SINGAL=2]="SINGAL"}(st||(st={}));var ut,ct=st;!function(t){t[t.QINIU=1]="QINIU",t[t.ALI=2]="ALI",t[t.AWS=3]="AWS",t[t.STC=4]="STC",t[t.MINIO=5]="MINIO"}(ut||(ut={}));var lt,ht=ut;!function(t){t[t.UPDATE=1]="UPDATE",t[t.DELETE=2]="DELETE"}(lt||(lt={}));var dt,gt,pt,ft,_t,Et=lt;!function(t){t[t.LOG=0]="LOG",t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t[t.FATAL=4]="FATAL",t[t.STATISTICS=6]="STATISTICS",t[t.NONE=1e3]="NONE"}(dt||(dt={})),function(t){t.IM="IM",t.RTC="RTC"}(gt||(gt={})),function(t){t.L_IMSDK_VER_O="L-imsdk_ver-O",t.A_INIT_O="A-init-O",t.A_INIT_REPEAT_O="A_INIT_REPEAT_O",t.L_INIT_O="L-init-O",t.A_DESTROY_O="A_DESTROY_O",t.L_DESTROY_O="L_DESTROY_O",t.A_CONNECT_T="A-connect-T",t.A_CONNECT_R="A-connect-R",t.A_CONNECT_S="A-connect-S",t.A_DISCONNECT_O="A-disconnect-O",t.A_RECONNECT_T="A-reconnect-T",t.A_RECONNECT_R="A_RECONNECT_R",t.L_CONNECT_T="L-connect-T",t.L_CONNECT_R="L-connect-R",t.L_CONNECT_S="L-connect-S",t.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",t.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",t.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",t.A_MSG_LISTENER_E="A-MSG_LISTENER-E",t.O="L-original-O",t.T="L-TEST-O",t.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",t.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",t.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",t.A_SEND_MSG_T="A-send_msg-T",t.A_SEND_MSG_R="A-send_msg-R",t.L_SEND_MSG_T="L-send_msg-T",t.L_SEND_MSG_R="L-send_msg-R",t.L_PULL_MSG_T="L-pull_msg-T",t.L_PULL_MSG_R="L-pull_msg-R",t.L_PULL_MSG_O="L-pull_msg-O",t.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",t.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",t.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",t.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",t.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",t.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",t.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",t.L_RECV_S_MSG_O="L-recv_s_msg-O",t.A_DELETE_MESSAGES_S="A-delete_messages-S",t.P_DELETE_MSG_S="P-delete_msg-S",t.L_PULL_CONVERSATION_S="L-pull_conversation-S",t.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",t.A_REGTYP_O="A-regtyp-O",t.P_REGTYP_E="P-regtype-E",t.L_GET_NAVI_T="L-get_navi-T",t.L_GET_NAVI_R="L-get_navi-R",t.L_REQUEST_T="L-request-T",t.L_REQUEST_R="L-request-R",t.L_PARSE_NAVI_E="L-parse_navi-E",t.L_ENV_S="L-Env-S",t.L_GET_INDEX_NAVI_S="L-get_index_navi-S",t.A_JOIN_CHATROOM_T="A-join_chatroom-T",t.A_JOIN_CHATROOM_R="A-join_chatroom-R",t.L_JOIN_CHATROOM_T="L-join_chatroom-T",t.L_JOIN_CHATROOM_R="L-join_chatroom-R",t.A_QUIT_CHATROOM_T="A-quit_chatroom-T",t.A_QUIT_CHATROOM_R="A-quit_chatroom-R",t.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",t.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",t.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",t.L_MEDIA_S="L-media-S",t.L_MEDIA_UPLOAD_T="L-media_upload-T",t.L_MEDIA_UPLOAD_R="L-media_upload-R",t.G_UPLOAD_LOG_S="G-upload_log-S",t.G_REPORT_LOG_S="G-report_log-S",t.G_UPLOAD_LOG_E="G-upload_log-E",t.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",t.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",t.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",t.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",t.A_GET_HISTORY_MSG_T="A-get_history_msg-T",t.A_GET_HISTORY_MSG_R="A-get_history_msg-R",t.L_GET_HISTORY_MSG_T="L-get_history_msg-T",t.L_GET_HISTORY_MSG_R="L-get_history_msg-R",t.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",t.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",t.A_CALLBACK_O="A-callback-O",t.A_CALLBACK_E="A-callback-E",t.L_CALLBACK_E="L-callback-E",t.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",t.L_PB_ENCODE_E="L-pb-encode-E",t.L_PB_DECODE_E="L-pb-decode-E",t.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",t.L_REPORT_FULL_LOG_O="L-report_full_log-O",t.L_REPORT_FULL_LOG_T="L-report_full_log-T",t.L_REPORT_FULL_LOG_R="L-report_full_log-R",t.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",t.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",t.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",t.L_LOGDB_CLOSED_S="L-logDB_closed-S",t.L_LOGDB_ERROR_E="L-logDB_error-S",t.L_LOGDB_ABORT_S="L-logDB_abort-S",t.L_REALTIME_LOG_R="L_REALTIME_LOG_R",t.L_REALTIME_LOG_O="L_REALTIME_LOG_O",t.L_REALTIME_LOG_T="L_REALTIME_LOG_T",t.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",t.L_RECV_RMTP_O="L_RECV_RMTP_O",t.L_RECV_RMTP_E="L_RECV_RMTP_E",t.L_RECV_S_NTF_O="L-recv_s_ntf_O",t.L_VER_REPORT_T="L-VER_REPORT-T",t.L_VER_REPORT_R="L-VER_REPORT-R",t.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",t.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",t.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",t.A_REMOVE_PROXY_O="A-remove_proxy-O",t.A_SET_PROXY_O="A-set_proxy-O",t.A_TEST_PROXY_O="A-test_proxy-O",t.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",t.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",t.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",t.L_GET_STATIC_CONF_T="L-get_static_conf-T",t.L_GET_STATIC_CONF_R="L-get_static_conf-R",t.L_GET_STATIC_CONF_E="L-get_static_conf-E"}(pt||(pt={})),function(t){t.IM_NAVI="IM-stats_navi-S",t.IM_WEBSOCKET="IM-stats_websocket-S",t.IM_CONNECTION_DURATION="IM-stats_con_dur-S",t.IM_CMP="IM-stats_cmp-S",t.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",t.IM_STATS_CS="IM-stats_cs-S",t.IM_NETWORK_CHANGE="IM-stats_network_change-S"}(ft||(ft={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(_t||(_t={}));var Tt,vt,yt=_t;!function(t){t[t.GLOBAL=1]="GLOBAL",t[t.CUSTOM=2]="CUSTOM",t[t.THIRD_PARTY=3]="THIRD_PARTY"}(Tt||(Tt={})),function(t){t[t.MSG_ORIGINAL=0]="MSG_ORIGINAL",t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY"}(vt||(vt={}));var Ct,mt=Tt;!function(t){t[t.typing=0]="typing"}(Ct||(Ct={}));var It,Rt,St=Ct;!function(t){t[t.SENDING=10]="SENDING",t[t.FAILED=20]="FAILED",t[t.SENT=30]="SENT",t[t.RECEIVED=40]="RECEIVED",t[t.READ=50]="READ",t[t.DESTROYED=60]="DESTROYED"}(It||(It={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(Rt||(Rt={}));var Ot,Nt=Rt;!function(t){t[t.Deblock=0]="Deblock",t[t.Blocked=1]="Blocked"}(Ot||(Ot={}));var Mt,Ut=Ot;!function(t){t[t.UnmuteUsers=0]="UnmuteUsers",t[t.MuteUsers=1]="MuteUsers",t[t.UnmuteAll=2]="UnmuteAll",t[t.MuteAll=3]="MuteAll",t[t.RemoveWhitelist=4]="RemoveWhitelist",t[t.AddWhitelist=5]="AddWhitelist",t[t.UnmuteGloble=6]="UnmuteGloble",t[t.MuteGloble=7]="MuteGloble"}(Mt||(Mt={}));var Lt,At=Mt;!function(t){t[t.LeaveOnMyOwn=0]="LeaveOnMyOwn",t[t.OtherDeviceLogin=1]="OtherDeviceLogin"}(Lt||(Lt={}));var wt,bt,Pt,Dt,Vt,Gt,Bt,kt,xt,Ft,Kt,Ht,qt,Yt,jt,Qt,Wt,Jt=Lt;!function(t){t[t.RMTP=1]="RMTP",t[t.TLS=2]="TLS",t[t.RPP=3]="RPP",t[t.QUIC=4]="QUIC",t[t.WS=5]="WS",t[t.WSS=6]="WSS",t[t.HTTP=11]="HTTP",t[t.HTTPS=12]="HTTPS"}(wt||(wt={})),function(t){t.NAVI="rc-navi",t.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(bt||(bt={})),function(t){t[t.PUBLIC=0]="PUBLIC",t[t.PRIVATE=1]="PRIVATE"}(Pt||(Pt={})),function(t){t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Dt||(Dt={})),function(t){t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY",t[t.MSG_RECALL=3]="MSG_RECALL",t[t.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",t[t.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(Vt||(Vt={})),function(t){t[t.CHANNEL_DELETE=1]="CHANNEL_DELETE",t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",t[t.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Gt||(Gt={})),function(t){t[t.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",t[t.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",t[t.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",t[t.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",t[t.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(Bt||(Bt={})),function(t){t[t.NOT_MENTIONED=0]="NOT_MENTIONED",t[t.ALL=1]="ALL",t[t.ME=2]="ME"}(kt||(kt={})),function(t){t[t.PRIVATE=1]="PRIVATE",t[t.OPEN=0]="OPEN"}(xt||(xt={})),function(t){t[t.NAVI=1]="NAVI",t[t.TCP=2]="TCP",t[t.WS=3]="WS"}(Ft||(Ft={})),function(t){t[t.REQUEST=0]="REQUEST",t[t.LOCAL=1]="LOCAL"}(Kt||(Kt={})),function(t){t[t.CURRENT=2]="CURRENT"}(Ht||(Ht={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT"}(qt||(qt={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT",t[t.REDIRECTED=3]="REDIRECTED",t[t.TIMEOUT=4]="TIMEOUT"}(Yt||(Yt={})),function(t){t[t.RTC=0]="RTC",t[t.LIVE=2]="LIVE",t[t.SIP=4]="SIP",t[t.CALL=5]="CALL",t[t.MEETING=6]="MEETING",t[t.CROSS_MUTI=7]="CROSS_MUTI",t[t.CROSS_LIVE=8]="CROSS_LIVE"}(jt||(jt={})),function(t){t[t.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",t[t.AUDIO=1]="AUDIO"}(Qt||(Qt={})),function(t){t[t.ANCHOR=1]="ANCHOR",t[t.AUDIENCE=2]="AUDIENCE"}(Wt||(Wt={}));var Xt,Zt,zt,$t={"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(t){t[t.ROOM=1]="ROOM",t[t.PERSON=2]="PERSON"}(Xt||(Xt={})),function(t){t[t.AnchorToViewer=1]="AnchorToViewer",t[t.ViewerToAnchor=2]="ViewerToAnchor"}(Zt||(Zt={})),function(t){t[t.KICK=0]="KICK",t[t.REFUSE=1]="REFUSE",t[t.COEXIST=2]="COEXIST"}(zt||(zt={}));var te=function(t){return"string"==typeof t},ee=function(t){return"boolean"==typeof t},ne=function(t){return"number"==typeof t&&!Number.isNaN(t)},ie=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")},re=function(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)},oe=function(t){return te(t)&&t.length>0},se=function(t){return ie(t)&&t.length>0},ae=function(t){return"[object Object]"===Object.prototype.toString.call(t)},ue=function(t){return"[object Function]"===Object.prototype.toString.call(t)},ce=function(t){return void 0===t||"[object Undefined]"===Object.prototype.toString.call(t)},le=function(t){return"[object Null]"===Object.prototype.toString.call(t)},he=function(t){return te(t)&&/https?:\/\//.test(t)},de=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1},ge=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call($,t)},pe=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call(at,t)},fe=function(t){var e=!1;return te(t)&&!/_/g.test(t)&&t.length<=20&&(e=!0),e},_e=function(t){return[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE,$.APP_PUBLIC_SERVICE].includes(t)},Ee=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call(Q,t)},Te=function(t){var e=!1,n=!1,i=!1;if(ae(t)){var r=Object.keys(t).length;for(var o in e=r>20,t)if(n||(n=te(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=t[o];i=o.length>32||s.length>4096}}return{isExceedLimit:e,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},ve=function(){function t(){this._map={}}return t.prototype.on=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n})},t.prototype.once=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n,once:!0})},t.prototype.off=function(t,e,n){var i=this._map[t];i&&((i=i.filter((function(t){return t.listener!==e||t.target!==n}))).length?this._map[t]=i:delete this._map[t])},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=this._map[t];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,u=o.listener;a&&i.splice(r,1);try{u.call.apply(u,h([s],e,!1))}catch(t){null===console||void 0===console||console.error(t)}}},t.prototype.removeAll=function(t){delete this._map[t]},t.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},t}(),ye="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};ye.engine="5.8.4-alpha.6";var Ce=function(){function t(){}return t.add=function(t,e){ye[t]=e},t.validEngine=function(t){var e=t.match(/\d+\.\d+\.\d+/);if(!e)return!1;var n=e[0].split(".").map((function(t){return t.padStart(3,"0")})).join("");return ye.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(t){return t.padStart(3,"0")})).join("")>=n},t.getInfo=function(){return ye},t}(),me=null;function Ie(t,e,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-t];if(me&&t<dt.FATAL)try{var o=JSON.stringify(n);me[r](e,o)}catch(t){console.error(t)}}var Re,Se,Oe=Ie.bind(null,dt.DEBUG),Ne=Ie.bind(null,dt.INFO),Me=Ie.bind(null,dt.WARN),Ue=Ie.bind(null,dt.ERROR),Le=Ie.bind(null,dt.FATAL),Ae=Object.freeze({__proto__:null,init:function(t){me=t},log:Ie,debug:Oe,info:Ne,warn:Me,error:Ue,fatal:Le}),we=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},be=function(){var t=we();if(t="".concat(t.replace(/-/g,""),"a"),t=function(t){var e="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=e.length+1,i=+t,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(e[o])}while(i);return r.join("")}(t=parseInt(t,16)),t.length>22&&(t=t.slice(0,22)),t.length<22)for(var e=22-t.length,n=0;n<e;n++)t+="0";return t},Pe=function(){function t(t,e){var n=this;this._promise=new Promise((function(e){n._resolve=e,t(n._onResolve.bind(n))})),this._onCancel=e}return t.prototype._onResolve=function(t){this._resolve(t)},t.prototype.result=function(){return this._promise},t.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},t}();!function(t){t[t.STRING=0]="STRING",t[t.ONLY_STRING=1]="ONLY_STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.OBJECT=4]="OBJECT",t[t.ARRAY=5]="ARRAY",t[t.CALLBACK=6]="CALLBACK",t[t.CHANNEL_ID=7]="CHANNEL_ID",t[t.CONVERSATION=8]="CONVERSATION"}(Se||(Se={}));var De=((Re={})[Se.STRING]=oe,Re[Se.ONLY_STRING]=te,Re[Se.NUMBER]=ne,Re[Se.BOOLEAN]=function(t){return"boolean"==typeof t},Re[Se.OBJECT]=ae,Re[Se.ARRAY]=ie,Re[Se.CALLBACK]=function(t){var e=!0;return ae(t)||(e=!1),(t=t||{}).onSuccess&&!ue(t.onSuccess)&&(e=!1),t.onError&&!ue(t.onError)&&(e=!1),e},Re[Se.CHANNEL_ID]=fe,Re[Se.CONVERSATION]=function(t){var e=!0;return ae(t)||(e=!1),te(t.targetId)||(e=!1),ge(t.conversationType)||(e=!1),ce(t.channelId)||fe(t.channelId)||(e=!1),e},Re),Ve=function(t){function e(e){var n=t.call(this,e)||this;return n.name="RCAssertError",n}return a(e,t),e}(Error),Ge=function(t,e,n,i){if(void 0===i&&(i=!1),!Be(t,e,n,i))throw new Ve("'".concat(t,"' is invalid: ").concat(JSON.stringify(e)))},Be=function(t,e,n,i){void 0===i&&(i=!1),n=De[n]||n;var r=i?n(e):ce(e)||null==e||n(e);return r||null===console||void 0===console||console.error("'".concat(t,"' is invalid: ").concat(JSON.stringify(e))),r},ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function xe(t){var e,n,i,r,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=ke.indexOf(t.charAt(u++))<<2|(r=ke.indexOf(t.charAt(u++)))>>4,n=(15&r)<<4|(o=ke.indexOf(t.charAt(u++)))>>2,i=(3&o)<<6|(s=ke.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function Fe(t){for(var e=null===window||void 0===window?void 0:window.atob(t),n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n.buffer}var Ke,He,qe,Ye,je=function(t){if(!ae(t)||void 0===t.low||void 0===t.high)return t;var e=t.low;return e<0&&(e+=4294967296),e=e.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(e.length,"}$")),e),16)},Qe=function(t,e){var n=Math.floor(1e3*Math.random()%1e4),i=we(),r=function(t){t=t||"-";var e=new Date,n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate();return"".concat(n).concat(t).concat(i).concat(t).concat(r)}(),o=(new Date).getTime(),s="";if(e){var a=e.split(".");s=".".concat(a[a.length-1])}return"".concat(t,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},We=function(t){var e="application/octet-stream";switch(t){case Q.IMAGE:e="image/jpeg";break;case Q.AUDIO:e="audio/amr";break;case Q.VIDEO:e="video/3gpp";break;case Q.SIGHT:e="video/mpeg4";break;case Q.COMBINE_HTML:e="text/html"}return e},Je=function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=t.threadId,i=t.apnsCollapseId,r=t.category,o=t.richMediaUri,s=e.channelIdMi,a=e.channelIdHW,u=e.channelIdOPPO,c=e.typeVivo,l=e.googleConfig,h=e.miLargeIconUrl,d=e.importanceHW,g=e.categoryHW,p=e.imageUrlHW,f=e.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=i||"",_.category=r||"",_.richMediaUri=o||"";var E={};E.collapse_key=null==l?void 0:l.collapseKey,E.imageUrl=null==l?void 0:l.imageUrl;var T=null==l?void 0:l.priority;T&&!["high","normal"].includes(T)&&(T="normal"),E.priority=T;var v=[{HW:{channelId:a||"",importance:d||"NORMAL",image:p||"",category:g||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(v)},Xe=function(t,e,n){var i={},r={notificationId:n||""};if(!e)return{iOSConfig:i,androidConfig:r};try{var o=JSON.parse(e);null==o||o.forEach((function(t){var e,n,o,s,a,u,c,l,h,d=Object.keys(t);if(0!==d.length){var g=d[0];switch(g){case"HW":return r.channelIdHW=null===(e=t[g])||void 0===e?void 0:e.channelId,r.importanceHW=null===(n=t[g])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=t[g])||void 0===o?void 0:o.image,void(r.categoryHW=null===(s=t[g])||void 0===s?void 0:s.category);case"MI":return r.channelIdMi=null===(a=t[g])||void 0===a?void 0:a.channelId,void(r.miLargeIconUrl=null===(u=t[g])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(r.channelIdOPPO=null===(c=t[g])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(l=t[g])||void 0===l?void 0:l.classification,void(r.categoryVivo=null===(h=t[g])||void 0===h?void 0:h.category);case"APNS":return i.threadId=t[g]["thread-id"],i.apnsCollapseId=t[g]["apns-collapse-id"],i.category=t[g].category,void(i.richMediaUri=t[g].richMediaUri);case"FCM":r.googleConfig={collapseKey:t[g].collapse_key||"",imageUrl:t[g].imageUrl||"",priority:t[g].priority||""}}}}))}catch(n){t.error(pt.O,"Wrong format for pushConfigs field! content: ".concat(e))}return{iOSConfig:i,androidConfig:r}},Ze=function(t){var e=/^[A-Za-z0-9_=+-]+$/.test(t),n=t.length;return e&&(n<=128&&n>=1)},ze=function(t){var e=t.length;return e<=4096&&e>=1},$e=(Ke=0,function(){var t=((4294967295&Date.now())>>>0).toString(2),e=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=t+Ke.toString(2).padStart(11,"0")+e.toString(2).padStart(20,"0");return Ke=2047&++Ke,parseInt(n,2)}),tn=function(){var t=Ce.getInfo(),e="electron";for(var n in t)"engine"!==n&&(e=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return e},en=function(t,e,n){return c(void 0,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(e),"AES-CBC",!0,["decrypt"])];case 1:return i=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,Fe(t))];case 2:return r=o.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function nn(t,e){var n;if(!t)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(t)?i?t.replace(/^https?:\/\//i,"https://"):t:e!==wt.HTTP||i?"https://".concat(t):"http://".concat(t)}!function(t){t.GET="GET",t.POST="POST",t.PUT="PUT"}(He||(He={})),function(t){t.WIFI="wifi",t.FOUR_G="4g",t.THREE_G="3g",t.TWO_G="2g",t.FIVE_G="2g",t.THREE_GENT="3gnet",t.UNKONWN="unknown"}(qe||(qe={})),function(t){t[t.add=1]="add",t[t.update=2]="update",t[t.delete=3]="delete"}(Ye||(Ye={}));var rn=function(){var t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;return"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")};function on(t){var e=t.method||He.GET,n=t.timeout||y,i=t.headers,r=t.query,o=t.body,s=t.onProgress,a=T(t.url,r),u=rn(),c="[object XDomainRequest]"===Object.prototype.toString.call(u);if(u.open(e,a),i&&u.setRequestHeader)for(var l in i)u.setRequestHeader(l,i[l]);return c?function(t,e,n){return new Pe((function(i){0!==e&&(t.timeout=e),t.onload=function(){i({data:t.responseText,status:t.status||200})},t.onerror=function(){i({status:t.status})},t.ontimeout=function(){i({status:t.status})};var r="object"==typeof n?JSON.stringify(n):n;t.send(r)}),(function(e){t.abort(),e({status:-1})}))}(u,n,o):function(t,e,n,i){return new Pe((function(r){t.onreadystatechange=function(){4===t.readyState&&r({data:t.responseText,status:t.status,xhr:t})},t.onerror=function(){r({status:t.status})},i&&(t.upload.onprogress=function(t){return i(t)}),0!==e&&setTimeout((function(){t.abort(),r({status:t.status})}),e),t.send(n)}),(function(e){t.abort(),e({status:-1})}))}(u,n,o,s)}var sn,an,un=function(t,e,n){var i=null==n?void 0:n.isReverse;ae(t)&&function(){for(var n in t)e(t[n],n,t)}(),(ie(t)||te(t))&&function(){if(i)for(var n=t.length-1;n>=0;n--)e(t[n],n);else for(var r=0,o=t.length;r<o;r++)e(t[r],r)}()},cn=function(t,e){return un(t,(function(n,i){t[i]=e(n,i)})),t},ln=function(t,e){if(t.indexOf)return t.indexOf(e);var n=-1;return un(t,(function(t,i){e===t&&(n=i)})),n},hn=function(t,e){return-1!==ln(t,e)},dn=function(t,e){var n=[];return un(t,(function(t){n.push(t)})),-1!==ln(n,e)},gn=function(t){return JSON.parse(JSON.stringify(t))},pn=function(){return"undefined"!=typeof RCCppEngine},fn=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},_n=function(t){var e;if("object"==typeof t&&null!==t)if(Array.isArray(t))for(var n in e=[],t)e.push(_n(t[n]));else for(var n in e={},t)e[n]=_n(t[n]);else e=t;return e},En=function(t){var e;try{e=_n(t)}catch(n){e=JSON.parse(JSON.stringify(t))}return e},Tn={_delayTime:0,setTime:function(t){var e=(new Date).getTime();Tn._delayTime=e-t},getTime:function(){var t=Tn._delayTime;return(new Date).getTime()-t}},vn=function(t,e){var n=0;return t.isAutoDelete&&(n|=1),t.isOverwrite&&(n|=2),2===e&&(n|=4),n},yn=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}return t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.roomId,n=t.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===Z.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},t.prototype.pullEntry=function(t,e){this._pullQueue.push({roomId:t,timestamp:e}),this._startPull()},t.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},t}(),Cn="rtcRJoin_data",mn="rtcRExit",In="rtcRInfo",Rn="rtcUData",Sn="rtcUPut",On="rtcUDel",Nn="rtcSetData",Mn="userSetData",Un="rtcQryData",Ln="rtcDelData",An="rtcToken",wn="rtcUserState",bn="rtcUList",Pn="viewerJoinR",Dn="viewerExitR",Vn="rtcPullKv",Gn="rtcIdentityChange",Bn="rtcInvite",kn="rtcCancelInvite",xn="rtcInviteAnswer",Fn="rtcEndInvite",Kn="rtcQueryJoined";!function(t){t.RtcInput="RtcInput",t.RtcUserListOutput="RtcUserListOutput",t.SetUserStatusInput="SetUserStatusInput",t.RtcSetDataInput="RtcSetDataInput",t.RtcUserSetDataInput="RtcUserSetDataInput",t.RtcDataInput="RtcDataInput",t.RtcSetOutDataInput="RtcSetOutDataInput",t.MCFollowInput="MCFollowInput",t.RtcTokenOutput="RtcTokenOutput",t.RtcQryOutput="RtcQryOutput",t.RtcQryUserOutDataInput="RtcQryUserOutDataInput",t.RtcUserOutDataOutput="RtcUserOutDataOutput",t.RtcQueryListInput="RtcQueryListInput",t.RtcRoomInfoOutput="RtcRoomInfoOutput",t.RtcValueInfo="RtcValueInfo",t.RtcKeyDeleteInput="RtcKeyDeleteInput",t.RtcNotifyMsg="RtcNotifyMsg",t.RtcPullKV="RtcPullKV",t.RtcKVOutput="RtcKVOutput",t.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",t.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",t.RtcViewerJoinedOutput="RtcViewerJoinedOutput",t.RtcInviteInput="RtcInviteInput",t.RtcCancelInviteInput="RtcCancelInviteInput",t.RtcInviteAnswerInput="RtcInviteAnswerInput",t.RtcEndInviteInput="RtcEndInviteInput",t.RtcOutput="RtcOutput"}(an||(an={}));var Hn=((sn={})[an.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],sn[an.RtcUserListOutput]=["users","token","sessionId","roomInfo"],sn[an.SetUserStatusInput]=["status"],sn[an.RtcSetDataInput]=["interior","target","key","value","objectName","content"],sn[an.RtcUserSetDataInput]=["valueInfo","objectName","content"],sn[an.RtcDataInput]=["interior","target","key","objectName","content"],sn[an.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],sn[an.MCFollowInput]=["state"],sn[an.RtcTokenOutput]=["rtcToken"],sn[an.RtcQryOutput]=["outInfo"],sn[an.RtcQryUserOutDataInput]=["userId"],sn[an.RtcUserOutDataOutput]=["user"],sn[an.RtcQueryListInput]=["order"],sn[an.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],sn[an.RtcValueInfo]=["key","value"],sn[an.RtcKeyDeleteInput]=["key"],sn[an.RtcNotifyMsg]=["type","time","roomId"],sn[an.RtcPullKV]=["timestamp","roomId"],sn[an.RtcKVOutput]=["entries","bFullUpdate","syncTime"],sn[an.RtcQueryUserJoinedInput]=["userId"],sn[an.RtcQueryUserJoinedOutput]=["info"],sn[an.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],sn[an.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],sn[an.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],sn[an.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],sn),qn="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(an.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(an.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(an.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(an.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(an.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(an.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(an.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 ").concat(an.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(an.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(an.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(an.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(an.RtcQryOutput,"{\n repeated ").concat(an.RtcValueInfo," outInfo=1;\n }\n message ").concat(an.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(an.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(an.RtcUserSetDataInput," {\n repeated ").concat(an.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(an.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(an.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(an.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(an.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(an.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(an.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(an.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(an.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(an.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(an.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(an.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(an.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(an.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(an.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(an.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(an.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"),Yn=function(){function t(t,e,n,i,r,o){this.runtime=t,this.rtcCodec=e,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new yn(this)}return t.prototype.registerRTCSignalingListener=function(t){this._rtcSignalingListener=t},t.prototype.getInnerLogger=function(){return this.logger},t.prototype.getInnerStatisticLog=function(){return this.statisticLog},t.prototype.pullRTCRoomEntry=function(t,e){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=this.rtcCodec.encode(an.RtcPullKV,{timestamp:0,roomId:t}),[4,this.rtcSignaling(t,Vn,!0,e)];case 1:return n=c.sent(),i=n.code,r=n.buffer,i!==Z.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(an.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(t){return u(u({},t),{timestamp:je(t.timestamp)})})),this._watcher.onRTCDataChange(s,t),[2,{code:i,data:{kvEntries:s,syncTime:je(a)}}])}}))}))},t.prototype._receiveRtcKv=function(t){if(this._rtcSignalingListener)this._rtcSignalingListener(t);else{var e=this.rtcCodec.decode(an.RtcNotifyMsg,t),n=e.time,i=e.type,r=e.roomId;1===i&&this._rtcKVManager.pullEntry(r,je(n))}},t.prototype.destroy=function(){},t}();function jn(t){var e=function(){function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return!0===(t&&t.__isLong__)}function n(t,e){var n,i,o;return e?(o=(t>>>=0)>=0&&t<256)&&(i=u[t])?i:(n=r(t,(0|t)<0?-1:0,!0),o&&(u[t]=n),n):(o=(t|=0)>=-128&&t<128)&&(i=a[t])?i:(n=r(t,t<0?-1:0,!1),o&&(a[t]=n),n)}function i(t,e){if(isNaN(t)||!isFinite(t))return e?f:p;if(e){if(t<0)return f;if(t>=h)return y}else{if(-d>=t)return C;if(t+1>=d)return v}return t<0?i(-t,e).neg():r(0|t%l,0|t/l,e)}function r(e,n,i){return new t(e,n,i)}function o(t,e,n){var r,s,a,u,l,h,d;if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return p;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||n>36)throw RangeError("radix");if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(t.substring(1),e,n).neg();for(s=i(c(n,8)),a=p,u=0;u<t.length;u+=8)l=Math.min(8,t.length-u),h=parseInt(t.substring(u,u+l),n),l<8?(d=i(c(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(s)).add(i(h));return a.unsigned=e,a}function s(e){return e instanceof t?e:"number"==typeof e?i(e):"string"==typeof e?o(e):r(e.low,e.high,e.unsigned)}var a,u,c,l,h,d,g,p,f,_,E,T,v,y,C,m;return t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),t.isLong=e,a={},u={},t.fromInt=n,t.fromNumber=i,t.fromBits=r,c=Math.pow,t.fromString=o,t.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,g=n(16777216),p=n(0),t.ZERO=p,f=n(0,!0),t.UZERO=f,_=n(1),t.ONE=_,E=n(1,!0),t.UONE=E,T=n(-1),t.NEG_ONE=T,v=r(-1,2147483647,!1),t.MAX_VALUE=v,y=r(-1,-1,!0),t.MAX_UNSIGNED_VALUE=y,C=r(0,-2147483648,!1),t.MIN_VALUE=C,(m=t.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},m.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},m.toString=function(t){var e,n,r,o,s,a,u,l;if((t=t||10)<2||t>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(C)?(e=i(t),r=(n=this.div(e)).mul(e).sub(this),n.toString(t)+r.toInt().toString(t)):"-"+this.neg().toString(t);for(o=i(c(t,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(t),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},m.getHighBits=function(){return this.high},m.getHighBitsUnsigned=function(){return this.high>>>0},m.getLowBits=function(){return this.low},m.getLowBitsUnsigned=function(){return this.low>>>0},m.getNumBitsAbs=function(){var t,e;if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},m.isZero=function(){return 0===this.high&&0===this.low},m.isNegative=function(){return!this.unsigned&&this.high<0},m.isPositive=function(){return this.unsigned||this.high>=0},m.isOdd=function(){return 1==(1&this.low)},m.isEven=function(){return 0==(1&this.low)},m.equals=function(t){return e(t)||(t=s(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},m.eq=m.equals,m.notEquals=function(t){return!this.eq(t)},m.neq=m.notEquals,m.lessThan=function(t){return this.comp(t)<0},m.lt=m.lessThan,m.lessThanOrEqual=function(t){return this.comp(t)<=0},m.lte=m.lessThanOrEqual,m.greaterThan=function(t){return this.comp(t)>0},m.gt=m.greaterThan,m.greaterThanOrEqual=function(t){return this.comp(t)>=0},m.gte=m.greaterThanOrEqual,m.compare=function(t){if(e(t)||(t=s(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},m.comp=m.compare,m.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(_)},m.neg=m.negate,m.add=function(t){var n,i,o,a,u,c,l,h,d,g,p;return e(t)||(t=s(t)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,u=t.high>>>16,c=65535&t.high,l=t.low>>>16,h=0,d=0,g=0,p=0,g+=(p+=a+(65535&t.low))>>>16,d+=(g+=o+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((g&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},m.subtract=function(t){return e(t)||(t=s(t)),this.add(t.neg())},m.sub=m.subtract,m.multiply=function(t){var n,o,a,u,c,l,h,d,f,_,E,T;return this.isZero()?p:(e(t)||(t=s(t)),t.isZero()?p:this.eq(C)?t.isOdd()?C:p:t.eq(C)?this.isOdd()?C:p:this.isNegative()?t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg():t.isNegative()?this.mul(t.neg()).neg():this.lt(g)&&t.lt(g)?i(this.toNumber()*t.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=t.high>>>16,l=65535&t.high,h=t.low>>>16,f=0,_=0,E=0,T=0,E+=(T+=u*(d=65535&t.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=u*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=u*l)>>>16,f+=n*d+o*h+a*l+u*c,r((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},m.mul=m.multiply,m.divide=function(t){var n,r,o,a,u,l,h;if(e(t)||(t=s(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:p;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return f;if(t.gt(this.shru(1)))return E;o=f}else{if(this.eq(C))return t.eq(_)||t.eq(T)?C:t.eq(C)?_:(n=this.shr(1).div(t).shl(1)).eq(p)?t.isNegative()?_:T:(r=this.sub(t.mul(n)),o=n.add(r.div(t)));if(t.eq(C))return this.unsigned?f:p;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=p}for(r=this;r.gte(t);){for(n=Math.max(1,Math.floor(r.toNumber()/t.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(t);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(t);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},m.div=m.divide,m.modulo=function(t){return e(t)||(t=s(t)),this.sub(this.div(t).mul(t))},m.mod=m.modulo,m.not=function(){return r(~this.low,~this.high,this.unsigned)},m.and=function(t){return e(t)||(t=s(t)),r(this.low&t.low,this.high&t.high,this.unsigned)},m.or=function(t){return e(t)||(t=s(t)),r(this.low|t.low,this.high|t.high,this.unsigned)},m.xor=function(t){return e(t)||(t=s(t)),r(this.low^t.low,this.high^t.high,this.unsigned)},m.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):r(0,this.low<<t-32,this.unsigned)},m.shl=m.shiftLeft,m.shiftRight=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):r(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},m.shr=m.shiftRight,m.shiftRightUnsigned=function(t){var n;return e(t)&&(t=t.toInt()),0===(t&=63)?this:(n=this.high,t<32?r(this.low>>>t|n<<32-t,n>>>t,this.unsigned):r(32===t?n:n>>>t-32,0,this.unsigned))},m.shru=m.shiftRightUnsigned,m.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},m.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},m.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},m.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,255&e>>>8,255&e>>>16,255&e>>>24,255&t,255&t>>>8,255&t>>>16,255&t>>>24]},m.toBytesBE=function(){var t=this.high,e=this.low;return[255&t>>>24,255&t>>>16,255&t>>>8,255&t,255&e>>>24,255&e>>>16,255&e>>>8,255&e]},t}(),n=function(t){function e(t){var e=0;return function(){return e<t.length?t.charCodeAt(e++):null}}function n(){var t=[],e=[];return function(){return 0===arguments.length?e.join("")+a.apply(String,t):(t.length+arguments.length>1024&&(e.push(a.apply(String,t)),t.length=0),void Array.prototype.push.apply(t,arguments))}}function i(t,e,n,i,r){var o,s,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,g=t[e+h];for(h+=d,o=g&(1<<-l)-1,g>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=c}return(g?-1:1)*s*Math.pow(2,o-i)}function r(t,e,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,p=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+g]=255&a,g+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[n+g]=255&s,g+=p,s/=256,c-=8);t[n+g-p]|=128*f}var o,s,a,u,c,l=function(t,e,n){if(void 0===t&&(t=l.DEFAULT_CAPACITY),void 0===e&&(e=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((t|=0)<0)throw RangeError("Illegal capacity");e=!!e,n=!!n}this.buffer=0===t?s:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e,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=t||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(t,e,n){return new l(t,e,n)},l.concat=function(t,e,n,i){var r,o,s,a,u,c;for(("boolean"==typeof e||"string"!=typeof e)&&(i=n,n=e,e=void 0),r=0,s=0,a=t.length;a>s;++s)l.isByteBuffer(t[s])||(t[s]=l.wrap(t[s],e)),(o=t[s].limit-t[s].offset)>0&&(r+=o);if(0===r)return new l(0,n,i);for(c=new l(r,n,i),s=0;a>s;)(o=(u=t[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(t){return!0===(t&&t.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(t,e,n,i){var r,s;if("string"!=typeof e&&(i=n,n=e,e=void 0),"string"==typeof t)switch(void 0===e&&(e="utf8"),e){case"base64":return l.fromBase64(t,n);case"hex":return l.fromHex(t,n);case"binary":return l.fromBinary(t,n);case"utf8":return l.fromUTF8(t,n);case"debug":return l.fromDebug(t,n);default:throw Error("Unsupported encoding: "+e)}if(null===t||"object"!=typeof t)throw TypeError("Illegal buffer");if(l.isByteBuffer(t))return(r=o.clone.call(t)).markedOffset=-1,r;if(t instanceof Uint8Array)r=new l(0,n,i),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new Uint8Array(t.buffer));else if(t instanceof ArrayBuffer)r=new l(0,n,i),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new Uint8Array(t):null);else{if("[object Array]"!==Object.prototype.toString.call(t))throw TypeError("Illegal buffer");for((r=new l(t.length,n,i)).limit=t.length,s=0;s<t.length;++s)r.view[s]=t[s]}return r},o.writeBitSet=function(t,e){var n,i,r,o,s,a,u=void 0===e;if(u&&(e=this.offset),!this.noAssert){if(!(t instanceof Array))throw TypeError("Illegal BitSet: Not an array");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)}for(i=e,o=(r=t.length)>>3,s=0,e+=this.writeVarint32(r,e);o--;)n=1&!!t[s++]|(1&!!t[s++])<<1|(1&!!t[s++])<<2|(1&!!t[s++])<<3|(1&!!t[s++])<<4|(1&!!t[s++])<<5|(1&!!t[s++])<<6|(1&!!t[s++])<<7,this.writeByte(n,e++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!t[s++])<<a++;this.writeByte(n,e++)}return u?(this.offset=e,this):e-i},o.readBitSet=function(t){var e,n,i,r,o,s,a,u=void 0===t;for(u&&(t=this.offset),r=(i=(n=this.readVarint32(t)).value)>>3,o=0,s=[],t+=n.length;r--;)e=this.readByte(t++),s[o++]=!!(1&e),s[o++]=!!(2&e),s[o++]=!!(4&e),s[o++]=!!(8&e),s[o++]=!!(16&e),s[o++]=!!(32&e),s[o++]=!!(64&e),s[o++]=!!(128&e);if(i>o)for(a=0,e=this.readByte(t++);i>o;)s[o++]=!!(1&e>>a++);return u&&(this.offset=t),s},o.readBytes=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+t+") <= "+this.buffer.byteLength)}return n=this.slice(e,e+t),i&&(this.offset+=t),n},o.writeBytes=o.append,o.writeInt8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(t){var e,n=void 0===t;if(n&&(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)}return 128==(128&(e=this.view[t]))&&(e=-(255-e+1)),n&&(this.offset+=1),e},o.readByte=o.readInt8,o.writeUint8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(t){var e,n=void 0===t;if(n&&(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)}return e=this.view[t],n&&(this.offset+=1),e},o.readUInt8=o.readUint8,o.writeInt16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),32768==(32768&e)&&(e=-(65535-e+1)),n&&(this.offset+=2),e},o.readShort=o.readInt16,o.writeUint16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),n&&(this.offset+=2),e},o.readUInt16=o.readUint16,o.writeInt32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),e|=0,n&&(this.offset+=4),e},o.readInt=o.readInt32,o.writeUint32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),n&&(this.offset+=4),e},o.readUInt32=o.readUint32,t&&(o.writeInt64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,r(this.view,t,e,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=i(this.view,t,this.littleEndian,23,4),n&&(this.offset+=4),e},o.readFloat=o.readFloat32,o.writeFloat64=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=8,r(this.view,t,e,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(t){var e,n=void 0===t;if(n&&(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 e=i(this.view,t,this.littleEndian,52,8),n&&(this.offset+=8),e},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(t){return(t>>>=0)<128?1:t<16384?2:1<<21>t?3:1<<28>t?4:5},l.zigZagEncode32=function(t){return((t|=0)<<1^t>>31)>>>0},l.zigZagDecode32=function(t){return 0|t>>>1^-(1&t)},o.writeVarint32=function(t,e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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)}for((e+=i=l.calculateVarint32(t))>(r=this.buffer.byteLength)&&this.resize((r*=2)>e?r:e),e-=i,t>>>=0;t>=128;)n=128|127&t,this.view[e++]=n,t>>>=7;return this.view[e++]=t,o?(this.offset=e,this):i},o.writeVarint32ZigZag=function(t,e){return this.writeVarint32(l.zigZagEncode32(t),e)},o.readVarint32=function(t){var e,n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&t>this.limit)throw(r=Error("Truncated")).truncated=!0,r;e=this.view[t++],n<5&&(i|=(127&e)<<7*n),++n}while(0!=(128&e));return i|=0,o?(this.offset=t,i):{value:i,length:n}},o.readVarint32ZigZag=function(t){var e=this.readVarint32(t);return"object"==typeof e?e.value=l.zigZagDecode32(e.value):e=l.zigZagDecode32(e),e},t&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(e){"number"==typeof e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e));var n=e.toInt()>>>0,i=e.shiftRightUnsigned(28).toInt()>>>0,r=e.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(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftLeft(1).xor(e.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftRightUnsigned(1).xor(e.and(t.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(e,n){var i,r,o,s,a,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),i=l.calculateVarint64(e),r=e.toInt()>>>0,o=e.shiftRightUnsigned(28).toInt()>>>0,s=e.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return u?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(t,e){return this.writeVarint64(l.zigZagEncode64(t),e)},o.readVarint64=function(e){var n,i,r,o,s,a,u=void 0===e;if(u&&(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)}if(n=e,i=0,r=0,o=0,s=0,i=127&(s=this.view[e++]),128&s&&(i|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[e++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=t.fromBits(i|r<<28,r>>>4|o<<24,!1),u?(this.offset=e,a):{value:a,length:e-n}},o.readVarint64ZigZag=function(e){var n=this.readVarint64(e);return n&&n.value instanceof t?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=t.length,!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===t.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(e(t))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(t){var e,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,r=-1,c.decodeUTF8toUTF16(function(){if(0===r)return null;if(t>=this.limit)throw RangeError("Illegal range: Truncated data, "+t+" < "+this.limit);return 0===(r=this.view[t++])?null:r}.bind(this),i=n(),!0),o?(this.offset=t,i()):{string:i(),length:t-e}},o.writeIString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof t)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(e(t),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i):(this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),n+=4,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(t){var e,n,i,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=t,n=this.readUint32(t),i=this.readUTF8String(n,l.METRICS_BYTES,t+=4),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=c.calculateUTF16asUTF8(e(t))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(t){return c.calculateUTF16asUTF8(e(t))[0]},l.calculateUTF8Bytes=function(t){return c.calculateUTF16asUTF8(e(t))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(t,e,i){var r,o,s,a,u;if("number"==typeof e&&(i=e,e=void 0),(r=void 0===i)&&(i=this.offset),void 0===e&&(e=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");if(t|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,e===l.METRICS_CHARS){if(o=n(),c.decodeUTF8(function(){return t>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(t){++s,c.UTF8toUTF16(t,o)})),s!==t)throw RangeError("Illegal range: Truncated data, "+s+" == "+t);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(e===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+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+t+") <= "+this.buffer.byteLength)}if(u=i+t,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+e)},o.readString=o.readUTF8String,o.writeVString=function(t,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=c.calculateUTF16asUTF8(e(t),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(t){var e,n,i,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,n=this.readVarint32(t),i=this.readUTF8String(n.value,l.METRICS_BYTES,t+=n.length),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},o.append=function(t,e,n){var i,r,o;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=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 t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(t.view.subarray(t.offset,t.limit),n),t.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(t,e){return t.append(this,e),this},o.assert=function(t){return this.noAssert=!t,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(t){var e=new l(0,this.littleEndian,this.noAssert);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),e.view=new Uint8Array(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e},o.compact=function(t,e){var n,i,r;if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return 0===t&&e===this.buffer.byteLength?this:0===(n=e-t)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(t,e)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=n,this)},o.copy=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}if(t===e)return new l(0,this.littleEndian,this.noAssert);var n=e-t,i=new l(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=t),this.copyTo(i,0,t,e),i},o.copyTo=function(t,e,n,i){var r,o,s;if(!this.noAssert&&!l.isByteBuffer(t))throw TypeError("Illegal target: Not a ByteBuffer");if(e=(o=void 0===e)?t.offset:0|e,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,e<0||e>t.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+e+" <= "+t.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=i-n)?t:(t.ensureCapacity(e+s),t.view.set(this.view.subarray(n,i),e),r&&(this.offset+=s),o&&(t.offset+=s),this)},o.ensureCapacity=function(t){var e=this.buffer.byteLength;return t>e?this.resize((e*=2)>t?e:t):this},o.fill=function(t,e,n){var i=void 0===e;if(i&&(e=this.offset),"string"==typeof t&&t.length>0&&(t=t.charCodeAt(0)),void 0===e&&(e=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,e<0||e>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+n+" <= "+this.buffer.byteLength)}if(e>=n)return this;for(;n>e;)this.view[e++]=t;return i&&(this.offset=e),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(t){if(t=void 0===t?this.offset:t,!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=t,this},o.order=function(t){if(!this.noAssert&&"boolean"!=typeof t)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!t,this},o.LE=function(t){return this.littleEndian=void 0===t||!!t,this},o.BE=function(t){return this.littleEndian=void 0!==t&&!t,this},o.prepend=function(t,e,n){var i,r,o,s,a;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=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 t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(t.view.subarray(t.offset,t.limit),n-r),t.offset=t.limit,i&&(this.offset-=r)),this},o.prependTo=function(t,e){return t.prepend(this,e),this},o.printDebug=function(t){"function"!=typeof t&&(t=console.log.bind(console)),t(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(t){var e,n;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal capacity: "+t+" (not an integer)");if((t|=0)<0)throw RangeError("Illegal capacity: 0 <= "+t)}return this.buffer.byteLength<t&&(e=new ArrayBuffer(t),(n=new Uint8Array(e)).set(this.view),this.buffer=e,this.view=n),this},o.reverse=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return t===e||Array.prototype.reverse.call(this.view.subarray(t,e)),this},o.skip=function(t){if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");t|=0}var e=this.offset+t;if(!this.noAssert&&(e<0||e>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+t+" <= "+this.buffer.byteLength);return this.offset=e,this},o.slice=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=t,n.limit=e,n},o.toBuffer=function(t){var e,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 t||0!==n||i!==this.buffer.byteLength?n===i?s:(e=new ArrayBuffer(i-n),new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(n,i),0),e):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(t,e,n){if(void 0===t)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof t&&(n=e=t="utf8"),t){case"utf8":return this.toUTF8(e,n);case"base64":return this.toBase64(e,n);case"hex":return this.toHex(e,n);case"binary":return this.toBinary(e,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+t)}},u=function(){var t,e,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(t=0,e=i.length;e>t;++t)r[i[t]]=t;return n.encode=function(t,e){for(var n,r;null!==(n=t());)e(i[63&n>>2]),r=(3&n)<<4,null!==(n=t())?(e(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=t())?(e(i[63&(r|3&n>>6)]),e(i[63&n])):(e(i[63&r]),e(61))):(e(i[63&r]),e(61),e(61))},n.decode=function(t,e){function n(t){throw Error("Illegal character code: "+t)}for(var i,o,s;null!==(i=t());)if(void 0===(o=r[i])&&n(i),null!==(i=t())&&(void 0===(s=r[i])&&n(i),e(o<<2>>>0|(48&s)>>4),null!==(i=t()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(e((15&s)<<4>>>0|(60&o)>>2),null!==(i=t())){if(void 0===(s=r[i])){if(61===i)break;n(i)}e((3&o)<<6>>>0|s)}}},n.test=function(t){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t)},n}(),o.toBase64=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity||t>e)throw RangeError("begin, end");var i;return u.encode(function(){return e>t?this.view[t++]:null}.bind(this),i=n()),i()},l.fromBase64=function(t,n){if("string"!=typeof t)throw TypeError("str");var i=new l(t.length/4*3,n),r=0;return u.decode(e(t),(function(t){i.view[r++]=t})),i.limit=r,i},l.btoa=function(t){return l.fromBinary(t).toBase64()},l.atob=function(t){return l.fromBase64(t).toBinary()},o.toBinary=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity()||t>e)throw RangeError("begin, end");if(t===e)return"";for(var n=[],i=[];e>t;)n.push(this.view[t++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(t,e){if("string"!=typeof t)throw TypeError("str");for(var n,i=0,r=t.length,o=new l(r,e);r>i;){if((n=t.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(t){for(var e,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(e=this.view[n])<16?"0"+e.toString(16).toUpperCase():e.toString(16).toUpperCase(),t&&(o+=e>32&&e<127?String.fromCharCode(e):".")),++n,t&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":t||0!==n&&n!==i?" ":""}if(t&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return t?s:r},l.fromDebug=function(t,e,n){for(var i,r,o=t.length,s=new l(0|(o+1)/3,e,n),a=0,u=0,c=!1,h=!1,d=!1,g=!1,p=!1;o>a;){switch(i=t.charAt(a++)){case"!":if(!n){if(h||d||g){p=!0;break}h=d=g=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||g){p=!0;break}h=g=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){p=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){p=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(g||d){p=!0;break}g=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(g){p=!0;break}g=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){p=!0;break}if(r=parseInt(i+t.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=r,c=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!g)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(t,e){if(t=void 0===t?this.offset:t,e=void 0===e?this.limit:e,!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}for(var n,i=new Array(e-t);e>t;)(n=this.view[t++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},l.fromHex=function(t,e,n){var i,r,o,s,a;if(!n){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if(t.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=t.length,o=new l(0|r/2,e),s=0,a=0;r>s;s+=2){if(i=parseInt(t.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},c=function(){var t={MAX_CODEPOINT:1114111,encodeUTF8:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<128?e(127&n):n<2048?(e(192|31&n>>6),e(128|63&n)):n<65536?(e(224|15&n>>12),e(128|63&n>>6),e(128|63&n)):(e(240|7&n>>18),e(128|63&n>>12),e(128|63&n>>6),e(128|63&n)),n=null},decodeUTF8:function(t,e){for(var n,i,r,o,s=function(t){t=t.slice(0,t.indexOf(null));var e=Error(t.toString());throw e.name="TruncatedError",e.bytes=t,e};null!==(n=t());)if(0==(128&n))e(n);else if(192==(224&n))null===(i=t())&&s([n,i]),e((31&n)<<6|63&i);else if(224==(240&n))(null===(i=t())||null===(r=t()))&&s([n,i,r]),e((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=t())||null===(r=t())||null===(o=t()))&&s([n,i,r,o]),e((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(t,e){for(var n,i=null;null!==(n=null!==i?i:t());)n>=55296&&n<=57343&&null!==(i=t())&&i>=56320&&i<=57343?(e(1024*(n-55296)+i-56320+65536),i=null):e(n);null!==i&&e(i)},UTF8toUTF16:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<=65535?e(n):(e(55296+((n-=65536)>>10)),e(n%1024+56320)),n=null},encodeUTF16toUTF8:function(e,n){t.UTF16toUTF8(e,(function(e){t.encodeUTF8(e,n)}))},decodeUTF8toUTF16:function(e,n){t.decodeUTF8(e,(function(e){t.UTF8toUTF16(e,n)}))},calculateCodePoint:function(t){return t<128?1:t<2048?2:t<65536?3:4},calculateUTF8:function(t){for(var e,n=0;null!==(e=t());)n+=e<128?1:e<2048?2:e<65536?3:4;return n},calculateUTF16asUTF8:function(e){var n=0,i=0;return t.UTF16toUTF8(e,(function(t){++n,i+=t<128?1:t<2048?2:t<65536?3:4})),[n,i]}};return t}(),o.toUTF8=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var i;try{c.decodeUTF8toUTF16(function(){return e>t?this.view[t++]:null}.bind(this),i=n())}catch(n){if(t!==e)throw RangeError("Illegal range: Truncated data, "+t+" != "+e)}return i()},l.fromUTF8=function(t,n,i){if(!i&&"string"!=typeof t)throw TypeError("Illegal str: Not a string");var r=new l(c.calculateUTF16asUTF8(e(t),!0)[1],n,i),o=0;return c.encodeUTF16toUTF8(e(t),(function(t){r.view[o++]=t})),r.limit=o,r},l}(e),i=function(e,n){var i,r,o={};return o.ByteBuffer=e,o.c=e,i=e,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var t={};return t.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),t.XHR=function(){var t,e=[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(t=0;t<e.length;t++){try{n=e[t]()}catch(t){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},t.fetch=function(e,n){if(n&&"function"!=typeof n&&(n=null),t.IS_NODE)if(n)g.readFile(e,(function(t,e){n(t?null:""+e)}));else try{return g.readFileSync(e)}catch(t){return null}else{var i=t.XHR();if(i.open("GET",e,!!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)}},t.toCamelCase=function(t){return t.replace(/_([a-zA-Z])/g,(function(t,e){return e.toUpperCase()}))},t}(),o.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},o.DotProto=function(t,e){function n(t,n){var i=-1,r=1;if("-"==t.charAt(0)&&(r=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))i=parseInt(t);else if(e.NUMBER_HEX.test(t))i=parseInt(t.substring(2),16);else{if(!e.NUMBER_OCT.test(t))throw Error("illegal id value: "+(r<0?"-":"")+t);i=parseInt(t.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+t);return i}function i(t){var n=1;if("-"==t.charAt(0)&&(n=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))return n*parseInt(t,10);if(e.NUMBER_HEX.test(t))return n*parseInt(t.substring(2),16);if(e.NUMBER_OCT.test(t))return n*parseInt(t.substring(1),8);if("inf"===t)return 1/0*n;if("nan"===t)return NaN;if(e.NUMBER_FLT.test(t))return n*parseFloat(t);throw Error("illegal number value: "+(n<0?"-":"")+t)}function r(t,e,n){void 0===t[e]?t[e]=n:(Array.isArray(t[e])||(t[e]=[t[e]]),t[e].push(n))}var o,s,a={},u=function(t){this.source=t+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var t,n='"'===this._stringOpen?e.STRING_DQ:e.STRING_SQ;if(n.lastIndex=this.index-1,!(t=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,t[1]},c.next=function(){var t,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(t=!1;e.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,t=!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,t=!0}}while(t);if(this.index===this.source.length)return null;if(r=this.index,e.DELIM.lastIndex=0,!e.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!e.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},c.peek=function(){if(0===this.stack.length){var t=this.next();if(null===t)return null;this.stack.push(t)}return this.stack[0]},c.skip=function(t){var e=this.next();if(e!==t)throw Error("illegal '"+e+"', '"+t+"' expected")},c.omit=function(t){return this.peek()===t&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(t){this.tn=new u(t),this.proto3=!1},(s=o.prototype).parse=function(){var t,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;t=this.tn.next();)switch(t){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(t=this.tn.next(),!e.TYPEREF.test(t))throw Error("illegal package name: "+t);this.tn.skip(";"),n.package=t;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(t=this.tn.peek())&&this.tn.next(),t=this._readString(),this.tn.skip(";"),n.imports.push(t);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 '"+t+"'")}}catch(t){throw t.message="Parse error at line "+this.tn.line+": "+t.message,t}return delete n.name,n},o.parse=function(t){return new o(t).parse()},s._readString=function(){var t,e,n="";do{if("'"!==(e=this.tn.next())&&'"'!==e)throw Error("illegal string delimiter: "+e);n+=this.tn.next(),this.tn.skip(e),t=this.tn.peek()}while('"'===t||'"'===t);return n},s._readValue=function(t){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),e.NUMBER.test(n))return i(n);if(e.BOOL.test(n))return"true"===n.toLowerCase();if(t&&e.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(t,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!e.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),e.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(t,i),n||this.tn.skip(";")},s._parseOptionValue=function(t,n){var i=this.tn.peek();if("{"!==i)r(t.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!e.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(t.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(t,n+"."+i)}},s._parseService=function(t){var n,i=this.tn.next();if(!e.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(";"),t.services.push(n)},s._parseServiceRPC=function(t){var n,i,r="rpc",o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!e.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===t[r]&&(t[r]={}),t[r][n]=i},s._parseMessage=function(t,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!e.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(e.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!e.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),t.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(t,i,r){var o,s,a;if(!e.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!e.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(t,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!e.TYPE.test(r)&&!e.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!e.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return t.fields.push(o),o},s._parseMessageOneOf=function(t){var n,i,r,o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(t,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),t.oneofs[i]=r},s._parseFieldOptions=function(t){this.tn.skip("[");for(var e=!0;"]"!==this.tn.peek();)e||this.tn.skip(","),this._parseOption(t,!0),e=!1;this.tn.next()},s._parseEnum=function(t){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!e.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),t.enums.push(r)},s._parseExtensionRanges=function(){var e,n,r,o=[];do{for(n=[];;){switch(e=this.tn.next()){case"min":r=t.ID_MIN;break;case"max":r=t.ID_MAX;break;default:r=i(e)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(t){var n,i=this.tn.next();if(!e.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(e.RULE.test(i))this._parseMessageField(n,i);else{if(!e.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(";"),t.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(t){function n(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function r(e,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case t.WIRE_TYPES.STARTGROUP:r(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,u,c,l,h,d,g,p,f,_,E,T,v,y,C={},m=function(t,e,n){this.builder=t,this.parent=e,this.name=n,this.className},I=m.prototype;return I.fqn=function(){for(var t=this.name,e=this;null!=(e=e.parent);)t=e.name+"."+t;return t},I.toString=function(t){return(t?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},C.T=m,o=function(t,e,n,i,r){m.call(this,t,e,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(m.prototype)).getChildren=function(t){var e,n,i;if(null==(t=t||null))return this.children.slice();for(e=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof t&&e.push(this.children[n]);return e},s.addChild=function(t){var e;if(e=this.getChild(t.name))if(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName))e.name=e.originalName;else{if(!(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+t.name);t.name=t.originalName}this.children.push(t)},s.getChild=function(t){var e,n,i="number"==typeof t?"id":"name";for(e=0,n=this.children.length;n>e;++e)if(this.children[e][i]===t)return this.children[e];return null},s.resolve=function(t,e){var n,i="string"==typeof t?t.split("."):t,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof C.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof C.T&&(!e||n instanceof C.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(t,e)}while(null!=r);return r},s.qn=function(t){var e,n,i=[],r=t;do{i.unshift(r.name),r=r.parent}while(null!==r);for(e=1;e<=i.length;e++)if(n=i.slice(i.length-e),t===this.resolve(n,t instanceof C.Namespace))return n.join(".");return t.fqn()},s.build=function(){var t,e,n,i={},r=this.children;for(e=0,n=r.length;n>e;++e)(t=r[e])instanceof o&&(i[t.name]=t.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var t,e,n,i,r={},o=Object.keys(this.options);for(t=0,e=o.length;e>t;++t)n=o[t],i=this.options[o[t]],r[n]=i;return r},s.getOption=function(t){return void 0===t?this.options:void 0!==this.options[t]?this.options[t]:null},C.Namespace=o,a=function(e,n,i,r){if(this.type=e,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},u=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new i(0):e.defaultValue},u.verifyValue=function(i){var r,o,s,a=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i>4294967295?0|i:i;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i<0?i>>>0:i;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return n(i,!1)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return n(i,!0)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof i&&a(typeof i,"not a boolean"),i;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof i&&a(typeof i,"not a number"),i;case t.TYPES.string:return"string"==typeof i||i&&i instanceof String||a(typeof i,"not a string"),""+i;case t.TYPES.bytes:return e.isByteBuffer(i)?i:e.wrap(i);case t.TYPES.enum:for(r=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==i)return r[s].id;if(r[s].id==i)return r[s].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 t.TYPES.group:case t.TYPES.message:if(i&&"object"==typeof i||a(typeof i,"object expected"),i instanceof this.resolvedType.clazz)return i;if(i instanceof t.Builder.Message){for(s in o={},i)i.hasOwnProperty(s)&&(o[s]=i[s]);i=o}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},u.calculateLength=function(e,n){if(null===n)return 0;var r;switch(this.type){case t.TYPES.int32:return n<0?i.calculateVarint64(n):i.calculateVarint32(n);case t.TYPES.uint32:return i.calculateVarint32(n);case t.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(n));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return i.calculateVarint64(n);case t.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(n));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return i.calculateVarint32(n);case t.TYPES.double:return 8;case t.TYPES.string:return r=i.calculateUTF8Bytes(n),i.calculateVarint32(r)+r;case t.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 t.TYPES.message:return r=this.resolvedType.calculate(n),i.calculateVarint32(r)+r;case t.TYPES.group:return(r=this.resolvedType.calculate(n))+i.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},u.encodeValue=function(e,n,r){var o,s;if(null===n)return r;switch(this.type){case t.TYPES.int32:n<0?r.writeVarint64(n):r.writeVarint32(n);break;case t.TYPES.uint32:r.writeVarint32(n);break;case t.TYPES.sint32:r.writeVarint32ZigZag(n);break;case t.TYPES.fixed32:r.writeUint32(n);break;case t.TYPES.sfixed32:r.writeInt32(n);break;case t.TYPES.int64:case t.TYPES.uint64:r.writeVarint64(n);break;case t.TYPES.sint64:r.writeVarint64ZigZag(n);break;case t.TYPES.fixed64:r.writeUint64(n);break;case t.TYPES.sfixed64:r.writeInt64(n);break;case t.TYPES.bool:"string"==typeof n?r.writeVarint32("false"===n.toLowerCase()?0:!!n):r.writeVarint32(n?1:0);break;case t.TYPES.enum:r.writeVarint32(n);break;case t.TYPES.float:r.writeFloat32(n);break;case t.TYPES.double:r.writeFloat64(n);break;case t.TYPES.string:r.writeVString(n);break;case t.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=o;break;case t.TYPES.message:s=(new i).LE(),this.resolvedType.encode(n,s),r.writeVarint32(s.offset),r.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(n,r),r.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return r},u.decode=function(e,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(r=e.clone()).limit=r.offset+o,e.offset+=o,r;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return i.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},C.Element=a,c=function(t,e,n,i,r,s){o.call(this,t,e,n,i,s),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(o.prototype)).build=function(n){var r,o,s,a;if(this.clazz&&!n)return this.clazz;for(r=function(t,n){function r(e,n,o,s){var a,u,c,l,h,d,g;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(i.isByteBuffer(e))return n?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(t,e){u[e]=r(t,n,o,s)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,e.valueElem.resolvedType);return u}for(g in h=e.$type,d=void 0,e)e.hasOwnProperty(g)&&(u[g]=h&&(d=h.getChild(g))?r(e[g],n,o,d.resolvedType):r(e[g],n,o));return u}var o,s,a=n.getChildren(t.Reflect.Message.Field),u=n.getChildren(t.Reflect.Message.OneOf),c=function(e){var r,o,s,l;for(t.Builder.Message.call(this),r=0,o=u.length;o>r;++r)this[u[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new t.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof c)||Array.isArray(e)||e instanceof t.Map||i.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(e)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,i,r){var o=n._fieldsByName[e];if(!r){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");i=o.verifyValue(i,!0)}return null===this[e]&&(this[e]=[]),this[e].push(i),this},l.$add=l.add,l.set=function(e,i,r){var o,s,a;if(e&&"object"==typeof e){for(o in r=i,e)e.hasOwnProperty(o)&&void 0!==(i=e[o])&&this.$set(o,i,r);return this}if(s=n._fieldsByName[e],r)this[e]=i;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=i=s.verifyValue(i)}return s&&s.oneof&&(a=this[s.oneof.name],null!==i?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,i){if(i)return this[e];var r=n._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(t){var e,i,r,o=t.originalName.replace(/(_[a-zA-Z])/g,(function(t){return t.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),e=t.originalName.replace(/([A-Z])/g,(function(t){return"_"+t})),i=function(e,n){return this[t.name]=n?e:t.verifyValue(e),this},r=function(){return this[t.name]},null===n.getChild("set"+o)&&(l["set"+o]=i),null===n.getChild("set_"+e)&&(l["set_"+e]=i),null===n.getChild("get"+o)&&(l["get"+o]=r),null===n.getChild("get_"+e)&&(l["get_"+e]=r)}(s);return l.encode=function(t,i){var r,o;"boolean"==typeof t&&(i=t,t=void 0),r=!1,t||(t=new e,r=!0),o=t.littleEndian;try{return n.encode(this,t.LE(),i),(r?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},c.encode=function(t,e,n){return new c(t).encode(e,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(t){var e,r=!1;return t||(t=new i,r=!0),e=(new i).LE(),n.encode(this,e).flip(),t.writeVarint32(e.remaining()),t.append(e),r?t.flip():t},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toArrayBuffer()),t}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBuffer()),t}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBase64()),t}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toHex()),t}},l.toHex=l.encodeHex,l.toRaw=function(t,e){return r(this,!!t,!!e,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},c.decode=function(t,e){var r,o;"string"==typeof t&&(t=i.wrap(t,e||"base64")),r=(t=i.isByteBuffer(t)?t:i.wrap(t)).littleEndian;try{return o=n.decode(t.LE()),t.LE(r),o}catch(e){throw t.LE(r),e}},c.decodeDelimited=function(t,e){var r,o,s;if("string"==typeof t&&(t=i.wrap(t,e||"base64")),(t=i.isByteBuffer(t)?t:i.wrap(t)).remaining()<1)return null;if(r=t.offset,o=t.readVarint32(),t.remaining()<o)return t.offset=r,null;try{return s=n.decode(t.slice(t.offset,t.offset+o).LE()),t.offset+=o,s}catch(e){throw t.offset+=o,e}},c.decode64=function(t){return c.decode(t,"base64")},c.decodeHex=function(t){return c.decode(t,"hex")},c.decodeJSON=function(t){return new c(JSON.parse(t))},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}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof T){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(t,e,n){var i,r,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)r=t[(i=this._fields[o]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),e,t);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=e,a;return e},l.calculate=function(t){for(var e,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=t[(e=this._fields[r]).name],e.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);i+=e.calculate(n,t)}return i},l.decode=function(e,n,i){var o,s,a,u,c,l,h,d,g,p,f,_;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.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(s,e)):u.map?(d=u.decode(s,e),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,e),u.oneof&&(null!==(g=l[u.oneof.name])&&g!==u.name&&(l[g]=null),l[u.oneof.name]=u.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;r(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(p=0,f=this._fields.length;f>p;++p)if(null===l[(u=this._fields[p]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,_;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},C.Message=c,h=function(e,n,i,r,o,s,a,u,l,h){m.call(this,e,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=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=t.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(m.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(e,n){var i,r,o;if(n=n||!1,i=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this),null===e)return this.required&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],r=0;r<e.length;r++)o.push(this.element.verifyValue(e[r]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,n,r){var o,s,a,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return n;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],n);a=n.offset-s,(u=i.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<e.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],n);else this.map?e.forEach((function(e,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,n)}),this):this.hasWirePresence(e,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,n))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return n},d.calculate=function(e,n){var r,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);r+=i.calculateVarint32(s),r+=s}else for(o=0;o<e.length;o++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(o),r+=o}),this):this.hasWirePresence(e,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.decode=function(e,n,i){var r,o,s,u,c,l,h;if(!(!this.map&&e==this.type.wireType||!i&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,e,h)}return[u,r]}return this.element.decode(n,e,this.id)},C.Message.Field=h,g=function(t,e,n,i,r,o,s){h.call(this,t,e,n,null,i,r,o,s),this.extension},g.prototype=Object.create(h.prototype),C.Message.ExtensionField=g,p=function(t,e,n){m.call(this,t,e,n),this.fields=[]},C.Message.OneOf=p,f=function(t,e,n,i,r){o.call(this,t,e,n,i,r),this.className="Enum",this.object=null},f.getName=function(t,e){var n,i,r=Object.keys(t);for(i=0;i<r.length;++i)if(t[n=r[i]]===e)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(e){var n,i,r,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,r=0,o=(i=this.getChildren(f.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},C.Enum=f,_=function(t,e,n,i){m.call(this,t,e,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(m.prototype),C.Enum.Value=_,E=function(t,e,n,i){m.call(this,t,e,n),this.field=i},E.prototype=Object.create(m.prototype),C.Extension=E,T=function(t,e,n,i){o.call(this,t,e,n,i),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(t,e){var n,r=function(e){t.Builder.Service.call(this),this.rpcImpl=e||function(t,e,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(t.Builder.Service.prototype),s=e.getChildren(t.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(t){o[t.name]=function(n,r){try{try{n=t.resolvedRequestType.clazz.decode(i.wrap(n))}catch(t){if(!(t instanceof TypeError))throw t}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof t.resolvedRequestType.clazz||(n=new t.resolvedRequestType.clazz(n)),this.rpcImpl(t.fqn(),n,(function(n,i){if(!n){try{i=t.resolvedResponseType.clazz.decode(i)}catch(t){}return i&&i instanceof t.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+e.name+"#"+t.name))}r(n)}))}catch(t){setTimeout(r.bind(this,t),0)}},r[t.name]=function(e,n,i){new r(e)[t.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[t.name],"$options",{value:t.buildOpt()}),Object.defineProperty(o[t.name],"$options",{value:r[t.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:e.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:e}),Object.defineProperty(o,"$type",{value:e})),r}(t,this)},C.Service=T,v=function(t,e,n,i){m.call(this,t,e,n),this.className="Service.Method",this.options=i||{}},(v.prototype=Object.create(m.prototype)).buildOpt=s.buildOpt,C.Service.Method=v,y=function(t,e,n,i,r,o,s,a){v.call(this,t,e,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},y.prototype=Object.create(v.prototype),C.Service.RPCMethod=y,C}(o),o.Builder=function(t,e,n){function i(t){t.messages&&t.messages.forEach((function(e){e.syntax=t.syntax,i(e)})),t.enums&&t.enums.forEach((function(e){e.syntax=t.syntax}))}var r=function(t){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=t||{}},o=r.prototype;return r.isMessage=function(t){return"string"==typeof t.name&&(void 0===t.values&&void 0===t.rpc)},r.isMessageField=function(t){return"string"==typeof t.rule&&"string"==typeof t.name&&"string"==typeof t.type&&void 0!==t.id},r.isEnum=function(t){return"string"==typeof t.name&&!(void 0===t.values||!Array.isArray(t.values)||0===t.values.length)},r.isService=function(t){return!("string"!=typeof t.name||"object"!=typeof t.rpc||!t.rpc)},r.isExtend=function(t){return"string"==typeof t.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(t){if("string"!=typeof t||!e.TYPEREF.test(t))throw Error("illegal namespace: "+t);return t.split(".").forEach((function(t){var e=this.ptr.getChild(t);null===e&&this.ptr.addChild(e=new n.Namespace(this,this.ptr,t)),this.ptr=e}),this),this},o.create=function(e){var i,o,s,a,u;if(!e)return this;if(Array.isArray(e)){if(0===e.length)return this;e=e.slice()}else e=[e];for(i=[e];i.length>0;){if(e=i.pop(),!Array.isArray(e))throw Error("not a valid namespace: "+JSON.stringify(e));for(;e.length>0;){if(o=e.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(t){s.addChild(a[t]=new n.Message.OneOf(this,s,t))}),this),o.fields&&o.fields.forEach((function(t){if(null!==s.getChild(0|t.id))throw Error("duplicate or invalid field id in "+s.name+": "+t.id);if(t.options&&"object"!=typeof t.options)throw Error("illegal field options in "+s.name+"#"+t.name);var e=null;if("string"==typeof t.oneof&&!(e=a[t.oneof]))throw Error("illegal oneof in "+s.name+"#"+t.name+": "+t.oneof);t=new n.Message.Field(this,s,t.rule,t.keytype,t.type,t.name,t.id,t.options,e,o.syntax),e&&e.fields.push(t),s.addChild(t)}),this),u=[],o.enums&&o.enums.forEach((function(t){u.push(t)})),o.messages&&o.messages.forEach((function(t){u.push(t)})),o.services&&o.services.forEach((function(t){u.push(t)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){i.push(e),e=u,u=null,this.ptr=s,s=null;continue}u=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(t){s.addChild(new n.Enum.Value(this,s,t.name,t.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(t){var e=o.rpc[t];s.addChild(new n.Service.RPCMethod(this,s,t,e.request,e.response,!!e.request_stream,!!e.response_stream,e.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(e){var i,r,o,a;if(null!==s.getChild(0|e.id))throw Error("duplicate extended field id in "+s.name+": "+e.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(t){e.id>=t[0]&&e.id<=t[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+e.id+" (not within valid ranges)");r=e.name,this.options.convertFieldsToCamelCase&&(r=t.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,e.rule,e.type,this.ptr.fqn()+"."+r,e.id,e.options),a=new n.Extension(this,this.ptr,e.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}e=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(e,n){var r,o,s,a,u,c,l,h,d="/";if("string"==typeof n){if(t.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,t.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(e.imports&&e.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,u=0;u<e.imports.length;u++)if("string"==typeof e.imports[u]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=e.imports[u]))continue;if(c=s+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!t.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=t.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(t.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(e.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(t,e,n){return e+"_import"+u+"."+n}))):this.import(e.imports[u],n+"_import"+u):this.import(e.imports[u]);a&&(this.importRoot=null)}return e.package&&this.define(e.package),e.syntax&&i(e),h=this.ptr,e.options&&Object.keys(e.options).forEach((function(t){h.options[t]=e.options[t]})),e.messages&&(this.create(e.messages),this.ptr=h),e.enums&&(this.create(e.enums),this.ptr=h),e.services&&(this.create(e.services),this.ptr=h),e.extends&&this.create(e.extends),this.reset()},o.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(t){this.ptr=t,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(e.TYPE.test(this.ptr.type))this.ptr.type=t.TYPES[this.ptr.type];else{if(!e.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=t.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?t.TYPES.group:t.TYPES.message}}if(this.ptr.map){if(!e.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=t.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof t.Reflect.Service.Method){if(!(this.ptr instanceof t.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 t.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 t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof t.Reflect.Message.OneOf||this.ptr instanceof t.Reflect.Extension||this.ptr instanceof t.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(t){var e,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!t)return this.result;for(e="string"==typeof t?t.split("."):t,n=this.result,i=0;i<e.length;i++){if(!n[e[i]]){n=null;break}n=n[e[i]]}return n},o.lookup=function(t,e){return t?this.ns.resolve(t,e):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(o,o.Lang,o.Reflect),o.Map=function(t,e){function n(t){var e=0;return{next:function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}}var i=function(t,n){var i,r,o,s;if(!t.map)throw Error("field is not a map");if(this.field=t,this.keyElem=new e.Element(t.keyType,null,!0,t.syntax),this.valueElem=new e.Element(t.type,t.resolvedType,!1,t.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++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t)),n=e in this.map;return delete this.map[e],n},r.entries=function(){var t,e,i=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)i.push([(t=this.map[r[e]]).key,t.value]);return n(i)},r.keys=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].key);return n(e)},r.values=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].value);return n(e)},r.forEach=function(t,e){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)t.call(e,(n=this.map[r[i]]).value,n.key,this)},r.set=function(t,e){var n=this.keyElem.verifyValue(t),i=this.valueElem.verifyValue(e);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t));return e in this.map?this.map[e].value:void 0},r.has=function(t){return this.keyElem.valueToString(this.keyElem.verifyValue(t))in this.map},i}(0,o.Reflect),o.loadProto=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=void 0),o.loadJson(o.DotProto.Parser.parse(t),e,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadProto(i,n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadProto(i,n,t)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(t){return void 0===(t=t||{}).convertFieldsToCamelCase&&(t.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===t.populateAccessors&&(t.populateAccessors=o.populateAccessors),new o.Builder(t)},o.loadJson=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=null),e&&"object"==typeof e||(e=o.newBuilder()),"string"==typeof t&&(t=JSON.parse(t)),e.import(t,n),e.resolveAll(),e},o.loadJsonFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadJson(JSON.parse(i),n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadJson(JSON.parse(i),n,t)},r=t,o.loadProto(r,void 0,"").build("Modules").probuf}(n,e);return i}var Qn,Wn,Jn=function(){function t(t,e,n){this.pbmaps=t,this.logger=n,this.pbModules=jn(e)}return t.prototype.getModule=function(t){return new this.pbModules[t]},t.prototype.encode=function(t,e,n){var i=new this.pbModules[t];if(e)try{this.pbmaps[t].forEach((function(t){var n=e[t];void 0!==n&&i["set".concat(function(t,e,n){if(void 0===e||void 0===n)return t.toUpperCase();var i=t.slice(e,n);return t.replace(i,(function(t){return t.toUpperCase()}))}(t,0,1))](n)}))}catch(e){var r="pbname: ".concat(t,", stack: ").concat(e.stack);this.logger?this.logger.error(pt.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(pt.L_PB_ENCODE_E,r)}return n?i:i.toArrayBuffer()},t.prototype.decode=function(t,e){var n=this.pbModules[t].decode(e);return this.fixInt64Values(n)},t.prototype.fixInt64Values=function(t){var e=this;if(t instanceof Array)return t.map((function(t){return e.fixInt64Values(t)}));if(!ae(t))return t;if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){var n=t.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var i in t)t[i]=this.fixInt64Values(t[i]);return t},t}();!function(t){t[t.BJ=1]="BJ",t[t.SG=2]="SG",t[t.NA=3]="NA"}(Wn||(Wn={}));var Xn=((Qn={})[Wn.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="]},Qn[Wn.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"]},Qn[Wn.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[]},Qn);function Zn(t){return t>=Wn.BJ&&t<=3?t:Wn.BJ}wt.HTTPS;var zn=function(){function t(){this.initOption={}}return t.prototype.init=function(t){this.initOption=t},t.prototype.getNaviUrlList=function(t){var e,n=this.initOption||{},i=n.areaCode,r=n.navigators,o=(e=i,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].naviUrlBase64).map((function(t){return xe(t)})),s=t.split("@")[1],a=s?s.split(";"):[],u=r&&r.length>0?h(h([],a,!0),r,!0):h(h([],a,!0),o,!0);return u.filter((function(t,e){return u.indexOf(t)===e})).map((function(t){return nn(t)}))},t.prototype.getLogUrlPolicyList=function(t,e){var n,i=t||{},r=i.log,o=i.logPolicy,s=this.initOption||{},a=s.areaCode,c=s.logServerUrl,l=(n=a,void 0===n&&(n=Wn.BJ),Xn[Zn(n)].logUrlBase64).map((function(t){return u(u({},t),{addr:xe(t.addr)})})),d=[],g={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(g,r.policy);else if(o)try{var p=JSON.parse(o);d.push({addr:p.url,protocol:wt.HTTPS,weight:1}),g.level=p.level,g.itv=p.itv,g.times=p.times}catch(n){e.warn(pt.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:t.logPolicy}))}var f=c?h([{addr:c,protocol:wt.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:g,addrs:f.filter((function(t,e){return f.findIndex((function(e){return e.addr===t.addr&&e.protocol===t.protocol}))===e})).map((function(t){return u(u({},t),{addr:nn(t.addr,t.protocol)})})).sort((function(t,e){return e.weight-t.weight}))}},t.prototype.getMiniCmpUrlList=function(){var t,e,n=(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].miniCmpBase64).map((function(t){return xe(t)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},t.prototype.getStaticConfigUrl=function(){var t,e;return(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].staticConfigUrlBase64).map((function(t){return xe(t)}))},t}(),$n=new zn,ti=function(){function t(t,e,n){void 0===n&&(n=Wn.BJ),this.appkey=t,this.logger=e,this.areaCode=n,this.staticUrls=[]}return t.prototype.getStaticConfig=function(){var t;return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:if(!(e=this.getCache()))return[3,6];s.label=1;case 1:return s.trys.push([1,4,,5]),n=JSON.parse(e),Date.now()-(null==n?void 0:n.time)<q?[4,this.decryptData(n.val)]:[3,3];case 2:return[2,{navi:s.sent().resources.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return nn(t.addr,t.protocol)}))||[]}];case 3:return[3,5];case 4:return i=s.sent(),this.logger.error(pt.L_GET_STATIC_CONF_E,JSON.stringify({error:null==i?void 0:i.stack})),[3,5];case 5:this.clearCache(),s.label=6;case 6:return[4,this._requestHandle()];case 7:return(r=s.sent())?[4,this.decryptData(r)]:[2];case 8:return(null==(o=s.sent())?void 0:o.areaCode)!==this.areaCode?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:r})),this.staticUrls=(null==o?void 0:o.bootstrap)||[],[2,{navi:(null===(t=null==o?void 0:o.resources)||void 0===t?void 0:t.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return nn(t.addr,t.protocol)})))||[]}])}}))}))},t.prototype._requestHandle=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:t=(t=h(h([],this.staticUrls,!0),$n.getStaticConfigUrl(),!0).map((function(t){return nn(t)}))).filter((function(e,n){return t.indexOf(e)===n})),e=0,n=t,u.label=1;case 1:return e<n.length?(i=n[e],this.logger.info(pt.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest("".concat(i,"/").concat(this.appkey))]):[3,4];case 2:if(o=u.sent(),s=o.code,a=o.data,200===s)return this.logger.info(pt.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),[2,a];this.logger.warn(pt.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),u.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.setAreaCode=function(t){this.areaCode=t},t}(),ei=be(),ni=Date.now(),ii=null,ri="RC_LOGS",oi="RC_CONF",si=null,ai=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(ri,"readwrite").objectStore(ri),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),si=setTimeout((function(){return ai(t)}),6e5),[2]}}))}))},ui=function(t,e,n,i){void 0===i&&(i=168),ii||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==fn(n).type?ii=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(t),s=r.open(o,1);s.onerror=function(t){e.error(pt.L_LOGDB_OPEN_FAILED_E,t.target.error),n(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(pt.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(pt.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(pt.L_LOGDB_ABORT_S,t.target.error)},ai(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:t,db:o})):n(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(ri)&&e.deleteObjectStore(ri);var n=e.createObjectStore(ri,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(oi,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(pt.L_UNSUPPORT_INDEXDB_O))},ci=function(){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return ii?(si&&(clearTimeout(si),si=null),[4,ii]):[2];case 1:return(t=e.sent())&&t.db.close(),ii=null,[2]}}))}))},li=[],hi=!1,di=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return hi||0===li.length?[2]:(hi=!0,e=li.splice(0),[4,new Promise((function(n){var i=t.transaction(ri,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(ri);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),hi=!1,setTimeout((function(){return di(t)})),[2]}}))}))};function gi(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(oi,"readonly").objectStore(oi).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var pi,fi=0,_i=function(){return{setTimestamp4RealtimeLog:function(t){fi=t},getTimestamp4RealtimeLog:function(){return fi},getLogs:function(t,e,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(o){switch(o.label){case 0:return[4,ii];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(ri,"readonly").objectStore(ri),a=[],u=IDBKeyRange.bound(t,e),c=s.index("time").openCursor(u);c.onsuccess=function(t){var e=t.target.result;if(e){var r=e.value;r.level<=n&&(i?r.sessionId===ei:r.level>=0)&&a.push(r),e.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(t){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ei="REPORT_SESSION",Ti=function(t,e){return c(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Ei,"_").concat(t),[4,gi("".concat(Ei,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,ii];case 1:return(n=r.sent())?(i=n.db,i.transaction(oi,"readwrite").objectStore(oi).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))};!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD",t[t.FATAL=0]="FATAL",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"}(pi||(pi={}));var vi=function(t){return[pi.DEBUG,pi.INFO,pi.WARN,pi.ERROR].some((function(e){return e===t}))},yi=0,Ci=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.outputLevel=pi.WARN,this.debug=this._log.bind(this,pi.DEBUG),this.info=this._log.bind(this,pi.INFO),this.warn=this._log.bind(this,pi.WARN),this.error=this._log.bind(this,pi.ERROR),this.__statistics=this._log.bind(this,pi.STATISTICS)}return t.prototype._stdout=function(t,e,n,i,r){if(!(t<=pi.FATAL)&&console&&!(t>this.outputLevel)){var o=["error","warn","info","debug"][t-1];null===console||void 0===console||console[o]("".concat(n,"[").concat(this._id,"][").concat(o.toUpperCase(),"]: ").concat(e," | ").concat(i," | ").concat(r))}},t.prototype.setOutputLevel=function(t){vi(t)&&(this.outputLevel=t)},t.prototype._log=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)?(this._stdout(t,e,r.toISOString(),n,i),t!==pi.DEBUG&&this.flush({time:+r,sessionId:ei,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})):this._stdout(pi.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),e,i)},t.prototype.createTraceId=function(){return"".concat(++yi)},t.prototype.getSessionId=function(){return ei},t}(),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){!function(t){c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?(li.push(t),di(e.db),[2]):[2]}}))}))}(t)},e}(Ci),Ii=function(){function t(t,e,n,i,r){this.appkey=t,this.deviceId=e,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 t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=$n.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.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])}))}))},t.prototype.realtimeReport=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||ni,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(pt.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e,itv:n}),s),[4,this.logDB.getLogs(r,o,e,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(pt.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(pt.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressLogs(c)]):[3,5];case 3:return h=l.sent(),d=h.success,g=h.data,d||this.logger.warn(pt.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(pt.L_REALTIME_LOG_O,"compress done",s),p=he(t)?t:"https://".concat(t),p+="?version=".concat("5.8.4-alpha.6","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:g,method:"POST"})];case 4:f=l.sent().status,this.logger.info(pt.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(c[c.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(pt.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o}),s),[4,this.logDB.getLogs(t,e,pi.DEBUG,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(pt.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),h=he(i)?i:"https://".concat(i),h+="?version=".concat("5.8.4-alpha.6","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return g=l.sent(),p=g.success,f=g.data,d=p?f:"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(pt.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(pt.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),Ri=48,Si=64,Oi=80,Ni=96,Mi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ui=Mi.length,Li=function(t){for(var e={},n=0;n<t.length-1;n++){var i=t.charAt(n)+t.charAt(n+1);e.hasOwnProperty(i)?e[i].push(n):e[i]=[n]}for(var r=[],o=[],s=function(){if(o.length>0){var t=o.join("");if(o=[],t.length>26){var e=wi(t.length),n=String.fromCharCode(Oi|e.length);r.push(n+e)}else{var i=String.fromCharCode(Ni|t.length);r.push(i)}r.push(t)}},a=0;a<t.length;){var u=Ai(e,t,a);if(u.length<2)o.push(t.charAt(a++));else if(u.length<4)o.push(t.substr(a,u.length)),a+=u.length;else{var c=wi(a-u.offset),l=wi(u.length);if(c.length+l.length>=u.length)o.push(t.substr(a,u.length)),a+=u.length;else{s();var h=String.fromCharCode(Si|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}s();var d=wi(t.length),g=String.fromCharCode(Ri|d.length);return r.push(g+d),r.join("")},Ai=function(t,e,n){var i={length:0,offset:-1};if(e.length,n>=e.length-1)return i;var r=t[e.charAt(n)+e.charAt(n+1)];if(r[0]===n)return i;for(var o=e.length-n,s=0,a=r.length;s<a;s++){var u=r[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=i.length)break;if(!(i.length>2&&e.charAt(u+i.length-1)!==e.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&e.charAt(u+d)===e.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},wi=function(t){var e=[],n=0;do{n=t%Ui,e.push(Mi.charAt(n)),t=(t-n)/Ui}while(t>0);return e.join("")},bi=function(t){var e="RCDeviceId",n=i(t),r="",o=n.get(e);return o?r=o:(r=be(),n.set(e,r)),r},Pi=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},Di=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,u=t.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Vi=function(t){function e(e,n,i,r){var o=this,s=bi(n),a=Pi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=t.call(this,e,s,u,_i(),i)||this).runtime=n,o.clientReportLevel=r,vi(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Ti(e.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressLogs=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:Li(t.map(Di).join(""))}]}))}))},e.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.logger.getSessionId(),c(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,gi("".concat(Ei,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s){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,t.prototype.report.call(this,e,n,i,r,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(Ii),Gi=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(t,e,n){return void 0===e&&(e=Date.now()-Gi),void 0===n&&(n=Date.now()),c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return e=e<0?Date.now()+e:e,(n=n<=0?Date.now():n)-e>Gi&&(e=n-Gi),(i=new mi(t,"RC-IM","IM")).debug(pt.T,"get logs: startTime ".concat(e," endTime ").concat(n)),ui(t,i,{tag:"browser"}),[4,_i().getLogs(e,n,pi.DEBUG,!1)];case 1:return r=o.sent().logs,i.debug(pt.T,"get logs ".concat(r.length)),function(t,e){var n=e.map((function(t){var e=t.sessionId,n=t.time,i=t.type,r=t.level,o=t.tag,s=t.traceId,a=t.loggerId,u=t.content;return"".concat(e,",").concat(n,",").concat(i,",").concat(r,",").concat(o,",").concat(s,",").concat(a,',"').concat(u,'"\n')})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download="".concat(t,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}("".concat(t,"-").concat(e,"-").concat(n),r),[2]}}))}))}}}}var Bi,ki,xi,Fi,Ki,Hi,qi,Yi=function(){function t(t){this._context=t}return t.prototype.__getContext=function(){return this._context},t.prototype.createCodec=function(t,e){return this._context.createCodec(t,e)},t.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._context.refetchNaviInfo()]}))}))},t.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},t.prototype.getCoreVersion=function(){return"5.8.4-alpha.6"},t.prototype.getAPIVersion=function(){return"5.8.4-alpha.6"},t.prototype.getAppkey=function(){return this._context.appkey},t.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},t.prototype.getDeviceId=function(){return this._context.getDeviceId()},t.prototype.sendMessage=function(t,e,n){return this._context.sendMessage(t,e,n)},t.prototype.registerMessageType=function(t,e,n,i){void 0===i&&(i=[]),this._context.registerMessageType(t,e,n,i)},t.prototype.getServerTime=function(){return this._context.getServerTime()},t.prototype.getOSInfo=function(){return this._context.getOSInfo()},t.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._context.setCallInfo(t,e,n)},t.prototype.createLogger=function(t,e){return this._context.createLogger(t,e)},t}(),ji="pgMsgP",Qi="chatMsg",Wi="pcMsgP",Ji="pbMsgP",Xi={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Zi="delMsg",zi="joinChrm",$i="joinChrmR",tr="exitChrm",er="setKV",nr="delKV",ir="setKVS",rr="delKVS",or="qryRelationR",sr="delRelation",ar="setSeAtt",ur={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},cr="reqCall",lr="pullKvMsg",hr="qryPMsg",dr="qryGMsg",gr="qryCHMsg",pr="qryCMsg",fr="qrySMsg",_r=((Bi={})["ppMsgP"]=$.PRIVATE,Bi[ji]=$.GROUP,Bi[Qi]=$.CHATROOM,Bi[Wi]=$.CUSTOMER_SERVICE,Bi[Ji]=$.SYSTEM,Bi),Er=((ki={})[$.PRIVATE]=hr,ki[$.GROUP]=dr,ki[$.CHATROOM]=gr,ki[$.CUSTOMER_SERVICE]=pr,ki[$.SYSTEM]=fr,ki),Tr=((xi={})[$.PRIVATE]=ur.PRIVATE,xi[$.GROUP]=ur.GROUP,xi[$.ULTRA_GROUP]=ur.ULTRA_GROUP,xi[$.CUSTOMER_SERVICE]=ur.CUSTOMER_SERVICE,xi[$.SYSTEM]=ur.SYSTEM,xi),vr="1",yr="0",Cr=1,mr=2,Ir=3;!function(t){t[t.AT_MOST_ONCE=0]="AT_MOST_ONCE",t[t.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",t[t.EXACTLY_ONCE=2]="EXACTLY_ONCE",t[t.DEFAULT=3]="DEFAULT"}(Fi||(Fi={})),function(t){t[t.SYMMETRIC=0]="SYMMETRIC",t[t.CONNECT=1]="CONNECT",t[t.CONN_ACK=2]="CONN_ACK",t[t.PUBLISH=3]="PUBLISH",t[t.PUB_ACK=4]="PUB_ACK",t[t.QUERY=5]="QUERY",t[t.QUERY_ACK=6]="QUERY_ACK",t[t.QUERY_CONFIRM=7]="QUERY_CONFIRM",t[t.SUBSCRIBE=8]="SUBSCRIBE",t[t.SUB_ACK=9]="SUB_ACK",t[t.UNSUBSCRIBE=10]="UNSUBSCRIBE",t[t.UNSUB_ACK=11]="UNSUB_ACK",t[t.PING_REQ=12]="PING_REQ",t[t.PING_RESP=13]="PING_RESP",t[t.DISCONNECT=14]="DISCONNECT",t[t.RESERVER2=15]="RESERVER2"}(Ki||(Ki={})),function(t){t.PUB="pub",t.QUERY="qry"}(Hi||(Hi={})),function(t){t[t.V4=4]="V4",t[t.V3=3]="V3"}(qi||(qi={}));var Rr,Sr=function(){function t(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=Fi.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Fi.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,t&&t>0&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=e,this.qos=n,this._dup=i)}return t.prototype.encode=function(){var t=this.type<<4;return t|=this._retain?1:0,t|=this.qos<<1,t|=this._dup?8:0},t}(),Or=function(){function t(){}return t.writeUTF=function(t,e){for(var n=this._getBackAndByteSize(t),i=n.back,r=n.byteSize,o=0,s=i.length;o<s;o++)i[o]>255&&(i[o]&=255);return e?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},t._getBackAndByteSize=function(t){var e=[],n=0;if(te(t))for(var i=0,r=t.length;i<r;i++){var o=t.charCodeAt(i);o>=0&&o<=127?(n+=1,e.push(o)):o>=128&&o<=2047?(n+=2,e.push(192|31&o>>6),e.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,e.push(224|15&o>>12),e.push(128|63&o>>6),e.push(128|63&o))}return{byteSize:n,back:e}},t.readUTF=function(t){for(var e,n,i=[],r=-1,o=t,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?i.push(a):(e=(a-=65536)>>10|55296,n=a%1024|56320,i.push(e,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},t}(),Nr=function(){function t(t){this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return t.prototype.check=function(){return this._position>=this._pool.length},t.prototype.read2Byte=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<2;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readInt=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<4;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readLong=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<8;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i}return parseInt(e,16)},t.prototype.readByte=function(){if(this.check())return-1;var t=this._pool[this._position++];return t>255&&(t&=255),t},t.prototype.readUTF=function(){if(this.check())return"";var t=this.readByte()<<8|this.readByte(),e=this._position;this._position+=t;var n=this._pool.subarray(e,this._position);return Or.readUTF(n)},t.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},t}(),Mr=function(){function t(){this._pool=[],this._position=0,this._writen=0}return t.prototype.write=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")?this._pool=this._pool.concat(t):t>=0&&(t>255&&(t&=255),this._pool.push(t),this._writen++),t},t.prototype.writeArr=function(t){return this._pool=this._pool.concat(t),t},t.prototype.writeUTF=function(t){var e=Or.writeUTF(t);this._pool=this._pool.concat(e),this._writen+=e.length},t.prototype.getBytesArray=function(){return this._pool},t}(),Ur=function(t,e){return t&&e?"".concat(e,"_").concat(t):t||Date.now()},Lr=function(){function t(t){this.header=t,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ur(t,e)},t.prototype.read=function(t,e,n,i){this.readMessage(t,e,n,i)},t.prototype.readMessage=function(t,e,n,i){return{stream:e,length:n}},t}(),Ar=function(){function t(t){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Sr(t,!1,Fi.AT_MOST_ONCE,!1)}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ur(t,e)},t.prototype.write=function(t){var e=this.getHeaderFlag();t.write(e),this.writeMessage(t)},t.prototype.setHeaderQos=function(t){this._header.qos=t},t.prototype.getHeaderFlag=function(){return this._header.encode()},t.prototype.getLengthSize=function(){return this.lengthSize},t.prototype.getBufferData=function(){var t=new Mr;this.write(t);var e=t.getBytesArray();return new Int8Array(e)},t}(),wr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=null,e.userId=null,e.timestamp=0,e}return a(e,t),e.prototype.readMessage=function(t,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=e.MESSAGE_LENGTH)return{stream:n,length:i};if(r===qi.V4){var o=n.readByte();1&o&&(this.userId=n.readUTF()),2&o&&n.readUTF(),4&o&&(this.timestamp=n.readLong()),8&o&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var s=n.readUTF();t.debug(pt.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},e.MESSAGE_LENGTH=2,e}(Lr),br=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){return e.readByte(),this.status=+e.readByte(),{stream:e,length:n}},e.MESSAGE_LENGTH=2,e}(Lr),Pr=function(t){function e(){return t.call(this,Ki.PING_REQ)||this}return a(e,t),e.prototype.writeMessage=function(t){},e}(Ar),Dr=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e}(Lr),Vr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.messageId=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){var i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:n}},e}(Lr),Gr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.writeMessage=function(t){var e=this.messageId,n=255&e,i=(65280&e)>>8;t.write(i),t.write(n)},e}(Ar),Br=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=Hi.PUB,e}return a(e,t),e.prototype.readMessage=function(e,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),t.prototype.readMessage.call(this,e,n,i),this.data=n.readAll(),{stream:n,length:i}},e}(Vr),kr=function(t){function e(e,n,i){var r=t.call(this,Ki.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Hi.PUB,r.topic=e,r.data=te(n)?Or.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Gr),xr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=Hi.PUB,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,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}},e}(Vr),Fr=function(t){function e(e){var n=t.call(this,Ki.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=e,n}return a(e,t),e.prototype.writeMessage=function(e){t.prototype.writeMessage.call(this,e)},e}(Gr),Kr=function(t){function e(e,n,i){var r=t.call(this,Ki.QUERY)||this;return r.identifier=Hi.QUERY,r.topic=e,r.data=te(n)?Or.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Gr),Hr=function(t){function e(e){var n=t.call(this,Ki.QUERY_CONFIRM)||this;return n.messageId=e,n}return a(e,t),e}(Gr),qr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.identifier=Hi.QUERY,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},e}(Vr),Yr=function(t,e,n){var i=new Uint8Array(e),r=new Nr(i),o=r.readByte(),s=function(t,e){var n,i=t.type;switch(i){case Ki.CONN_ACK:n=new wr(t);break;case Ki.PUBLISH:(n=new Br(t)).syncMsg=t.syncMsg;break;case Ki.PUB_ACK:n=new xr(t);break;case Ki.QUERY_ACK:n=new qr(t);break;case Ki.SUB_ACK:case Ki.UNSUB_ACK:case Ki.PING_RESP:n=new Dr(t);break;case Ki.DISCONNECT:n=new br(t);break;default:n=new Lr(t),e.error(pt.O,"No support for deserializing ".concat(i," messages"))}return n}(new Sr(o),t);return s.read(t,r,i.length-1,n),s};!function(t){t[t.ppMsgP=1]="ppMsgP",t[t.ppMsgN=2]="ppMsgN",t[t.ppMsgS=3]="ppMsgS",t[t.pgMsgP=4]="pgMsgP",t[t.chatMsg=5]="chatMsg",t[t.pcMsgP=6]="pcMsgP",t[t.qryPMsg=7]="qryPMsg",t[t.qryGMsg=8]="qryGMsg",t[t.qryCHMsg=9]="qryCHMsg",t[t.qryCMsg=10]="qryCMsg",t[t.qrySMsg=11]="qrySMsg",t[t.recallMsg=12]="recallMsg",t[t.prMsgS=13]="prMsgS",t[t.pbMsgP=14]="pbMsgP",t[t.rrMsg=15]="rrMsg",t[t.rrList=16]="rrList",t[t.s_ntf=17]="s_ntf",t[t.s_msg=18]="s_msg",t[t.s_stat=19]="s_stat",t[t.s_cmd=20]="s_cmd",t[t.s_us=21]="s_us",t[t.pullUS=22]="pullUS",t[t.pgMsgS=23]="pgMsgS",t[t.chatMsgS=24]="chatMsgS",t[t.qrySessionsAtt=25]="qrySessionsAtt",t[t.pullMsg=26]="pullMsg",t[t.qrySessions=27]="qrySessions",t[t.delSessions=28]="delSessions",t[t.delMsg=29]="delMsg",t[t.updRRTime=30]="updRRTime",t[t.chrmPull=31]="chrmPull",t[t.joinChrm=32]="joinChrm",t[t.joinChrmR=33]="joinChrmR",t[t.exitChrm=34]="exitChrm",t[t.queryChrmI=35]="queryChrmI",t[t.setKV=36]="setKV",t[t.delKV=37]="delKV",t[t.pullKV=38]="pullKV",t[t.qryRelation=39]="qryRelation",t[t.delRelation=40]="delRelation",t[t.pullSeAtts=41]="pullSeAtts",t[t.setSeAtt=42]="setSeAtt",t[t.qnTkn=43]="qnTkn",t[t.qnUrl=44]="qnUrl",t[t.aliUrl=45]="aliUrl",t[t.s3Url=46]="s3Url",t[t.stcUrl=47]="stcUrl",t[t.minioUrl=48]="minioUrl",t[t.cleanPMsg=49]="cleanPMsg",t[t.cleanGMsg=50]="cleanGMsg",t[t.cleanCMsg=51]="cleanCMsg",t[t.cleanSMsg=52]="cleanSMsg",t[t.rtcPing=53]="rtcPing",t[t.rtc_ntf=54]="rtc_ntf",t[t.rtcSetOutData=55]="rtcSetOutData",t[t.rtcQryUserOutData=56]="rtcQryUserOutData",t[t.addSeTag=57]="addSeTag",t[t.delSeTag=58]="delSeTag",t[t.addTag=59]="addTag",t[t.delTag=60]="delTag",t[t.disTag=61]="disTag",t[t.reportsdk=62]="reportsdk",t[t.pullUgSes=63]="pullUgSes",t[t.pullUgMsg=64]="pullUgMsg",t[t.ugMsg=65]="ugMsg",t[t.qryUgMsg=66]="qryUgMsg",t[t.updUgRTime=67]="updUgRTime",t[t.upMsgEx=68]="upMsgEx",t[t.modifyMsg=69]="modifyMsg",t[t.qryMsgChange=70]="qryMsgChange",t[t.qryMsg=71]="qryMsg",t[t.operate=72]="operate",t[t.s_opNtf=73]="s_opNtf",t[t.ugUnpushQuery=74]="ugUnpushQuery",t[t.ugUnpushSet=75]="ugUnpushSet",t[t.setRtcRoomId=76]="setRtcRoomId",t[t.qryUgUal=77]="qryUgUal",t[t.s_pubCall=78]="s_pubCall"}(Rr||(Rr={}));var jr=Rr,Qr=function(){function t(t,e){this._runtime=t,this._appkey=e,this._users={}}return t.prototype._getMemData=function(t){return this._users[t]=this._users[t]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[t]},t.prototype.setInboxTime=function(t,e){var n=this._getMemData(e);if(!(n.inboxTime>t)){n.inboxTime=t;var i=Y.INBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getInboxTime=function(t){var e=this._getMemData(t);if(0===e.inboxTime){var n=Y.INBOX_TIME_KEY(this._appkey,t);e.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.inboxTime},t.prototype.setBroadcastSyncTime=function(t,e){var n=this._getMemData(e);if(!(n.broadcastSyncTime>=t||ce(t))){n.broadcastSyncTime=t;var i=Y.BROADCASTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getBroadcastSyncTime=function(t){var e=this._getMemData(t);if(!e||0===e.broadcastSyncTime){var n=Y.BROADCASTBOX_TIME_KEY(this._appkey,t);e.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return e.broadcastSyncTime},t.prototype.setOutboxTime=function(t,e){var n=this._getMemData(e);if(!(n.outboxTime>=t)){n.outboxTime=t;var i=Y.OUTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getOutboxTime=function(t){var e=this._getMemData(t);if(0===e.outboxTime){var n=Y.OUTBOX_TIME_KEY(this._appkey,t);e.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.outboxTime},t}(),Wr={_caches:{},set:function(t,e){this._caches[t]=e},get:function(t){return this._caches[t]||0},clear:function(t){this._caches[t]=0}},Jr=function(){function t(t,e,n){this.logger=t,this._kvCaches={},this._chatroomId=e,this._currentUserId=n}return t.prototype._add=function(t){var e=t.key;t.isDeleted=!1,this._kvCaches[e]=t},t.prototype._remove=function(t){var e=t.key,n=this._kvCaches[e];n&&(n.isDeleted=!0,this._kvCaches[e]=n)},t.prototype._setEntry=function(t,e){var n=t.key,i=t.type,r=t.isOverwrite,o=t.userId,s=this._getSetUserId(n),a=i===Et.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(e||r||u||c)&&l.call(this,t)},t.prototype.getValue=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.value},t.prototype.getVersion=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.version},t.prototype.getAllValue=function(){var t={};for(var e in this._kvCaches)this._kvCaches[e].isDeleted||(t[e]=this._kvCaches[e].value);return t},t.prototype._getSetUserId=function(t){return(this._kvCaches[t]||{}).userId},t.prototype._isExisted=function(t){var e=this._kvCaches[t]||{},n=e.value,i=e.isDeleted;return n&&!i},t.prototype.setEntries=function(t){var e=this,n=t.kvEntries,i=t.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(t){e._setEntry(t,i)}))},t.prototype.clear=function(){this._kvCaches={}},t}(),Xr=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}return t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.chrmId,n=t.timestamp,(i=Wr.get(e))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===Z.SUCCESS?(Wr.set(e,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.reset=function(t){Wr.clear(t);var e=this._storeCaches[t];null==e||e.clear()},t.prototype.pullEntry=function(t,e){this._pullQueue.push({chrmId:t,timestamp:e}),this._startPull()},t.prototype.setLocal=function(t,e,n){var i=this._storeCaches[t];de(i)||(i=new Jr(this._engine.getInnerLogger(),t,n)),i.setEntries(e),this._storeCaches[t]=i},t.prototype.getValue=function(t,e){var n=this._storeCaches[t];return n?n.getValue(e):null},t.prototype.getVersion=function(t,e){var n=this._storeCaches[t];return n?n.getVersion(e):null},t.prototype.getAll=function(t){var e=this._storeCaches[t],n={};return e&&(n=e.getAllValue()),n},t}(),Zr=function(){function t(t){this._canJoinMulipleChrm=t,this._joinedChrmsInfo={}}return t.prototype.set=function(t,e){void 0===e&&(e=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[t]=e},t.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},t.prototype.remove=function(t){delete this._joinedChrmsInfo[t]},t.prototype.clear=function(){this._joinedChrmsInfo={}},t}(),zr="converStatusChanged",$r=function(){function t(t,e,n){this._eventEmitter=new ve,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(e,"-").concat(n),this._oldStorage=i(t.runtime),this._storage=new o(t.runtime,Y.CONVER_STATE_PULL_TIME_KEY(e,n)),this._appkey=e,this._currentUserId=n,this._engine=t,this.adaptOldStatus()}return t.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var t=this._oldStorage.get(this._storagePullTimeKey)||0;if(!t)return;this._storage.set(this._storagePullTimeKey,t),this._oldStorage.remove(this._storagePullTimeKey)}catch(t){this._engine.getInnerLogger().error(pt.A_CALLBACK_E,"adaptOldStatus error: ".concat(t.message))}},t.prototype._set=function(t){var e=this;if(!ce(t)&&Array.isArray(t)){var n=this._storage.get(this._storagePullTimeKey)||0,i=t.length;t.forEach((function(t,r){var o=t.updatedTime||0;n=o>n?o:n,t.conversationType=t.type,e._eventEmitter.emit(zr,{statusItem:t,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(t)]);case 1:return e=r.sent(),n=e.code,i=e.data,n===Z.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.pull=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},t.prototype.watch=function(t){this._eventEmitter.on(zr,(function(e){t(e)}))},t.prototype.setConversationUpdatedTime=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;return t&&t>e?(this._storage.set(this._storagePullTimeKey,t),t):e},t.prototype.getConversationUpdatedTime=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(),to={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},eo={};for(var no in to){var io=to[no].keyName;eo[io]=no}var ro,oo=function(){function t(t,e,n,i){this._appkey=e,this._currentUserId=n,this.logger=i,this.storage=new o(t,Y.OLD_CONVER_STATE_KEY(e,n)),this._localStore=new o(t,Y.CONVER_STATE_KEY(e,n))}return t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t.prototype._getConOptionByKey=function(t){var e=(t=t||"").split("_");if(e.length>=2){var n=e.shift(),i=e.shift(),r=e.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:$.PRIVATE,targetId:"",channelId:""}},t.prototype._updateMentionedUserList=function(t,e,n){var i=this,r=t.conversationType,o=t.messageType,s=t.isMentioned,a=t.senderUserId;s&&r===$.GROUP&&((n.userIdList||[]).forEach((function(t){t===i._currentUserId&&e.indexOf(a)<0&&e.push(a)})),n.type===ct.ALL&&e.indexOf(a)<0&&e.push(a));if(o===it.RECALL&&r===$.GROUP){var u=e.indexOf(a);u>=0&&e.splice(u,1)}return e},t.prototype.updateMentionedData=function(t){var e=t.conversationType,n=t.targetId,i=t.content,r=t.channelId,o=i.mentionedInfo;if(o){var s=this._getStoreKey(e,n,r),a=this._localStore.get(s)||{},u=eo.mentionedInfo,c=eo.hasMentioned,l=a[u]||{},h=l.userIdList||[];o={userIdList:h=this._updateMentionedUserList(t,h,o),type:(null==o?void 0:o.type)||l.type},0!==h.length?(a[u]=o,a[c]=!0):(delete a[u],delete a[c]),de(a)?this._localStore.set(s,a):this._localStore.remove(s)}},t.prototype._setLocal=function(t,e){if("tags"===t)for(var n in e)e[n].isTop||delete e[n].isTop;return e},t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=eo[s],u=n[s];if(!ce(a)&&!ce(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===to[a].defaultVal||"tags"===s&&!de(u)?delete o[a]:o[a]=this._setLocal(s,u),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var c=Object.keys(o);1===c.length&&c.includes("st")&&delete o.st,de(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in to){var a=to[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||gn(c)}return o},t.prototype.getValue=function(t){var e=this._localStore.getValues()||{},n=[];for(var i in e){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=e[i];for(var a in s)if(to[a]){var u=to[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||gn(l)}o=t?t(o):o,n.push(o)}return n},t.prototype.getValueForTag=function(){var t=this._localStore.getValues()||{},e={};for(var n in t){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=t[n];for(var c in a){var l=to[c],h=l.keyName,d=l.defaultVal;s[h]=a[c]||gn(d)}for(var g in s.tags){ce(e[g])&&(e[g]=[]);var p=u(u({},s),{conversationType:r,targetId:o});delete p.tags,e[g].push(p)}}return e},t.prototype.adaptOldStore=function(){try{var t=this.storage.getValues();if(0===Object.keys(t).length)return;for(var e in t){var n="_".concat(e);this._localStore.set(n,t[e])}this.storage.clear()}catch(t){this.logger.error(pt.O,"adaptOldStore error: ".concat(t.message))}},t.prototype.remove=function(t,e,n){var i=this._getStoreKey(t,e,n);this._localStore.remove(i)},t}(),so=[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE,$.APP_PUBLIC_SERVICE],ao={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},uo=1e3,co=function(){function t(t,e,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new ve,this._draftMap={},this._recallMsgTimeMap={},this._appkey=e,this._loginUserId=n,this._store=new oo(t.runtime,e,n,t.getInnerLogger()),this._statusManager=new $r(t,e,n),this._statusManager.watch((function(t){var e=t.statusItem,n=t.isLastPull;o.addStatus(e,n)})),this._eventEmitter.on(ao.CHANGED,(function(t){i(t)})),this._eventEmitter.on(ao.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>uo&&(s=s.sort((function(t,e){var n=t.lastMessageSentTime,i=void 0===n?0:n,r=e.lastMessageSentTime;return(void 0===r?0:r)-i})),s.splice(uo,s.length).forEach((function(t){o._store.remove(t.conversationType,t.targetId,t.channelId)})))}return t.prototype._calcMsg=function(t,e,n,i){var r=!this._recallMsgTimeMap[t]||this._recallMsgTimeMap[t]&&!this._recallMsgTimeMap[t].find((function(t){return t===i.sentTime})),o=e>=i.sentTime;return n&&(o=n<i.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:r}},t.prototype._calcUnreadCount=function(t,e){var n=t.content,i=t.messageType,r=t.sentTime,o=t.isCounted,s=t.messageDirection,a=t.senderUserId,u=s===J.SEND&&a===this._loginUserId,c=i===it.RECALL,l=ae(n),h=!1,d={},g=e.lastUnreadTime,p=e.lastReadTime,f=e.unreadMessageCount;if(g>r||u)return{hasChanged:h,localConversation:e,updateItems:d};if(o&&(e.unreadMessageCount=f+1,e.lastUnreadTime=r,h=!0),c&&l){var _="".concat(t.conversationType,"_").concat(t.channelId,"_").concat(t.targetId),E=this._calcMsg(_,g,p,n),T=E.isNotRead,v=E.isNotRepeadRecallSendTime;T&&f&&v&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),e.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:e.unreadMessageCount||0,time:r}),{hasChanged:h,localConversation:e,updateItems:d}},t.prototype._calcMentionedInfo=function(t,e){var n=t.content,i=t.messageDirection,r=t.isMentioned,o=t.sentTime,s=i===J.SEND,a=ae(n),u=!1,c={};return!s&&r&&a&&n.mentionedInfo&&(e.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:e,updateItems:c}},t.prototype._calcMentionedCount=function(t,e){var n=t.content,i=t.messageDirection,r=!1;if(t.isMentioned&&i===J.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===ct.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=e.unreadMentionedCount||0;e.unreadMentionedCount=u+1}if((a||[]).includes(this._loginUserId)){r=!0;u=e.unreadMentionedMeCount||0;e.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:e}},t.prototype._setUpdatedConversation=function(t){if(ae(t)){var e=t.conversationType,n=t.targetId,i=t.channelId,r="".concat(e,"_").concat(n),o=this._store.get(e,n,i)||{};this._updatedConversations[r]=Object.assign(o,t)}},t.prototype._setConTagStatusChanged=function(t,e,n,i){var r=(this._store.get(t,e,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},t.prototype.addStatus=function(t,e){var n=t.conversationType,i=t.targetId,r=t.updatedTime,o=t.notificationStatus,s=t.notificationLevel,a=t.isTop,u=t.tags,c=t.channelId,l={},h={};if(n!==$.ULTRA_GROUP){ce(o)||(h.notificationStatus={time:r,val:o}),ce(s)||(h.notificationLevel={time:r,val:s}),ce(a)||(h.isTop={time:r,val:a}),ce(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(t){l[t.tagId]={isTop:t.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:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),e&&this._notifyConversationChanged()}},t.prototype._notifyConversationChanged=function(){var t=[];for(var e in this._updatedConversations)t.push(this._updatedConversations[e]);0!==t.length&&(this._eventEmitter.emit(ao.CHANGED,t),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ao.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},t.prototype.setConversationCacheByMessage=function(t,e){var n=this,i=t.conversationType,r=t.isPersited,o=t.targetId,s=t.channelId,a=t.sentTime;if(so.indexOf(i)>=0){var c=!1,l=this._store.get(i,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(e){var i=e.call(n,t,l),r=i.hasChanged,o=i.localConversation,s=i.updateItems;c=c||r,h=u(u({},h),s),l=gn(o)})),this._store.set(i,o,l,s),this._store.updateMentionedData(t),r){var d=this._store.get(i,o,s);d.updatedItems=u({latestMessage:{time:t.sentTime,val:t}},h),d.latestMessage=t;var g=Object.assign(d,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(g)}(c||r)&&this._notifyConversationChanged()}},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t.prototype.getAllUnreadCount=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(t){var i=t.unreadMessageCount,o=t.notificationStatus,s=t.notificationLevel,a=t.conversationType;i=i||0,(n||void 0!==s&&s<=0||void 0===s&&o!==ot.OPEN)&&(e.length>0?e.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var o=i.unreadMessageCount,s=i.notificationLevel,a=void 0===s?0:s,u=i.conversationType,c=i.unreadMentionedCount;t.includes(u)&&(0===e.length||e.includes(a))&&(r+=(n?c:o)||0)})),r},t.prototype.getUnreadCountByTag=function(t,e){var n=this._store.getValueForTag()[t]||[],i=0;return n.forEach((function(t){var n=t.unreadMessageCount,r=t.notificationStatus,o=t.notificationLevel;(e||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},t.prototype.getUnreadCount=function(t,e,n){return this._store.get(t,e,n).unreadMessageCount||0},t.prototype.clearUnreadCount=function(t,e,n,i){void 0===i&&(i=!0);var r=this._store.get(t,e,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(t,"_").concat(n,"_").concat(e)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(t,e,r,n),i&&0!==Object.keys(a).length){var u=Object.assign(r,{conversationType:t,targetId:e,channelId:n,updatedItems:a});this._setUpdatedConversation(u),this._notifyConversationChanged()}},t.prototype.clearAllUnreadCount=function(){var t=this;this._store.getValue().forEach((function(e){e.unreadMessageCount&&(e.unreadMessageCount=0,e.lastReadTime=e.lastUnreadTime,t._recallMsgTimeMap={},t._store.set(e.conversationType,e.targetId,e,e.channelId))}))},t.prototype.startPullConversationStatus=function(t){this._statusManager.pull(t)},t.prototype.setDraft=function(t,e,n,i){var r="".concat(t,"_").concat(e,"_").concat(i);this._draftMap[r]=n},t.prototype.getDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);return this._draftMap[i]},t.prototype.clearDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);delete this._draftMap[i]},t.prototype.addTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i),o=r.tags;o=Object.assign(o,n);var s=r.lastMessageSentTime||(new Date).getTime();this._store.set(t,e,{tags:o,lastMessageSentTime:s},i)},t.prototype.deleteTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i).tags;n.forEach((function(t){delete r[t]})),this._store.set(t,e,{tags:r},i)},t.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},t.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(t){return t.notificationStatus===ot.OPEN||t.notificationLevel&&t.notificationLevel>0})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,notificationLevel:t.notificationLevel||0,notificationStatus:t.notificationStatus||2}}))},t.prototype.getTopConversationList=function(t,e){return(this._store.getValue()||{}).filter((function(n){return t.includes(n.conversationType)&&(ce(e)||e===n.channelId)&&n.isTop})).map((function(t){return{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount||0,latestMessage:null,hasMentioned:t.hasMentioned||!1,mentionedInfo:t.mentionedInfo,notificationStatus:t.notificationStatus||0,notificationLevel:t.notificationLevel,isTop:t.isTop||!1,lastUnreadTime:t.lastUnreadTime||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.adaptOldStore=function(){this._store.adaptOldStore()},t.prototype.getUnreadMentionedCount=function(t,e,n){return void 0===n&&(n=""),this.get(t,e,n).unreadMentionedCount||0},t.prototype.getAllUnreadMentionedCount=function(){var t=this._store.getValue(),e=0;return t.forEach((function(t){var n=t.unreadMentionedCount;n=n||0,e+=Number(n)})),e},t.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(t){return t.unreadMessageCount||t.unreadMentionedCount})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,unreadCount:t.unreadMessageCount||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.getUnreadConversationList=function(t){return(this._store.getValue()||{}).filter((function(e){return t.includes(e.conversationType)&&e.unreadMessageCount&&e.unreadMessageCount>0})).map((function(t){return{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount||0,latestMessage:null,hasMentioned:t.hasMentioned||!1,mentionedInfo:t.mentionedInfo,notificationStatus:t.notificationStatus||0,notificationLevel:t.notificationLevel,isTop:t.isTop||!1,lastUnreadTime:t.lastUnreadTime||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.setConversationUpdatedTime=function(t){return this._statusManager.setConversationUpdatedTime(t)},t.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},t}(),lo=function(){function t(t,e,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey=Y.TAG_STATE_KEY(e,n),this._storagePullTimeKey=Y.USER_SETTING_TIME_KEY(e,n),this._storage=i(t.runtime),this._engine=t,this._tagWatcherFunc=r}return t.prototype._updateTag=function(t){var e=t.tags,n={};e.forEach((function(t){n[t.tagId]={tagName:t.tagName,createdTime:t.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},t.prototype.addTag=function(t,e){var n=this._storage.get(this._storageTagKey)||{};t.forEach((function(t){var e,i=(null===(e=n[t.tagId])||void 0===e?void 0:e.createdTime)||t.createdTime||0;n[t.tagId]={tagName:t.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,e)},t.prototype.deleteTag=function(t,e){var n=this._storage.get(this._storageTagKey)||{};t.forEach((function(t){delete n[t]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,e)},t.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},t.prototype.getTags=function(){var t=this._storage.get(this._storageTagKey)||{},e=[];for(var n in t)e.push({tagId:n,tagName:t[n].tagName,createdTime:t[n].createdTime,conversationCount:0});return e.sort((function(t,e){return(t.createdTime||0)-(e.createdTime||0)}))},t.prototype.getTagById=function(t){var e=this._storage.get(this._storageTagKey)||{};return e[t]?{tagId:t,tagName:e[t].tagName,createdTime:e[t].createdTime,conversationCount:0}:null},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(t)]);case 1:return e=u.sent(),n=e.code,i=e.data,n!==Z.SUCCESS||ce(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,ce(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},t.prototype.pullUserSettings=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},t.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(),ho=function(t){return t.replace(/@.+$/,"@")},go=function(){function t(t,e,n,i,r){void 0===r&&(r=!0),this.appkey=t,this.logger=e,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.crtRequest=null}return t.prototype.request=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(u){switch(u.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(t,e,n,i,r),[4,this.crtRequest]);case 1:return o=u.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},t.prototype.sendRequest=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u,c,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return o=ho(t),!e&&(s=this.getNaviCache(o))&&(a=s.timestamp,u=s.naviInfo,n||Date.now()-a<v)?(this.logger.info(pt.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:u}),i),c={bid:tn(),ptc:Ft.NAVI,cod:Z.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:u.type||0,hos:"",cache:Kt.LOCAL,v:Ht.CURRENT,rsn:null==r?void 0:r.reason,cid:"".concat(null==r?void 0:r.uuid,"_").concat(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.statisticLog.__statistics(ft.IM_NAVI,JSON.stringify(c),i),[2,{code:Z.SUCCESS,data:u}]):(h=$n.getNaviUrlList(t),this.logger.info(pt.L_GET_NAVI_T,JSON.stringify({token:t,uris:h}),i),[4,this.requestHandler(h,t,i,r)]);case 1:return d=l.sent(),g=d.code,p=d.data,g===Z.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(f=l.sent())?void 0:f.navi)&&(null==f?void 0:f.navi.length)>0?(_=f.navi,[4,this.requestHandler(_,t,i,r)]):[3,4];case 3:E=l.sent(),g=E.code,p=E.data,l.label=4;case 4:return g!==Z.SUCCESS?(this.logger.warn(pt.L_GET_NAVI_R,g,i),[2,{code:g}]):(T=p,this.logger.info(pt.L_GET_NAVI_R,JSON.stringify({naviInfo:T}),i),this.setNaviCache(o,T),[2,{code:g,data:T}])}}))}))},t.prototype.requestHandler=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:r=0,o=t.length,l.label=1;case 1:return r<o?(s=r===t.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,t[r],this.appkey,e,n,s)]):[3,4];case 2:if(c=l.sent(),h=c.code,d=c.data,g={bid:tn(),ptc:Ft.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:t[r],cache:Kt.REQUEST,v:Ht.CURRENT,rsn:null==i?void 0:i.reason,cid:"".concat(null==i?void 0:i.uuid,"_").concat(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.__statistics(ft.IM_NAVI,JSON.stringify(g),n),[Z.SUCCESS,Z.RC_CONN_TOKEN_INCORRECT,Z.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:Z.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.transHttpCode=function(t){switch(t){case 401:case 403:return Z.RC_CONN_TOKEN_INCORRECT;case 416:return Z.RC_LICENSE_EXPIRED;default:return Z.RC_NAVI_REQ_FAILED}},t.prototype.getNaviInfoFromCache=function(t){var e=this.getNaviCache(ho(t));return e?e.naviInfo:null},t.prototype.updateVoipCallInfo=function(t,e){var n=this.getNaviInfoFromCache(t);n&&this.setNaviCache(ho(t),u(u({},n),{voipCallInfo:e}))},t.prototype.getNaviV2RequestOption=function(t){var e,n=t.uri,i=t.token,r=t.platform,o=t.protocol;e="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(i),"&version=").concat("5.8.4-alpha.6","&platfrom=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2")},body:s,url:e,timeout:C}},t.prototype.useV2Navi=function(){return!0},t}(),po={},fo=function(t){function e(e,n,i,r,o){var s=t.call(this,e,n,i,o,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol))||this;return s.runtime=r,s}return a(e,t),e.prototype.httpRequest=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return o="".concat(t,"/navi.js?appId=").concat(e,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(F,"&r=").concat(Date.now()),this.logger.debug(pt.L_REQUEST_T,"req navi => ".concat(o),i),[4,this.runtime.httpReq({url:o,timeout:C,dataType:"text"})];case 1:if(200!==(s=c.sent()).status)return this.logger.debug(pt.L_REQUEST_R,"request navi failed: ".concat(s.status),i),!this.runtime.useNavi&&r?(u={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:$n.getMiniCmpUrlList().join(",")},[2,{code:Z.SUCCESS,data:u}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(u=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",this.runtime.useNavi||(u.server="",u.backupServer=$n.getMiniCmpUrlList().join(","),u.logSwitch=0),[2,{code:Z.SUCCESS,data:u}]}catch(t){this.logger.error(pt.L_PARSE_NAVI_E,s.data,i)}return[2,{code:Z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.httpRequestV2=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return r=this.getNaviV2RequestOption({appkey:e,token:n,uri:t,platform:this.runtime.tag,protocol:(/^https/.test(t)?wt.WSS:wt.WS).toString()}),this.logger.debug(pt.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(pt.L_REQUEST_R,"request navi failed: ".concat(o.status),i),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(r.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,u=$n.getMiniCmpUrlList(),a.serverAddr=u.map((function(t,e){return{addr:t,protocol:/^https/.test(r.url)?wt.WSS:wt.WS,weight:u.length-e}}))),[2,{code:Z.SUCCESS,data:a}]}catch(t){this.logger.error(pt.L_PARSE_NAVI_E,o.data,i)}return[2,{code:Z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.getNaviCache=function(t){if(po[t])return po[t];var e,n=Y.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var r=i.getItem(n);e=r?JSON.parse(r):[]}catch(t){e=[]}if(0===e.length)return null;var o=e.find((function(e){return e.token===t}))||null;return po[t]=o,o},e.prototype.setNaviCache=function(t,e){var n,i=Y.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var o=r.getItem(i);n=o?JSON.parse(o):[]}catch(t){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(e){return s-e.timestamp<v&&t!==e.token})));var a={timestamp:s,naviInfo:e,token:t};n.push(a),r.setItem(i,JSON.stringify(n)),po[t]=a},e}(go),_o=function(){function t(t,e){this._runtime=t,this._appkey=e,this._sendMessageMap={},this._userId=""}return t.prototype.init=function(t){this._userId=t;var e=Y.SEND_MSG_KEY(this._appkey,t);this._sendMessageMap=this._getLocalInfo(e)},t.prototype._getLocalInfo=function(t){var e=this._runtime.localStorage.getItem(t);try{return e?JSON.parse(e):{}}catch(t){return{}}},t.prototype.setMessage=function(t,e){this._sendMessageMap[t]=e;var n=Y.SEND_MSG_KEY(this._appkey,this._userId),i=this._getLocalInfo(n);i[t]=e,this._runtime.localStorage.setItem(n,JSON.stringify(i))},t.prototype.getSendMessageMap=function(){return this._sendMessageMap},t.prototype.removeByUID=function(t){delete this._sendMessageMap[t]},t.prototype.removeByTimestamp=function(t){var e=Y.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(e);Object.keys(n).forEach((function(e){n[e]<t&&delete n[e]})),this._runtime.localStorage.setItem(e,JSON.stringify(n))},t}();(ro={})[$.PRIVATE]=jr.qryPMsg,ro[$.GROUP]=jr.qryGMsg,ro[$.CHATROOM]=jr.qryCHMsg,ro[$.CUSTOMER_SERVICE]=jr.qryCMsg,ro[$.SYSTEM]=jr.qrySMsg;var Eo=[jr[jr.recallMsg],jr[jr.ppMsgS],jr[jr.pgMsgS],jr[jr.ppMsgP],jr[jr.pgMsgP],jr[jr.chatMsg],jr[jr.pcMsgP],jr[jr.prMsgS],jr[jr.updUgRTime],jr[jr.pbMsgP]],To=function(){function t(t,e,n){this._localStore=new o(t,Y.ULTRA_GROUP_STATE_KEY(e,n))}return t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=yo[s],u=n[s];if(!ce(a)&&!ce(u))u===vo[a].defaultVal?delete o[a]:o[a]=u}de(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in vo){var a=vo[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||gn(c)}return o},t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t}(),vo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},yo={};for(var Co in vo){var mo=vo[Co].keyName;yo[mo]=Co}var Io,Ro=function(){function t(t,e,n){this._store=new To(t.runtime,e,n)}return t.prototype.addUltraGroupStatus=function(t){var e=t.conversationType,n=t.targetId,i=t.notificationStatus,r=t.notificationLevel,o=t.channelId;e===$.ULTRA_GROUP&&this._store.set(e,n,{notificationStatus:i,notificationLevel:r},o)},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t}(),So="UpStreamMessage",Oo="PushExtra",No="DownStreamMessage",Mo="DownStreamMessages",Uo="SessionsAttQryInput",Lo="SessionsAttOutput",Ao="SyncRequestMsg",wo="ChrmPullMsg",bo="NotifyMsg",Po="HistoryMsgInput",Do="HistoryMsgOuput",Vo="RelationQryInput",Go="RelationsOutput",Bo="UnreadMsgInfo",ko="DeleteSessionsInput",xo="SessionInfo",Fo="DeleteSessionsOutput",Ko="RelationsInput",Ho="DeleteMsgInput",qo="CleanHisMsgInput",Yo="SessionMsgReadInput",jo="ChrmInput",Qo="ChrmOutput",Wo="QueryChatRoomInfoInput",Jo="QueryChatRoomInfoOutput",Xo="GetQNupTokenInput",Zo="GetQNupTokenOutput",zo="GetQNdownloadUrlInput",$o="GetDownloadUrlInput",ts="GetQNdownloadUrlOutput",es="GetDownloadUrlOutput",ns="ChrmKVEntity",is="SetChrmKV",rs="SetChrmKVS",os="DeleteChrmKVS",ss="ChrmKVOutput",as="ChrmKVSOutput",us="ChrmKVSVersionEntity",cs="ChrmKVSOutputEntity",ls="QueryChrmKV",hs="SetUserSettingInput",ds="SetUserSettingOutput",gs="PullUserSettingInput",ps="PullUserSettingOutput",fs="UserSettingNotification",_s="SessionReq",Es="SessionStates",Ts="SessionState",vs="SessionStateItem",ys="SessionStateModifyReq",Cs="SessionStateModifyResp",ms="GroupUnpushQuery",Is="GroupUnpushSet",Rs="QryRemindListReq",Ss="QryRemindListResp",Os="GroupUnpushResult",Ns="GrpReadReceiptMsg",Ms="GrpReadReceiptQryReq",Us="GrpReadReceiptQryResp",Ls="GrpMsgReadUser",As="SessionTagAddInput",ws="SessionTagItem",bs="SessionTagDelInput",Ps="SessionDisTagReq",Ds="ReportSDKInput",Vs="ReportSDKOutput",Gs="UltraGrpPullSes",Bs="UltraGrpPullMsg",ks="MsgChangeReq",xs="QueryMsgChange",Fs="MsgChange",Ks="MsgChangeList",Hs="MsgQuery",qs="MessageQueryInfo",Ys="MsgQueryAck",js="OperateStatus",Qs="OperateStatusNotify",Ws="OperateInfo",Js="OperateSummary",Xs="SetRtcRoomIdInput",Zs="SetRtcRoomIdOutput",zs="CallInfoUpStream",$s="CallInfoDownStream",ta="KvInput",ea="KvOutput";(Io={})[So]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Io[Mo]=["list","syncTime","finished","broadcastSyncTime"],Io[No]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Io[Oo]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Io[Uo]=["nothing"],Io[Lo]=["inboxTime","sendboxTime","totalUnreadCount"],Io[Ao]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Io[wo]=["syncTime","count"],Io[bo]=["type","time","chrmId"],Io[Po]=["targetId","time","count","order","busChannel"],Io[Do]=["list","syncTime","hasMsg"],Io[Vo]=["type","count","startTime","order"],Io[Go]=["info","isFinished"],Io[Bo]=["msgId","msgTime","remindType","className"],Io[ko]=["sessions"],Io[xo]=["type","channelId","busChannel"],Io[Fo]=["nothing"],Io[Ko]=["type","msg","count","busChannel","startTime","endTime"],Io[Ho]=["type","conversationId","msgs","busChannel"],Io[qo]=["targetId","dataTime","conversationType","busChannel"],Io[Yo]=["type","msgTime","channelId","busChannel"],Io[jo]=["nothing"],Io[Qo]=["nothing","sessionId","joinTime"],Io[Wo]=["count","order"],Io[Jo]=["userTotalNums","userInfos"],Io[Xo]=["type","key","httpMethod","queryString","url"],Io[zo]=["type","key","fileName"],Io[$o]=["type","key","fileName"],Io[Zo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Io[ts]=["downloadUrl"],Io[es]=["downloadUrl"],Io[ns]=["key","value","status","timestamp","uid","version"],Io[is]=["entry","bNotify","notification","type"],Io[rs]=["entry","bNotify","notification","type"],Io[os]=["entry","bNotify","notification","type"],Io[ss]=["entries","bFullUpdate","syncTime"],Io[as]=["timestamp","errorKeys","keysVersion"],Io[us]=["version","key"],Io[cs]=["key","errorCode"],Io[ls]=["timestamp"],Io[hs]=["version","value"],Io[ds]=["version","reserve"],Io[gs]=["version","reserve"],Io[ps]=["items","version"],Io.UserSettingItem=["targetId","type","key","value","version","status","tags"],Io[_s]=["time"],Io[Es]=["version","state"],Io[Ts]=["type","channelId","time","stateItem","busChannel"],Io[vs]=["sessionStateType","value","tags"],Io[ys]=["version","state"],Io[Cs]=["version"],Io[Is]=["busChannel","unpushLevel"],Io[Rs]=["groupId","busChannel","msgTime","size"],Io[ms]=["busChannel"],Io[Os]=["groupId","busChannel","unpushLevel"],Io[Ns]=["msgId","busChannel"],Io[Ms]=["msgId","busChannel"],Io[Us]=["totalMemberNum","list"],Io[Ls]=["readTime","userId"],Io[As]=["version","tags"],Io[ws]=["tagId","name","createdTime","isTop"],Io[bs]=["version","tags"],Io[Ps]=["tagId"],Io[fs]=["version","reserve"],Io[Ds]=["sdkInfo"],Io[Vs]=["nothing"],Io[Gs]=["syncTime","isEraseMsgContent"],Io[Bs]=["syncTime"],Io[ks]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Io[xs]=["syncTime"],Io[Ks]=["list","syncTime","hasNext"],Io[Fs]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Io[Hs]=["targetId","type","query"],Io[qs]=["msgTime","msgUID","busChannel"],Io[Ys]=["list"],Io[js]=["targetId","type","opType","busChannel"],Io[Qs]=["type","notifyType","info","summary"],Io[Ws]=["targetId","busChannel","userId","opType","optime"],Io[Js]=["targetId","busChannel","count","opType"],Io[Xs]=["rtcRoomId"],Io[Zs]=["nothing"];var na,ia,ra,oa,sa="\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 ".concat(bo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Ao," {\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 ").concat(So," {\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 userId = 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 ").concat(Oo," {\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 ").concat(Mo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(No," {\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 toUserId = 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 = ").concat(Q.IMAGE,";\n audio = ").concat(Q.AUDIO,";\n video = ").concat(Q.VIDEO,";\n file = ").concat(Q.FILE,";\n sight = ").concat(Q.SIGHT,";\n html = ").concat(Q.COMBINE_HTML,";\n }\n message ").concat(Xo," {\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 ").concat(zo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat($o," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Zo," {\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 ").concat(ts," {\n required string downloadUrl = 1;\n }\n message ").concat(es," {\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 ").concat(jo," {\n required int32 nothing = 1;\n }\n message ").concat(Qo," {\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 ").concat(wo," {\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 ").concat(Vo,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(Ko,"\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 ").concat(Go,"\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 ").concat(Bo," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(Bo," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message ").concat(Rs," // 新增 查询未读@列表入参\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 ").concat(Ss," //查询未读@列表出参\n {\n repeated ").concat(Bo," 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 ").concat(qo,"\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 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 ").concat(Wo,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Jo,"\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 ").concat(Po,"\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 ").concat(Do,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Uo,"{\n required int32 nothing = 1;\n }\n message ").concat(Lo,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Yo,"\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 ").concat(ko,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(xo,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Fo,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Ho,"\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 ").concat(is," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(rs," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(os," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(ss," {\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 ").concat(as," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(cs,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(ls," {\n required int64 timestamp = 1;\n }\n message ").concat(hs," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(ds," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(gs," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(ps," {\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 ").concat(_s," {\n required int64 time = 1;\n }\n message ").concat(Es," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Ts," {\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 ").concat(vs," {\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 ").concat(ys," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(ms," {\n optional string busChannel = 1;\n }\n message ").concat(Is,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Os," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Cs," {\n required int64 version=1;\n }\n message ").concat(Ns," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Ms," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Us," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Ls," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(As," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ws," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(bs," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Ps," {\n repeated string tagId=1;\n }\n message ").concat(fs," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ds,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Vs,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Gs,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Bs,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(ks,"\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 ").concat(xs," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Ks," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Fs," //变更详情\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 ").concat(Hs," //请求\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 ").concat(Ys," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(js," //客户端发送\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 ").concat(Qs," //服务端发送\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 ").concat(Ws," {\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 ").concat(Js," {\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 ").concat(Xs,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Zs,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(zs,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat($s,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(ta,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(ea,"\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}\n"),aa=function(t,e,n,i,r,o){var s=r?Object.keys(r).map((function(e){return t.encode(an.RtcValueInfo,{key:e,value:r[e]},!0)})):void 0,a=o?Object.keys(o).map((function(e){return t.encode(an.RtcValueInfo,{key:e,value:o[e]},!0)})):void 0;return t.encode(an.RtcInput,{roomType:e,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},ua=function(t,e){var n=t.decode(an.RtcUserListOutput,e),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return un(i,(function(t){var e=t.userId,n=t.userData,i={};un(n,(function(t){var e=t.key,n=t.value;i[e]=n})),c[e]=i})),{users:c,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};!function(t){t[t.ACCEPTED=0]="ACCEPTED",t[t.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",t[t.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",t[t.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",t[t.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",t[t.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",t[t.REDIRECT=6]="REDIRECT",t[t.PACKAGE_ERROR=7]="PACKAGE_ERROR",t[t.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",t[t.BLOCK=9]="BLOCK",t[t.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",t[t.DEVICE_ERROR=11]="DEVICE_ERROR",t[t.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",t[t.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",t[t.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",t[t.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",t[t.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",t[t.OTP_USED=17]="OTP_USED",t[t.PLATFORM_ERROR=18]="PLATFORM_ERROR",t[t.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",t[t.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(na||(na={})),function(t){t[t.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",t[t.BLOCK=2]="BLOCK",t[t.BLOCK_NEW=5]="BLOCK_NEW",t[t.REDIRECT_NEW=6]="REDIRECT_NEW",t[t.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",t[t.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",t[t.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(ia||(ia={}));var ca,la=((ra={})[ia.OTHER_DEVICE_LOGIN]=Z.RC_DISCONN_KICK,ra[ia.BLOCK]=Z.RC_DISCONN_EXCEPTION,ra[ia.BLOCK_NEW]=Z.RC_DISCONN_EXCEPTION,ra[ia.REDIRECT_NEW]=Z.RC_CONN_REDIRECTED,ra[ia.TOKEN_EXPIRED]=Z.RC_CONN_TOKEN_EXPIRED,ra[ia.ILLEGAL_PROTOCOL_VERSION]=Z.RC_CONN_PROTO_VERSION_ERROR,ra[ia.ACCOUNT_CANCELLATION]=Z.RC_ACCOUNT_CANCELLATION,ra),ha=((oa={})[na.ACCEPTED]=Z.SUCCESS,oa[na.UNACCEPTABLE_PROTOCOL_VERSION]=Z.RC_CONN_PROTO_VERSION_ERROR,oa[na.IDENTIFIER_REJECTED]=Z.RC_CONN_IDENTIFIER_REJECTED,oa[na.SERVER_UNAVAILABLE]=Z.RC_CONN_SERVER_UNAVAILABLE,oa[na.TOKEN_INCORRECT]=Z.RC_CONN_TOKEN_INCORRECT,oa[na.NOT_AUTHORIZED]=Z.RC_CONN_NOT_AUTHRORIZED,oa[na.REDIRECT]=Z.RC_CONN_REDIRECTED,oa[na.PACKAGE_ERROR]=Z.RC_CONN_PACKAGE_NAME_INVALID,oa[na.APP_BLOCK_OR_DELETE]=Z.RC_CONN_APP_BLOCKED_OR_DELETED,oa[na.BLOCK]=Z.RC_CONN_USER_BLOCKED,oa[na.TOKEN_EXPIRE]=Z.RC_CONN_TOKEN_EXPIRED,oa[na.DEVICE_ERROR]=Z.RC_CONN_DEVICE_ERROR,oa[na.HOSTNAME_ERROR]=Z.RC_CONN_HOSTNAME_ERROR,oa[na.HASOHTERSAMECLIENTONLINE]=Z.RC_DISCONN_SAME_CLIENT_ON_LINE,oa[na.OUT_OF_LIMIT]=Z.RC_LISCENSE_COUNT_OUT_OF_LIMIT,oa[na.IN_OTHER_CLUSTER]=Z.RC_CONN_WRONG_CLUSTER,oa[na.APP_AUTH_NOT_PASS]=Z.RC_APP_AUTH_NOT_PASS,oa[na.OTP_USED]=Z.RC_OTP_USED,oa[na.PLATFORM_ERROR]=Z.RC_PLATFORM_ERROR,oa[na.ACCOUNT_CANCELLATION]=Z.RC_ACCOUNT_CANCELLATION,oa[na.LICENSE_EXPIRED]=Z.RC_LICENSE_EXPIRED,oa),da=function(t){return t===Z.RC_CONN_REDIRECTED},ga=function(t){return Object.keys(la).some((function(e){return la[e]===t}))},pa=function(t){return Object.keys(ha).some((function(e){return ha[e]===t}))};!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.SUSPENDED=3]="SUSPENDED"}(ca||(ca={}));var fa,_a=function(){function t(t,e,n,i,r){this.appkey=t,this.navi=e,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:qe.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=ca.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return t.prototype.getToken=function(){return this.token},t.prototype.getCurrentUserId=function(){return this._crtUserId},t.prototype.setConnectionStatus=function(t,e){if(this._crtConnectionStatus!==t){if(this._crtConnectionStatus=t,this._connectDurSwitch&&t!==ca.CONNECTED&&t!==ca.CONNECTING){var n={bid:tn(),cod:e,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(ft.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(t){case ca.CONNECTED:this.logger.info(pt.L_CONNECT_S,t),this.checkAlive(),this.listener.onConnected();break;case ca.CONNECTING:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.listener.onConnecting();break;case ca.SUSPENDED:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),da(e)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(e);break;default:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(e)}}},t.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},t.prototype.setNetwork=function(t,e){if(!e){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:t.type,on:this._network.type};this.statisticLog.__statistics(ft.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=t},t.prototype.getNetwork=function(){return this._network},t.prototype.connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._crtConnectionStatus===ca.CONNECTED?[2,{code:Z.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=we(),this.token=t,this.reconnectKick=e,this.setConnectionStatus(ca.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Yt.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(ft.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(t,e,!1,i)]);case 1:return o=u.sent(),s=o.code,a=o.data,s!==Z.SUCCESS?(this.setConnectionStatus(ca.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(ca.CONNECTED),[2,{code:s,data:a}])}}))}))},t.prototype.try2Connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(t,e,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),o=r.code,s=r.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},t.prototype.createConnectionTask=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,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(t,n,!1,i,r)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==Z.SUCCESS?[2,{code:s}]:1===(u=a).type?[2,{code:Z.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(pt.L_CONNECT_T,JSON.stringify({token:t,reconnectKickEnable:e}),i),[4,this.connectWithToken(t.replace(/@.+$/,"@"),u,e,i)]);case 2:return c=l.sent(),h=c.code,d=c.data,da(h)?(this.logger.warn(pt.L_CONNECT_R,"redirect code: ".concat(h),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(t,e,!0,i)]):[Z.RC_TCP_RESET,Z.RC_CONN_ACK_TIMEOUT,Z.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(pt.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),i),this.setConnectionStatus(ca.SUSPENDED,h),this.setConnectionStatus(ca.CONNECTING),[2,this.createConnectionTask(t,e,!1,i)]):h!==Z.SUCCESS?(this.logger.warn(pt.L_CONNECT_R,"code: ".concat(h),i),[2,{code:h}]):(this.logger.info(pt.L_CONNECT_R,"userId: ".concat(d),i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},t.prototype.setReconnectReason=function(t){switch(t){case Z.TIMEOUT:return void(this.reason=Yt.TIMEOUT);case Z.RC_CONN_REDIRECTED:return void(this.reason=Yt.REDIRECTED);default:this.reason=Yt.RECONNECT}},t.prototype.try2Reconnect=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(pt.T,"try2Reconnect -> ignoreNaviCache: ".concat(t,", reason: ").concat(e),n),this.stopReconnectTimer(),i=function(){return c(r,void 0,void 0,(function(){var r,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==ca.SUSPENDED?[2]:(this.setConnectionStatus(ca.CONNECTING,e),this.setReconnectReason(e),this.retryCount+=1,r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(ft.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,t,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===Z.SUCCESS?(this.setConnectionStatus(ca.CONNECTED),[2]):[Z.SERVER_UNAVAILABLE,Z.TIMEOUT,Z.RC_SOCKET_DISCONNECTED,Z.RC_SOCKET_NOT_CREATED,Z.RC_CONN_ACK_TIMEOUT,Z.RC_TCP_RESET,Z.RC_NAVI_REQ_FAILED,Z.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==ca.CONNECTING||(this.setConnectionStatus(ca.SUSPENDED,o),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(ca.DISCONNECTED,o),[2])}}))}))},i(),[2]}))}))},t.prototype.onDisconnectByServer=function(t,e){var n=this;return da(t)?(this.setConnectionStatus(ca.SUSPENDED,t),void this.try2Reconnect(!0,t)):t===Z.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ca.SUSPENDED,t),void setTimeout((function(){n.try2Reconnect(!0,t)}),1e3*(e||0))):void this.setConnectionStatus(ca.DISCONNECTED,t)},t.prototype.onDisconenctUnusual=function(t){this.setConnectionStatus(ca.SUSPENDED,t),this.try2Reconnect(!1,t)},t.prototype.checkAlive=function(){return c(this,void 0,void 0,(function(){var t,e,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==ca.CONNECTED?(this._failedCount=0,this.logger.debug(pt.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(t=this.logger.createTraceId(),this.logger.info(pt.L_CHECK_ALIVE_IM_T,null,t),[4,this.sendPing(15e3)]);case 1:return(e=i.sent())===Z.SUCCESS?(this.logger.info(pt.L_CHECK_ALIVE_IM_R,e,t),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==ca.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(pt.L_CHECK_ALIVE_IM_R,"code: ".concat(e,", count: ").concat(this._failedCount),t),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(pt.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(ca.SUSPENDED,Z.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,Z.RC_PING_EXCEED_LIMIT),[2]))}}))}))},t.prototype.disconnect=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.setConnectionStatus(ca.DISCONNECTED,Z.ACTIVE_DISCONNECT),this.close(!1,t),[2]}}))}))},t.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},t.prototype.getCmpList=function(t,e){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var n=t.server,i=t.backupServer,r=t.serverAddr,o=t.protocol,s=t.openTLS;if(r)return this.cmpWeightCache=h([],r,!0),h([],r,!0);var a=[],u=[];return n&&u.push(n),null==i||i.split(",").forEach((function(t){u.indexOf(t)<0&&u.push(t)})),u.forEach((function(t,i){var r;r=e?1===s?wt.TLS:wt.RMTP:"http"===o?wt.WS:wt.WSS,a.push({addr:t,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},t.prototype.updateCmpWeight=function(t,e,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(e){return n?e.addr===t&&e.protocol===wt.QUIC:e.addr===t}));if(i)if(e){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==r&&(i.weight=r+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==o&&(i.weight=o-1)}}},t.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},t}(),Ea=function(){function t(e){this.logger=e,this._codec=t.createPBCodec()}return t.createPBCodec=function(){var t=jn(sa);return t.getModule=function(e){var n=new t[e];return n.getArrayData=function(){var t=n.toArrayBuffer();return t=re(t)?[].slice.call(new Int8Array(t)):t},n},t},t.prototype.decodeByPBName=function(t,e,n){var i,r=this,o=t,s=((i={})[Mo]=r._formatSyncMessages,i[No]=r._formatReceivedMessage,i[So]=r._formatSentMessage,i[Do]=r._formatHistoryMessages,i[Go]=r._formatConversationList,i[Jo]=r._formatChatRoomInfos,i[ss]=r._formatChatRoomKVList,i[ps]=r._formatUserSetting,i[Es]=r._formatConversationStatus,i[Us]=r._formatGrpReadReceiptQryResp,i[ds]=r._formatSetUserSettingOutput,i[fs]=r._formatUserSettingNotification,i[Ks]=r._formatUltraMsgChangeList,i[Qs]=r._formatUltraOperateStatusNotifyList,i[Ys]=r._formatUltraMsgList,i[Ss]=r._formatUltraGroupUnreadMentionedList,i[Qo]=r._formatChrmKVVersion,i[ea]=r._formatCallKVInfo,i[$s]=r._fromatCallInfoDownStream,i)[e];try{o=t.length>0&&r._codec[e].decode(t),ae(o)&&(o=function(t){for(var e in t)ae(t[e])&&(t[e]=je(t[e]));return t}(o)),ue(s)&&(o=s.call(this,o,n))}catch(t){this.logger.error(pt.L_PB_DECODE_E,e)}return o},t.prototype._readBytes=function(t){var e=t.offset,n=t.buffer,i=t.limit;if(e)try{var r=re(n)?new Uint8Array(n):n;return Or.readUTF(r.subarray(e,i))}catch(t){this.logger.error(pt.O,null==t?void 0:t.stack)}return t},t.prototype._formatBytes=function(t){if(!t)return t;var e=this._readBytes(t);try{e=e?JSON.parse(e):e}catch(t){this.logger.error(pt.O,null==t?void 0:t.stack)}return e||t},t.prototype._formatSyncMessages=function(t,e){e=e||{};var n=this,i=t.list,r=t.syncTime,o=t.finished;return(ce(o)||null===o)&&(t.finished=!0),t.syncTime=je(r),t.list=cn(i,(function(t){return n._formatReceivedMessage(t,e)})),t},t.prototype._getUtfContent=function(t){if(t.user){var e=t.user,n=e.portrait,i=e.portraitUri,r=n||i;r&&(t.user.portrait=t.user.portraitUri=r)}return t},t.prototype._setExpansion=function(t){var e;return t&&(e=function(t){var e={},n=JSON.parse(t);return un(n,(function(t,n){e[n]=t.v})),e}(t)),e},t.prototype._setPushConfig=function(t,e){var n=t.pushContent,i=t.pushExt,r=t.configFlag,o={};return i&&(o=Xe(e,i.pushConfigs,i.pushId)),u(u({},o),{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})},t.prototype._formatReceivedMessage=function(t,e){if(!t)return t;var i=this,r=e||{},o=r.currentUserId,s=r.connectedTime,a=t.content,u=t.fromUserId,c=t.type,l=t.groupId,h=t.status,d=t.dataTime,g=t.extraContent,p=t.configFlag,f=t.extStatus,_=t.clientUniqueId,E=t.busChannel,T=t.msgId,v=t.classname,y=t.direction||J.RECEIVE,C=function(t){var e=n.READ;return{isPersited:!!(16&t),isCounted:!!(32&t),isMentioned:!!(64&t),disableNotification:!!(512&t),receivedStatus:e=2&t?n.RETRIEVED:e,canIncludeExpansion:!!(1024&t)}}(h),m=C.isPersited,I=C.isCounted,R=C.isMentioned,S=C.disableNotification,O=C.receivedStatus,N=C.canIncludeExpansion,M=!!(2&(f||0)),U=!!(4&(f||0)),L=!!(8&(f||0))?Pt.PRIVATE:Pt.PUBLIC,A=[$.GROUP,$.CHATROOM,$.RTC_ROOM,$.ULTRA_GROUP].indexOf(c)>-1?l:u,w=u,b=J.RECEIVE;y===J.SEND&&(w=o,b=J.SEND);var P=je(d),D=P<s,V=c===$.CHATROOM,G=i._setExpansion(g),B=i._formatBytes(a);B=i._getUtfContent(B);var k=i._setPushConfig(t,this.logger);V&&u===o&&(b=J.SEND);var x={conversationType:c,targetId:A,senderUserId:w,messageType:v,messageUId:T,isPersited:m,isCounted:I,isMentioned:R,sentTime:P,messageDirection:b,receivedTime:Tn.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:N,content:B,expansion:G,configFlag:p,pushConfig:k,channelId:E||"",isInterrupt:M,isModifyMessage:U,messageId:je(_)||0,sentStatus:It.SENT};return c!==$.ULTRA_GROUP?(x.isOffLineMessage=D,x):(x.channelType=L,x)},t.prototype._formatSentMessage=function(t,e){var n=this,i=t.content,r=t.classname,o=t.sessionId,s=t.msgId,a=t.extraContent,c=t.pushExt,l=t.pushContent,h=t.configFlag,d=t.extStatus,g=t.clientUniqueId,p=t.systemId,f=e.signal,_=e.currentUserId,E=f.date,T=f.topic,v=f.targetId,y=!!(2&(d||0)),C=function(t){return{isPersited:!!(1&t),isCounted:!!(2&t),disableNotification:!!(32&t),canIncludeExpansion:!!(64&t)}}(o),m=C.isPersited,I=C.isCounted,R=C.disableNotification,S=C.canIncludeExpansion,O=_r[T]||$.PRIVATE,N=dn(Xi,T),M=n._formatBytes(i),U=p||v;r===it.RECALL&&(O=M.conversationType||O,U=M.targetId||v);var L=n._setExpansion(a),A=n._setPushConfig(t,this.logger),w=u(u({},A),{pushTitle:null==c?void 0:c.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:O,targetId:U,messageType:r,messageUId:s,isPersited:m,isCounted:I,isStatusMessage:N,senderUserId:_,content:n._formatBytes(i),sentTime:1e3*E,receivedTime:Tn.getTime(),messageDirection:J.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:S,expansion:L,pushConfig:w,channelId:t.busChannel||"",isInterrupt:y,messageId:je(g)||0}},t.prototype._formatHistoryMessages=function(t,e){var n=this,i=e.conversation||{},r=t.list,o=t.hasMsg,s=i.targetId,a=je(t.syncTime),u=[];return un(r,(function(t){var r=n._formatReceivedMessage(t,e);i.conversationType===$.ULTRA_GROUP?r.targetId=t.groupId||i.targetId:r.targetId=s,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!o}},t.prototype._formatUltraMsgChangeList=function(t){var e=t.list,n=t.syncTime,i=t.hasNext;return{syncTime:n,list:e&&e.map((function(t){var e=t.targetId,n=t.type,i=t.time,r=t.changeType,o=t.msgUID,s=t.msgTime,a=t.busChannel,u=t.isAdmin,c=t.isDel,l=t.operatorId,h=t.subChangeType,d=t.userGroupIds,g=t.busChannelType,p=t.remindType;return{targetId:e,conversationType:n,changeType:r,messageUId:o,changeTime:je(i),sendTime:je(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:g,mentionedType:p}})),hasNext:i}},t.prototype._formatUltraOperateStatusNotifyList=function(t){var e=t.type,n=t.notifyType,i=t.info,r=t.summary,o=[],s=[],a=2==(2&n),u=1==(1&n);return u&&Array.isArray(i)&&i.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.userId,r=t.opType,s=t.optime,a=je(s);o.push({targetId:e,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.count,r=t.opType;s.push({targetId:e,channelId:n,count:i,operationType:r})})),{conversationType:e,info:o,summary:s,hasInfo:u,hasSummary:a}},t.prototype._formatUltraMsgList=function(t,e){var n=this,i=t.list;return{list:i&&i.map((function(t){return n._formatReceivedMessage(t,e)}))}},t.prototype._formatUltraGroupUnreadMentionedList=function(t){var e=t.msgInfo;return(void 0===e?[]:e).map((function(t){return{messageUId:t.msgId,senTtime:je(t.msgTime),mentionedType:t.remindType,messageType:t.className||""}}))},t.prototype._getUltraGroupConversationInfo=function(t,e){var n=e.versionTime,i=e.unreadCount,r=e.remindCount,o=e.busChannelType,s=e.msgInfo,a=e.remindMeCount;return t.versionTime=je(n)||0,t.unreadMessageCount=this._getUnreadCount(je(i)||0),t.unreadMentionedCount=this._getUnreadCount(je(r)||0),t.unreadMentionedMeCount=this._getUnreadCount(je(a)||0),t.channelType=o||Pt.PUBLIC,t.lastReadTime=0,s&&(t.firstUnreadMessage={sentTime:je(s.msgTime)},t.lastReadTime=je(s.msgTime)-1),t},t.prototype._getUnreadCount=function(t){return t>999?999:t},t.prototype._formatConversationList=function(t,e){var n=this,i=this,r=t.info,o=e.afterDecode,s={list:(r=cn(r,(function(t){var r=t.msg,s=t.userId,a=t.type,u=t.unreadCount,c=t.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,e)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:je(u)||0,latestMessage:l||{},channelId:c||""};return a===$.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,t)),(null==o?void 0:o(h))||h})))||[]};return((null==e?void 0:e.conversationType)||$.NONE)===$.ULTRA_GROUP&&(s.isFinished=t.isFinished),s},t.prototype._formatSetUserSettingOutput=function(t){return t},t.prototype._formatChatRoomInfos=function(t){var e=t.userTotalNums,n=t.userInfos;return{userCount:e,userInfos:cn(n,(function(t){var e=t.id,n=t.time;return{id:e,time:je(n)}}))}},t.prototype._formatChatRoomKVList=function(t){var e=t.entries,n=t.bFullUpdate,i=t.syncTime;return e=cn(e=e||[],(function(t){var e=t.key,n=t.value,i=t.status,r=t.timestamp,o=t.uid,s=t.version,a=function(t){return{isAutoDelete:!!(1&t),isOverwrite:!!(2&t),type:4&t?Et.DELETE:Et.UPDATE}}(i);return{key:e,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:je(r),version:je(s)}})),{kvEntries:e,isFullUpdate:n,syncTime:i}},t.prototype._formatUserSetting=function(t){var e=this,n=t.items,i=t.version,r={};return un(n||[],(function(t){var n=t.key,i=t.version,o=t.value;t.version=je(i),t.value=e._readBytes(o),"Tag"===n&&t.tags.forEach((function(t){t.createdTime=je(t.createdTime),t.tagName=t.name})),r[n]=t})),{settings:r,version:i}},t.prototype._formatConversationStatus=function(t){var e=t.state,n=[];return un(e,(function(t){var e=t.type,i=t.channelId,r=t.time,o=t.stateItem,s=t.busChannel,a=ot.CLOSE,u=at.NOT_SET,c=!1,l=[];un(o,(function(t){var e=t.sessionStateType,n=t.value,i=t.tags;switch(e){case Cr:a=n===vr?ot.OPEN:ot.CLOSE,u=Number(n)||at.NOT_SET;break;case mr:c=n===vr;break;case Ir:l=i}})),n.push({conversationType:e,type:e,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:je(r),tags:l,channelId:s||""})})),n},t.prototype._formatGrpReadReceiptQryResp=function(t){var e=t.totalMemberNum,n=t.list;return n.forEach((function(t){t.readTime=je(t.readTime)})),{totalMemberCount:e,list:n}},t.prototype._formatUserSettingNotification=function(t){return t},t.prototype._formatChrmKVVersion=function(t){var e=t.joinTime,n=t.createTime,i=t.memberCount,r=t.chatroomBanState;return{joinTime:e,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&t.whiteListState)}},t.prototype._formatRTCJoinedUserInfo=function(t){return(t.info||[]).map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:je(t.joinTime)}}))},t.prototype._formatCallKVInfo=function(t){return t},t.prototype._fromatCallInfoDownStream=function(t){return t},t.prototype.encodeServerConfParams=function(){var t=this._codec.getModule(Uo);return t.setNothing(1),t.getArrayData()},t.prototype._updateMentionedInfo=function(t,e,n){var i,r,o;return{userIdList:(null===(i=t.mentionedInfo)||void 0===i?void 0:i.userIdList)||e,type:(null===(r=t.mentionedInfo)||void 0===r?void 0:r.type)||n||ct.ALL,mentionedContent:(null===(o=t.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}},t.prototype._calculateFlag=function(t){var e=t.isFilerWhiteBlacklist,n=t.isVoipPush,i=t.pushConfig||{},r=0;return r|=n?1:0,r|=e?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},t.prototype._getPushExtraModule=function(t){var e=t.pushTitle,n=t.iOSConfig,i=t.androidConfig,r=t.templateId,o=void 0===r?"":r,s=this._codec.getModule(Oo);if(e&&s.setTitle(e),n||i){var a=Je(n,i);s.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&s.setPushId(null==i?void 0:i.notificationId),s.setTemplateId(o),s},t.prototype._getUpMsgModule=function(t,e){var n=e.messageType,i=e.isMentioned,r=e.mentionedType,o=e.content,s=e.directionalUserIdList,a=e.canIncludeExpansion,u=e.expansion,c=e.pushConfig,l=e.channelId,h=e.pushData,d=void 0===h?"":h,g=e.mentionedUserIdList,p=void 0===g?[]:g,f=e.pushContent,_=void 0===f?"":f,E=e.messageId,T=void 0===E?0:E,v=t.conversationType,y=t.targetId,C=this._codec.getModule(So),m=function(t){var e=t.isStatusMessage,n=t.isPersited,i=t.isCounted;e&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),t.isMentioned&&(r|=4),t.disableNotification&&(r|=32),t.canIncludeExpansion&&(r|=64),r}(e),I=c||{},R=I.pushContent,S=void 0===R?_:R,O=I.pushData,N=void 0===O?d:O;C.setSessionId(m),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,p,r)),S&&C.setPushText(S),N&&C.setAppData(N),s&&C.setUserId(s);var M=this._calculateFlag(e);if(C.setConfigFlag(M),C.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),C.setContent(JSON.stringify(o)),a&&u){var U={};un(u,(function(t,e){U[e]={v:t}})),C.setExtraContent(JSON.stringify(U))}if(c){var L=this._getPushExtraModule(c);C.setPushExt(L)}return C.setClientUniqueId(T),ce(l)||C.setBusChannel(l),v===$.SYSTEM&&C.setSystemId(y),C},t.prototype.encodeUpMsg=function(t,e){return this._getUpMsgModule(t,e).getArrayData()},t.prototype.encodeSyncMsg=function(t){var e=t.sendboxTime,n=t.inboxTime,i=t.broadcastSyncTime,r=this._codec.getModule(Ao);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(e),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},t.prototype.encodeChrmSyncMsg=function(t,e){t=t||0,e=e||0;var n=this._codec.getModule(wo);return n.setCount(e),n.setSyncTime(t),n.getArrayData()},t.prototype.encodeGetHistoryMsg=function(t,e){var n=e.count,i=e.order,r=e.timestamp,o=e.channelId,s=this._codec.getModule(Po);return s.setTargetId(t),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},t.prototype.encodeSuperSyncMsg=function(t){var e=this._codec.getModule(Bs);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeGetConversationList=function(t){var e=(t=t||{}).count,n=t.startTime,i=this._codec.getModule(Vo);return i.setType(1),i.setCount(e),i.setStartTime(n),i.getArrayData()},t.prototype.encodeOldConversationList=function(t){var e=(t=t||{}).count,n=t.type,i=t.startTime,r=t.order;e=e||0,i=i||0,r=r||0;var o=this._codec.getModule(Vo);return o.setType(n),o.setCount(e),o.setStartTime(i),o.setOrder(r),o.getArrayData()},t.prototype.encodeRemoveOldConversationList=function(t){var e=(t=t||{}).conversationType,n=t.channelId,i=this._codec.getModule(Ko);return i.setType(e),n&&i.setBusChannel([n]),i.getArrayData()},t.prototype.encodeRemoveConversationList=function(t){var e=this,n=this._codec.getModule(ko),i=[];return un(t,(function(t){var n=t.conversationType,r=t.targetId,o=e._codec.getModule(xo);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},t.prototype.encodeDeleteMessages=function(t,e,n,i){var r=this._codec.getModule(Ho),o=[];return un(n,(function(t){o.push({msgId:t.messageUId,msgDataTime:t.sentTime,direct:t.messageDirection})})),r.setType(t),r.setConversationId(e),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},t.prototype.encodeClearMessages=function(t,e,n,i){var r=this._codec.getModule(qo);return e=e||(new Date).getTime(),r.setDataTime(e),r.setTargetId(t),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},t.prototype.encodeClearUnreadCount=function(t,e){var n=t.conversationType,i=t.targetId,r=t.channelId,o=e.timestamp,s=this._codec.getModule(Yo);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},t.prototype.encodeExpandUltraMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.keys,u={mid:o,put:t.expansion,del:a,clear:t.removeAll?1:0},c=this._codec.getModule(ks);return c.setFromUserId(e),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.getArrayData()},t.prototype.encodemodifyMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.content,u=this._codec.getModule(ks);return u.setFromUserId(e),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},t.prototype.encodeQueryMsgChange=function(t){var e=this._codec.getModule(xs);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeMsgQuery=function(t){var e=t.targetId,n=t.conversationType,i=t.messages,r=this._codec.getModule(Hs),o=i.map((function(t){return{msgTime:t.sendTime,msgUID:t.messageUId,busChannel:t.channelId}}));return r.setTargetId(e),r.setType(n),r.setQuery(o),r.getArrayData()},t.prototype.encodeUnreadMentionedMsgQuery=function(t){var e=t.targetId,n=t.channelId,i=t.sentTime,r=t.count,o=this._codec.getModule(Rs);return o.setGroupId(e),o.setBusChannel(n),o.setMsgTime(i),o.setSize(r),o.getArrayData()},t.prototype.encodeOperateStatus=function(t,e,n,i){var r=this._codec.getModule(js);return r.setTargetId(t),r.setType(e),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},t.prototype.encodeJoinOrQuitChatRoom=function(){var t=this._codec.getModule(jo);return t.setNothing(1),t.getArrayData()},t.prototype.encodeGetChatRoomInfo=function(t,e){var n=this._codec.getModule(Wo);return n.setCount(t),n.setOrder(e),n.getArrayData()},t.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(t,e){var n=this._codec.getModule(Is);return n.setUnpushLevel(t),n.setBusChannel(e),n.getArrayData()},t.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(t){var e=this._codec.getModule(ms);return e.setBusChannel(t),e.getArrayData()},t.prototype.encodeGetFileToken=function(t,e,n,i,r){var o=this._codec.getModule(Xo);return o.setType(t),o.setKey(e),o.setHttpMethod(n),o.setQueryString(i),o.setUrl(r),o.getArrayData()},t.prototype.encodeGetFileUrl=function(t,e,n,i){var r=this._codec.getModule(t);return r.setType(e),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},t.prototype.encodeModifyChatRoomKV=function(t,e,n){var i=this._codec.getModule(is),r=e.key,o=e.value,s=e.notificationExtra,a=e.isSendNotification,u=e.type,c=e.timestamp,l=u||Et.UPDATE,h=vn(e,l),d={key:r,value:o||"",uid:n,version:c};if(ce(h)||(d.status=h),i.setEntry(d),a){var g={conversationType:$.CHATROOM,targetId:t},p={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(g,{messageType:it.CHRM_KV_NOTIFY,content:p,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType($.CHATROOM)}return i.getArrayData()},t.prototype.encodeModifyChatRoomKVS=function(t,e,n){var i=this._codec.getModule(rs),r=e.entries,o=e.type||Et.UPDATE,s=vn(e,o),a=[];return r.forEach((function(t){var e={key:t.key,value:t.value||"",uid:n,version:t.timestamp};ce(s)||(e.status=s),a.push(e)})),i.setEntry(a),i.getArrayData()},t.prototype.encodePullChatRoomKV=function(t){var e=this._codec.getModule(ls);return e.setTimestamp(t),e.getArrayData()},t.prototype.encodePullUserSetting=function(t){var e=this._codec.getModule(gs);return e.setVersion(t),e.getArrayData()},t.prototype.encodeGetConversationStatus=function(t){var e=this._codec.getModule(_s);return e.setTime(t),e.getArrayData()},t.prototype.encodeSetConversationStatus=function(t,e){var n=this,i=this._codec.getModule(ys),r=Tn.getTime(),o=[];return un(t,(function(t){var e=n._codec.getModule(Ts),i=t.conversationType,s=t.targetId,a=t.notificationStatus,u=t.isTop,c=t.channelId,l=t.notificationLevel,h=[];e.setType(i),e.setChannelId(s),e.setTime(r),e.setBusChannel(c);var d=a===ot.OPEN,g={};ce(a)||(g[Cr]=d),ce(l)||(g[Cr]=l),ce(u)||(g[mr]=u),un(g,(function(t,e){if(!ce(t)){var i=n._codec.getModule(vs);t=t?vr:yr,ce(l)||Number(e)!==Cr||(t=String(l)),i.setSessionStateType(Number(e)),i.setValue(t),h.push(i)}})),e.setStateItem(h),o.push(e)})),i.setVersion(e||r),i.setState(o),i.getArrayData()},t.prototype.encodeReadReceipt=function(t,e){var n=this._codec.getModule(Ns);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeCreateTag=function(t,e){var n=this,i=this._codec.getModule(As),r=[];return t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t.tagId),e.setName(t.tagName),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeMessageReader=function(t,e){var n=this._codec.getModule(Ns);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeRemoveTag=function(t,e){var n=this,i=this._codec.getModule(bs),r=[];return t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeDisConversationTag=function(t){var e=this._codec.getModule(Ps);return e.setTagId(t),e.getArrayData()},t.prototype.encodeUpdateConversationTag=function(t,e){var n=this,i=this._codec.getModule(ys),r=[];return e.forEach((function(e){var i=n._codec.getModule(Ts),o=n._codec.getModule(vs),s=[];t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t.tagId),ce(t.isTop)||e.setIsTop(t.isTop),s.push(e)})),o.setSessionStateType(Ir),o.setValue(JSON.stringify(s)),o.setTags(s),i.setType(e.conversationType),i.setChannelId(e.targetId),i.setTime(Date.now()),i.setStateItem([o]),r.push(i)})),i.setState(r),i.setVersion(Tn.getTime()),i.getArrayData()},t.prototype.encodeReportSDKInfo=function(t){var e=this._codec.getModule(Ds);return e.setSdkInfo(t),e.getArrayData()},t.prototype.encodeUltraGroup=function(t,e){var n=this._codec.getModule(Gs);return n.setSyncTime(t),n.setIsEraseMsgContent(e),n.getArrayData()},t.prototype.encodebindRTCRoomForChatroom=function(t){var e=this._codec.getModule(Xs);return e.setRtcRoomId(t.rtcRoomId),e.getArrayData()},t.prototype.encodeSetCallInfo=function(t,e){var n=this._codec.getModule(zs);return n.setKey(t),n.setDataContent(e),n.getArrayData()},t.prototype.encodePullKVMsg=function(t){var e=this._codec.getModule(ta);return e.setSyncTime(t),e.getArrayData()},t}(),Ta=function(t){function e(e,n,i,r,o,s){var a=t.call(this,e,n,i,r,s)||this;return a.runtime=o,a.wsListener=s,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 Ea(a.logger),a}return a(e,t),e.prototype.getConnectedTime=function(){return this._connectedTime},e.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},e.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},e.prototype.connectWithToken=function(t,e,n,i){return c(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,h,d;return l(this,(function(g){switch(g.label){case 0:if(n=e.openAnti,r=e.type,o=this.getCmpList(e),0===(s=o.filter((function(t,e){return o.findIndex((function(e){return e.addr===t.addr}))===e})).sort((function(t,e){return t.weight>e.weight?-1:1}))).length)return this.logger.error(pt.L_NAVI_CONF_E,"no service available",i),[2,{code:Z.SERVER_UNAVAILABLE}];a=1===n?qi.V4:qi.V3,u=function(e){var n,o,u,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return n=s[e],o=n.protocol,u=n.addr,h=n.weight,d=function(t,e,n,i,r,o,s){var a=Pi(r),u=a.type,c=a.version,l="browser"===r.tag?"|".concat(u,"|").concat(c):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(t,"://").concat(e,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(F,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===wt.WS?"ws":"wss",u,c.appkey,t,c.runtime,"",a),g=Date.now(),[4,c.connectWebSocket(d,a,i)];case 1:return p=l.sent(),f=p.code,_=p.data,E=c.cmpWeightCache.findIndex((function(t){return t.addr===u})),T={bid:tn(),ptc:Ft.WS,cod:f,net:c.getNetwork().type,dur:Date.now()-g,spr:0,pr:r||0,hos:u,idx:E,rct:c.retryCount?qt.RECONNECT:qt.CONNECT,cid:"".concat(c.uuid,"_").concat(c.retryCount),v:Ht.CURRENT,rsn:c.reason,count:c.retryCount,weight:h},c.statisticLog.__statistics(ft.IM_WEBSOCKET,JSON.stringify(T),i),f===Z.RC_SOCKET_DISCONNECTED||f===Z.TIMEOUT?[2,"continue"]:f!==Z.SUCCESS?[2,{value:{code:f}}]:(c._localConnectedTime=Math.floor((Date.now()+g)/2),c._socket=_.socket,c.updateCmpWeight(s[e].addr,!0),c.curCmpUrl=s[e].addr,[2,{value:{code:f,data:_.userId}}])}}))},c=this,h=0,g.label=1;case 1:return h<s.length?[5,u(h)]:[3,4];case 2:if("object"==typeof(d=g.sent()))return[2,d.value];g.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:Z.SERVER_UNAVAILABLE}]}}))}))},e.prototype.connectWebSocket=function(t,e,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(pt.T,"connect start: ".concat(t),n),[2,new Promise((function(r){var o=i.runtime.createWebSocket(t);i._socketIndex=o.id;var s=setTimeout((function(){i.logger.info(pt.T,"connect timeout: ".concat(t),n),r({code:Z.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(pt.T,"socket open",n)})),o.onMessage((function(t){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var s,a=Yr(i.logger,t,e);if(a instanceof wr){var u=a.status;if(u!==na.ACCEPTED)return i.logger.info(pt.T,"connect failed: ".concat(u),n),void r({code:(s=u,ha[s])});i.logger.info(pt.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:Z.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof br){var d=a.status;return i.logger.info(pt.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}i._onReceiveSignal(a)}}else i.logger.warn(pt.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(pt.T,"socket close",n);var t=Z.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)})),o.onError((function(t){i.logger.info(pt.T,"socket error",n);var e=Z.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)}))}))]}))}))},e.prototype._qosNeedAck=function(t,e){t.header&&t.header.qos!==Fi.AT_MOST_ONCE&&(t instanceof Br&&!t.syncMsg&&(this.logger.debug(pt.O,"send pubAck -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Fr(e))),t instanceof qr&&(this.logger.debug(pt.O,"send queryCon -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Hr(e))))},e.prototype._publishReader=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return n=t.syncMsg,i=t.topic,this.logger.debug(pt.O,"recv PublishReader -> messageId: ".concat(e," ").concat(i)),i===Mn?[2]:!n||function(t){return[jr.ppMsgS,jr.pgMsgS,jr.chatMsgS].map((function(t){return jr[t]})).indexOf(t)>=0}(i)?(this.wsListener.signal(t),[2]):[4,new Promise((function(t){o._syncMessageIds[e]=t}))];case 1:return r=s.sent(),delete this._syncMessageIds[e],this.wsListener.signal(t,r),[2]}}))}))},e.prototype._onReceiveSignal=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return e=t.messageId,t instanceof Dr&&this._pingResolve?(this._pingResolve(Z.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(t,e),e>0&&(t instanceof xr||t instanceof qr)&&(this.logger.debug(pt.O,"recv ack -> messageId: ".concat(e," ").concat(t.topic)),(n=this._messageIds[e])&&(n(t),delete this._messageIds[e]),(i=this._syncMessageIds[e])&&(delete this._syncMessageIds[e],i(t))),t instanceof Br?[4,this._publishReader(t,e)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.onRecvDisconnect=function(t,e){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(t){return la[t]}(t)))},e.prototype.onSocketEnd=function(t,e){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(e),this._pingResolve&&(this._pingResolve(e),this._pingResolve=void 0))},e.prototype.clearResolves=function(){for(var t in this._messageIds){var e=this._messageIds[t];delete this._messageIds[t],e(Z.RC_SOCKET_DISCONNECTED)}},e.prototype.sendPing=function(t){var e=this;return new Promise((function(n){e._pingResolve=n,setTimeout((function(){return n(Z.TIMEOUT)}),t),e.sendOnly(new Pr)}))},e.prototype.sendOnly=function(t){this._socket&&((t instanceof kr||t instanceof Kr)&&(t.messageId=this._generateMessageId()),this._socket.send(t.getBufferData().buffer))},e.prototype.send=function(t,e,n,i){return void 0===i&&(i=3e4),c(this,void 0,void 0,(function(){var r,o,s,a,u=this;return l(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),t.messageId=r,this._socket.send(t.getBufferData().buffer),[4,new Promise((function(t){u._messageIds[r]=t,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],t()}),i)}))]):[2,{code:Z.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof qr||o instanceof xr?(s=e&&o.data&&[Z.SUCCESS,Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,e,n):o,0!==o.status?(this.logger.warn(pt.O,"send failed -> message: ".concat(r,", respPBName: ").concat(e,", status: ").concat(o.status)),[2,{code:o.status,data:e&&o.data?a:null}]):[2,{code:Z.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(pt.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(e,", timeout: ").concat(i)),[2,{code:Z.TIMEOUT}])}}))}))},e.prototype.close=function(t){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},e}(_a);!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD"}(fa||(fa={}));var va=null,ya="RC_CONF",Ca="RC_STATISTICS",ma=null,Ia=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(Ca,"readwrite").objectStore(Ca),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),ma=setTimeout((function(){return Ia(t)}),6e5),[2]}}))}))},Ra=function(t,e,n){void 0===n&&(n=168),va||("undefined"!=typeof window&&window&&window.indexedDB?va=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(t),s=r.open(o,2);s.onerror=function(t){e.error(pt.L_LOGDB_OPEN_FAILED_E,t.target.error),i(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(pt.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(pt.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(pt.L_LOGDB_ABORT_S,t.target.error)},Ia(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:t,db:o})):i(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(Ca)&&e.deleteObjectStore(Ca);var n=e.createObjectStore(Ca,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(ya,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(pt.L_UNSUPPORT_INDEXDB_O))},Sa=function(){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return va?(ma&&(clearTimeout(ma),ma=null),[4,va]):[2];case 1:return(t=e.sent())&&t.db.close(),va=null,[2]}}))}))};function Oa(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(ya,"readonly").objectStore(ya).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Na="REPORT_SESSION",Ma=function(t,e){return c(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Na,"_").concat(t),[4,Oa("".concat(Na,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){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(ya,"readwrite").objectStore(ya).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))},Ua=function(){return va},La=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,u=t.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Aa=be(),wa=Date.now(),ba=0,Pa=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.__statistics=this._writer.bind(this,fa.STATISTICS)}return t.prototype._writer=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)&&this.flush({time:+r,sessionId:Aa,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})},t.prototype.createTraceId=function(){return"".concat(Aa,"-").concat(++ba)},t.prototype.getSessionId=function(){return Aa},t}(),Da=function(){function t(t,e,n,i,r,o){void 0===o&&(o=r),this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=$n.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.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])}))}))},t.prototype.realtimeReport=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||wa,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(pt.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e}),s),[4,this.statisticDB.getStatistics(r,o,e,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(pt.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(pt.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressStatistics(c)]):[3,5];case 3:return h=l.sent(),d=h.success,g=h.data,d||this.logger.warn(pt.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(pt.L_REALTIME_LOG_O,"compress done",s),p=he(t)?t:"https://".concat(t),p+="?version=".concat("5.8.4-alpha.6","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:g,method:"POST"})];case 4:f=l.sent().status,this.logger.info(pt.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(c[c.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(pt.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(t,e,fa.STATISTICS,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(pt.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),h=he(i)?i:"https://".concat(i),h+="?version=".concat("5.8.4-alpha.6","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return g=l.sent(),p=g.success,f=g.data,d=p?f:"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(pt.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(pt.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),Va="RC_STATISTICS",Ga=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){Fa(t)},e}(Pa),Ba=!1,ka=[],xa=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return Ba||0===ka.length?[2]:(Ba=!0,e=ka.splice(0),[4,new Promise((function(n){var i=t.transaction(Va,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Va);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),Ba=!1,setTimeout((function(){return xa(t)})),[2]}}))}))},Fa=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Ua()];case 1:return(e=n.sent())?(ka.push(t),xa(e.db),[2]):[2]}}))}))},Ka=0,Ha=function(){return{setTimestamp4RealtimeLog:function(t){Ka=t},getTimestamp4RealtimeLog:function(){return Ka},getStatistics:function(t,e){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,Ua()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(Va,"readonly").objectStore(Va),o=[],s=IDBKeyRange.bound(t,e),a=r.index("time").openCursor(s);a.onsuccess=function(t){var e=t.target.result;if(e){var n=e.value;o.push(n),e.continue()}else i({dbReady:!0,logs:o})},a.onerror=function(t){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},qa=function(t){function e(e,n,i,r){var o=this,s=bi(n),a=Pi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=t.call(this,e,s,u,Ha(),i,r)||this).runtime=n,o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Ma(e.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressStatistics=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:Li(t.map(La).join(""))}]}))}))},e.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.reportClass.getSessionId(),c(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,Oa("".concat(Na,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s){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,t.prototype.report.call(this,e,n,i,r,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(Da),Ya=function(t){function e(e,n,i,r){void 0===r&&(r=Wn.BJ);var o=t.call(this,e,n,r)||this;return o.appkey=e,o.logger=n,o.runtime=i,o.areaCode=r,o._storageKey="",o._storageKey=Y.STATIC_CONFIG_KEY(e),o}return a(e,t),e.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},e.prototype.setCache=function(t){this.runtime.localStorage.setItem(this._storageKey,t)},e.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},e.prototype.sendRequest=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:t})];case 1:return e=r.sent(),n=e.status,i=e.data,[2,{code:n,data:i}]}}))}))},e.prototype.decryptData=function(t){return c(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,en(t,A,w)];case 1:return e=i.sent(),[2,JSON.parse(e)];case 2:return n=i.sent(),this.logger.error(pt.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},e}(ti),ja=function(t,e,i,r,o,s,a){return{conversationType:t,targetId:e,senderUserId:s,messageDirection:J.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:It.SENT}},Qa=function(t){return t.sort((function(t,e){var n,i,r=(null===(n=t.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),t},Wa=function(t){function e(e,n,i,r){var o=t.call(this,e,n,i,r,new mi(r.appkey,"RC-E","IM"),new Ga(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._latestPullKVMsgTimestamp=0,o._intervalTimerForChrmPull=-1,o._lastSyncUltraMsgTimeStamp=0,o._lastSyncUltraMsgLocalTimeStamp=0,o._ultraGroupTimer=-1,o._isUltraPulling=!1,o._ultraGroupTimeQue=[],o._isUltraGroupListExist=!1,o._ultraGroupMap={},o._ultraMsgMap={},o._pullUltraChangeMessageQue=[],o._isPullingUltraChangeMessage=!1,o._lastPullingUltraChangeMessageTime=0;var s=r.appkey,a=r.logOutputLevel,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),ui(s,o.logger,e,u),o.reporter=new Vi(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new fo(s,o.logger,o.statisticLog,e,new Ya(s,o.logger,e,l)),Ra(s,o.logger,u),o.reporterStatistic=new qa(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new Qr(e,s),o._sendMessageStore=new _o(e,s),o._chrmEntryHandler=new Xr(o),o._connMgr=new Ta(s,o.navi,o.logger,o.statisticLog,o.runtime,{signal:o._signalHandler.bind(o),onConnected:o.onConnected.bind(o),onDisconnected:o.onDisconnected.bind(o),onConnecting:o._watcher.onConnecting,onSuspend:o._watcher.onSuspend}),$n.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),o}return a(e,t),e.prototype.onConnected=function(){var t=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),e=this._connMgr.getCurrentUserId();this.currentUserId=e,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new Zr(t.joinMChrm)),this._conversationManager||(this._conversationManager=new co(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Ro(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new lo(this,this._appkey,this.currentUserId,this._watcher.tag)),this._watcher.onConnected(),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===t.ugMsg&&this._notificationOnline(),this.reporter.checkStart(t),this.reporterStatistic.checkStart(t)},e.prototype.onDisconnected=function(t){this._resetMemoryState(),this._watcher.onDisconnected(t)},e.prototype.createLogger=function(t,e){return new mi(this._appkey,t,e)},e.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},e.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},e.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},e.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},e.prototype.connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(t,e,n,i)]}))}))},e.prototype._signalHandler=function(t,e){var n=t.syncMsg,i=t.topic;if(n)this._receiveSyncMsg(t,e);else{var r=this.logger.createTraceId();this.logger.debug(pt.L_RECV_RMTP_O,i,r);var o=jr[i];if(o)switch(o){case jr.s_ntf:this._pullMsg(t);break;case jr.s_msg:this._receiveMsg(t);break;case jr.s_cmd:this._receiveStateNotify(t);break;case jr.s_us:this._receiveSettingNotify(t);break;case jr.rtc_ntf:this._receiveRtcKv(t.data);break;case jr.s_opNtf:this._pullOperateStatusNotify(t);break;case jr.s_pubCall:this._pubCallInfo(t)}else this.logger.error(pt.L_RECV_RMTP_E,i,r)}},e.prototype._receiveStateNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,bo),n=e.time,i=e.type,r=e.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(r,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(r),this._watcher.chatroom({chatroomDestroyed:t.targetId});break;case 6:this._ultraGroupTimeQue.push(n),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(n),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},e.prototype._receiveSettingNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,fs).version;this._userSettingManager.pullUserSettings(e)},e.prototype._receiveMessageExpansion=function(t){var e=t.content,n=e.put,i=e.del,r=e.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},e.prototype._clearUltraGroupUnreadCount=function(t,e){var n=this._connMgr.codec.decodeByPBName(t.data,Yo),i=n.channelId,r=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(r,"_").concat(i)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(En([s]))),e&&(this._ultraMsgMap[e.messageUId]=e.timestamp)},e.prototype._receiveSyncMsg=function(t,e){if(Eo.includes(t.topic))if(t.topic!==jr[jr.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(t.data,So,{currentUserId:this.currentUserId,signal:t});((n=this._handleMsgProperties(n)).conversationType!==$.CHATROOM||this._chrmsQueue[n.targetId])&&(this._pullingMsg?this._pullQueue.push((null==e?void 0:e.timestamp)||n.sentTime):(e&&(n.sentTime=e.timestamp,n.messageUId=e.messageUId,this._sendMessageStore.setMessage(e.messageUId,e.timestamp)),this.logger.info(pt.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==it.EXPANSION_NOTIFY?((n.messageType===it.SYNC_READ_STATUS||n.messageType===it.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(t,e)},e.prototype._batchMessage=function(t){for(var e=this,n=[],i=[],r=t.length-1;r>=0;r-=1){var o=t[r];o.messageType!==it.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):i.unshift(o)}this._watcher.batchMessage(n),0!==i.length&&i.forEach((function(t){var n=t.content,i=n.startTime,r=n.endTime,o=n.platform,s=n.logId,a=n.uri;e.reporter.report(parseInt(i,10),parseInt(r,10),o,a,s,t.messageUId)}))},e.prototype._pubCallInfo=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,$s),n=e.key,i=e.dataContent,r=e.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},e.prototype._pullMsg=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,bo),n=e.type,i=e.chrmId,r=e.time;if(this.logger.info(pt.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},e.prototype._startSyncInterval=function(){var t=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-t._latestSyncTimestamp>=18e4&&t._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},e.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},e.prototype._syncCallPullKVMsg=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),e=new Kr(lr,t,this.currentUserId),[4,this._connMgr.send(e,ea)]):[2];case 1:return n=o.sent(),i=n.code,r=n.data,i===Z.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(e.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===ca.CONNECTED},enumerable:!1,configurable:!0}),e.prototype._messageProcessor=function(t){var e=this,n=0,i=[],r=[];return t.forEach((function(t){if((i.push(t.messageUId),t.messageDirection===J.SEND)&&(n=Math.max(t.sentTime,n),e._sendMessageStore.getSendMessageMap()[t.messageUId]))return void e._sendMessageStore.removeByUID(t.messageUId);if(t.messageType!==it.DELIVERED&&t.messageType!==it.DELIVERED_MSG)if(t.messageType!==it.EXPANSION_NOTIFY){if(t.messageType!==it.SYNC_READ_STATUS||t.senderUserId===e.currentUserId){(t.messageType===it.SYNC_READ_STATUS||t.messageType===it.READ_RECEIPT&&t.senderUserId===e.currentUserId)&&e._conversationManager.clearUnreadCount(t.conversationType,t.targetId,t.channelId);var o=e._handleMsgProperties(t);e._conversationManager.setConversationCacheByMessage(o,!0),r.push(o)}}else e._receiveMessageExpansion(t)})),{newOutboxTime:n,messageUIds:i,messages:r}},e.prototype._syncMsg=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,u,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,t=this._letterbox.getOutboxTime(this.currentUserId),e=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:t,inboxTime:e,broadcastSyncTime:n}),r=new Kr(jr[jr.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(pt.L_PULL_MSG_T,JSON.stringify({outboxTime:t,inboxTime:e,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==Z.SUCCESS||!u||ce(u.finished)||ce(u.list)||ce(u.syncTime)?(this.logger.warn(pt.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(c=u.list,h=u.finished,d=u.syncTime,g=u.broadcastSyncTime,p=void 0===g?1:g,this.logger.info(pt.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:c.map((function(t){return{messageUId:t.messageUId,messageId:t.messageId,sentTime:t.sentTime}}))}),o),f=this._messageProcessor(c),_=f.newOutboxTime,E=f.messageUIds,T=f.messages,this._batchMessage(T),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(_,this.currentUserId),this._letterbox.setBroadcastSyncTime(p,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,v=this._pullQueue.filter((function(t){return t>d})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,v),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(pt.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:v}),o),h?(this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg()),[2]):(this._syncMsg(),[2]))}}))}))},e.prototype._receiveMsg=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,No,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(e=this._handleMsgProperties(e),this.logger.info(pt.L_RECV_S_MSG_O,JSON.stringify({messageUId:e.messageUId,messgeId:e.messageId,sentTime:e.sentTime})),e.messageType!==it.DELIVERED&&e.messageType!==it.DELIVERED_MSG){if(e.conversationType!==$.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}e.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(e.messageUId,e.sentTime),e.isStatusMessage||e.senderUserId===this.currentUserId||this._letterbox.setInboxTime(e.sentTime,this.currentUserId),e.messageType!==it.EXPANSION_NOTIFY?e.messageType===it.SYNC_READ_STATUS&&e.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(e,!0),this._batchMessage([e])):this._receiveMessageExpansion(e)}}},e.prototype._handleMsgProperties=function(t,e){void 0===e&&(e=!1);var n,i=t.messageType,r=t.isStatusMessage,o=t.isCounted,s=void 0!==o&&o,a=t.isPersited,c=void 0!==a&&a,l=i in b,h=i in this._customMessageType;if(n=l?u(u({},b[i]),{isStatusMessage:D.includes(i)}):h?this._customMessageType[i]:{isCounted:s,isPersited:c,isStatusMessage:!1},Object.assign(t,n),e&&!ce(r)&&(t.isStatusMessage=r),!e){var d=t.content.user;if(d){var g=d.portrait,p=d.portraitUri,f=g||p;f&&(d.portrait=d.portraitUri=f)}}return t},e.prototype._fixDownstreamData=function(t,e,n){return t&&2===e.list.length&&(e.hasMore=!0,0===n?e.list.shift():e.list.pop()),e},e.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){var u;return void 0===o&&(o=""),c(this,void 0,void 0,(function(){var s,c,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return c=(s=this).currentUserId,h=s._connMgr,d=Er[t]||hr,g=1===i&&0===n,h?(p=h.codec.encodeGetHistoryMsg(e,{timestamp:n,count:g?2:i,order:r,channelId:o}),this.logger.info(pt.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:t,channelId:o,timestamp:n,count:i,order:r}),a),[4,h.send(new Kr(d,p,c),Do,{currentUserId:c,connectedTime:h.getConnectedTime(),conversation:{targetId:e}})]):[3,2];case 1:return f=l.sent(),(_=f.code)===Z.SUCCESS&&p?(E=f.data,E=this._fixDownstreamData(g,E,r),T=[],null===(u=E.list)||void 0===u||u.forEach((function(t){t&&T.push(t.messageUId)})),this.logger.info(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:T.join(",")}),a),[2,{code:_,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:Z.RC_NET_CHANNEL_INVALID}]}}))}))},e.prototype.getMessages=function(t,e,n,i,r,o,s){return this.getHistoryMessage(t,e,n,i,r,o,s)},e.prototype.reportSDKInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(t),this.logger.debug(pt.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new Kr(jr[jr.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==Z.SUCCESS&&this.logger.warn(pt.L_VER_REPORT_R,u,r),[2]}}))}))},e.prototype.deleteRemoteMessage=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeDeleteMessages(t,e,n,i),u=new Kr(Zi,a,o),[4,s.send(u)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),[2,c.code]}}))}))},e.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(e,n,i,t),u=Tr[t],c=new Kr(u,a,o),[4,s.send(c)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},e.prototype.getConversationList=function(t,e,n,i,r){return void 0===t&&(t=300),c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,e=e||$.PRIVATE,a=s.codec.encodeOldConversationList({count:t,type:e,startTime:n,order:i}),u=new Kr(or,a,o),[4,s.send(u,Go,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(t){var e=t.conversationType,n=t.targetId,i=t.channelId,r=g._conversationManager.get(e,n,i);return Object.assign(t,r),t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==Z.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},e.prototype.removeConversation=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:n,targetId:e}),o=new Kr(sr,r,e),[4,i.send(o)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},e.prototype.getConversation=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return t!==$.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(e)])?[3,3]:[2,{code:Z.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(t,e,n))?[4,this.getHistoryMessage(t,e,0,1,0)]:[2,{code:Z.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==Z.SUCCESS)return[2,{code:Z.CONVER_GET_ERROR}];u=(null==a?void 0:a.list[0])||null,i={conversationType:t,targetId:e,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:u,notificationStatus:r.notificationStatus||ot.CLOSE,notificationLevel:r.notificationLevel||at.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:Z.SUCCESS,data:i}]}}))}))},e.prototype.getAllConversationUnreadCount=function(t,e,n){var i=this._conversationManager.getAllUnreadCount(t,e,n);return Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.getTotalUnreadCountByLevels=function(t,e,n){void 0===n&&(n=!1);var i=0;if(t.includes($.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var o=this._ultraGroupMap[r];(0===e.length||e.includes(o.notificationLevel))&&(i+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(t,e,n),Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.getConversationUnreadCount=function(t,e,n){var i,r;return t===$.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap["".concat(n,"_").concat(e)])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(t,e,n),Promise.resolve({code:Z.SUCCESS,data:r})},e.prototype.clearConversationUnreadCount=function(t,e,n){return this._conversationManager.clearUnreadCount(t,e,n,!1),Promise.resolve(Z.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(Z.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.saveConversationMessageDraft=function(t,e,n,i){return this._conversationManager.setDraft(t,e,n,i),Promise.resolve(Z.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,e,n){var i=this._conversationManager.getDraft(t,e,n);return Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.clearConversationMessageDraft=function(t,e,n){return this._conversationManager.clearDraft(t,e,n),Promise.resolve(Z.SUCCESS)},e.prototype.pullConversationStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this)._connMgr,i=e.currentUserId,r=n.codec.encodeGetConversationStatus(t),o=new Kr(jr[jr.pullSeAtts],r,i),[4,n.send(o,Es)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,this.logger.info(pt.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:t,userId:i})),a!==Z.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(t){var e=t.conversationType,n=t.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),e===$.ULTRA_GROUP?h._setUltraConversationStatus(t):c.push(t)})),[2,{code:a,data:c}])}}))}))},e.prototype._setUltraConversationStatus=function(t){var e=t.targetId,n=t.notificationStatus,i=t.notificationLevel,r=t.channelId,o=t.isTop,s=this._ultraGroupMap["".concat(r,"_").concat(e)];return s&&void 0!==i&&(s.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==n&&(s.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==o&&(s.isTop=o),s},e.prototype.batchSetConversationStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,h,d,g,p,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=this._conversationManager.getConversationUpdatedTime(),o=i.codec.encodeSetConversationStatus(t,r),s=new Kr(ar,o,n),[4,i.send(s,Cs)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return a=l.sent(),c=a.code,h=a.data,c!==Z.SUCCESS?[2,c]:(d=h,this._conversationManager.setConversationUpdatedTime(d.version),g=[],t.forEach((function(t){if(t.conversationType!==$.ULTRA_GROUP)f._conversationManager.addStatus(u(u({},t),{updatedTime:d.version}),!0);else{var e=f._setUltraConversationStatus(t);e&&g.push(e)}})),g.length>0&&(p=En(g),p=Qa(p),this._watcher.conversation(p)),[2,c])}}))}))},e.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:t,targetId:e,notificationLevel:n,channelId:i}])]}))}))},e.prototype._joinChrm=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new Kr(s=n?$i:zi,o,t),this.logger.info(pt.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:e,topic:s}),i),[4,r.send(a,Qo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,d=c===Z.SUCCESS?"info":"warn",this.logger[d](pt.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===Z.SUCCESS?(p=(g=h).joinTime,f=g.createTime,_=g.memberCount,E=g.isAllChatroomBanned,T=g.isCurrentUserBanned,v=g.isCurrentChatroomBanned,y=g.isCurrentChatroomInWhitelist,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,e,p),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,e),this._startSyncIntervalForChrmPull(),[2,{code:c,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:v,isCurrentChatroomInWhitelist:y}}]):[2,{code:c}]}}))}))},e.prototype._rejoinChrm=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,c,h;return l(this,(function(l){switch(l.label){case 0:for(n in t=this._joinedChrmManager.get(),e=[],t)e.push(n);i=0,l.label=1;case 1:return i<e.length?(r=e[i],this.logger.info(pt.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:t[r]||10,topic:$i})),o=this.logger.createTraceId(),[4,this._joinChrm(r,t[r]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,c=s.data,h=a===Z.SUCCESS?"info":"warn",this.logger[h](pt.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===Z.SUCCESS)return this._watcher.chatroom({rejoinedRoom:u({chatroomId:r,count:t[r]},c)}),[2];a===Z.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]}}))}))},e.prototype._pullChrmMsg=function(t,e,n){return void 0===e&&(e=10),void 0===n&&(n=0),c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[t],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,e),a=new Kr(jr[jr.chrmPull],s,t),this.logger.info(pt.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:t,timestamp:o})),[4,this._connMgr.send(a,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=l.sent(),c=u.code,h=u.data,i.pulling=!1,c===Z.SUCCESS&&h?(d=h.list,g=h.syncTime,p=h.finished,i.timestamp=n?Math.max(g,n):g,i.queue=i.queue.filter((function(t){return t>g})),f=[],_=[],d.forEach((function(t){t.sentTime<o||(f.push(t.messageUId),_.push(t))})),this._batchMessage(_),this.logger.info(pt.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:f.join(",")})),(!p||i.queue.length>0)&&this._pullChrmMsg(t),[2]):(this.logger.warn(pt.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},e.prototype.joinChatroom=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(t,e,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.joinExistChatroom=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(t,e,!0,n)]}))}))},e.prototype.quitChatroom=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr,n=e.codec.encodeJoinOrQuitChatRoom(),i=new Kr(tr,n,t),[4,e.send(i)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===Z.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,o]}}))}))},e.prototype.getChatroomInfo=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(e,n),o=new Kr(jr[jr.queryChrmI],r,t),[4,i.send(o,Jo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==Z.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},e.prototype.getChatroomHistoryMessages=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeGetHistoryMsg(t,{timestamp:e,count:n,order:i}),s=new Kr(gr,o,t),[4,r.send(s,Do,{conversation:{targetId:t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==Z.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},e.prototype._modifyChatroomKV=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=this._chrmEntryHandler.getVersion(t,e.key),e.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(t,e,r),a=e.type===Et.UPDATE?er:nr,u=new Kr(a,s,t),[4,i.send(u,Qo)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),(h=c.code)===Z.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[e],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},e.prototype._chatroomKVStoreNotAllSuccess=function(t,e){var n=e.data,i=t;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(t){var e=i.findIndex((function(e){return t.key===e.key}));-1!==e&&i.splice(e,1)})),i},e.prototype._modifyChatroomKVS=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,e.entries.forEach((function(e){var n=_._chrmEntryHandler.getVersion(t,e.key);e.version=null==n?_.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(t,e,r),s=e.type===Et.UPDATE?ir:rr,a=new Kr(s,o,t),[4,i.send(a,as)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,-1!==[Z.SUCCESS,Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(g=[],delete(p=u({},e)).entries,e.entries.forEach((function(t){g.push(u(u({},t),p))})),h===Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,d=f.errorKeys,g=this._chatroomKVStoreNotAllSuccess(g,c)),this._chrmEntryHandler.setLocal(t,{kvEntries:g,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},e.prototype.setChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.setChatroomEntries=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceSetChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntries=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceRemoveChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.getChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(t,e))?[2,{code:Z.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new Kr(jr[jr.pullKV],r,t),[4,i.send(o,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(t){return t.key===e})),void 0!==u)?[2,{code:Z.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:Z.CHATROOM_KEY_NOT_EXIST}]}}))}))},e.prototype.getAllChatroomEntry=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return(e=this._chrmEntryHandler.getAll(t))&&Object.keys(e).length?[2,{code:Z.SUCCESS,data:e}]:this._isConnected?(n=this._connMgr,e={},i=n.codec.encodePullChatRoomKV(0),r=new Kr(jr[jr.pullKV],i,t),[4,n.send(r,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),(s=o.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(t){t.key&&(e[t.key]=t.value||"")})),[2,{code:Z.SUCCESS,data:e}]}}))}))},e.prototype.pullChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,h,d,g,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(e),s=new Kr(jr[jr.pullKV],o,t),this.logger.info(pt.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:t,timestamp:e})),[4,i.send(s,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,h=u===Z.SUCCESS?"info":"warn",this.logger[h](pt.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:e})),u===Z.SUCCESS&&c?(d=c.kvEntries,g=[],d.length>0&&(d.forEach((function(e){var n=e.key,i=e.value,r=e.type,o=e.timestamp,s=e.userId;p._chrmEntryHandler.getValue(t,n)===i&&s===p.getCurrentUserId()||g.push({key:n,value:i,type:r,timestamp:o,chatroomId:t})})),this._chrmEntryHandler.setLocal(t,c,r),g.length>0&&this._watcher.chatroom({updatedEntries:g})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},e.prototype._startSyncIntervalForChrmPull=function(){var t=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var e=Object.keys(t._chrmsQueue);0!==e.length&&t._isConnected?e.forEach((function(e){t._pullChrmMsg(e),t.getNaviInfoFromCache().kvStorage&&t._chrmEntryHandler.pullEntry(e,0)})):t._stopSyncIntervalForChrmPull()}),M)},e.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},e.prototype.sendMessage=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,c,h,d,g,p,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=function(t,e){return"RC:SRSMsg"===t.messageType&&Object.assign(t,{directionalUserIdList:[e]}),t}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![$.PRIVATE,$.GROUP].includes(t)&&n.isStatusMessage,s=o?function(t){var e;return(e={},e[$.PRIVATE]=jr.ppMsgS,e[$.GROUP]=jr.pgMsgS,e)[t]}(t):function(t){var e;return(e={},e[$.PRIVATE]=jr.ppMsgP,e[$.GROUP]=jr.pgMsgP,e[$.CHATROOM]=jr.chatMsg,e[$.CUSTOMER_SERVICE]=jr.pcMsgP,e[$.RTC_ROOM]=jr.prMsgS,e[$.SYSTEM]=jr.pbMsgP,e)[t]}(t)||jr.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:$e(),n.messageId=a,c=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},n),(h=new kr(jr[s],c,t===$.SYSTEM?this.currentUserId:e)).setHeaderQos(Fi.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(h),[2,{code:Z.SUCCESS,data:ja(t,e,u({},n),"",0,this.currentUserId,a)}]):(d=this._connMgr.getCrtServerTime(),g=ja(t,e,u({},n),"",d,this.currentUserId,a),null==i||i(a),this.logger.info(pt.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:t,targetId:e,channelId:n.channelId}),r),[4,this._connMgr.send(h)])):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return p=l.sent(),f=p.code,_=p.data,f!==Z.SUCCESS?(this.logger.warn(pt.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:g.messageUId,messageId:g.messageId}),r),g.sentStatus=It.FAILED,[2,{code:f,data:g}]):(this.logger.info(pt.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:null==_?void 0:_.messageUId,messageId:null==_?void 0:_.messageId}),r),E=_,this._sendMessageStore.setMessage(E.messageUId,E.timestamp),g.sentTime=E.timestamp,g.messageUId=E.messageUId,this._conversationManager.setConversationCacheByMessage(g,!0),[2,{code:Z.SUCCESS,data:g}])}}))}))},e.prototype.recallMsg=function(t,e,n,i,r){var o;return c(this,void 0,void 0,(function(){var s,a,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=r.user,a=r.extra,c=r.isDelete,h={conversationType:t,targetId:e,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},g=jr[jr.recallMsg],p=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},d),(f=new kr(g,p,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,T=_.data,t===$.ULTRA_GROUP&&this.logger.debug(pt.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:t,targetId:e,channelId:r.channelId})),E!==Z.SUCCESS?[2,{code:E}]:(v=T,t===$.ULTRA_GROUP?(this._ultraMsgMap[v.messageUId]=v.timestamp,this._updateUltraGroupWhenRecallMsg(e,r.channelId||"",n),[2,{code:Z.SUCCESS}]):(this._sendMessageStore.setMessage(v.messageUId,v.timestamp),y=ja(t,e,u(u({},d),{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),[2,{code:Z.SUCCESS,data:y}]))}}))}))},e.prototype.sendReadReceiptMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(e,n),r=new Kr(jr[jr.rrMsg],i,t),[2,this._connMgr.send(r)]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getMessageReader=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(e,n),r=new Kr(jr[jr.rrList],i,t),[2,this._connMgr.send(r,Us)]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.pullUserSettings=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullUserSetting(t),n=new Kr(jr[jr.pullUS],e,this.currentUserId),[4,this._connMgr.send(n,ps)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&this._naviChangeHandler(o),[2,{code:r,data:o}]}}))}))},e.prototype._naviChangeHandler=function(t){var e;if(t){var n=t.settings,i=null===(e=null==n?void 0:n.VoipInfo)||void 0===e?void 0:e.value;if(i){var r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var o=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(u({},o))}}else this.logger.warn(pt.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:t}))},e.prototype.getFileToken=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=i&&"uploads"!==i?e||"":Qe(t,e),s=this._connMgr.codec.encodeGetFileToken(t,o,n||"",i||"",r||""),a=new Kr(jr[jr.qnTkn],s,this.currentUserId),[4,this._connMgr.send(a,Zo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,d=u(u({},d),{fileName:o,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),h===Z.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},e.prototype.getFileUrl=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",o="",s="",e===ht.QINIU?(o=zo,s=ts):(o=$o,s=es),r=e===ht.QINIU?jr[jr.qnUrl]:e===ht.AWS?jr[jr.s3Url]:e===ht.STC?jr[jr.stcUrl]:e===ht.MINIO?jr[jr.minioUrl]:jr[jr.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,t,n,i),u=new Kr(r,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,g=d,h===Z.SUCCESS?[2,{code:h,data:g}]:[2,{code:h}]}}))}))},e.prototype.disconnect=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return t.sent(),this._resetMemoryState(),[2]}}))}))},e.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._chrmsQueue={}},e.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},e.prototype.registerMessageType=function(t,e,n,i,r){this._customMessageType[t]={isPersited:e,isCounted:n,isStatusMessage:r}},e.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([t],e),i=new Kr(jr[jr.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([u(u({},t),{createdTime:a})],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([t],e),i=new Kr(jr[jr.delSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([t],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.updateTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([t],e),i=new Kr(jr[jr.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([t],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){return t=this._userSettingManager.getTags(),e=this._conversationManager.getConversationListForTag(),t.forEach((function(t){t.conversationCount=e[t.tagId]?e[t.tagId].length:0})),[2,{code:Z.SUCCESS,data:t}]}))}))},e.prototype.addTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s=this;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(t)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e),i=new Kr(jr[jr.addTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:Z.TAG_NOT_EXIST}]:[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(r=a.sent().code)!==Z.SUCCESS?[2,{code:r}]:((o={})[t]={},e.forEach((function(t){s._conversationManager.addTagStatus(t.conversationType,t.targetId,o,t.channelId)})),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e),i=new Kr(jr[jr.delTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(r=s.sent().code)!==Z.SUCCESS?[2,{code:r}]:(e.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTagsForConversation=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=t.conversationType,i=t.targetId,r=t.channelId,o=e.map((function(t){return{tagId:t}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[t]),a=new Kr(jr[jr.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(u=c.sent().code)!==Z.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,i,e,r),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getConversationListByTag=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:$.PRIVATE,startTime:e}),a=new Kr(or,s,r),[4,o.send(a,Go,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,c!==Z.SUCCESS?[2,{code:c}]:(d=this._conversationHasTagFilter(t,null==h?void 0:h.list),[2,{code:c,data:d}])}}))}))},e.prototype._conversationHasTagFilter=function(t,e){var n=this,i=[],r=[];function o(t,e){return t.latestMessage&&e.latestMessage?t.latestMessage.sentTime-e.latestMessage.sentTime:0}return e.forEach((function(e){var o=e.conversationType,s=e.targetId,a=e.channelId,c=n._conversationManager.get(o,s,a),l=c.hasMentioned,h=c.mentionedInfo,d=c.lastUnreadTime,g=c.notificationStatus,p=c.isTop,f=c.tags,_=c.unreadMessageCount,E=f&&f[t];if(E){var T=u(u({},e),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:g,isTop:p,unreadMessageCount:_});E.isTop?i.push(u(u({},T),{isTopInTag:!0})):r.push(u(u({},T),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),h(h([],i,!0),r,!0)},e.prototype.getUnreadCountByTag=function(t,e){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(t,e),[2,{code:Z.SUCCESS,data:n}]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.setConversationStatusInTag=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=e.targetId,r=e.conversationType,o=e.channelId,s=n.isTop,a=[{tagId:t,isTop:s}],(u=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(u.tags,t)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[e]),h=new Kr(jr[jr.addTag],c,this.currentUserId),[4,this._connMgr.send(h)]):[2,{code:Z.NO_TAG_IN_CONVER}]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(d=l.sent().code)!==Z.SUCCESS?[2,{code:d}]:((g={})[t]={},s&&(g[t].isTop=!0),this._conversationManager.addTagStatus(r,i,g,o),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getTagsForConversation=function(t){var e;return c(this,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:Z.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(e=i[o])||void 0===e?void 0:e.tagName});return[2,{code:Z.SUCCESS,data:r}]}))}))},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:Z.SUCCESS,data:t})},e.prototype.getTopConversationList=function(t,e){var n=this._conversationManager.getTopConversationList(t,e);return Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUnreadConversationList=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){return e=this._conversationManager.getUnreadConversationList(t),[2,Promise.resolve({code:Z.SUCCESS,data:e})]}))}))},e.prototype.getUnreadMentionedCount=function(t){var e,n;return n=t.conversationType===$.ULTRA_GROUP?(null===(e=this._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)])||void 0===e?void 0:e.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(t.conversationType,t.targetId,t.channelId),n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:Z.SUCCESS,data:t})},e.prototype.getConversationNotificationLevel=function(t,e,n){if(!this._isUltraGroupListExist&&t===$.ULTRA_GROUP)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var i;if(!(i=t===$.ULTRA_GROUP?this._ultraGroupManager.get($.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n)))return Promise.resolve({code:Z.SUCCESS,data:at.NOT_SET});var r=i.notificationLevel;return ce(i.notificationLevel)&&!ce(i.notificationStatus)&&(r=ot.OPEN===i.notificationStatus?1:0),Promise.resolve({code:Z.SUCCESS,data:r})},e.prototype.getConversationNotificationStatus=function(t,e,n){var i;return(i=t===$.ULTRA_GROUP?this._ultraGroupManager.get($.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n))?Promise.resolve({code:Z.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:Z.SUCCESS,data:ot.CLOSE})},e.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this.getHistoryMessage(t,e,n,i,r,o)},e.prototype.getUltraGroupList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o=this;return l(this,(function(s){return e=t.targetId,n=t.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap).filter((function(t){return!(t.targetId!==e&&e||t.channelType!==n&&ne(n))}))).map((function(t){var e=t.unreadMessageCount,n=t.unreadMentionedCount,i=t.unreadMentionedMeCount;return e=o._getUnreadCount(e),n=o._getUnreadCount(n),i=o._getUnreadCount(i),u(u({},t),{unreadMessageCount:e,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Qa(i),r=En(i),[2,{code:Z.SUCCESS,data:r}]):[2,{code:Z.METHOD_NOT_AVAILABLE}]}))}))},e.prototype._getUnreadCount=function(t){return t>999?999:t},e.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){(t.notificationStatus===ot.OPEN||t.notificationLevel>0)&&e.push({conversationType:$.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){!0===t.isTop&&e.push({conversationType:$.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadInfoList=function(t){var e=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=e._ultraGroupMap[i];t.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:e._getUnreadCount(r.unreadMessageCount),mentionedCount:e._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:e._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getAllUltraGroupUnreadCount=function(t){if(void 0===t&&(t=!1),!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var e=0;for(var n in this._ultraGroupMap)e+=t?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return e=this._getUnreadCount(e),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.clearUltraUnreadcount=function(t,e){return void 0===e&&(e=""),c(this,void 0,void 0,(function(){var n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:$.ULTRA_GROUP,targetId:t,channelId:e},{timestamp:n}),(r=new kr(jr[jr.updUgRTime],i,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,Z.RC_NET_UNAVAILABLE]:[2,Promise.resolve(Z.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===Z.SUCCESS&&((s=this._ultraGroupMap["".concat(e,"_").concat(t)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},e.prototype._getUltraGroupList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d,g,p,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,e=this._connMgr.codec.encodeUltraGroup(t,false),n=new Kr(jr[jr.pullUgSes],e,this.currentUserId),[4,this._connMgr.send(n,Go,{currentUserId:this.currentUserId,conversationType:$.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(t){t.notificationStatus=ot.CLOSE,t.notificationLevel=at.NOT_SET,t.isTop=!1,f._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)]=t,f._ultraGroupManager.addUltraGroupStatus(t)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(pt.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){f._getUltraGroupList(t),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(pt.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,g=h.data,d!==Z.SUCCESS&&this.logger.warn(pt.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(g)),p=Object.values(this._ultraGroupMap),p=Qa(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(En(p)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.label=4;case 4:return[2]}}))}))},e.prototype._startUltraSyncInterval=function(){var t=this,e=function(){t._ultraGroupTimer=setTimeout((function(){Date.now()-t._lastSyncUltraMsgLocalTimeStamp>=18e4&&t._syncUltraMsg(t._lastSyncUltraMsgTimeStamp),t._stopUltraSyncInterval(),e()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),e()},e.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},e.prototype._notificationOnline=function(){return c(this,void 0,void 0,(function(){var t,e,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return t=r.sent(),e=t.code,n=t.data,e===Z.SUCCESS&&n?(this.logger.info(pt.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(pt.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},e.prototype._fetchUltraMsg=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return e=this._connMgr.codec.encodeSuperSyncMsg(t),n=new Kr(jr[jr.pullUgMsg],e,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(pt.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:t}),i),[4,this._connMgr.send(n,Mo,{currentUserId:this.currentUserId,conversation:{conversationType:$.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===Z.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(t){return t.messageUId})).join(","),this.logger.info(pt.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:t,syncTime:u}),i)):this.logger.warn(pt.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:t}),i),[2,{code:o,data:s}]}}))}))},e.prototype._getUltraGroup=function(t,e,n){var i,r,o,s=t.targetId,a=t.messageType,u=t.channelId,c=t.isCounted,l=t.channelType,h=t.sentTime,d=t.senderUserId,g=t.content,p=t.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],_=f||{conversationType:$.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ot.CLOSE,notificationLevel:at.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==it.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=e,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),p&&(null===(i=null==g?void 0:g.mentionedInfo)||void 0===i?void 0:i.type)!==ct.ALL&&(null===(o=null===(r=null==g?void 0:g.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=t,_.channelType=l,f||(this._ultraGroupMap["".concat(u,"_").concat(s)]=_),_},e.prototype._syncUltraMsg=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,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(t)]);case 1:return e=l.sent(),n=e.code,i=e.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===Z.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},u=[],r.forEach((function(t){var e,n,i,r=t.targetId,s=t.content,c=t.messageUId,l=t.channelId,d=t.isMentioned;if(h._ultraMsgMap[c])delete h._ultraMsgMap[c];else{var g=0;d&&((null===(e=null==s?void 0:s.mentionedInfo)||void 0===e?void 0:e.type)===ct.ALL||(null===(i=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(h.currentUserId)))&&(g=1);var p=h._getUltraGroup(t,g,o);a["".concat(l,"_").concat(r)]=p,h._ultraGroupManager.addUltraGroupStatus(p),u.push(t)}})),Object.keys(a).length>0&&(this.logger.debug(pt.O,"notice ultragroups"),c=Object.values(a),c=Qa(c),this._watcher.conversation(En(c))),this.logger.debug(pt.O,"notice ultragroup message"),this._batchMessage(u),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(t){return t>o})),this._lastSyncUltraMsgTimeStamp=o,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(o)),[2]):(this._syncUltraMsg(o),[2])):[2]}}))}))},e.prototype.sendUltraMessage=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===e.messageType&&this.logger.warn(pt.O,"ultra group -> direction message convert to message"),e=this._handleMsgProperties(e,!0),r=e.messageId?e.messageId:$e(),e.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:$.ULTRA_GROUP,targetId:t},e),(s=new kr(jr[jr.ugMsg],o,t)).setHeaderQos(Fi.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),c=ja($.ULTRA_GROUP,t,u({},e),"",a,this.currentUserId,r),n&&n(r),this.logger.info(pt.L_SEND_MSG_T,JSON.stringify({messageType:e.messageType,conversationType:$.ULTRA_GROUP,targetId:t,channelId:e.channelId}),i),[4,this._connMgr.send(s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return h=l.sent(),d=h.code,g=h.data,d!==Z.SUCCESS?(this.logger.warn(pt.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:c.messageUId,messageId:c.messageId}),i),c.sentStatus=It.FAILED,[2,{code:d,data:c}]):(this.logger.info(pt.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),p=g,c.sentTime=p.timestamp,c.messageUId=p.messageUId,this._ultraMsgMap[p.messageUId]=p.timestamp,f=e.channelId||"",(_=this._ultraGroupMap["".concat(f,"_").concat(t)])?(_.latestMessage=c,ne(_.channelType)&&(c.channelType=_.channelType)):(_={conversationType:$.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:ot.CLOSE,notificationLevel:at.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(f,"_").concat(t)]=_,this._ultraGroupManager.addUltraGroupStatus(_)),this._watcher.conversation(En([_])),[2,{code:d,data:c}])}}))}))},e.prototype.sendUltraGroupTypingStatus=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=t.conversationType,i=t.channelId,r=t.targetId,o=this._connMgr.codec.encodeOperateStatus(r,n,i||"",e||0),(s=new kr(jr[jr.operate],o,r)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==Z.SUCCESS?[2,{code:a,msg:Z[a]}]:[2,{code:a}]}}))}))},e.prototype.getUltraGroupMessageListByMessageUId=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?t.messages&&t.messages.length<1||t.messages&&t.messages.length>20?[2,{code:Z.MSG_LIMIT_ERROR}]:(e={},t.messages.forEach((function(t){e[t.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(t),(i=new Kr(jr[jr.qryMsg],n,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ys,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o,msg:Z[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(t){var n=t.messageUId;e[n]=t})),[2,{code:0,data:e}])}}))}))},e.prototype._pullOperateStatusNotify=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,Qs),n=e.conversationType,i=e.info,r=e.summary;this.logger.debug(pt.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(e)}},e.prototype.expandUltraMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeExpandUltraMessage(t,this.currentUserId),(n=new Kr(jr[jr.upMsgEx],e,t.targetId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==Z.SUCCESS?[2,{code:i,msg:Z[i]}]:[2,{code:i}]}}))}))},e.prototype.modifyMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodemodifyMessage(t,this.currentUserId),(n=new Kr(jr[jr.modifyMsg],e,t.targetId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==Z.SUCCESS?[2,{code:r,msg:Z[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},e.prototype._pullUltraChangeMessageList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,e=this._connMgr.codec.encodeQueryMsgChange(t),(n=new Kr(jr[jr.qryMsgChange],e,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n,Ks)]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===Z.SUCCESS&&o?(s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(t){return t>u})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,c),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},e.prototype._handleUltraChangeList=function(t){var e={};t.forEach((function(t){var n=t.changeType;e[n]||(e[n]=[]),e[n].push(t)}));var n=Vt.CHANNEL_CHANGE,i=Vt.MSG_RECALL,r=Vt.MSG_EXPANSION,o=Vt.MSG_MODIFY,s=Vt.USER_GROUP_CHANGE;e[n]&&this._handleUltraChannelChange(e[n]),e[i]&&this._handleMsgRecall(e[i]),e[r]&&this._handleMsgUpdate(e[r]),e[o]&&this._handleMsgUpdate(e[o]),e[s]&&this._handleUserGroupStatus(e[s])},e.prototype._handleUltraChannelChange=function(t){var e=this,n=[],i=[],r=[];t.forEach((function(t){var o=t.subChangeType,s=t.targetId,a=t.channelId,u=t.sendTime,c=t.operatorId,l="".concat(a,"_").concat(s),h=e._ultraGroupMap[l];if(h){var d=Gt.PUBLIC_TO_PRIVATE,g=Gt.PRIVATE_TO_PUBLIC,p=Gt.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=Gt.CHANNEL_DELETE,_=Gt.CHANNEL_USER_KICKED;switch(o){case g:h.channelType=Pt.PUBLIC,n.push({targetId:s,channelId:a,changeType:Dt.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Pt.PRIVATE,n.push({targetId:s,channelId:a,changeType:Dt.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case p:n.push({targetId:s,channelId:a,changeType:Dt.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete e._ultraGroupMap[l];break;case f:i.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:u}),delete e._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:c,channelType:Pt.PRIVATE}),c===e.currentUserId&&delete e._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},e.prototype._handleMsgRecall=function(t){var e=this,n=[];t.forEach((function(t){var i=t.targetId,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.conversationType,u=t.operatorId,c=t.mentionedType;e._updateUltraGroupWhenRecallMsg(i,r,o,s,c),n.push({targetId:i,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:r,content:{conversationType:a,targetId:i,messageUId:o,channelId:r},messageDirection:1,messageType:it.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:0})})),this._watcher.ultraGroupMessageRecalled(n)},e.prototype._handleMsgUpdate=function(t){var e={};for(var n in t.forEach((function(t){var n=t.targetId,i=t.conversationType,r=t.sendTime,o=t.messageUId,s=t.channelId,a="".concat(i,"_").concat(n);e[a]||(e[a]=[]),e[a].push({messageUId:o,channelId:s,sendTime:r})})),e){var i=n.split("_"),r=i.shift(),o=i.join("_");this._pullUltraMessageList(t[0].changeType,{targetId:o,conversationType:Number(r),messages:h([],e[n],!0)})}},e.prototype._pullUltraMessageList=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(e),(i=new Kr(jr[jr.qryMsg],n,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ys,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o,msg:Z[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(t){var e=t.targetId,n=t.channelId,i=t.messageUId,r=c._ultraGroupMap["".concat(n,"_").concat(e)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=t),u.push(t)})),t===Vt.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),t===Vt.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},e.prototype._handleUserGroupStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d;return l(this,(function(l){return e=Bt.REMOVE_USER_GROUP,n=Bt.JOIN_USER_GROUP,i=Bt.EXIT_USER_GROUP,r=Bt.CHANNEL_BIND_USER_GROUP,o=Bt.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],h=[],t.forEach((function(t){var l=t.conversationType,d=t.targetId,g=t.userGroupIds,p=t.busChannelType,f=t.channelId;switch(t.subChangeType){case e:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case i:u.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case r:c.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:p,userGroupIds:g});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:p,userGroupIds:g})}})),d={},s.length>0&&(d.userGroupDisband=s),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]}))}))},e.prototype.getUltraHistoryMsg=function(t,e,n){var i;return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(t,e),o=new Kr(jr[jr.qryUgMsg],r,this.currentUserId),this.logger.info(pt.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:$.ULTRA_GROUP,channelId:e.channelId,timestamp:null==e?void 0:e.timestamp,count:null==e?void 0:e.count}),n),[4,this._connMgr.send(o,Do,{currentUserId:this.currentUserId,conversation:{conversationType:$.ULTRA_GROUP,targetId:t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===Z.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(t){t&&c.push(t.messageUId)})),this.logger.info(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},e.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(e,n),r=new Kr(jr[jr.ugUnpushSet],i,t),[4,this._connMgr.send(r)]):[2,{code:Z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,Z.SUCCESS,[2,{code:s}]}}))}))},e.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(e),r=new Kr(jr[jr.ugUnpushQuery],i,t),[4,n.send(r,Os)]):[2,{code:Z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===Z.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}]}}))}))},e.prototype._updateUltraGroupWhenRecallMsg=function(t,e,n,i,r){var o="".concat(e,"_").concat(t);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&u<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===kt.ALL||r===kt.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===kt.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(En([s])))}},e.prototype.getAllConversationState=function(){return Promise.resolve({code:Z.SUCCESS,data:this._conversationManager.getAllConversationState()})},e.prototype.getUltraGroupUnreadMentionedMessages=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(e=this._connMgr.codec.encodeUnreadMentionedMsgQuery(t),n=new Kr(jr[jr.qryUgUal],e,this.currentUserId),[4,this._connMgr.send(n,Ss)]):[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})]:[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(e=t.targetId,n=t.channelId,i=this._ultraGroupMap["".concat(n,"_").concat(e)]||{},r=i.firstUnreadMessage||null,[2,{code:Z.SUCCESS,data:r}]):[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})]:[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.bindRTCRoomForChatroom=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=t.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(t),i=new Kr(jr[jr.setRtcRoomId],n,e),[4,this._connMgr.send(i)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},e.prototype.rtcSignaling=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,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,o=n?new Kr(e,r,t):new kr(e,r,t),[4,this._connMgr.send(o)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},e.prototype.rtcPing=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=aa(this.rtcCodec,e,n),[4,this.rtcSignaling(t,jr[jr.rtcPing],!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o!==Z.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(an.RtcOutput,s)).version=je(a.version),[2,{code:o,data:a}])}}))}))},e.prototype.getDeviceId=function(){return bi(this.runtime)},e.prototype.getOSInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.getProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.getMainProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.destroy=function(){ci(),Sa()},e.prototype.callExtra=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},e.prototype.getConversationListWithAllChannelByPage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getConversationsByPage=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.clearConversations=function(){throw new Error("Method not implemented.")},e.prototype.setUserStatusListener=function(t,e){throw new Error("Method not implemented.")},e.prototype.setUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.subscribeUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.getUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.addToBlacklist=function(t){return Promise.resolve(Z.NOT_SUPPORT)},e.prototype.removeFromBlacklist=function(t){return Promise.resolve(Z.NOT_SUPPORT)},e.prototype.getBlacklist=function(){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getBlacklistStatus=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.insertMessage=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.batchInsertMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getMessageCount=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.deleteMessages=function(t){throw new Error("Method not implemented.")},e.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.clearMessages=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setMessageContent=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.setMessageSearchField=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchConversationByContent=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.searchConversationByContentWithAllChannel=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchMessageByContent=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessagesByUser=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.getUnreadMentionedMessages=function(t,e){throw new Error("Method not implemented.")},e.prototype.setMessageSentStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.updateMessageReceiptStatus=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setMessageReceivedStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.clearData=function(){throw new Error("Method not implemented.")},e.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setCallInfo=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(e,n),[4,i.send(new Kr(cr,r,t),zs)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===Z.SUCCESS&&a?[2,Promise.resolve({code:s,data:{key:a.key,value:a.dataContent}})]:[2,Promise.resolve({code:s})];case 2:return[2,Promise.resolve({code:Z.RC_NET_CHANNEL_INVALID})]}}))}))},e.prototype.getGroupMessageDeliverList=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getPrivateMessageDeliverTime=function(t,e){throw new Error("Method not implemented.")},e.prototype.setCheckDuplicateMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setProxy=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getProxy=function(){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.testProxy=function(t,e){return Promise.resolve({status:Z.NOT_SUPPORT})},e.prototype.setNetwork=function(t,e){this._connMgr.setNetwork(t,e)},e}(Yn),Ja=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.joinRTCRoom=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return s=aa(this._context.rtcCodec,e,n,i,r,o),[4,this.rtcSignaling(t,Cn,!0,s)];case 1:return a=l.sent(),u=a.code,c=a.buffer,u===Z.SUCCESS&&c&&(h=ua(this._context.rtcCodec,c)),[2,{code:u,data:h}]}}))}))},e.prototype.quitRTCRoom=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e=this._context.rtcCodec.encode(an.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,mn,!0,e)];case 1:return[2,n.sent().code]}}))}))},e.prototype.rtcPing=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(t,e,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.rtcPingResVersion=function(t,e,n){return this._context.rtcPing(t,e,n)},e.prototype.getRTCRoomInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,In,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r&&(o=this._context.rtcCodec.decode(an.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfoList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,Rn,!0,e)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r&&(s=ua(this._context.rtcCodec,r),o={users:s.users}),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfo=function(t){throw new Error("Method not implemented.")},e.prototype.setRTCUserInfo=function(t,e,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(an.RtcValueInfo,{key:e,value:n}),[4,this.rtcSignaling(t,Sn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.removeRTCUserInfo=function(t,e){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(an.RtcKeyDeleteInput,{key:e}),[4,this.rtcSignaling(t,On,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.setRTCData=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(an.RtcSetDataInput,{interior:i,target:r,key:e,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(t,Nn,!1,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCTotalRes=function(t,e,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(an.RtcValueInfo,{key:e.name,value:e.content},!0),valueInfo:[this._context.rtcCodec.encode(an.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(an.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(an.RtcUserSetDataInput,o),[4,this.rtcSignaling(t,Mn,!0,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCCDNUris=function(t,e,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(an.RtcUserSetDataInput,{objectName:e,valueInfo:this._context.rtcCodec.encode(an.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(t,Mn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.getRTCData=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(an.RtcDataInput,{interior:n,target:i,key:e}),[4,this.rtcSignaling(t,Un,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===Z.SUCCESS&&a?(u=this._context.rtcCodec.decode(an.RtcQryOutput,a).outInfo,c={},u.forEach((function(t){c[t.key]=t.value})),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},e.prototype.removeRTCData=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(an.RtcDataInput,{interior:n,target:i,key:e,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(t,Ln,!1,o)];case 1:return[2,s.sent().code]}}))}))},e.prototype.setRTCOutData=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCOutData=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCToken=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=aa(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,An,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=this._context.rtcCodec.decode(an.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},e.prototype.setRTCState=function(t,e){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(an.MCFollowInput,{state:e}),[4,this.rtcSignaling(t,wn,!0,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.getRTCUserList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,bn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r?(o=ua(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},e.prototype.joinLivingRoomAsAudience=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return i=aa(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,Pn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=this._context.rtcCodec.decode(an.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:o,data:{token:u,kvEntries:c}}]):[2,{code:o}]}}))}))},e.prototype.quitLivingRoomAsAudience=function(t){return c(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return e=this._context.rtcCodec.encode(an.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,Dn,!0,e)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},e.prototype.rtcIdentityChange=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(an.RtcInput,{roomType:jt.LIVE,broadcastType:n,identityChangeType:e,needSysChatroom:!1}),[4,this.rtcSignaling(t,Gn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=ua(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},e.prototype.requestRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteTimeout,o=t.inviteInfo,s=t.roomId,a=this._context.rtcCodec.encode(an.RtcInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,Bn,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},e.prototype.cancelRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteInfo,o=t.roomId,s=this._context.rtcCodec.encode(an.RtcCancelInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,kn,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.responseRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return e=t.inviteUserId,n=t.inviteRoomId,i=t.inviteSessionId,r=t.content,o=t.key,s=t.value,a=t.agree,u=t.roomId,c=this._context.rtcCodec.encode(an.RtcInviteAnswerInput,{inviteUserId:e,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,xn,!0,c)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},e.prototype.endRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.endRoomId,n=t.sessionId,i=t.content,r=t.keys,o=t.roomId,s=this._context.rtcCodec.encode(an.RtcEndInviteInput,{inviteRoomId:e,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,Fn,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.registerRTCSignalListener=function(t){this._context.registerRTCSignalingListener(t)},e.prototype.rtcSignaling=function(t,e,n,i){return this._context.rtcSignaling(t,e,n,i)},e.prototype.getRTCJoinedUserInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryUserJoinedInput,{userId:t}),[4,this.rtcSignaling("",Kn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r?(o=this._context.rtcCodec.decode(an.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:je(t.joinTime)}}))}]):[2,{code:i}]}}))}))},e}(Yi);function Xa(t){return u({},t)}var Za=function(){function t(t,e){var n,i;this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[it.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[it.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[it.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[it.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[it.INTERCEPT]=this._processInterceptMessage.bind(this),n[it.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[it.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[it.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[it.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[it.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[it.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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=u({},e),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((function(t){return t.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,ca.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,ca.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,ca.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,ca.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)};this.rtcCodec=this.createCodec(Hn,qn),this._engine=pn()?new RCCppEngine(t,this.rtcCodec,r,this._options):new Wa(t,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new yn(this._engine)}return t.init=function(e,n){if(this._context)return this._context.logger.warn(pt.A_INIT_REPEAT_O),this._context;this._context=new t(e,n),this._context.logger.info(pt.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(pt.L_IMSDK_VER_O,JSON.stringify({commitId:"9f51eda4fdcfc4fecb7423c4a03db8e78cb60b14",version:"5.8.4-alpha.6"}));var i=this._context._engine;return e.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},t.destroy=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._context?(this._context.logger.info(pt.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return t.sent(),this._context=void 0,[2]}}))}))},t.prototype.createCodec=function(t,e){return new Jn(t,e)},t.prototype.install=function(t,e){var n=this.logger.createTraceId();if(this.logger.info(pt.L_INSTALL_PLUGIN_T,JSON.stringify({tag:t.tag}),n),this._pluginInstanseMap[t.tag])return this.logger.warn(pt.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[t.tag];var i="RCRTC"===t.tag?new Ja(this):new Yi(this),r=null;try{if(!t.verify(this._runtime))return null;r=t.setup(i,this._runtime,e)}catch(t){this.logger.error(pt.L_INSTALL_PLUGIN_R,null==t?void 0:t.stack,n)}return["RCRTC","RCCall"].includes(t.tag)&&t.version&&t.name&&(this._versionInfo[t.name]=t.version),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[t.tag]=r),r},t.prototype._onConnectionStatusChange=function(t,e){var n,i;this.logger.warn(pt.A_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),null===(i=(n=this._watcher).connection)||void 0===i||i.call(n,t,e),this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,t,e)}))},t.prototype._processChatrormMessage=function(t){var e;if("function"==typeof this._watcher.chatroomState)return this._watcher.chatroomState({userChange:{users:(e={},e[t.senderUserId]="RC:ChrmQuitNtf"===t.messageType?yt.QUIT:yt.JOIN,e),chatroomId:t.targetId}}),!0},t.prototype._processChrmMemChangeMessage=function(t){if("function"==typeof this._watcher.chatroomState){var e={};Array.isArray(t.content.userList)&&t.content.userList.forEach((function(t){e[t.userId]=t.status})),this._watcher.chatroomState({userChange:{users:e,chatroomId:t.targetId}})}return!0},t.prototype._processTypingStatusMessage=function(t){if(this._addTypingInfo(Xa(t)),this._watcher.typingState)return!0},t.prototype._processInterceptMessage=function(t){var e={conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId||"",blockType:t.content.interceptType,blockedMessageUId:t.content.msgUId,extra:t.content.extra};if(t.conversationType===$.ULTRA_GROUP){var n=t.content.sourceType;if(e.sourceType=n,(n===vt.MSG_EXPANSION||n===vt.MSG_MODIFY)&&t.content.sourceContent)try{e.sourceContent=JSON.parse(t.content.sourceContent)}catch(t){this.logger.warn(pt.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:t.message}))}}return this._MessageBlockedListener(e),!0},t.prototype._processChrmSyncMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:t.content.chatroomId,status:t.content.status,reason:t.content.reason,time:t.content.time,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBlockMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:t.content.chatroomId,operateType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBanMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:t.content.chatroomId,banType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processReadReceiptMessage=function(t){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.content.lastMessageSendTime)},t.prototype._processReadReceiptRequestMessage=function(t){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.senderUserId)},t.prototype._processReadReceiptResponseMessage=function(t){var e,n=null===(e=t.content)||void 0===e?void 0:e.receiptMessageDic,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.senderUserId,n[i])},t.prototype._messageReceiver=function(t,e,n){var i,r,o,s,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[t.messageType])||void 0===r?void 0:r.call(i,t))&&!this._pluginContextQueue.some((function(e){if(!e.onmessage)return!1;try{return e.onmessage(Xa(t))}catch(t){return a.logger.error(pt.A_MSG_LISTENER_E,null==t?void 0:t.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Xa(t),e,n),!this._messageProccessor[t.messageType])return t;this._messageProccessor[t.messageType](t)}},t.prototype._batchMessageReceiver=function(t,e,n){var i=this,r=[];t.forEach((function(t){var o=i._messageReceiver(t,e,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(pt.L_BATCH_MESSAGE_O,r.map((function(t){return t.messageUId})).join(",")),this._watcher.batchMessage(r))},t.prototype._chatroomInfoListener=function(t){var e,n;null===(n=(e=this._watcher).chatroomState)||void 0===n||n.call(e,t)},t.prototype._conversationInfoListener=function(t){var e,n;null===(n=(e=this._watcher).conversationState)||void 0===n||n.call(e,t)},t.prototype._expansionInfoListener=function(t){var e,n;null===(n=(e=this._watcher).expansion)||void 0===n||n.call(e,t)},t.prototype._tagListener=function(){var t,e;null===(e=(t=this._watcher).tag)||void 0===e||e.call(t)},t.prototype._conversationTagListener=function(){var t,e;null===(e=(t=this._watcher).conversationTagChanged)||void 0===e||e.call(t)},t.prototype._typingStatusListener=function(t){var e,n;null===(n=(e=this._watcher).typingState)||void 0===n||n.call(e,t)},t.prototype._pullFinishedListener=function(){var t,e;null===(e=(t=this._watcher).pullFinished)||void 0===e||e.call(t)},t.prototype._MessageBlockedListener=function(t){var e,n;null===(n=(e=this._watcher).messageBlocked)||void 0===n||n.call(e,t)},t.prototype._messageDeliveredListerer=function(t){var e,n;null===(n=(e=this._watcher).messageDelivered)||void 0===n||n.call(e,t)},t.prototype._groupMessageDeliveredStatusListerer=function(t){var e,n;null===(n=(e=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(e,t)},t.prototype._callInfoListener=function(t){var e=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(t)}catch(t){e.logger.warn(pt.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype._ultraGroupEnableListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupEnable)||void 0===n||n.call(e,t)},t.prototype._operateStatusListener=function(t){var e,n;null===(n=(e=this._watcher).operateStatus)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageExpansionUpdatedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageModifiedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageRecalledListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelChangeTypeListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelUserKickedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelDeleteListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(e,t)},t.prototype._userGroupStatusListener=function(t){var e,n;null===(n=(e=this._watcher).userGroupStatus)||void 0===n||n.call(e,t)},t.prototype._rtcDataChange=function(t,e){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.call(n,t,e)}))},t.prototype._naviDataChange=function(t){this._pluginContextQueue.forEach((function(e){var n;null===(n=e.onnavidatachange)||void 0===n||n.call(e,t)}))},t.prototype.assignWatcher=function(t){var e=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];e._watcher[n]=ue(i)||ae(i)?i:void 0}}))},t.prototype._resetWatcher=function(){var t=this;Object.keys(this._watcher).forEach((function(e){t._watcher[e]=void 0}))},t.prototype._addTypingInfo=function(t){var e=t.senderUserId,n=t.conversationType,i=t.targetId,r=t.content,o=t.channelId,s=r.typingContentType,a=o||"",u="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(t){return t.userId===e}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:e,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},t.prototype._startCheckTypingInfo=function(){var t=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var e in t._typingInfo){var n=t._typingInfo[e].length;t._typingInfo[e]=t._typingInfo[e].filter((function(e){return Date.now()-e.timestamp<t._typingExpireTime})),t._typingInfo[e].length===n||t._typingChangedList.includes(e)||t._typingChangedList.push(e),0===t._typingInfo[e].length&&delete t._typingInfo[e]}t._notifyTypingChanged()}),500))},t.prototype._notifyTypingChanged=function(){var t=this;if(this._typingChangedList.length>0){var e=this._typingChangedList.map((function(e){return{conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:t._typingInfo[e]||[]}}));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},t.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},t.prototype.getServerTime=function(){return this._engine.getServerTime()},t.prototype.getDeviceId=function(){return this._engine.getDeviceId()},t.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),t.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.refetchNaviInfo()]}))}))},t.prototype.connect=function(t,e,n){var i,r;return c(this,void 0,void 0,(function(){var o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._token=t,[4,this._runtime.getNetworkType()];case 1:return o=l.sent(),this._engine.setNetwork({status:!0,type:o},!0),s=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(t,e,s,n)];case 2:return a=l.sent(),u=a.code,c=a.data,u!==Z.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=Ce.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:u,userId:c}])}}))}))},t.prototype.disconnect=function(t){return c(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(t)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondisconnect)try{t.ondisconnect()}catch(t){e.logger.error(pt.L_CALLBACK_E,null==t?void 0:t.stack)}})),[2,Promise.resolve()]}}))}))},t.prototype.reconnect=function(t){return this.connect(this.token,!!t,this.logger.createTraceId())},t.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},t.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},t.prototype.registerMessageType=function(t,e,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),ie(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[t]=i),this._engine.registerMessageType(t,e,n,i,r)},t.prototype.registerRTCSignalingListener=function(t){this._engine.registerRTCSignalingListener(t)},t.prototype.checkSearchPropsMsg=function(t,e){var n=this._registerMessageSearchPropsMapping[t],i={};return n&&ae(e)&&Object.keys(e).forEach((function(t){if(n.includes(t)){var r=e[t];ne(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[t]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:Z.SEARCH_PROPS_LIMIT_ERROR}:{code:Z.SUCCESS}},t.prototype.sendMessage=function(t,e,n,i,r){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==Z.SUCCESS)return Promise.resolve({code:s,msg:a});if(t===$.SYSTEM&&n.messageType!==it.SYNC_READ_STATUS)return Promise.resolve({code:Z.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(t!==$.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(1===((null==u?void 0:u.grpRRVer)||0)&&n.messageType===it.READ_RECEIPT_RESPONSE)return Promise.resolve({code:Z.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,h=n.expansion;if(l){var d=Te(h),g=d.isIllgalEx,p=d.isExKeyOrValLengthExceedLimit;if(d.isExceedLimit||p)return Promise.resolve({code:Z.EXPANSION_LIMIT_EXCEET});if(g)return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}var f,T,v=JSON.stringify(n.content);return f=v,void 0===T&&(T="utf-8"),("utf-16"===T?_(f):E(f))>N?Promise.resolve({code:Z.RC_MSG_CONTENT_EXCEED_LIMIT}):t===$.ULTRA_GROUP?this._engine.sendUltraMessage(e,n,i,r):this._engine.sendMessage(t,e,n,i,r)},t.prototype.sendExpansionMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return e=t.channelId,n=t.conversationType,i=t.targetId,r=t.messageUId,o=t.keys,s=t.expansion,a=t.removeAll,t.canIncludeExpansion?(u=Te(s),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:Z.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:r},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:it.EXPANSION_NOTIFY,channelId:e})])):[2,{code:Z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},t.prototype.sendReadReceiptMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Z.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(t,e,n)]}))}))},t.prototype.getMessageReader=function(t,e,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Z.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(t,e,n)]}))}))},t.prototype._destroy=function(){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(e){switch(e.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return e.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){t.logger.error(pt.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},t.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),t===$.ULTRA_GROUP){var u={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,u,a)}return this._engine.getHistoryMessage(t,e,n,i,r,o,s||"",a)},t.prototype.getMessages=function(t,e,n,i,r,o,s){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),t===$.ULTRA_GROUP){var a={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,a,s)}return this._engine.getMessages(t,e,n,i,r,o,s)},t.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(t,e,n,i,r,o,s)},t.prototype.getConversationList=function(t,e,n,i,r){if(void 0===t&&(t=300),void 0===r&&(r=""),e===$.ULTRA_GROUP){var o=Z.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:Z[o]})}return this._engine.getConversationList(t,e,n,i,r)},t.prototype.getConversationsByPage=function(t,e,n,i){return this._engine.getConversationsByPage(t,e,n,i)},t.prototype.getConversation=function(t,e,n){return this._engine.getConversation(t,e,n)},t.prototype.removeConversation=function(t,e,n){return void 0===n&&(n=""),t===$.ULTRA_GROUP?Promise.resolve(Z.METHOD_NOT_SUPPORT):this._engine.removeConversation(t,e,n)},t.prototype.getUltraGroupList=function(t){return this._engine.getUltraGroupList(t)},t.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},t.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},t.prototype.clearUnreadCount=function(t,e,n){return void 0===n&&(n=""),t===$.ULTRA_GROUP?this._engine.clearUltraUnreadcount(e,n):this._engine.clearConversationUnreadCount(t,e,n)},t.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},t.prototype.getUnreadCount=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(t,e,n)},t.prototype.getTotalUnreadCount=function(t,e,n){if(e&&e.includes($.ULTRA_GROUP)){var i=Z.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:Z[i]})}return this._engine.getAllConversationUnreadCount(t,e&&e.length>0?e:[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE],!!n)},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){return this._engine.getTotalUnreadCountByLevels(t,e,n)},t.prototype.getFirstUnreadMessage=function(t,e,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(t,e,n)},t.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setConversationNotificationLevel(t,e,n,i)]}))}))},t.prototype.setConversationStatus=function(t,e,n,i,r){if(void 0===r&&(r=""),t===$.ULTRA_GROUP&&void 0!==n)return Promise.resolve(Z.METHOD_NOT_SUPPORT);var o=[{conversationType:t,targetId:e,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},t.prototype.saveConversationMessageDraft=function(t,e,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(t,e,n,i)},t.prototype.getConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(t,e,n)},t.prototype.clearConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(t,e,n)},t.prototype.recallMessage=function(t,e,n,i,r){return this._engine.recallMsg(t,e,n,i,r)},t.prototype.deleteRemoteMessage=function(t,e,n,i){return void 0===i&&(i=""),t===$.ULTRA_GROUP?Promise.resolve(Z.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(t,e,n,i)},t.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(t,e,n,i)},t.prototype.joinChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinChatroom(t,e,n)},t.prototype.joinExistChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinExistChatroom(t,e,n)},t.prototype.quitChatroom=function(t){return this._engine.quitChatroom(t)},t.prototype.getChatroomInfo=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this._engine.getChatroomInfo(t,e,n)},t.prototype.setChatroomEntry=function(t,e){var n=e.key,i=e.value;return Ze(n)&&ze(i)?this._engine.setChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.setChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n],r=i.key,o=i.value;if(!Ze(r)||!ze(o))return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}var s=u(u({},e),{isOverwrite:e.isForce});return this._engine.setChatroomEntries(t,s)},t.prototype.forceSetChatroomEntry=function(t,e){var n=e.key,i=e.value;return Ze(n)&&ze(i)?this._engine.forceSetChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntry=function(t,e){var n=e.key;return Ze(n)?this._engine.removeChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n].key;if(!Ze(i))return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(t,e)},t.prototype.forceRemoveChatroomEntry=function(t,e){var n=e.key;return Ze(n)?this._engine.forceRemoveChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.getChatroomEntry=function(t,e){return this._engine.getChatroomEntry(t,e)},t.prototype.getAllChatroomEntries=function(t){return this._engine.getAllChatroomEntry(t)},t.prototype.getChatroomHistoryMessages=function(t,e,n,i){return void 0===e&&(e=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(t,i,e,n)},t.prototype.getFileToken=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return o=this.getNaviInfoFromCache(),s=(null==o?void 0:o.bosAddr)||"",a=(null==o?void 0:o.uploadServer)||"",u=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(t,e,n,i,r)];case 1:return c=l.sent(),h=c.code,d=c.data,h===Z.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:u}))]:[2,Promise.reject(h)]}}))}))},t.prototype.getFileUrl=function(t,e,n,i,r){return void 0===r&&(r=ht.QINIU),c(this,void 0,void 0,(function(){var o,s,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(t,r,e,n)];case 1:return o=u.sent(),s=o.code,a=o.data,s===Z.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},t.prototype.createTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.createTag(t)]}))}))},t.prototype.removeTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeTag(t)]}))}))},t.prototype.updateTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.updateTag(t)]}))}))},t.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getTagList()]}))}))},t.prototype.addTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.length>1e3?[2,Promise.reject(Z.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(t,e)]}))}))},t.prototype.removeTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagForConversations(t,e)]}))}))},t.prototype.removeTagsForConversation=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagsForConversation(t,e)]}))}))},t.prototype.getConversationListByTag=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(t,e,n,i)]}))}))},t.prototype.getUnreadCountByTag=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(t,e)]}))}))},t.prototype.setConversationStatusInTag=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationStatusInTag(t,e,n)]}))}))},t.prototype.getTagsForConversation=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagsForConversation(t)]}))}))},t.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},t.prototype.getTopConversationList=function(t,e){return t&&0!==t.length||(t=[$.PRIVATE,$.CHATROOM,$.GROUP,$.SYSTEM,$.APP_PUBLIC_SERVICE,$.PUBLIC_SERVICE]),this._engine.getTopConversationList(t,e)},t.prototype.getUnreadConversationList=function(t){return t&&0!==t.length||(t=[$.PRIVATE,$.CHATROOM,$.GROUP,$.SYSTEM,$.APP_PUBLIC_SERVICE,$.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(t)},t.prototype.getUnreadMentionedCount=function(t){return this._engine.getUnreadMentionedCount(t)},t.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},t.prototype.sendUltraGroupTypingStatus=function(t){if(t.conversationType!==$.ULTRA_GROUP){var e=Z.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:Z[e]})}return this._engine.sendUltraGroupTypingStatus(t)},t.prototype.getUltraGroupMessageListByMessageUId=function(t){return this._engine.getUltraGroupMessageListByMessageUId(t)},t.prototype.expandUltraMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.conversationType,n=t.expansion,i=t.canIncludeExpansion,e!==$.ULTRA_GROUP?[2,{code:r=Z.CONVERSATION_TYPE_NOT_SUPPORT,msg:Z[r]}]:i?(o=Te(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:Z.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:Z.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(t)]):[2,{code:Z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},t.prototype.modifyMessage=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return t.conversationType!==$.ULTRA_GROUP?[2,{code:e=Z.CONVERSATION_TYPE_NOT_SUPPORT,msg:Z[e]}]:[4,this._engine.modifyMessage(t)];case 1:return[2,{code:n.sent().code}]}}))}))},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(t,e)},t.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadCountByTargetId(t,e)},t.prototype.getAllUltraGroupUnreadCount=function(t){return void 0===t&&(t=!1),this._engine.getAllUltraGroupUnreadCount(t)},t.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},t.prototype.getUltraGroupUnreadMentionedMessages=function(t){return this._engine.getUltraGroupUnreadMentionedMessages(t)},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return this._engine.getUltraGroupFirstUnreadMessageTimestamp(t)},t.prototype.getUltraGroupUnreadInfoList=function(t){return this._engine.getUltraGroupUnreadInfoList(t)},t.prototype.callExtra=function(t){for(var e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(e=this._engine).callExtra.apply(e,h([t],n,!1))},t.prototype.getOSInfo=function(){return this._engine.getOSInfo()},t.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._engine.setCallInfo(t,e,n)},t.prototype.getGroupMessageDeliverList=function(t,e,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(t,e,n)},t.prototype.getPrivateMessageDeliverTime=function(t,e){return void 0===e&&(e=""),this._engine.getPrivateMessageDeliverTime(t,e)},t.prototype.clearConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(t,e)]}))}))},t.prototype.setUserStatusListener=function(t,e){var n=this;return this._engine.setUserStatusListener(t,(function(t){try{e(t)}catch(t){n.logger.error(pt.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype.addToBlacklist=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.addToBlacklist(t)]}))}))},t.prototype.removeFromBlacklist=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeFromBlacklist(t)]}))}))},t.prototype.getBlacklist=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklist()]}))}))},t.prototype.getBlacklistStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklistStatus(t)]}))}))},t.prototype.insertMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==Z.SUCCESS?[2,Promise.resolve({code:r,msg:o})]:[2,this._engine.insertMessage(t,e,n)]}))}))},t.prototype.batchInsertMessage=function(t,e){return this._engine.batchInsertMessage(t,e)},t.prototype.getMessageCount=function(t,e,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(t,e,n)]}))}))},t.prototype.deleteMessages=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.deleteMessages(t)]}))}))},t.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(t,e,n,i,r)]}))}))},t.prototype.clearMessages=function(t,e,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(t,e,n)]}))}))},t.prototype.getMessage=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getMessage(t)]}))}))},t.prototype.setMessageContent=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(t,e,n)]}))}))},t.prototype.setMessageSearchField=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(t,e,n)]}))}))},t.prototype.setMessageSentStatus=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(t,e)]}))}))},t.prototype.setMessageReceivedStatus=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(t,e)]}))}))},t.prototype.setMessageStatusToRead=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(t,e,n,i)]}))}))},t.prototype.setUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.setUserStatus(t)]}))}))},t.prototype.subscribeUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.subscribeUserStatus(t)]}))}))},t.prototype.getUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getUserStatus(t)]}))}))},t.prototype.searchConversationByContent=function(t,e,n,i){return void 0===e&&(e=[]),void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(t,e,n,i)]}))}))},t.prototype.searchConversationByContentWithAllChannel=function(t,e,n){return void 0===e&&(e=[]),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(t,e,n)]}))}))},t.prototype.searchMessageByContent=function(t,e,n,i,r,o,s){return void 0===s&&(s=""),c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(t,e,n,i,r,o,s)]}))}))},t.prototype.searchMessagesByUser=function(t,e,n,i,r,o){return void 0===r&&(r=5),void 0===o&&(o=""),c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(t,e,n,i,r,o)]}))}))},t.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(t,e,n,i,r)]}))}))},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(t,e,n,i,r,o,s)]}))}))},t.prototype.getUnreadMentionedMessages=function(t,e,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(t,e,n)},t.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(t,e,n,i)},t.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return void 0===e&&(e=""),this._engine.getUltraGroupDefaultNotificationLevel(t,e)},t.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(t,e,n)},t.prototype.getConversationNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(t,e,n)},t.prototype.getConversationNotificationStatus=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(t,e,n)},t.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this._engine.getRemoteHistoryMessages(t,e,n,i,r,o)},t.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},t.prototype.getConversationListWithAllChannelByPage=function(t,e){return this._engine.getConversationListWithAllChannelByPage(t,e)},t.prototype.clearData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.clearData()]}))}))},t.prototype.createLogger=function(t,e){return this._engine.createLogger(t,e)},t.prototype.setCheckDuplicateMessage=function(t){return this._engine.setCheckDuplicateMessage(t)},t.prototype.rtcSignaling=function(t,e,n,i){return this._engine.rtcSignaling(t,e,n,i)},t.prototype.rtcPing=function(t,e,n){return this._engine.rtcPing(t,e,n)},t.prototype.bindRTCRoomForChatroom=function(t){return this._engine.bindRTCRoomForChatroom(t)},t.prototype.setProxy=function(t){return this._engine.setProxy(t)},t.prototype.getProxy=function(){return this._engine.getProxy()},t.prototype.testProxy=function(t,e){return this._engine.testProxy(t,e)},t}(),za=x;export{_a as AConnectionMgr,Yn as AEngine,Za as APIContext,o as AppStorage,Wn as AreaCode,Se as AssertRules,Ci as BasicLogger,go as BasicNavi,Ii as BasicReporter,ti as BasicStaticConfigManager,Pa as BasicStatistic,Da as BasicStatisticReporter,P as CPP_PROTOCAL_MSGTYPE_OPTION,$t as CallLibMsgType,Et as ChatroomEntryType,Jt as ChatroomSyncStatusReason,yt as ChatroomUserChangeType,At as ChrmMemBanType,Ut as ChrmMemOperateType,Nt as ChrmSyncStatus,Jn as Codec,Yt as ConnectReason,qt as ConnectType,et as ConnectionStatus,$ as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,Tn as DelayTimer,wt as EConnectProtocol,xt as EnterpriseType,Z as ErrorCode,ve as EventEmitter,F as FORMATED_VERSION,Q as FileType,y as HTTP_TIMEOUT,He as HttpMethod,M as IM_CHATROOM_PULL_INTERVAL_TIME,R as IM_PING_INTERVAL_TIME,O as IM_PING_MIN_TIMEOUT,S as IM_PING_TIMEOUT,I as IM_SIGNAL_TIMEOUT,mi as IndexDBLogger,Vi as IndexDBReporter,Ga as IndexDBStatistic,qa as IndexDBStatisticReporter,Y as LOCAL_STORAGE_KEYS,Wt as LiveRole,Qt as LiveType,pi as LogL,dt as LogLevel,gt as LogSource,pt as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,U as MAX_MESSAGE_EXPANSION_KEY_LENGTH,L as MAX_MESSAGE_EXPANSION_VAL_LENGTH,K as MAX_UPLOAD_FILE_SIZE,ct as MentionedType,vt as MessageBlockSourceType,mt as MessageBlockType,J as MessageDirection,it as MessageType,v as NAVI_CACHE_DURATION,C as NAVI_REQ_TIMEOUT,Kt as NaviCacheType,qe as NetworkType,at as NotificationLevel,ot as NotificationStatus,k as ONE_LOG_SIZE_MAX,St as OperateStatus,Yi as PluginContext,Ft as ProtocalType,Ve as RCAssertError,ca as RCConnectionStatus,V as REAT_TIME_LOG_SIZE,Xt as RTCApiType,Zt as RTCIdentityChangeType,zt as RTCJoinType,jt as RTCMode,Ja as RTCPluginContext,n as ReceivedStatus,b as SEND_MESSAGE_TYPE_OPTION,q as STATIC_CONFIG_CACHE_TIME,w as STATIC_CONFIG_IV,A as STATIC_CONFIG_KEY,D as STATUS_MESSAGE,It as SentStatus,fa as StatisticL,ft as StatisticsTag,Ht as StatisticsVersion,bt as StoreKeys,Pe as SuspendablePromise,Ye as TagChangeType,H as UPLOAD_FILE_CHUNK_SIZE,Dt as UltraGroupChannelChangeType,Pt as UltraGroupChannelType,kt as UltraMentionedType,Vt as UltraMsgChangeType,Gt as UltraMsgSubChangeType,ht as UploadMethod,Bt as UserGroupChangeType,x as VERSION,Ce as VersionManage,m as WEB_SOCKET_TIMEOUT,fo as WebSocketNavi,T as appendUrl,Ge as assert,En as clone,gn as cloneByJSON,ci as deInitLogDB,en as decryptCBC,nn as fixUrlProtocol,un as forEach,fn as getBrowser,$e as getClientMessageId,We as getMimeKey,we as getUUID,be as getUUID22,Qe as getUploadFileName,tn as getbundleId,on as httpRequest,ln as indexOf,ui as initLogDB,Ra as initStatisticDB,ie as isArray,re as isArrayBuffer,ee as isBoolean,pa as isConnnectAck,ga as isDisconnectedByServer,ue as isFunction,he as isHttpUrl,dn as isInObject,hn as isInclude,le as isNull,ne as isNumber,ae as isObject,te as isString,_e as isTypeInConversationList,ce as isUndefined,fe as isValidChannelId,Ze as isValidChrmEntryKey,ze as isValidChrmEntryValue,ge as isValidConversationType,Te as isValidExpansion,Ee as isValidFileType,pe as isValidNotificationLevel,Ae as logger,cn as map,se as notEmptyArray,de as notEmptyObject,oe as notEmptyString,Je as pushConfigsToJSON,Xe as pushJSONToConfigs,La as statisticTranscsv,f as todo,Di as transcsv,Sa as unInitStatisticDB,$n as urlCenter,pn as usingCppEngine,Be as validate,za as version};
1
+ var t;!function(t){t[t.READ=1]="READ",t[t.LISTENED=2]="LISTENED",t[t.DOWNLOADED=4]="DOWNLOADED",t[t.RETRIEVED=8]="RETRIEVED",t[t.UNREAD=0]="UNREAD"}(t||(t={}));var e,n=t,i=function(t){return e||(e={set:function(e,n){t.localStorage.setItem(e,JSON.stringify(n))},get:function(e){var n;try{n=JSON.parse(t.localStorage.getItem(e))}catch(t){n=null}return n},remove:function(e){return t.localStorage.removeItem(e)},getKeys:function(){var e=[];for(var n in t.localStorage)e.push(n);return e}}),e},r=function(){function t(t){this._caches={},t&&(this._caches=t)}return t.prototype.set=function(t,e){this._caches[t]=e},t.prototype.remove=function(t){var e=this.get(t);return delete this._caches[t],e},t.prototype.get=function(t){return this._caches[t]},t.prototype.getKeys=function(){var t=[];for(var e in this._caches)t.push(e);return t},t}(),o=function(){function t(t,e){var n;this._rootStorage=i(t);var o=this._rootStorage.get(e)||{};this._cache=new r(((n={})[e]=o,n)),this._storageKey=e}return t.prototype._get=function(){var t=this._storageKey;return this._cache.get(t)||{}},t.prototype._set=function(t){var e=this._storageKey;t=t||{},this._cache.set(e,t),this._rootStorage.set(e,t)},t.prototype.set=function(t,e){var n=this._get();n[t]=e,this._set(n)},t.prototype.remove=function(t){var e=this._get();delete e[t],this._set(e)},t.prototype.clear=function(){var t=this._storageKey;this._rootStorage.remove(t),this._cache.remove(t)},t.prototype.get=function(t){return this._get()[t]},t.prototype.getKeys=function(){var t=this._get(),e=[];for(var n in t)e.push(n);return e},t.prototype.getValues=function(){return this._get()||{}},t}(),s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},s(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var u=function(){return u=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},u.apply(this,arguments)};function c(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))}function l(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)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 s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],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(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var d,p=function(t){function e(e){return t.call(this,"TODO => ".concat(e))||this}return a(e,t),e}(Error),f=function(t){return new p(t)},_=function(t){for(var e=0,n=0,i=t.length;n<i;n++)e+=t.charCodeAt(n)<=65535?2:4;return e},E=function(t){for(var e,n=0,i=0,r=t.length;i<r;i++)n+=(e=t.charCodeAt(i))<127?1:e<=2047?2:e<=65535?3:4;return n},T=function(t,e){if(t=t.replace(/\?$/,""),!e)return t;var n=Object.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).filter((function(t){return!!t}));return n.length?[t,n.join("&")].join("?"):t},v=72e5,y=6e4,C=1e4,m=5e3,I=3e4,R=15e3,S=15e3,O=2e3,N=131072,M=18e4,U=32,L=4096,A="cd4936151214ce45dc1d12673a59d94c",w="51ad078e5eb17a91",b={"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},"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}},P={"RC:DizNtf":{isCounted:!1,isPersited:!1}},D=["RC:TypSts","RC:InterceptMsg","RC:RL"],V=20971520,G=1e5,B=3e3,k=1e3,x="5.8.4-alpha.8",F=x.replace(/-.+$/,""),K=5368709120,H=10485760,q=18e5,Y={NAVI_KEY:function(t){return"navi_".concat(t)},CONVER_STATE_PULL_TIME_KEY:function(t,e){return"RCV4-con-s-".concat(t,"-").concat(e)},OLD_CONVER_STATE_KEY:function(t,e){return"RCV4-con-".concat(t,"-").concat(e)},CONVER_STATE_KEY:function(t,e){return"RCV4-CONVER-".concat(t,"-").concat(e)},ULTRA_GROUP_STATE_KEY:function(t,e){return"RCV4-ultragroupconversation-".concat(t,"-").concat(e)},OUTBOX_TIME_KEY:function(t,e){return"outbox_".concat(t,"_").concat(e)},INBOX_TIME_KEY:function(t,e){return"inbox_".concat(t,"_").concat(e)},BROADCASTBOX_TIME_KEY:function(t,e){return"broadcastbox_".concat(t,"_").concat(e)},SEND_MSG_KEY:function(t,e){return"send_msg_".concat(t,"_").concat(e)},USER_SETTING_TIME_KEY:function(t,e){return"us-s-".concat(t,"-").concat(e)},TAG_STATE_KEY:function(t,e){return"tag-".concat(t,"-").concat(e)},STATIC_CONFIG_KEY:function(t){return"rc-static-config-".concat(t)}};!function(t){t[t.IMAGE=1]="IMAGE",t[t.AUDIO=2]="AUDIO",t[t.VIDEO=3]="VIDEO",t[t.FILE=4]="FILE",t[t.SIGHT=5]="SIGHT",t[t.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var j,Q=d;!function(t){t[t.SEND=1]="SEND",t[t.RECEIVE=2]="RECEIVE"}(j||(j={}));var W,J=j;!function(t){t[t.TIMEOUT=-1]="TIMEOUT",t[t.SUCCESS=0]="SUCCESS",t[t.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",t[t.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",t[t.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",t[t.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",t[t.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",t[t.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",t[t.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",t[t.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",t[t.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",t[t.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",t[t.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",t[t.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",t[t.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",t[t.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",t[t.NOT_IN_GROUP=22406]="NOT_IN_GROUP",t[t.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",t[t.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",t[t.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",t[t.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",t[t.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",t[t.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",t[t.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",t[t.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",t[t.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",t[t.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",t[t.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",t[t.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",t[t.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",t[t.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",t[t.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",t[t.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",t[t.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",t[t.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",t[t.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",t[t.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",t[t.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",t[t.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",t[t.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",t[t.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",t[t.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",t[t.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",t[t.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",t[t.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",t[t.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",t[t.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",t[t.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",t[t.RECALL_MESSAGE=25101]="RECALL_MESSAGE",t[t.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",t[t.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",t[t.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",t[t.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",t[t.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",t[t.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",t[t.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",t[t.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",t[t.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",t[t.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",t[t.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",t[t.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",t[t.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",t[t.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",t[t.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",t[t.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",t[t.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",t[t.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",t[t.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",t[t.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",t[t.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",t[t.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",t[t.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",t[t.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",t[t.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",t[t.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",t[t.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",t[t.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",t[t.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",t[t.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",t[t.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",t[t.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",t[t.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",t[t.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",t[t.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",t[t.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",t[t.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",t[t.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",t[t.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",t[t.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",t[t.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",t[t.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",t[t.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",t[t.RC_OTP_USED=31027]="RC_OTP_USED",t[t.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",t[t.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",t[t.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",t[t.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",t[t.RC_TCP_RESET=32054]="RC_TCP_RESET",t[t.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",t[t.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",t[t.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",t[t.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",t[t.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",t[t.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",t[t.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",t[t.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",t[t.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",t[t.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",t[t.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",t[t.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",t[t.TAG_EXISTS=33101]="TAG_EXISTS",t[t.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",t[t.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",t[t.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",t[t.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",t[t.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",t[t.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",t[t.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",t[t.UPLOAD_FAIL=34011]="UPLOAD_FAIL",t[t.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",t[t.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",t[t.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",t[t.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",t[t.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",t[t.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",t[t.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",t[t.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",t[t.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",t[t.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",t[t.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",t[t.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",t[t.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",t[t.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",t[t.NOT_SUPPORT=35004]="NOT_SUPPORT",t[t.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",t[t.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",t[t.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",t[t.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",t[t.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",t[t.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",t[t.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",t[t.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",t[t.UNKNOWN=-2]="UNKNOWN",t[t.PARAMETER_ERROR=-3]="PARAMETER_ERROR",t[t.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",t[t.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",t[t.CANCEL=1]="CANCEL",t[t.REJECT=2]="REJECT",t[t.HANGUP=3]="HANGUP",t[t.BUSYLINE=4]="BUSYLINE",t[t.NO_RESPONSE=5]="NO_RESPONSE",t[t.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",t[t.NETWORK_ERROR=7]="NETWORK_ERROR",t[t.REMOTE_CANCEL=11]="REMOTE_CANCEL",t[t.REMOTE_REJECT=12]="REMOTE_REJECT",t[t.REMOTE_HANGUP=13]="REMOTE_HANGUP",t[t.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",t[t.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",t[t.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",t[t.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",t[t.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",t[t.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",t[t.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",t[t.INVITE_DICUSSION=21409]="INVITE_DICUSSION",t[t.HAVNODEVICEID=24001]="HAVNODEVICEID",t[t.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",t[t.FEILD=24009]="FEILD",t[t.VOIPISNULL=24013]="VOIPISNULL",t[t.NOENGINETYPE=24010]="NOENGINETYPE",t[t.NULLCHANNELNAME=24011]="NULLCHANNELNAME",t[t.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",t[t.NOVOIP=24014]="NOVOIP",t[t.INTERNALERRROR=24015]="INTERNALERRROR",t[t.VOIPCLOSE=24016]="VOIPCLOSE",t[t.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",t[t.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",t[t.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",t[t.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",t[t.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",t[t.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",t[t.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",t[t.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",t[t.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",t[t.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",t[t.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",t[t.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",t[t.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",t[t.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",t[t.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",t[t.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",t[t.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",t[t.COOKIE_ENABLE=51001]="COOKIE_ENABLE"}(W||(W={}));var X,Z=W;!function(t){t[t.NONE=0]="NONE",t[t.PRIVATE=1]="PRIVATE",t[t.DISCUSSION=2]="DISCUSSION",t[t.GROUP=3]="GROUP",t[t.CHATROOM=4]="CHATROOM",t[t.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",t[t.SYSTEM=6]="SYSTEM",t[t.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",t[t.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",t[t.ULTRA_GROUP=10]="ULTRA_GROUP",t[t.RTC_ROOM=12]="RTC_ROOM"}(X||(X={}));var z,$=X;!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",t[t.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",t[t.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",t[t.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",t[t.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",t[t.BLOCKED=9]="BLOCKED",t[t.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",t[t.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",t[t.REDIRECT=14]="REDIRECT",t[t.USER_LOGOUT=19]="USER_LOGOUT",t[t.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",t[t.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",t[t.ULTRALIMIT=1101]="ULTRALIMIT",t[t.REQUEST_NAVI=201]="REQUEST_NAVI",t[t.RESPONSE_NAVI=202]="RESPONSE_NAVI",t[t.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",t[t.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",t[t.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",t[t.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(z||(z={}));var tt,et=z;!function(t){t.TextMessage="RC:TxtMsg",t.VOICE="RC:VcMsg",t.HQ_VOICE="RC:HQVCMsg",t.IMAGE="RC:ImgMsg",t.GIF="RC:GIFMsg",t.RICH_CONTENT="RC:ImgTextMsg",t.LOCATION="RC:LBSMsg",t.FILE="RC:FileMsg",t.SIGHT="RC:SightMsg",t.COMBINE="RC:CombineMsg",t.COMBINE_V2="RC:CombineV2Msg",t.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",t.LOG_COMMAND="RC:LogCmdMsg",t.EXPANSION_NOTIFY="RC:MsgExMsg",t.REFERENCE="RC:ReferenceMsg",t.RECALL="RC:RcCmd",t.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",t.READ_RECEIPT="RC:ReadNtf",t.READ_RECEIPT_REQUEST="RC:RRReqMsg",t.READ_RECEIPT_RESPONSE="RC:RRRspMsg",t.SYNC_READ_STATUS="RC:SRSMsg",t.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",t.DELIVERED="RC:Delivered",t.DELIVERED_MSG="RC:DRMsg",t.CHATROOM_JOIN="RC:ChrmJoinNtf",t.CHATROOM_LEFT="RC:ChrmQuitNtf",t.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",t.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",t.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",t.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",t.TYPING_STATUS="RC:TypSts",t.INTERCEPT="RC:InterceptMsg"}(tt||(tt={}));var nt,it=tt;!function(t){t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE"}(nt||(nt={}));var rt,ot=nt;!function(t){t[t.ALL_MESSAGE=-1]="ALL_MESSAGE",t[t.NOT_SET=0]="NOT_SET",t[t.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",t[t.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",t[t.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",t[t.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(rt||(rt={}));var st,at=rt;!function(t){t[t.ALL=1]="ALL",t[t.SINGAL=2]="SINGAL"}(st||(st={}));var ut,ct=st;!function(t){t[t.QINIU=1]="QINIU",t[t.ALI=2]="ALI",t[t.AWS=3]="AWS",t[t.STC=4]="STC",t[t.MINIO=5]="MINIO"}(ut||(ut={}));var lt,ht=ut;!function(t){t[t.UPDATE=1]="UPDATE",t[t.DELETE=2]="DELETE"}(lt||(lt={}));var dt,gt,pt,ft,_t,Et=lt;!function(t){t[t.LOG=0]="LOG",t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR",t[t.FATAL=4]="FATAL",t[t.STATISTICS=6]="STATISTICS",t[t.NONE=1e3]="NONE"}(dt||(dt={})),function(t){t.IM="IM",t.RTC="RTC"}(gt||(gt={})),function(t){t.L_IMSDK_VER_O="L-imsdk_ver-O",t.A_INIT_O="A-init-O",t.A_INIT_REPEAT_O="A_INIT_REPEAT_O",t.L_INIT_O="L-init-O",t.A_DESTROY_O="A_DESTROY_O",t.L_DESTROY_O="L_DESTROY_O",t.A_CONNECT_T="A-connect-T",t.A_CONNECT_R="A-connect-R",t.A_CONNECT_S="A-connect-S",t.A_DISCONNECT_O="A-disconnect-O",t.A_RECONNECT_T="A-reconnect-T",t.A_RECONNECT_R="A_RECONNECT_R",t.L_CONNECT_T="L-connect-T",t.L_CONNECT_R="L-connect-R",t.L_CONNECT_S="L-connect-S",t.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",t.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",t.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",t.A_MSG_LISTENER_E="A-MSG_LISTENER-E",t.O="L-original-O",t.T="L-TEST-O",t.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",t.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",t.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",t.A_SEND_MSG_T="A-send_msg-T",t.A_SEND_MSG_R="A-send_msg-R",t.L_SEND_MSG_T="L-send_msg-T",t.L_SEND_MSG_R="L-send_msg-R",t.L_PULL_MSG_T="L-pull_msg-T",t.L_PULL_MSG_R="L-pull_msg-R",t.L_PULL_MSG_O="L-pull_msg-O",t.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",t.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",t.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",t.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",t.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",t.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",t.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",t.L_RECV_S_MSG_O="L-recv_s_msg-O",t.A_DELETE_MESSAGES_S="A-delete_messages-S",t.P_DELETE_MSG_S="P-delete_msg-S",t.L_PULL_CONVERSATION_S="L-pull_conversation-S",t.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",t.A_REGTYP_O="A-regtyp-O",t.P_REGTYP_E="P-regtype-E",t.L_GET_NAVI_T="L-get_navi-T",t.L_GET_NAVI_R="L-get_navi-R",t.L_REQUEST_T="L-request-T",t.L_REQUEST_R="L-request-R",t.L_PARSE_NAVI_E="L-parse_navi-E",t.L_ENV_S="L-Env-S",t.L_GET_INDEX_NAVI_S="L-get_index_navi-S",t.A_JOIN_CHATROOM_T="A-join_chatroom-T",t.A_JOIN_CHATROOM_R="A-join_chatroom-R",t.L_JOIN_CHATROOM_T="L-join_chatroom-T",t.L_JOIN_CHATROOM_R="L-join_chatroom-R",t.A_QUIT_CHATROOM_T="A-quit_chatroom-T",t.A_QUIT_CHATROOM_R="A-quit_chatroom-R",t.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",t.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",t.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",t.L_MEDIA_S="L-media-S",t.L_MEDIA_UPLOAD_T="L-media_upload-T",t.L_MEDIA_UPLOAD_R="L-media_upload-R",t.G_UPLOAD_LOG_S="G-upload_log-S",t.G_REPORT_LOG_S="G-report_log-S",t.G_UPLOAD_LOG_E="G-upload_log-E",t.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",t.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",t.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",t.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",t.A_GET_HISTORY_MSG_T="A-get_history_msg-T",t.A_GET_HISTORY_MSG_R="A-get_history_msg-R",t.L_GET_HISTORY_MSG_T="L-get_history_msg-T",t.L_GET_HISTORY_MSG_R="L-get_history_msg-R",t.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",t.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",t.A_CALLBACK_O="A-callback-O",t.A_CALLBACK_E="A-callback-E",t.L_CALLBACK_E="L-callback-E",t.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",t.L_PB_ENCODE_E="L-pb-encode-E",t.L_PB_DECODE_E="L-pb-decode-E",t.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",t.L_REPORT_FULL_LOG_O="L-report_full_log-O",t.L_REPORT_FULL_LOG_T="L-report_full_log-T",t.L_REPORT_FULL_LOG_R="L-report_full_log-R",t.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",t.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",t.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",t.L_LOGDB_CLOSED_S="L-logDB_closed-S",t.L_LOGDB_ERROR_E="L-logDB_error-S",t.L_LOGDB_ABORT_S="L-logDB_abort-S",t.L_REALTIME_LOG_R="L_REALTIME_LOG_R",t.L_REALTIME_LOG_O="L_REALTIME_LOG_O",t.L_REALTIME_LOG_T="L_REALTIME_LOG_T",t.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",t.L_RECV_RMTP_O="L_RECV_RMTP_O",t.L_RECV_RMTP_E="L_RECV_RMTP_E",t.L_RECV_S_NTF_O="L-recv_s_ntf_O",t.L_VER_REPORT_T="L-VER_REPORT-T",t.L_VER_REPORT_R="L-VER_REPORT-R",t.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",t.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",t.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",t.A_REMOVE_PROXY_O="A-remove_proxy-O",t.A_SET_PROXY_O="A-set_proxy-O",t.A_TEST_PROXY_O="A-test_proxy-O",t.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",t.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",t.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",t.L_GET_STATIC_CONF_T="L-get_static_conf-T",t.L_GET_STATIC_CONF_R="L-get_static_conf-R",t.L_GET_STATIC_CONF_E="L-get_static_conf-E"}(pt||(pt={})),function(t){t.IM_NAVI="IM-stats_navi-S",t.IM_WEBSOCKET="IM-stats_websocket-S",t.IM_CONNECTION_DURATION="IM-stats_con_dur-S",t.IM_CMP="IM-stats_cmp-S",t.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",t.IM_STATS_CS="IM-stats_cs-S",t.IM_NETWORK_CHANGE="IM-stats_network_change-S"}(ft||(ft={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(_t||(_t={}));var Tt,vt,yt=_t;!function(t){t[t.GLOBAL=1]="GLOBAL",t[t.CUSTOM=2]="CUSTOM",t[t.THIRD_PARTY=3]="THIRD_PARTY"}(Tt||(Tt={})),function(t){t[t.MSG_ORIGINAL=0]="MSG_ORIGINAL",t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY"}(vt||(vt={}));var Ct,mt=Tt;!function(t){t[t.typing=0]="typing"}(Ct||(Ct={}));var It,Rt,St=Ct;!function(t){t[t.SENDING=10]="SENDING",t[t.FAILED=20]="FAILED",t[t.SENT=30]="SENT",t[t.RECEIVED=40]="RECEIVED",t[t.READ=50]="READ",t[t.DESTROYED=60]="DESTROYED"}(It||(It={})),function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(Rt||(Rt={}));var Ot,Nt=Rt;!function(t){t[t.Deblock=0]="Deblock",t[t.Blocked=1]="Blocked"}(Ot||(Ot={}));var Mt,Ut=Ot;!function(t){t[t.UnmuteUsers=0]="UnmuteUsers",t[t.MuteUsers=1]="MuteUsers",t[t.UnmuteAll=2]="UnmuteAll",t[t.MuteAll=3]="MuteAll",t[t.RemoveWhitelist=4]="RemoveWhitelist",t[t.AddWhitelist=5]="AddWhitelist",t[t.UnmuteGloble=6]="UnmuteGloble",t[t.MuteGloble=7]="MuteGloble"}(Mt||(Mt={}));var Lt,At=Mt;!function(t){t[t.LeaveOnMyOwn=0]="LeaveOnMyOwn",t[t.OtherDeviceLogin=1]="OtherDeviceLogin"}(Lt||(Lt={}));var wt,bt,Pt,Dt,Vt,Gt,Bt,kt,xt,Ft,Kt,Ht,qt,Yt,jt,Qt,Wt,Jt=Lt;!function(t){t[t.RMTP=1]="RMTP",t[t.TLS=2]="TLS",t[t.RPP=3]="RPP",t[t.QUIC=4]="QUIC",t[t.WS=5]="WS",t[t.WSS=6]="WSS",t[t.HTTP=11]="HTTP",t[t.HTTPS=12]="HTTPS"}(wt||(wt={})),function(t){t.NAVI="rc-navi",t.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp"}(bt||(bt={})),function(t){t[t.PUBLIC=0]="PUBLIC",t[t.PRIVATE=1]="PRIVATE"}(Pt||(Pt={})),function(t){t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Dt||(Dt={})),function(t){t[t.MSG_EXPANSION=1]="MSG_EXPANSION",t[t.MSG_MODIFY=2]="MSG_MODIFY",t[t.MSG_RECALL=3]="MSG_RECALL",t[t.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",t[t.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}(Vt||(Vt={})),function(t){t[t.CHANNEL_DELETE=1]="CHANNEL_DELETE",t[t.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",t[t.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",t[t.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",t[t.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",t[t.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(Gt||(Gt={})),function(t){t[t.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",t[t.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",t[t.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",t[t.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",t[t.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(Bt||(Bt={})),function(t){t[t.NOT_MENTIONED=0]="NOT_MENTIONED",t[t.ALL=1]="ALL",t[t.ME=2]="ME"}(kt||(kt={})),function(t){t[t.PRIVATE=1]="PRIVATE",t[t.OPEN=0]="OPEN"}(xt||(xt={})),function(t){t[t.NAVI=1]="NAVI",t[t.TCP=2]="TCP",t[t.WS=3]="WS"}(Ft||(Ft={})),function(t){t[t.REQUEST=0]="REQUEST",t[t.LOCAL=1]="LOCAL"}(Kt||(Kt={})),function(t){t[t.CURRENT=2]="CURRENT"}(Ht||(Ht={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT"}(qt||(qt={})),function(t){t[t.CONNECT=0]="CONNECT",t[t.RECONNECT=1]="RECONNECT",t[t.REDIRECTED=3]="REDIRECTED",t[t.TIMEOUT=4]="TIMEOUT"}(Yt||(Yt={})),function(t){t[t.RTC=0]="RTC",t[t.LIVE=2]="LIVE",t[t.SIP=4]="SIP",t[t.CALL=5]="CALL",t[t.MEETING=6]="MEETING",t[t.CROSS_MUTI=7]="CROSS_MUTI",t[t.CROSS_LIVE=8]="CROSS_LIVE"}(jt||(jt={})),function(t){t[t.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",t[t.AUDIO=1]="AUDIO"}(Qt||(Qt={})),function(t){t[t.ANCHOR=1]="ANCHOR",t[t.AUDIENCE=2]="AUDIENCE"}(Wt||(Wt={}));var Xt,Zt,zt,$t={"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(t){t[t.ROOM=1]="ROOM",t[t.PERSON=2]="PERSON"}(Xt||(Xt={})),function(t){t[t.AnchorToViewer=1]="AnchorToViewer",t[t.ViewerToAnchor=2]="ViewerToAnchor"}(Zt||(Zt={})),function(t){t[t.KICK=0]="KICK",t[t.REFUSE=1]="REFUSE",t[t.COEXIST=2]="COEXIST"}(zt||(zt={}));var te=function(t){return"string"==typeof t},ee=function(t){return"boolean"==typeof t},ne=function(t){return"number"==typeof t&&!Number.isNaN(t)},ie=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")},re=function(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)},oe=function(t){return te(t)&&t.length>0},se=function(t){return ie(t)&&t.length>0},ae=function(t){return"[object Object]"===Object.prototype.toString.call(t)},ue=function(t){return"[object Function]"===Object.prototype.toString.call(t)},ce=function(t){return void 0===t||"[object Undefined]"===Object.prototype.toString.call(t)},le=function(t){return"[object Null]"===Object.prototype.toString.call(t)},he=function(t){return te(t)&&/https?:\/\//.test(t)},de=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1},ge=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call($,t)},pe=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call(at,t)},fe=function(t){var e=!1;return te(t)&&!/_/g.test(t)&&t.length<=20&&(e=!0),e},_e=function(t){return[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE,$.APP_PUBLIC_SERVICE].includes(t)},Ee=function(t){return ne(t)&&Object.prototype.hasOwnProperty.call(Q,t)},Te=function(t){var e=!1,n=!1,i=!1;if(ae(t)){var r=Object.keys(t).length;for(var o in e=r>20,t)if(n||(n=te(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!i){var s=t[o];i=o.length>32||s.length>4096}}return{isExceedLimit:e,isIllgalEx:n,isExKeyOrValLengthExceedLimit:i}},ve=function(){function t(){this._map={}}return t.prototype.on=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n})},t.prototype.once=function(t,e,n){var i=this._map[t]||(this._map[t]=[]);i.some((function(t){return t.listener===e&&t.target===n}))||i.push({listener:e,target:n,once:!0})},t.prototype.off=function(t,e,n){var i=this._map[t];i&&((i=i.filter((function(t){return t.listener!==e||t.target!==n}))).length?this._map[t]=i:delete this._map[t])},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var i=this._map[t];if(i)for(var r=i.length-1;r>=0;r-=1){var o=i[r],s=o.target,a=o.once,u=o.listener;a&&i.splice(r,1);try{u.call.apply(u,h([s],e,!1))}catch(t){null===console||void 0===console||console.error(t)}}},t.prototype.removeAll=function(t){delete this._map[t]},t.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},t}(),ye="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};ye.engine="5.8.4-alpha.8";var Ce=function(){function t(){}return t.add=function(t,e){ye[t]=e},t.validEngine=function(t){var e=t.match(/\d+\.\d+\.\d+/);if(!e)return!1;var n=e[0].split(".").map((function(t){return t.padStart(3,"0")})).join("");return ye.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(t){return t.padStart(3,"0")})).join("")>=n},t.getInfo=function(){return ye},t}(),me=null;function Ie(t,e,n,i){void 0===n&&(n={});var r=["error","warn","info","debug"][3-t];if(me&&t<dt.FATAL)try{var o=JSON.stringify(n);me[r](e,o)}catch(t){console.error(t)}}var Re,Se,Oe=Ie.bind(null,dt.DEBUG),Ne=Ie.bind(null,dt.INFO),Me=Ie.bind(null,dt.WARN),Ue=Ie.bind(null,dt.ERROR),Le=Ie.bind(null,dt.FATAL),Ae=Object.freeze({__proto__:null,init:function(t){me=t},log:Ie,debug:Oe,info:Ne,warn:Me,error:Ue,fatal:Le}),we=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))},be=function(){var t=we();if(t="".concat(t.replace(/-/g,""),"a"),t=function(t){var e="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=e.length+1,i=+t,r=[];do{var o=i%n;i=(i-o)/n,r.unshift(e[o])}while(i);return r.join("")}(t=parseInt(t,16)),t.length>22&&(t=t.slice(0,22)),t.length<22)for(var e=22-t.length,n=0;n<e;n++)t+="0";return t},Pe=function(){function t(t,e){var n=this;this._promise=new Promise((function(e){n._resolve=e,t(n._onResolve.bind(n))})),this._onCancel=e}return t.prototype._onResolve=function(t){this._resolve(t)},t.prototype.result=function(){return this._promise},t.prototype.abort=function(){this._onCancel(this._onResolve.bind(this))},t}();!function(t){t[t.STRING=0]="STRING",t[t.ONLY_STRING=1]="ONLY_STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.OBJECT=4]="OBJECT",t[t.ARRAY=5]="ARRAY",t[t.CALLBACK=6]="CALLBACK",t[t.CHANNEL_ID=7]="CHANNEL_ID",t[t.CONVERSATION=8]="CONVERSATION"}(Se||(Se={}));var De=((Re={})[Se.STRING]=oe,Re[Se.ONLY_STRING]=te,Re[Se.NUMBER]=ne,Re[Se.BOOLEAN]=function(t){return"boolean"==typeof t},Re[Se.OBJECT]=ae,Re[Se.ARRAY]=ie,Re[Se.CALLBACK]=function(t){var e=!0;return ae(t)||(e=!1),(t=t||{}).onSuccess&&!ue(t.onSuccess)&&(e=!1),t.onError&&!ue(t.onError)&&(e=!1),e},Re[Se.CHANNEL_ID]=fe,Re[Se.CONVERSATION]=function(t){var e=!0;return ae(t)||(e=!1),te(t.targetId)||(e=!1),ge(t.conversationType)||(e=!1),ce(t.channelId)||fe(t.channelId)||(e=!1),e},Re),Ve=function(t){function e(e){var n=t.call(this,e)||this;return n.name="RCAssertError",n}return a(e,t),e}(Error),Ge=function(t,e,n,i){if(void 0===i&&(i=!1),!Be(t,e,n,i))throw new Ve("'".concat(t,"' is invalid: ").concat(JSON.stringify(e)))},Be=function(t,e,n,i){void 0===i&&(i=!1),n=De[n]||n;var r=i?n(e):ce(e)||null==e||n(e);return r||null===console||void 0===console||console.error("'".concat(t,"' is invalid: ").concat(JSON.stringify(e))),r},ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function xe(t){var e,n,i,r,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=ke.indexOf(t.charAt(u++))<<2|(r=ke.indexOf(t.charAt(u++)))>>4,n=(15&r)<<4|(o=ke.indexOf(t.charAt(u++)))>>2,i=(3&o)<<6|(s=ke.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a}function Fe(t){for(var e=null===window||void 0===window?void 0:window.atob(t),n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n.buffer}var Ke,He,qe,Ye,je=function(t){if(!ae(t)||void 0===t.low||void 0===t.high)return t;var e=t.low;return e<0&&(e+=4294967296),e=e.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(e.length,"}$")),e),16)},Qe=function(t,e){var n=Math.floor(1e3*Math.random()%1e4),i=we(),r=function(t){t=t||"-";var e=new Date,n=e.getFullYear(),i=e.getMonth()+1,r=e.getDate();return"".concat(n).concat(t).concat(i).concat(t).concat(r)}(),o=(new Date).getTime(),s="";if(e){var a=e.split(".");s=".".concat(a[a.length-1])}return"".concat(t,"__RC-").concat(r,"_").concat(n,"_").concat(o).concat(i).concat(s)},We=function(t){var e="application/octet-stream";switch(t){case Q.IMAGE:e="image/jpeg";break;case Q.AUDIO:e="audio/amr";break;case Q.VIDEO:e="video/3gpp";break;case Q.SIGHT:e="video/mpeg4";break;case Q.COMBINE_HTML:e="text/html"}return e},Je=function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=t.threadId,i=t.apnsCollapseId,r=t.category,o=t.richMediaUri,s=e.channelIdMi,a=e.channelIdHW,u=e.channelIdOPPO,c=e.typeVivo,l=e.googleConfig,h=e.miLargeIconUrl,d=e.importanceHW,g=e.categoryHW,p=e.imageUrlHW,f=e.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=i||"",_.category=r||"",_.richMediaUri=o||"";var E={};E.collapse_key=null==l?void 0:l.collapseKey,E.imageUrl=null==l?void 0:l.imageUrl;var T=null==l?void 0:l.priority;T&&!["high","normal"].includes(T)&&(T="normal"),E.priority=T;var v=[{HW:{channelId:a||"",importance:d||"NORMAL",image:p||"",category:g||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:u||""}},{VIVO:{classification:c||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(v)},Xe=function(t,e,n){var i={},r={notificationId:n||""};if(!e)return{iOSConfig:i,androidConfig:r};try{var o=JSON.parse(e);null==o||o.forEach((function(t){var e,n,o,s,a,u,c,l,h,d=Object.keys(t);if(0!==d.length){var g=d[0];switch(g){case"HW":return r.channelIdHW=null===(e=t[g])||void 0===e?void 0:e.channelId,r.importanceHW=null===(n=t[g])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(o=t[g])||void 0===o?void 0:o.image,void(r.categoryHW=null===(s=t[g])||void 0===s?void 0:s.category);case"MI":return r.channelIdMi=null===(a=t[g])||void 0===a?void 0:a.channelId,void(r.miLargeIconUrl=null===(u=t[g])||void 0===u?void 0:u.large_icon_uri);case"OPPO":return void(r.channelIdOPPO=null===(c=t[g])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(l=t[g])||void 0===l?void 0:l.classification,void(r.categoryVivo=null===(h=t[g])||void 0===h?void 0:h.category);case"APNS":return i.threadId=t[g]["thread-id"],i.apnsCollapseId=t[g]["apns-collapse-id"],i.category=t[g].category,void(i.richMediaUri=t[g].richMediaUri);case"FCM":r.googleConfig={collapseKey:t[g].collapse_key||"",imageUrl:t[g].imageUrl||"",priority:t[g].priority||""}}}}))}catch(n){t.error(pt.O,"Wrong format for pushConfigs field! content: ".concat(e))}return{iOSConfig:i,androidConfig:r}},Ze=function(t){var e=/^[A-Za-z0-9_=+-]+$/.test(t),n=t.length;return e&&(n<=128&&n>=1)},ze=function(t){var e=t.length;return e<=4096&&e>=1},$e=(Ke=0,function(){var t=((4294967295&Date.now())>>>0).toString(2),e=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=t+Ke.toString(2).padStart(11,"0")+e.toString(2).padStart(20,"0");return Ke=2047&++Ke,parseInt(n,2)}),tn=function(){var t=Ce.getInfo(),e="electron";for(var n in t)"engine"!==n&&(e=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return e},en=function(t,e,n){return c(void 0,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(e),"AES-CBC",!0,["decrypt"])];case 1:return i=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},i,Fe(t))];case 2:return r=o.sent(),[2,(new TextDecoder).decode(r)]}}))}))};function nn(t,e){var n;if(!t)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(t)?i?t.replace(/^https?:\/\//i,"https://"):t:e!==wt.HTTP||i?"https://".concat(t):"http://".concat(t)}!function(t){t.GET="GET",t.POST="POST",t.PUT="PUT"}(He||(He={})),function(t){t.WIFI="wifi",t.FOUR_G="4g",t.THREE_G="3g",t.TWO_G="2g",t.FIVE_G="2g",t.THREE_GENT="3gnet",t.UNKONWN="unknown"}(qe||(qe={})),function(t){t[t.add=1]="add",t[t.update=2]="update",t[t.delete=3]="delete"}(Ye||(Ye={}));var rn=function(){var t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;return"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")};function on(t){var e=t.method||He.GET,n=t.timeout||y,i=t.headers,r=t.query,o=t.body,s=t.onProgress,a=T(t.url,r),u=rn(),c="[object XDomainRequest]"===Object.prototype.toString.call(u);if(u.open(e,a),i&&u.setRequestHeader)for(var l in i)u.setRequestHeader(l,i[l]);return c?function(t,e,n){return new Pe((function(i){0!==e&&(t.timeout=e),t.onload=function(){i({data:t.responseText,status:t.status||200})},t.onerror=function(){i({status:t.status})},t.ontimeout=function(){i({status:t.status})};var r="object"==typeof n?JSON.stringify(n):n;t.send(r)}),(function(e){t.abort(),e({status:-1})}))}(u,n,o):function(t,e,n,i){return new Pe((function(r){t.onreadystatechange=function(){4===t.readyState&&r({data:t.responseText,status:t.status,xhr:t})},t.onerror=function(){r({status:t.status})},i&&(t.upload.onprogress=function(t){return i(t)}),0!==e&&setTimeout((function(){t.abort(),r({status:t.status})}),e),t.send(n)}),(function(e){t.abort(),e({status:-1})}))}(u,n,o,s)}var sn,an,un=function(t,e,n){var i=null==n?void 0:n.isReverse;ae(t)&&function(){for(var n in t)e(t[n],n,t)}(),(ie(t)||te(t))&&function(){if(i)for(var n=t.length-1;n>=0;n--)e(t[n],n);else for(var r=0,o=t.length;r<o;r++)e(t[r],r)}()},cn=function(t,e){return un(t,(function(n,i){t[i]=e(n,i)})),t},ln=function(t,e){if(t.indexOf)return t.indexOf(e);var n=-1;return un(t,(function(t,i){e===t&&(n=i)})),n},hn=function(t,e){return-1!==ln(t,e)},dn=function(t,e){var n=[];return un(t,(function(t){n.push(t)})),-1!==ln(n,e)},gn=function(t){return JSON.parse(JSON.stringify(t))},pn=function(){return"undefined"!=typeof RCCppEngine},fn=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},_n=function(t){var e;if("object"==typeof t&&null!==t)if(Array.isArray(t))for(var n in e=[],t)e.push(_n(t[n]));else for(var n in e={},t)e[n]=_n(t[n]);else e=t;return e},En=function(t){var e;try{e=_n(t)}catch(n){e=JSON.parse(JSON.stringify(t))}return e},Tn={_delayTime:0,setTime:function(t){var e=(new Date).getTime();Tn._delayTime=e-t},getTime:function(){var t=Tn._delayTime;return(new Date).getTime()-t}},vn=function(t,e){var n=0;return t.isAutoDelete&&(n|=1),t.isOverwrite&&(n|=2),2===e&&(n|=4),n},yn=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}return t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.roomId,n=t.timestamp,(i=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,o===Z.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},t.prototype.pullEntry=function(t,e){this._pullQueue.push({roomId:t,timestamp:e}),this._startPull()},t.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},t}(),Cn="rtcRJoin_data",mn="rtcRExit",In="rtcRInfo",Rn="rtcUData",Sn="rtcUPut",On="rtcUDel",Nn="rtcSetData",Mn="userSetData",Un="rtcQryData",Ln="rtcDelData",An="rtcToken",wn="rtcUserState",bn="rtcUList",Pn="viewerJoinR",Dn="viewerExitR",Vn="rtcPullKv",Gn="rtcIdentityChange",Bn="rtcInvite",kn="rtcCancelInvite",xn="rtcInviteAnswer",Fn="rtcEndInvite",Kn="rtcQueryJoined";!function(t){t.RtcInput="RtcInput",t.RtcUserListOutput="RtcUserListOutput",t.SetUserStatusInput="SetUserStatusInput",t.RtcSetDataInput="RtcSetDataInput",t.RtcUserSetDataInput="RtcUserSetDataInput",t.RtcDataInput="RtcDataInput",t.RtcSetOutDataInput="RtcSetOutDataInput",t.MCFollowInput="MCFollowInput",t.RtcTokenOutput="RtcTokenOutput",t.RtcQryOutput="RtcQryOutput",t.RtcQryUserOutDataInput="RtcQryUserOutDataInput",t.RtcUserOutDataOutput="RtcUserOutDataOutput",t.RtcQueryListInput="RtcQueryListInput",t.RtcRoomInfoOutput="RtcRoomInfoOutput",t.RtcValueInfo="RtcValueInfo",t.RtcKeyDeleteInput="RtcKeyDeleteInput",t.RtcNotifyMsg="RtcNotifyMsg",t.RtcPullKV="RtcPullKV",t.RtcKVOutput="RtcKVOutput",t.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",t.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",t.RtcViewerJoinedOutput="RtcViewerJoinedOutput",t.RtcInviteInput="RtcInviteInput",t.RtcCancelInviteInput="RtcCancelInviteInput",t.RtcInviteAnswerInput="RtcInviteAnswerInput",t.RtcEndInviteInput="RtcEndInviteInput",t.RtcOutput="RtcOutput"}(an||(an={}));var Hn=((sn={})[an.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],sn[an.RtcUserListOutput]=["users","token","sessionId","roomInfo"],sn[an.SetUserStatusInput]=["status"],sn[an.RtcSetDataInput]=["interior","target","key","value","objectName","content"],sn[an.RtcUserSetDataInput]=["valueInfo","objectName","content"],sn[an.RtcDataInput]=["interior","target","key","objectName","content"],sn[an.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],sn[an.MCFollowInput]=["state"],sn[an.RtcTokenOutput]=["rtcToken"],sn[an.RtcQryOutput]=["outInfo"],sn[an.RtcQryUserOutDataInput]=["userId"],sn[an.RtcUserOutDataOutput]=["user"],sn[an.RtcQueryListInput]=["order"],sn[an.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],sn[an.RtcValueInfo]=["key","value"],sn[an.RtcKeyDeleteInput]=["key"],sn[an.RtcNotifyMsg]=["type","time","roomId"],sn[an.RtcPullKV]=["timestamp","roomId"],sn[an.RtcKVOutput]=["entries","bFullUpdate","syncTime"],sn[an.RtcQueryUserJoinedInput]=["userId"],sn[an.RtcQueryUserJoinedOutput]=["info"],sn[an.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],sn[an.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],sn[an.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],sn[an.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],sn),qn="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(an.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(an.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(an.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(an.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(an.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(an.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(an.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 ").concat(an.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(an.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(an.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(an.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(an.RtcQryOutput,"{\n repeated ").concat(an.RtcValueInfo," outInfo=1;\n }\n message ").concat(an.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(an.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(an.RtcUserSetDataInput," {\n repeated ").concat(an.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(an.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(an.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(an.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(an.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(an.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(an.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(an.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(an.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(an.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(an.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(an.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(an.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(an.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(an.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(an.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(an.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"),Yn=function(){function t(t,e,n,i,r,o){this.runtime=t,this.rtcCodec=e,this._watcher=n,this._options=i,this.logger=r,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new yn(this)}return t.prototype.registerRTCSignalingListener=function(t){this._rtcSignalingListener=t},t.prototype.getInnerLogger=function(){return this.logger},t.prototype.getInnerStatisticLog=function(){return this.statisticLog},t.prototype.pullRTCRoomEntry=function(t,e){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=this.rtcCodec.encode(an.RtcPullKV,{timestamp:0,roomId:t}),[4,this.rtcSignaling(t,Vn,!0,e)];case 1:return n=c.sent(),i=n.code,r=n.buffer,i!==Z.SUCCESS?[2,{code:i}]:(o=this.rtcCodec.decode(an.RtcKVOutput,r),s=o.entries,a=o.syncTime,s=(s||[]).map((function(t){return u(u({},t),{timestamp:je(t.timestamp)})})),this._watcher.onRTCDataChange(s,t),[2,{code:i,data:{kvEntries:s,syncTime:je(a)}}])}}))}))},t.prototype._receiveRtcKv=function(t){if(this._rtcSignalingListener)this._rtcSignalingListener(t);else{var e=this.rtcCodec.decode(an.RtcNotifyMsg,t),n=e.time,i=e.type,r=e.roomId;1===i&&this._rtcKVManager.pullEntry(r,je(n))}},t.prototype.destroy=function(){},t}();function jn(t){var e=function(){function t(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function e(t){return!0===(t&&t.__isLong__)}function n(t,e){var n,i,o;return e?(o=(t>>>=0)>=0&&t<256)&&(i=u[t])?i:(n=r(t,(0|t)<0?-1:0,!0),o&&(u[t]=n),n):(o=(t|=0)>=-128&&t<128)&&(i=a[t])?i:(n=r(t,t<0?-1:0,!1),o&&(a[t]=n),n)}function i(t,e){if(isNaN(t)||!isFinite(t))return e?f:p;if(e){if(t<0)return f;if(t>=h)return y}else{if(-d>=t)return C;if(t+1>=d)return v}return t<0?i(-t,e).neg():r(0|t%l,0|t/l,e)}function r(e,n,i){return new t(e,n,i)}function o(t,e,n){var r,s,a,u,l,h,d;if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return p;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||n>36)throw RangeError("radix");if((r=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return o(t.substring(1),e,n).neg();for(s=i(c(n,8)),a=p,u=0;u<t.length;u+=8)l=Math.min(8,t.length-u),h=parseInt(t.substring(u,u+l),n),l<8?(d=i(c(n,l)),a=a.mul(d).add(i(h))):a=(a=a.mul(s)).add(i(h));return a.unsigned=e,a}function s(e){return e instanceof t?e:"number"==typeof e?i(e):"string"==typeof e?o(e):r(e.low,e.high,e.unsigned)}var a,u,c,l,h,d,g,p,f,_,E,T,v,y,C,m;return t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),t.isLong=e,a={},u={},t.fromInt=n,t.fromNumber=i,t.fromBits=r,c=Math.pow,t.fromString=o,t.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,g=n(16777216),p=n(0),t.ZERO=p,f=n(0,!0),t.UZERO=f,_=n(1),t.ONE=_,E=n(1,!0),t.UONE=E,T=n(-1),t.NEG_ONE=T,v=r(-1,2147483647,!1),t.MAX_VALUE=v,y=r(-1,-1,!0),t.MAX_UNSIGNED_VALUE=y,C=r(0,-2147483648,!1),t.MIN_VALUE=C,(m=t.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},m.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},m.toString=function(t){var e,n,r,o,s,a,u,l;if((t=t||10)<2||t>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(C)?(e=i(t),r=(n=this.div(e)).mul(e).sub(this),n.toString(t)+r.toInt().toString(t)):"-"+this.neg().toString(t);for(o=i(c(t,6),this.unsigned),s=this,a="";;){if(u=s.div(o),l=(s.sub(u.mul(o)).toInt()>>>0).toString(t),(s=u).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},m.getHighBits=function(){return this.high},m.getHighBitsUnsigned=function(){return this.high>>>0},m.getLowBits=function(){return this.low},m.getLowBitsUnsigned=function(){return this.low>>>0},m.getNumBitsAbs=function(){var t,e;if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<<e);e--);return 0!=this.high?e+33:e+1},m.isZero=function(){return 0===this.high&&0===this.low},m.isNegative=function(){return!this.unsigned&&this.high<0},m.isPositive=function(){return this.unsigned||this.high>=0},m.isOdd=function(){return 1==(1&this.low)},m.isEven=function(){return 0==(1&this.low)},m.equals=function(t){return e(t)||(t=s(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},m.eq=m.equals,m.notEquals=function(t){return!this.eq(t)},m.neq=m.notEquals,m.lessThan=function(t){return this.comp(t)<0},m.lt=m.lessThan,m.lessThanOrEqual=function(t){return this.comp(t)<=0},m.lte=m.lessThanOrEqual,m.greaterThan=function(t){return this.comp(t)>0},m.gt=m.greaterThan,m.greaterThanOrEqual=function(t){return this.comp(t)>=0},m.gte=m.greaterThanOrEqual,m.compare=function(t){if(e(t)||(t=s(t)),this.eq(t))return 0;var n=this.isNegative(),i=t.isNegative();return n&&!i?-1:!n&&i?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},m.comp=m.compare,m.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(_)},m.neg=m.negate,m.add=function(t){var n,i,o,a,u,c,l,h,d,g,p;return e(t)||(t=s(t)),n=this.high>>>16,i=65535&this.high,o=this.low>>>16,a=65535&this.low,u=t.high>>>16,c=65535&t.high,l=t.low>>>16,h=0,d=0,g=0,p=0,g+=(p+=a+(65535&t.low))>>>16,d+=(g+=o+l)>>>16,h+=(d+=i+c)>>>16,h+=n+u,r((g&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},m.subtract=function(t){return e(t)||(t=s(t)),this.add(t.neg())},m.sub=m.subtract,m.multiply=function(t){var n,o,a,u,c,l,h,d,f,_,E,T;return this.isZero()?p:(e(t)||(t=s(t)),t.isZero()?p:this.eq(C)?t.isOdd()?C:p:t.eq(C)?this.isOdd()?C:p:this.isNegative()?t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg():t.isNegative()?this.mul(t.neg()).neg():this.lt(g)&&t.lt(g)?i(this.toNumber()*t.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,u=65535&this.low,c=t.high>>>16,l=65535&t.high,h=t.low>>>16,f=0,_=0,E=0,T=0,E+=(T+=u*(d=65535&t.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=u*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=u*l)>>>16,f+=n*d+o*h+a*l+u*c,r((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},m.mul=m.multiply,m.divide=function(t){var n,r,o,a,u,l,h;if(e(t)||(t=s(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:p;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return f;if(t.gt(this.shru(1)))return E;o=f}else{if(this.eq(C))return t.eq(_)||t.eq(T)?C:t.eq(C)?_:(n=this.shr(1).div(t).shl(1)).eq(p)?t.isNegative()?_:T:(r=this.sub(t.mul(n)),o=n.add(r.div(t)));if(t.eq(C))return this.unsigned?f:p;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=p}for(r=this;r.gte(t);){for(n=Math.max(1,Math.floor(r.toNumber()/t.toNumber())),u=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:c(2,a-48),h=(l=i(n)).mul(t);h.isNegative()||h.gt(r);)h=(l=i(n-=u,this.unsigned)).mul(t);l.isZero()&&(l=_),o=o.add(l),r=r.sub(h)}return o},m.div=m.divide,m.modulo=function(t){return e(t)||(t=s(t)),this.sub(this.div(t).mul(t))},m.mod=m.modulo,m.not=function(){return r(~this.low,~this.high,this.unsigned)},m.and=function(t){return e(t)||(t=s(t)),r(this.low&t.low,this.high&t.high,this.unsigned)},m.or=function(t){return e(t)||(t=s(t)),r(this.low|t.low,this.high|t.high,this.unsigned)},m.xor=function(t){return e(t)||(t=s(t)),r(this.low^t.low,this.high^t.high,this.unsigned)},m.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):r(0,this.low<<t-32,this.unsigned)},m.shl=m.shiftLeft,m.shiftRight=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?r(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):r(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},m.shr=m.shiftRight,m.shiftRightUnsigned=function(t){var n;return e(t)&&(t=t.toInt()),0===(t&=63)?this:(n=this.high,t<32?r(this.low>>>t|n<<32-t,n>>>t,this.unsigned):r(32===t?n:n>>>t-32,0,this.unsigned))},m.shru=m.shiftRightUnsigned,m.toSigned=function(){return this.unsigned?r(this.low,this.high,!1):this},m.toUnsigned=function(){return this.unsigned?this:r(this.low,this.high,!0)},m.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},m.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,255&e>>>8,255&e>>>16,255&e>>>24,255&t,255&t>>>8,255&t>>>16,255&t>>>24]},m.toBytesBE=function(){var t=this.high,e=this.low;return[255&t>>>24,255&t>>>16,255&t>>>8,255&t,255&e>>>24,255&e>>>16,255&e>>>8,255&e]},t}(),n=function(t){function e(t){var e=0;return function(){return e<t.length?t.charCodeAt(e++):null}}function n(){var t=[],e=[];return function(){return 0===arguments.length?e.join("")+a.apply(String,t):(t.length+arguments.length>1024&&(e.push(a.apply(String,t)),t.length=0),void Array.prototype.push.apply(t,arguments))}}function i(t,e,n,i,r){var o,s,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,g=t[e+h];for(h+=d,o=g&(1<<-l)-1,g>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,i),o-=c}return(g?-1:1)*s*Math.pow(2,o-i)}function r(t,e,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,p=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+g]=255&a,g+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[n+g]=255&s,g+=p,s/=256,c-=8);t[n+g-p]|=128*f}var o,s,a,u,c,l=function(t,e,n){if(void 0===t&&(t=l.DEFAULT_CAPACITY),void 0===e&&(e=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((t|=0)<0)throw RangeError("Illegal capacity");e=!!e,n=!!n}this.buffer=0===t?s:new ArrayBuffer(t),this.view=0===t?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=t,this.littleEndian=e,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=t||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(t,e,n){return new l(t,e,n)},l.concat=function(t,e,n,i){var r,o,s,a,u,c;for(("boolean"==typeof e||"string"!=typeof e)&&(i=n,n=e,e=void 0),r=0,s=0,a=t.length;a>s;++s)l.isByteBuffer(t[s])||(t[s]=l.wrap(t[s],e)),(o=t[s].limit-t[s].offset)>0&&(r+=o);if(0===r)return new l(0,n,i);for(c=new l(r,n,i),s=0;a>s;)(o=(u=t[s++]).limit-u.offset)<=0||(c.view.set(u.view.subarray(u.offset,u.limit),c.offset),c.offset+=o);return c.limit=c.offset,c.offset=0,c},l.isByteBuffer=function(t){return!0===(t&&t.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(t,e,n,i){var r,s;if("string"!=typeof e&&(i=n,n=e,e=void 0),"string"==typeof t)switch(void 0===e&&(e="utf8"),e){case"base64":return l.fromBase64(t,n);case"hex":return l.fromHex(t,n);case"binary":return l.fromBinary(t,n);case"utf8":return l.fromUTF8(t,n);case"debug":return l.fromDebug(t,n);default:throw Error("Unsupported encoding: "+e)}if(null===t||"object"!=typeof t)throw TypeError("Illegal buffer");if(l.isByteBuffer(t))return(r=o.clone.call(t)).markedOffset=-1,r;if(t instanceof Uint8Array)r=new l(0,n,i),t.length>0&&(r.buffer=t.buffer,r.offset=t.byteOffset,r.limit=t.byteOffset+t.byteLength,r.view=new Uint8Array(t.buffer));else if(t instanceof ArrayBuffer)r=new l(0,n,i),t.byteLength>0&&(r.buffer=t,r.offset=0,r.limit=t.byteLength,r.view=t.byteLength>0?new Uint8Array(t):null);else{if("[object Array]"!==Object.prototype.toString.call(t))throw TypeError("Illegal buffer");for((r=new l(t.length,n,i)).limit=t.length,s=0;s<t.length;++s)r.view[s]=t[s]}return r},o.writeBitSet=function(t,e){var n,i,r,o,s,a,u=void 0===e;if(u&&(e=this.offset),!this.noAssert){if(!(t instanceof Array))throw TypeError("Illegal BitSet: Not an array");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)}for(i=e,o=(r=t.length)>>3,s=0,e+=this.writeVarint32(r,e);o--;)n=1&!!t[s++]|(1&!!t[s++])<<1|(1&!!t[s++])<<2|(1&!!t[s++])<<3|(1&!!t[s++])<<4|(1&!!t[s++])<<5|(1&!!t[s++])<<6|(1&!!t[s++])<<7,this.writeByte(n,e++);if(r>s){for(a=0,n=0;r>s;)n|=(1&!!t[s++])<<a++;this.writeByte(n,e++)}return u?(this.offset=e,this):e-i},o.readBitSet=function(t){var e,n,i,r,o,s,a,u=void 0===t;for(u&&(t=this.offset),r=(i=(n=this.readVarint32(t)).value)>>3,o=0,s=[],t+=n.length;r--;)e=this.readByte(t++),s[o++]=!!(1&e),s[o++]=!!(2&e),s[o++]=!!(4&e),s[o++]=!!(8&e),s[o++]=!!(16&e),s[o++]=!!(32&e),s[o++]=!!(64&e),s[o++]=!!(128&e);if(i>o)for(a=0,e=this.readByte(t++);i>o;)s[o++]=!!(1&e>>a++);return u&&(this.offset=t),s},o.readBytes=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+t+") <= "+this.buffer.byteLength)}return n=this.slice(e,e+t),i&&(this.offset+=t),n},o.writeBytes=o.append,o.writeInt8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(t){var e,n=void 0===t;if(n&&(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)}return 128==(128&(e=this.view[t]))&&(e=-(255-e+1)),n&&(this.offset+=1),e},o.readByte=o.readInt8,o.writeUint8=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=1,this.view[e]=t,i&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(t){var e,n=void 0===t;if(n&&(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)}return e=this.view[t],n&&(this.offset+=1),e},o.readUInt8=o.readUint8,o.writeInt16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),32768==(32768&e)&&(e=-(65535-e+1)),n&&(this.offset+=2),e},o.readShort=o.readInt16,o.writeUint16=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=2,this.littleEndian?(this.view[e+1]=(65280&t)>>>8,this.view[e]=255&t):(this.view[e]=(65280&t)>>>8,this.view[e+1]=255&t),i&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(t){var e,n=void 0===t;if(n&&(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+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+2) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t],e|=this.view[t+1]<<8):(e=this.view[t]<<8,e|=this.view[t+1]),n&&(this.offset+=2),e},o.readUInt16=o.readUint16,o.writeInt32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),e|=0,n&&(this.offset+=4),e},o.readInt=o.readInt32,o.writeUint32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t>>>=0,"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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,this.littleEndian?(this.view[e+3]=255&t>>>24,this.view[e+2]=255&t>>>16,this.view[e+1]=255&t>>>8,this.view[e]=255&t):(this.view[e]=255&t>>>24,this.view[e+1]=255&t>>>16,this.view[e+2]=255&t>>>8,this.view[e+3]=255&t),i&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=0,this.littleEndian?(e=this.view[t+2]<<16,e|=this.view[t+1]<<8,e|=this.view[t],e+=this.view[t+3]<<24>>>0):(e=this.view[t+1]<<16,e|=this.view[t+2]<<8,e|=this.view[t+3],e+=this.view[t]<<24>>>0),n&&(this.offset+=4),e},o.readUInt32=o.readUint32,t&&(o.writeInt64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!1),o&&(this.offset+=8),r},o.readLong=o.readInt64,o.writeUint64=function(e,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e)),(n+=8)>(i=this.buffer.byteLength)&&this.resize((i*=2)>n?i:n),n-=8,r=e.low,o=e.high,this.littleEndian?(this.view[n+3]=255&r>>>24,this.view[n+2]=255&r>>>16,this.view[n+1]=255&r>>>8,this.view[n]=255&r,n+=4,this.view[n+3]=255&o>>>24,this.view[n+2]=255&o>>>16,this.view[n+1]=255&o>>>8,this.view[n]=255&o):(this.view[n]=255&o>>>24,this.view[n+1]=255&o>>>16,this.view[n+2]=255&o>>>8,this.view[n+3]=255&o,n+=4,this.view[n]=255&r>>>24,this.view[n+1]=255&r>>>16,this.view[n+2]=255&r>>>8,this.view[n+3]=255&r),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return n=0,i=0,this.littleEndian?(n=this.view[e+2]<<16,n|=this.view[e+1]<<8,n|=this.view[e],n+=this.view[e+3]<<24>>>0,e+=4,i=this.view[e+2]<<16,i|=this.view[e+1]<<8,i|=this.view[e],i+=this.view[e+3]<<24>>>0):(i=this.view[e+1]<<16,i|=this.view[e+2]<<8,i|=this.view[e+3],i+=this.view[e]<<24>>>0,e+=4,n=this.view[e+1]<<16,n|=this.view[e+2]<<8,n|=this.view[e+3],n+=this.view[e]<<24>>>0),r=new t(n,i,!0),o&&(this.offset+=8),r},o.readUInt64=o.readUint64),o.writeFloat32=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=4,r(this.view,t,e,this.littleEndian,23,4),i&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(t){var e,n=void 0===t;if(n&&(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+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=i(this.view,t,this.littleEndian,23,4),n&&(this.offset+=4),e},o.readFloat=o.readFloat32,o.writeFloat64=function(t,e){var n,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof t)throw TypeError("Illegal value: "+t+" (not a number)");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(e+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>e?n:e),e-=8,r(this.view,t,e,this.littleEndian,52,8),i&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(t){var e,n=void 0===t;if(n&&(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 e=i(this.view,t,this.littleEndian,52,8),n&&(this.offset+=8),e},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(t){return(t>>>=0)<128?1:t<16384?2:1<<21>t?3:1<<28>t?4:5},l.zigZagEncode32=function(t){return((t|=0)<<1^t>>31)>>>0},l.zigZagDecode32=function(t){return 0|t>>>1^-(1&t)},o.writeVarint32=function(t,e){var n,i,r,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"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)}for((e+=i=l.calculateVarint32(t))>(r=this.buffer.byteLength)&&this.resize((r*=2)>e?r:e),e-=i,t>>>=0;t>=128;)n=128|127&t,this.view[e++]=n,t>>>=7;return this.view[e++]=t,o?(this.offset=e,this):i},o.writeVarint32ZigZag=function(t,e){return this.writeVarint32(l.zigZagEncode32(t),e)},o.readVarint32=function(t){var e,n,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}n=0,i=0;do{if(!this.noAssert&&t>this.limit)throw(r=Error("Truncated")).truncated=!0,r;e=this.view[t++],n<5&&(i|=(127&e)<<7*n),++n}while(0!=(128&e));return i|=0,o?(this.offset=t,i):{value:i,length:n}},o.readVarint32ZigZag=function(t){var e=this.readVarint32(t);return"object"==typeof e?e.value=l.zigZagDecode32(e.value):e=l.zigZagDecode32(e),e},t&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(e){"number"==typeof e?e=t.fromNumber(e):"string"==typeof e&&(e=t.fromString(e));var n=e.toInt()>>>0,i=e.shiftRightUnsigned(28).toInt()>>>0,r=e.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(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftLeft(1).xor(e.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(e){return"number"==typeof e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),e.shiftRightUnsigned(1).xor(e.and(t.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(e,n){var i,r,o,s,a,u=void 0===n;if(u&&(n=this.offset),!this.noAssert){if("number"==typeof e)e=t.fromNumber(e);else if("string"==typeof e)e=t.fromString(e);else if(!(e&&e instanceof t))throw TypeError("Illegal value: "+e+" (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 e?e=t.fromNumber(e,!1):"string"==typeof e?e=t.fromString(e,!1):!1!==e.unsigned&&(e=e.toSigned()),i=l.calculateVarint64(e),r=e.toInt()>>>0,o=e.shiftRightUnsigned(28).toInt()>>>0,s=e.shiftRightUnsigned(56).toInt()>>>0,(n+=i)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=i,i){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==i?128|s:127&s;case 8:this.view[n+7]=8!==i?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==i?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==i?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==i?128|o:127&o;case 4:this.view[n+3]=4!==i?128|r>>>21:127&r>>>21;case 3:this.view[n+2]=3!==i?128|r>>>14:127&r>>>14;case 2:this.view[n+1]=2!==i?128|r>>>7:127&r>>>7;case 1:this.view[n]=1!==i?128|r:127&r}return u?(this.offset+=i,this):i},o.writeVarint64ZigZag=function(t,e){return this.writeVarint64(l.zigZagEncode64(t),e)},o.readVarint64=function(e){var n,i,r,o,s,a,u=void 0===e;if(u&&(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)}if(n=e,i=0,r=0,o=0,s=0,i=127&(s=this.view[e++]),128&s&&(i|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(r=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[e++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[e++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=t.fromBits(i|r<<28,r>>>4|o<<24,!1),u?(this.offset=e,a):{value:a,length:e-n}},o.readVarint64ZigZag=function(e){var n=this.readVarint64(e);return n&&n.value instanceof t?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),r=t.length,!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");for(i=0;r>i;++i)if(0===t.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(e(t))[1],n+=r+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r+1,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):r},o.readCString=function(t){var e,i,r,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,r=-1,c.decodeUTF8toUTF16(function(){if(0===r)return null;if(t>=this.limit)throw RangeError("Illegal range: Truncated data, "+t+" < "+this.limit);return 0===(r=this.view[t++])?null:r}.bind(this),i=n(),!0),o?(this.offset=t,i()):{string:i(),length:t-e}},o.writeIString=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof t)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(e(t),this.noAssert)[1],n+=4+i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+i,this.littleEndian?(this.view[n+3]=255&i>>>24,this.view[n+2]=255&i>>>16,this.view[n+1]=255&i>>>8,this.view[n]=255&i):(this.view[n]=255&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),n+=4,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==r+4+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+i));return s?(this.offset=n,this):n-r},o.readIString=function(t){var e,n,i,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=t,n=this.readUint32(t),i=this.readUTF8String(n,l.METRICS_BYTES,t+=4),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(t,n){var i,r,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return r=n,i=c.calculateUTF16asUTF8(e(t))[1],n+=i,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i,c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),s?(this.offset=n,this):n-r},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(t){return c.calculateUTF16asUTF8(e(t))[0]},l.calculateUTF8Bytes=function(t){return c.calculateUTF16asUTF8(e(t))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(t,e,i){var r,o,s,a,u;if("number"==typeof e&&(i=e,e=void 0),(r=void 0===i)&&(i=this.offset),void 0===e&&(e=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");if(t|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=i,e===l.METRICS_CHARS){if(o=n(),c.decodeUTF8(function(){return t>s&&i<this.limit?this.view[i++]:null}.bind(this),(function(t){++s,c.UTF8toUTF16(t,o)})),s!==t)throw RangeError("Illegal range: Truncated data, "+s+" == "+t);return r?(this.offset=i,o()):{string:o(),length:i-a}}if(e===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+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+t+") <= "+this.buffer.byteLength)}if(u=i+t,c.decodeUTF8toUTF16(function(){return u>i?this.view[i++]:null}.bind(this),o=n(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return r?(this.offset=i,o()):{string:o(),length:i-a}}throw TypeError("Unsupported metrics: "+e)},o.readString=o.readUTF8String,o.writeVString=function(t,n){var i,r,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,i=c.calculateUTF16asUTF8(e(t),this.noAssert)[1],r=l.calculateVarint32(i),n+=r+i,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=r+i,n+=this.writeVarint32(i,n),c.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==o+i+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+i+r));return a?(this.offset=n,this):n-o},o.readVString=function(t){var e,n,i,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,n=this.readVarint32(t),i=this.readUTF8String(n.value,l.METRICS_BYTES,t+=n.length),t+=i.length,r?(this.offset=t,i.string):{string:i.string,length:t-e}},o.append=function(t,e,n){var i,r,o;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=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 t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((n+=r)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=r,this.view.set(t.view.subarray(t.offset,t.limit),n),t.offset+=r,i&&(this.offset+=r)),this},o.appendTo=function(t,e){return t.append(this,e),this},o.assert=function(t){return this.noAssert=!t,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(t){var e=new l(0,this.littleEndian,this.noAssert);return t?(e.buffer=new ArrayBuffer(this.buffer.byteLength),e.view=new Uint8Array(e.buffer)):(e.buffer=this.buffer,e.view=this.view),e.offset=this.offset,e.markedOffset=this.markedOffset,e.limit=this.limit,e},o.compact=function(t,e){var n,i,r;if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return 0===t&&e===this.buffer.byteLength?this:0===(n=e-t)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=0,this):(i=new ArrayBuffer(n),(r=new Uint8Array(i)).set(this.view.subarray(t,e)),this.buffer=i,this.view=r,this.markedOffset>=0&&(this.markedOffset-=t),this.offset=0,this.limit=n,this)},o.copy=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}if(t===e)return new l(0,this.littleEndian,this.noAssert);var n=e-t,i=new l(n,this.littleEndian,this.noAssert);return i.offset=0,i.limit=n,i.markedOffset>=0&&(i.markedOffset-=t),this.copyTo(i,0,t,e),i},o.copyTo=function(t,e,n,i){var r,o,s;if(!this.noAssert&&!l.isByteBuffer(t))throw TypeError("Illegal target: Not a ByteBuffer");if(e=(o=void 0===e)?t.offset:0|e,n=(r=void 0===n)?this.offset:0|n,i=void 0===i?this.limit:0|i,e<0||e>t.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+e+" <= "+t.buffer.byteLength);if(n<0||i>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=i-n)?t:(t.ensureCapacity(e+s),t.view.set(this.view.subarray(n,i),e),r&&(this.offset+=s),o&&(t.offset+=s),this)},o.ensureCapacity=function(t){var e=this.buffer.byteLength;return t>e?this.resize((e*=2)>t?e:t):this},o.fill=function(t,e,n){var i=void 0===e;if(i&&(e=this.offset),"string"==typeof t&&t.length>0&&(t=t.charCodeAt(0)),void 0===e&&(e=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal value: "+t+" (not an integer)");if(t|=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,e<0||e>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+n+" <= "+this.buffer.byteLength)}if(e>=n)return this;for(;n>e;)this.view[e++]=t;return i&&(this.offset=e),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(t){if(t=void 0===t?this.offset:t,!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=t,this},o.order=function(t){if(!this.noAssert&&"boolean"!=typeof t)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!t,this},o.LE=function(t){return this.littleEndian=void 0===t||!!t,this},o.BE=function(t){return this.littleEndian=void 0!==t&&!t,this},o.prepend=function(t,e,n){var i,r,o,s,a;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=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 t instanceof l||(t=l.wrap(t,e)),(r=t.limit-t.offset)<=0||((o=r-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),r),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(t.view.subarray(t.offset,t.limit),n-r),t.offset=t.limit,i&&(this.offset-=r)),this},o.prependTo=function(t,e){return t.prepend(this,e),this},o.printDebug=function(t){"function"!=typeof t&&(t=console.log.bind(console)),t(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(t){var e,n;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal capacity: "+t+" (not an integer)");if((t|=0)<0)throw RangeError("Illegal capacity: 0 <= "+t)}return this.buffer.byteLength<t&&(e=new ArrayBuffer(t),(n=new Uint8Array(e)).set(this.view),this.buffer=e,this.view=n),this},o.reverse=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}return t===e||Array.prototype.reverse.call(this.view.subarray(t,e)),this},o.skip=function(t){if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal length: "+t+" (not an integer)");t|=0}var e=this.offset+t;if(!this.noAssert&&(e<0||e>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+t+" <= "+this.buffer.byteLength);return this.offset=e,this},o.slice=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=t,n.limit=e,n},o.toBuffer=function(t){var e,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 t||0!==n||i!==this.buffer.byteLength?n===i?s:(e=new ArrayBuffer(i-n),new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(n,i),0),e):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(t,e,n){if(void 0===t)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof t&&(n=e=t="utf8"),t){case"utf8":return this.toUTF8(e,n);case"base64":return this.toBase64(e,n);case"hex":return this.toHex(e,n);case"binary":return this.toBinary(e,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+t)}},u=function(){var t,e,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(t=0,e=i.length;e>t;++t)r[i[t]]=t;return n.encode=function(t,e){for(var n,r;null!==(n=t());)e(i[63&n>>2]),r=(3&n)<<4,null!==(n=t())?(e(i[63&((r|=15&n>>4)|15&n>>4)]),r=(15&n)<<2,null!==(n=t())?(e(i[63&(r|3&n>>6)]),e(i[63&n])):(e(i[63&r]),e(61))):(e(i[63&r]),e(61),e(61))},n.decode=function(t,e){function n(t){throw Error("Illegal character code: "+t)}for(var i,o,s;null!==(i=t());)if(void 0===(o=r[i])&&n(i),null!==(i=t())&&(void 0===(s=r[i])&&n(i),e(o<<2>>>0|(48&s)>>4),null!==(i=t()))){if(void 0===(o=r[i])){if(61===i)break;n(i)}if(e((15&s)<<4>>>0|(60&o)>>2),null!==(i=t())){if(void 0===(s=r[i])){if(61===i)break;n(i)}e((3&o)<<6>>>0|s)}}},n.test=function(t){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(t)},n}(),o.toBase64=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity||t>e)throw RangeError("begin, end");var i;return u.encode(function(){return e>t?this.view[t++]:null}.bind(this),i=n()),i()},l.fromBase64=function(t,n){if("string"!=typeof t)throw TypeError("str");var i=new l(t.length/4*3,n),r=0;return u.decode(e(t),(function(t){i.view[r++]=t})),i.limit=r,i},l.btoa=function(t){return l.fromBinary(t).toBase64()},l.atob=function(t){return l.fromBase64(t).toBinary()},o.toBinary=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),e|=0,(t|=0)<0||e>this.capacity()||t>e)throw RangeError("begin, end");if(t===e)return"";for(var n=[],i=[];e>t;)n.push(this.view[t++]),n.length>=1024&&(i.push(String.fromCharCode.apply(String,n)),n=[]);return i.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(t,e){if("string"!=typeof t)throw TypeError("str");for(var n,i=0,r=t.length,o=new l(r,e);r>i;){if((n=t.charCodeAt(i))>255)throw RangeError("illegal char code: "+n);o.view[i++]=n}return o.limit=r,o},o.toDebug=function(t){for(var e,n=-1,i=this.buffer.byteLength,r="",o="",s="";i>n;){if(-1!==n&&(r+=(e=this.view[n])<16?"0"+e.toString(16).toUpperCase():e.toString(16).toUpperCase(),t&&(o+=e>32&&e<127?String.fromCharCode(e):".")),++n,t&&n>0&&n%16==0&&n!==i){for(;r.length<51;)r+=" ";s+=r+o+"\n",r=o=""}r+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":t||0!==n&&n!==i?" ":""}if(t&&" "!==r){for(;r.length<51;)r+=" ";s+=r+o+"\n"}return t?s:r},l.fromDebug=function(t,e,n){for(var i,r,o=t.length,s=new l(0|(o+1)/3,e,n),a=0,u=0,c=!1,h=!1,d=!1,g=!1,p=!1;o>a;){switch(i=t.charAt(a++)){case"!":if(!n){if(h||d||g){p=!0;break}h=d=g=!0}s.offset=s.markedOffset=s.limit=u,c=!1;break;case"|":if(!n){if(h||g){p=!0;break}h=g=!0}s.offset=s.limit=u,c=!1;break;case"[":if(!n){if(h||d){p=!0;break}h=d=!0}s.offset=s.markedOffset=u,c=!1;break;case"<":if(!n){if(h){p=!0;break}h=!0}s.offset=u,c=!1;break;case"]":if(!n){if(g||d){p=!0;break}g=d=!0}s.limit=s.markedOffset=u,c=!1;break;case">":if(!n){if(g){p=!0;break}g=!0}s.limit=u,c=!1;break;case"'":if(!n){if(d){p=!0;break}d=!0}s.markedOffset=u,c=!1;break;case" ":c=!1;break;default:if(!n&&c){p=!0;break}if(r=parseInt(i+t.charAt(a++),16),!n&&(isNaN(r)||r<0||r>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[u++]=r,c=!0}if(p)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!g)throw TypeError("Illegal str: Missing offset or limit");if(u<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return s},o.toHex=function(t,e){if(t=void 0===t?this.offset:t,e=void 0===e?this.limit:e,!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}for(var n,i=new Array(e-t);e>t;)(n=this.view[t++])<16?i.push("0",n.toString(16)):i.push(n.toString(16));return i.join("")},l.fromHex=function(t,e,n){var i,r,o,s,a;if(!n){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");if(t.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(r=t.length,o=new l(0|r/2,e),s=0,a=0;r>s;s+=2){if(i=parseInt(t.substring(s,s+2),16),!n&&(!isFinite(i)||i<0||i>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=i}return o.limit=a,o},c=function(){var t={MAX_CODEPOINT:1114111,encodeUTF8:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<128?e(127&n):n<2048?(e(192|31&n>>6),e(128|63&n)):n<65536?(e(224|15&n>>12),e(128|63&n>>6),e(128|63&n)):(e(240|7&n>>18),e(128|63&n>>12),e(128|63&n>>6),e(128|63&n)),n=null},decodeUTF8:function(t,e){for(var n,i,r,o,s=function(t){t=t.slice(0,t.indexOf(null));var e=Error(t.toString());throw e.name="TruncatedError",e.bytes=t,e};null!==(n=t());)if(0==(128&n))e(n);else if(192==(224&n))null===(i=t())&&s([n,i]),e((31&n)<<6|63&i);else if(224==(240&n))(null===(i=t())||null===(r=t()))&&s([n,i,r]),e((15&n)<<12|(63&i)<<6|63&r);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(i=t())||null===(r=t())||null===(o=t()))&&s([n,i,r,o]),e((7&n)<<18|(63&i)<<12|(63&r)<<6|63&o)}},UTF16toUTF8:function(t,e){for(var n,i=null;null!==(n=null!==i?i:t());)n>=55296&&n<=57343&&null!==(i=t())&&i>=56320&&i<=57343?(e(1024*(n-55296)+i-56320+65536),i=null):e(n);null!==i&&e(i)},UTF8toUTF16:function(t,e){var n=null;for("number"==typeof t&&(n=t,t=function(){return null});null!==n||null!==(n=t());)n<=65535?e(n):(e(55296+((n-=65536)>>10)),e(n%1024+56320)),n=null},encodeUTF16toUTF8:function(e,n){t.UTF16toUTF8(e,(function(e){t.encodeUTF8(e,n)}))},decodeUTF8toUTF16:function(e,n){t.decodeUTF8(e,(function(e){t.UTF8toUTF16(e,n)}))},calculateCodePoint:function(t){return t<128?1:t<2048?2:t<65536?3:4},calculateUTF8:function(t){for(var e,n=0;null!==(e=t());)n+=e<128?1:e<2048?2:e<65536?3:4;return n},calculateUTF16asUTF8:function(e){var n=0,i=0;return t.UTF16toUTF8(e,(function(t){++n,i+=t<128?1:t<2048?2:t<65536?3:4})),[n,i]}};return t}(),o.toUTF8=function(t,e){if(void 0===t&&(t=this.offset),void 0===e&&(e=this.limit),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof e||e%1!=0)throw TypeError("Illegal end: Not an integer");if(e>>>=0,t<0||t>e||e>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+e+" <= "+this.buffer.byteLength)}var i;try{c.decodeUTF8toUTF16(function(){return e>t?this.view[t++]:null}.bind(this),i=n())}catch(n){if(t!==e)throw RangeError("Illegal range: Truncated data, "+t+" != "+e)}return i()},l.fromUTF8=function(t,n,i){if(!i&&"string"!=typeof t)throw TypeError("Illegal str: Not a string");var r=new l(c.calculateUTF16asUTF8(e(t),!0)[1],n,i),o=0;return c.encodeUTF16toUTF8(e(t),(function(t){r.view[o++]=t})),r.limit=o,r},l}(e),i=function(e,n){var i,r,o={};return o.ByteBuffer=e,o.c=e,i=e,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var t={};return t.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),t.XHR=function(){var t,e=[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(t=0;t<e.length;t++){try{n=e[t]()}catch(t){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},t.fetch=function(e,n){if(n&&"function"!=typeof n&&(n=null),t.IS_NODE)if(n)g.readFile(e,(function(t,e){n(t?null:""+e)}));else try{return g.readFileSync(e)}catch(t){return null}else{var i=t.XHR();if(i.open("GET",e,!!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)}},t.toCamelCase=function(t){return t.replace(/_([a-zA-Z])/g,(function(t,e){return e.toUpperCase()}))},t}(),o.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},o.DotProto=function(t,e){function n(t,n){var i=-1,r=1;if("-"==t.charAt(0)&&(r=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))i=parseInt(t);else if(e.NUMBER_HEX.test(t))i=parseInt(t.substring(2),16);else{if(!e.NUMBER_OCT.test(t))throw Error("illegal id value: "+(r<0?"-":"")+t);i=parseInt(t.substring(1),8)}if(i=0|r*i,!n&&i<0)throw Error("illegal id value: "+(r<0?"-":"")+t);return i}function i(t){var n=1;if("-"==t.charAt(0)&&(n=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))return n*parseInt(t,10);if(e.NUMBER_HEX.test(t))return n*parseInt(t.substring(2),16);if(e.NUMBER_OCT.test(t))return n*parseInt(t.substring(1),8);if("inf"===t)return 1/0*n;if("nan"===t)return NaN;if(e.NUMBER_FLT.test(t))return n*parseFloat(t);throw Error("illegal number value: "+(n<0?"-":"")+t)}function r(t,e,n){void 0===t[e]?t[e]=n:(Array.isArray(t[e])||(t[e]=[t[e]]),t[e].push(n))}var o,s,a={},u=function(t){this.source=t+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},c=u.prototype;return c._readString=function(){var t,n='"'===this._stringOpen?e.STRING_DQ:e.STRING_SQ;if(n.lastIndex=this.index-1,!(t=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,t[1]},c.next=function(){var t,n,i,r,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(t=!1;e.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,t=!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,t=!0}}while(t);if(this.index===this.source.length)return null;if(r=this.index,e.DELIM.lastIndex=0,!e.DELIM.test(this.source.charAt(r++)))for(;r<this.source.length&&!e.DELIM.test(this.source.charAt(r));)++r;return('"'===(o=this.source.substring(this.index,this.index=r))||"'"===o)&&(this._stringOpen=o),o},c.peek=function(){if(0===this.stack.length){var t=this.next();if(null===t)return null;this.stack.push(t)}return this.stack[0]},c.skip=function(t){var e=this.next();if(e!==t)throw Error("illegal '"+e+"', '"+t+"' expected")},c.omit=function(t){return this.peek()===t&&(this.next(),!0)},c.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=u,o=function(t){this.tn=new u(t),this.proto3=!1},(s=o.prototype).parse=function(){var t,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},i=!0;try{for(;t=this.tn.next();)switch(t){case"package":if(!i||null!==n.package)throw Error("unexpected 'package'");if(t=this.tn.next(),!e.TYPEREF.test(t))throw Error("illegal package name: "+t);this.tn.skip(";"),n.package=t;break;case"import":if(!i)throw Error("unexpected 'import'");"public"===(t=this.tn.peek())&&this.tn.next(),t=this._readString(),this.tn.skip(";"),n.imports.push(t);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 '"+t+"'")}}catch(t){throw t.message="Parse error at line "+this.tn.line+": "+t.message,t}return delete n.name,n},o.parse=function(t){return new o(t).parse()},s._readString=function(){var t,e,n="";do{if("'"!==(e=this.tn.next())&&'"'!==e)throw Error("illegal string delimiter: "+e);n+=this.tn.next(),this.tn.skip(e),t=this.tn.peek()}while('"'===t||'"'===t);return n},s._readValue=function(t){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),e.NUMBER.test(n))return i(n);if(e.BOOL.test(n))return"true"===n.toLowerCase();if(t&&e.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(t,n){var i,r=this.tn.next(),o=!1;if("("===r&&(o=!0,r=this.tn.next()),!e.TYPEREF.test(r))throw Error("illegal option name: "+r);i=r,o&&(this.tn.skip(")"),i="("+i+")",r=this.tn.peek(),e.FQTYPEREF.test(r)&&(i+=r,this.tn.next())),this.tn.skip("="),this._parseOptionValue(t,i),n||this.tn.skip(";")},s._parseOptionValue=function(t,n){var i=this.tn.peek();if("{"!==i)r(t.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(i=this.tn.next());){if(!e.NAME.test(i))throw Error("illegal option name: "+n+"."+i);this.tn.omit(":")?r(t.options,n+"."+i,this._readValue(!0)):this._parseOptionValue(t,n+"."+i)}},s._parseService=function(t){var n,i=this.tn.next();if(!e.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(";"),t.services.push(n)},s._parseServiceRPC=function(t){var n,i,r="rpc",o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,i={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.request_stream=!0,o=this.tn.next()),!e.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(i.request=o,this.tn.skip(")"),"returns"!==(o=this.tn.next()).toLowerCase())throw Error("illegal rpc service request type delimiter: "+o);if(this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(i.response_stream=!0,o=this.tn.next()),i.response=o,this.tn.skip(")"),"{"===(o=this.tn.peek())){for(this.tn.next();"}"!==(o=this.tn.next());){if("option"!==o)throw Error("illegal rpc service token: "+o);this._parseOption(i)}this.tn.omit(";")}else this.tn.skip(";");void 0===t[r]&&(t[r]={}),t[r][n]=i},s._parseMessage=function(t,i){var r=!!i,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!e.NAME.test(o))throw Error("illegal "+(r?"group":"message")+" name: "+o);for(s.name=o,r&&(this.tn.skip("="),i.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&i&&this._parseFieldOptions(i),this.tn.skip("{");"}"!==(o=this.tn.next());)if(e.RULE.test(o))this._parseMessageField(s,o);else if("oneof"===o)this._parseMessageOneOf(s);else if("enum"===o)this._parseEnum(s);else if("message"===o)this._parseMessage(s);else if("option"===o)this._parseOption(s);else if("service"===o)this._parseService(s);else if("extensions"===o)s.extensions=this._parseExtensionRanges();else if("reserved"===o)this._parseIgnored();else if("extend"===o)this._parseExtend(s);else{if(!e.TYPEREF.test(o))throw Error("illegal message token: "+o);if(!this.proto3)throw Error("illegal field rule: "+o);this._parseMessageField(s,"optional",o)}return this.tn.omit(";"),t.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(t,i,r){var o,s,a;if(!e.RULE.test(i))throw Error("illegal message field rule: "+i);if(o={rule:i,type:"",name:"",options:{},id:0},"map"===i){if(r)throw Error("illegal type: "+r);if(this.tn.skip("<"),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!e.TYPE.test(s)&&!e.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!e.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(r=void 0!==r?r:this.tn.next())){if(a=this._parseMessage(t,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!e.TYPE.test(r)&&!e.TYPEREF.test(r))throw Error("illegal message field type: "+r);if(o.type=r,s=this.tn.next(),!e.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return t.fields.push(o),o},s._parseMessageOneOf=function(t){var n,i,r,o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal oneof name: "+o);for(i=o,r=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(t,"optional",o)).oneof=i,r.push(n.id);this.tn.omit(";"),t.oneofs[i]=r},s._parseFieldOptions=function(t){this.tn.skip("[");for(var e=!0;"]"!==this.tn.peek();)e||this.tn.skip(","),this._parseOption(t,!0),e=!1;this.tn.next()},s._parseEnum=function(t){var i,r={name:"",values:[],options:{}},o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal name: "+o);for(r.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(r);else{if(!e.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),i={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),r.values.push(i)}this.tn.omit(";"),t.enums.push(r)},s._parseExtensionRanges=function(){var e,n,r,o=[];do{for(n=[];;){switch(e=this.tn.next()){case"min":r=t.ID_MIN;break;case"max":r=t.ID_MAX;break;default:r=i(e)}if(n.push(r),2===n.length)break;if("to"!==this.tn.peek()){n.push(r);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(t){var n,i=this.tn.next();if(!e.TYPEREF.test(i))throw Error("illegal extend reference: "+i);for(n={ref:i,fields:[]},this.tn.skip("{");"}"!==(i=this.tn.next());)if(e.RULE.test(i))this._parseMessageField(n,i);else{if(!e.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(";"),t.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(t){function n(e,n){if(e&&"number"==typeof e.low&&"number"==typeof e.high&&"boolean"==typeof e.unsigned&&e.low==e.low&&e.high==e.high)return new t.Long(e.low,e.high,void 0===n?e.unsigned:n);if("string"==typeof e)return t.Long.fromString(e,n||!1,10);if("number"==typeof e)return t.Long.fromNumber(e,n||!1);throw Error("not convertible to Long")}function r(e,n){var i=n.readVarint32(),o=7&i,s=i>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{i=n.readUint8()}while(128==(128&i));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:i=n.readVarint32(),n.offset+=i;break;case t.WIRE_TYPES.STARTGROUP:r(s,n);break;case t.WIRE_TYPES.ENDGROUP:if(s===e)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+e+" expected)");case t.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+e+": "+o)}return!0}var o,s,a,u,c,l,h,d,g,p,f,_,E,T,v,y,C={},m=function(t,e,n){this.builder=t,this.parent=e,this.name=n,this.className},I=m.prototype;return I.fqn=function(){for(var t=this.name,e=this;null!=(e=e.parent);)t=e.name+"."+t;return t},I.toString=function(t){return(t?this.className+" ":"")+this.fqn()},I.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},C.T=m,o=function(t,e,n,i,r){m.call(this,t,e,n),this.className="Namespace",this.children=[],this.options=i||{},this.syntax=r||"proto2"},(s=o.prototype=Object.create(m.prototype)).getChildren=function(t){var e,n,i;if(null==(t=t||null))return this.children.slice();for(e=[],n=0,i=this.children.length;i>n;++n)this.children[n]instanceof t&&e.push(this.children[n]);return e},s.addChild=function(t){var e;if(e=this.getChild(t.name))if(e instanceof c.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName))e.name=e.originalName;else{if(!(t instanceof c.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+t.name);t.name=t.originalName}this.children.push(t)},s.getChild=function(t){var e,n,i="number"==typeof t?"id":"name";for(e=0,n=this.children.length;n>e;++e)if(this.children[e][i]===t)return this.children[e];return null},s.resolve=function(t,e){var n,i="string"==typeof t?t.split("."):t,r=this,o=0;if(""===i[o]){for(;null!==r.parent;)r=r.parent;o++}do{do{if(!(r instanceof C.Namespace)){r=null;break}if(!((n=r.getChild(i[o]))&&n instanceof C.T&&(!e||n instanceof C.Namespace))){r=null;break}r=n,o++}while(o<i.length);if(null!=r)break;if(null!==this.parent)return this.parent.resolve(t,e)}while(null!=r);return r},s.qn=function(t){var e,n,i=[],r=t;do{i.unshift(r.name),r=r.parent}while(null!==r);for(e=1;e<=i.length;e++)if(n=i.slice(i.length-e),t===this.resolve(n,t instanceof C.Namespace))return n.join(".");return t.fqn()},s.build=function(){var t,e,n,i={},r=this.children;for(e=0,n=r.length;n>e;++e)(t=r[e])instanceof o&&(i[t.name]=t.build());return Object.defineProperty&&Object.defineProperty(i,"$options",{value:this.buildOpt()}),i},s.buildOpt=function(){var t,e,n,i,r={},o=Object.keys(this.options);for(t=0,e=o.length;e>t;++t)n=o[t],i=this.options[o[t]],r[n]=i;return r},s.getOption=function(t){return void 0===t?this.options:void 0!==this.options[t]?this.options[t]:null},C.Namespace=o,a=function(e,n,i,r){if(this.type=e,this.resolvedType=n,this.isMapKey=i,this.syntax=r,i&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},u=a.prototype,a.defaultFieldValue=function(e){if("string"==typeof e&&(e=t.TYPES[e]),void 0===e.defaultValue)throw Error("default value for type "+e.name+" is not supported");return e==t.TYPES.bytes?new i(0):e.defaultValue},u.verifyValue=function(i){var r,o,s,a=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this);switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i>4294967295?0|i:i;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof i||i==i&&i%1!=0)&&a(typeof i,"not an integer"),i<0?i>>>0:i;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return n(i,!1)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return n(i,!0)}catch(t){a(typeof i,t.message)}else a(typeof i,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof i&&a(typeof i,"not a boolean"),i;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof i&&a(typeof i,"not a number"),i;case t.TYPES.string:return"string"==typeof i||i&&i instanceof String||a(typeof i,"not a string"),""+i;case t.TYPES.bytes:return e.isByteBuffer(i)?i:e.wrap(i);case t.TYPES.enum:for(r=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<r.length;s++){if(r[s].name==i)return r[s].id;if(r[s].id==i)return r[s].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 t.TYPES.group:case t.TYPES.message:if(i&&"object"==typeof i||a(typeof i,"object expected"),i instanceof this.resolvedType.clazz)return i;if(i instanceof t.Builder.Message){for(s in o={},i)i.hasOwnProperty(s)&&(o[s]=i[s]);i=o}return new this.resolvedType.clazz(i)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+i+" (undefined type "+this.type+")")},u.calculateLength=function(e,n){if(null===n)return 0;var r;switch(this.type){case t.TYPES.int32:return n<0?i.calculateVarint64(n):i.calculateVarint32(n);case t.TYPES.uint32:return i.calculateVarint32(n);case t.TYPES.sint32:return i.calculateVarint32(i.zigZagEncode32(n));case t.TYPES.fixed32:case t.TYPES.sfixed32:case t.TYPES.float:return 4;case t.TYPES.int64:case t.TYPES.uint64:return i.calculateVarint64(n);case t.TYPES.sint64:return i.calculateVarint64(i.zigZagEncode64(n));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return i.calculateVarint32(n);case t.TYPES.double:return 8;case t.TYPES.string:return r=i.calculateUTF8Bytes(n),i.calculateVarint32(r)+r;case t.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 t.TYPES.message:return r=this.resolvedType.calculate(n),i.calculateVarint32(r)+r;case t.TYPES.group:return(r=this.resolvedType.calculate(n))+i.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},u.encodeValue=function(e,n,r){var o,s;if(null===n)return r;switch(this.type){case t.TYPES.int32:n<0?r.writeVarint64(n):r.writeVarint32(n);break;case t.TYPES.uint32:r.writeVarint32(n);break;case t.TYPES.sint32:r.writeVarint32ZigZag(n);break;case t.TYPES.fixed32:r.writeUint32(n);break;case t.TYPES.sfixed32:r.writeInt32(n);break;case t.TYPES.int64:case t.TYPES.uint64:r.writeVarint64(n);break;case t.TYPES.sint64:r.writeVarint64ZigZag(n);break;case t.TYPES.fixed64:r.writeUint64(n);break;case t.TYPES.sfixed64:r.writeInt64(n);break;case t.TYPES.bool:"string"==typeof n?r.writeVarint32("false"===n.toLowerCase()?0:!!n):r.writeVarint32(n?1:0);break;case t.TYPES.enum:r.writeVarint32(n);break;case t.TYPES.float:r.writeFloat32(n);break;case t.TYPES.double:r.writeFloat64(n);break;case t.TYPES.string:r.writeVString(n);break;case t.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,r.writeVarint32(n.remaining()),r.append(n),n.offset=o;break;case t.TYPES.message:s=(new i).LE(),this.resolvedType.encode(n,s),r.writeVarint32(s.offset),r.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(n,r),r.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return r},u.decode=function(e,n,i){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var r,o;switch(this.type){case t.TYPES.int32:return 0|e.readVarint32();case t.TYPES.uint32:return e.readVarint32()>>>0;case t.TYPES.sint32:return 0|e.readVarint32ZigZag();case t.TYPES.fixed32:return e.readUint32()>>>0;case t.TYPES.sfixed32:return 0|e.readInt32();case t.TYPES.int64:return e.readVarint64();case t.TYPES.uint64:return e.readVarint64().toUnsigned();case t.TYPES.sint64:return e.readVarint64ZigZag();case t.TYPES.fixed64:return e.readUint64();case t.TYPES.sfixed64:return e.readInt64();case t.TYPES.bool:return!!e.readVarint32();case t.TYPES.enum:return e.readVarint32();case t.TYPES.float:return e.readFloat();case t.TYPES.double:return e.readDouble();case t.TYPES.string:return e.readVString();case t.TYPES.bytes:if(o=e.readVarint32(),e.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+e.remaining());return(r=e.clone()).limit=r.offset+o,e.offset+=o,r;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,i)}throw Error("[INTERNAL] Illegal decode type")},u.valueFromString=function(e){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return this.verifyValue(parseInt(e));case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return this.verifyValue(e);case t.TYPES.bool:return"true"===e;case t.TYPES.string:return this.verifyValue(e);case t.TYPES.bytes:return i.fromBinary(e)}},u.valueToString=function(e){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===t.TYPES.bytes?e.toString("binary"):e.toString()},C.Element=a,c=function(t,e,n,i,r,s){o.call(this,t,e,n,i,s),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(o.prototype)).build=function(n){var r,o,s,a;if(this.clazz&&!n)return this.clazz;for(r=function(t,n){function r(e,n,o,s){var a,u,c,l,h,d,g;if(null===e||"object"!=typeof e)return s&&s instanceof t.Reflect.Enum&&null!==(a=t.Reflect.Enum.getName(s.object,e))?a:e;if(i.isByteBuffer(e))return n?e.toBase64():e.toBuffer();if(t.Long.isLong(e))return o?e.toString():t.Long.fromValue(e);if(Array.isArray(e))return u=[],e.forEach((function(t,e){u[e]=r(t,n,o,s)})),u;if(u={},e instanceof t.Map){for(l=(c=e.entries()).next();!l.done;l=c.next())u[e.keyElem.valueToString(l.value[0])]=r(l.value[1],n,o,e.valueElem.resolvedType);return u}for(g in h=e.$type,d=void 0,e)e.hasOwnProperty(g)&&(u[g]=h&&(d=h.getChild(g))?r(e[g],n,o,d.resolvedType):r(e[g],n,o));return u}var o,s,a=n.getChildren(t.Reflect.Message.Field),u=n.getChildren(t.Reflect.Message.OneOf),c=function(e){var r,o,s,l;for(t.Builder.Message.call(this),r=0,o=u.length;o>r;++r)this[u[r].name]=null;for(r=0,o=a.length;o>r;++r)this[(s=a[r]).name]=s.repeated?[]:s.map?new t.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===e||"object"!=typeof e||!("function"!=typeof e.encode||e instanceof c)||Array.isArray(e)||e instanceof t.Map||i.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(r=0,o=arguments.length;o>r;++r)void 0!==(l=arguments[r])&&this.$set(a[r].name,l);else this.$set(e)},l=c.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,i,r){var o=n._fieldsByName[e];if(!r){if(!o)throw Error(this+"#"+e+" is undefined");if(!(o instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+e+" is not a repeated field");i=o.verifyValue(i,!0)}return null===this[e]&&(this[e]=[]),this[e].push(i),this},l.$add=l.add,l.set=function(e,i,r){var o,s,a;if(e&&"object"==typeof e){for(o in r=i,e)e.hasOwnProperty(o)&&void 0!==(i=e[o])&&this.$set(o,i,r);return this}if(s=n._fieldsByName[e],r)this[e]=i;else{if(!s)throw Error(this+"#"+e+" is not a field: undefined");if(!(s instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+s.toString(!0));this[s.name]=i=s.verifyValue(i)}return s&&s.oneof&&(a=this[s.oneof.name],null!==i?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===e&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(e,i){if(i)return this[e];var r=n._fieldsByName[e];if(!(r&&r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(r instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+r.toString(!0));return this[r.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof t.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(t){var e,i,r,o=t.originalName.replace(/(_[a-zA-Z])/g,(function(t){return t.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),e=t.originalName.replace(/([A-Z])/g,(function(t){return"_"+t})),i=function(e,n){return this[t.name]=n?e:t.verifyValue(e),this},r=function(){return this[t.name]},null===n.getChild("set"+o)&&(l["set"+o]=i),null===n.getChild("set_"+e)&&(l["set_"+e]=i),null===n.getChild("get"+o)&&(l["get"+o]=r),null===n.getChild("get_"+e)&&(l["get_"+e]=r)}(s);return l.encode=function(t,i){var r,o;"boolean"==typeof t&&(i=t,t=void 0),r=!1,t||(t=new e,r=!0),o=t.littleEndian;try{return n.encode(this,t.LE(),i),(r?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},c.encode=function(t,e,n){return new c(t).encode(e,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(t){var e,r=!1;return t||(t=new i,r=!0),e=(new i).LE(),n.encode(this,e).flip(),t.writeVarint32(e.remaining()),t.append(e),r?t.flip():t},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toArrayBuffer()),t}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBuffer()),t}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toBase64()),t}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(t){throw t.encoded&&(t.encoded=t.encoded.toHex()),t}},l.toHex=l.encodeHex,l.toRaw=function(t,e){return r(this,!!t,!!e,this.$type)},l.encodeJSON=function(){return JSON.stringify(r(this,!0,!0,this.$type))},c.decode=function(t,e){var r,o;"string"==typeof t&&(t=i.wrap(t,e||"base64")),r=(t=i.isByteBuffer(t)?t:i.wrap(t)).littleEndian;try{return o=n.decode(t.LE()),t.LE(r),o}catch(e){throw t.LE(r),e}},c.decodeDelimited=function(t,e){var r,o,s;if("string"==typeof t&&(t=i.wrap(t,e||"base64")),(t=i.isByteBuffer(t)?t:i.wrap(t)).remaining()<1)return null;if(r=t.offset,o=t.readVarint32(),t.remaining()<o)return t.offset=r,null;try{return s=n.decode(t.slice(t.offset,t.offset+o).LE()),t.offset+=o,s}catch(e){throw t.offset+=o,e}},c.decode64=function(t){return c.decode(t,"base64")},c.decodeHex=function(t){return c.decode(t,"hex")},c.decodeJSON=function(t){return new c(JSON.parse(t))},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}(t,this),this._fields=[],this._fieldsById={},this._fieldsByName={},s=0,a=this.children.length;a>s;s++)if((o=this.children[s])instanceof f||o instanceof c||o instanceof T){if(r.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");r[o.name]=o.build()}else if(o instanceof c.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof c.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=r},l.encode=function(t,e,n){var i,r,o,s,a,u=null;for(o=0,s=this._fields.length;s>o;++o)r=t[(i=this._fields[o]).name],i.required&&null===r?null===u&&(u=i):i.encode(n?r:i.verifyValue(r),e,t);if(null!==u)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+u)).encoded=e,a;return e},l.calculate=function(t){for(var e,n,i=0,r=0,o=this._fields.length;o>r;++r){if(n=t[(e=this._fields[r]).name],e.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);i+=e.calculate(n,t)}return i},l.decode=function(e,n,i){var o,s,a,u,c,l,h,d,g,p,f,_;for(n="number"==typeof n?n:-1,c=e.offset,l=new this.clazz;e.offset<c+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.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(s,e)):u.map?(d=u.decode(s,e),l[u.name].set(d[0],d[1])):(l[u.name]=u.decode(s,e),u.oneof&&(null!==(g=l[u.oneof.name])&&g!==u.name&&(l[g]=null),l[u.oneof.name]=u.name));else switch(s){case t.WIRE_TYPES.VARINT:e.readVarint32();break;case t.WIRE_TYPES.BITS32:e.offset+=4;break;case t.WIRE_TYPES.BITS64:e.offset+=8;break;case t.WIRE_TYPES.LDELIM:h=e.readVarint32(),e.offset+=h;break;case t.WIRE_TYPES.STARTGROUP:for(;r(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(p=0,f=this._fields.length;f>p;++p)if(null===l[(u=this._fields[p]).name])if("proto3"===this.syntax)l[u.name]=u.defaultValue;else{if(u.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+u.name)).decoded=l,_;t.populateDefaults&&null!==u.defaultValue&&(l[u.name]=u.defaultValue)}return l},C.Message=c,h=function(e,n,i,r,o,s,a,u,l,h){m.call(this,e,n,s),this.className="Message.Field",this.required="required"===i,this.repeated="repeated"===i,this.map="map"===i,this.keyType=r||null,this.type=o,this.resolvedType=null,this.id=a,this.options=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=t.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(m.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(e,n){var i,r,o;if(n=n||!1,i=function(t,e){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+t+" ("+e+")")}.bind(this),null===e)return this.required&&i(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&i(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],r=0;r<e.length;r++)o.push(this.element.verifyValue(e[r]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||i(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&i(typeof e,"no array expected"),this.element.verifyValue(e))},d.hasWirePresence=function(e,n){if("proto3"!==this.syntax)return null!==e;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case t.TYPES.int32:case t.TYPES.sint32:case t.TYPES.sfixed32:case t.TYPES.uint32:case t.TYPES.fixed32:return 0!==e;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:case t.TYPES.uint64:case t.TYPES.fixed64:return 0!==e.low||0!==e.high;case t.TYPES.bool:return e;case t.TYPES.float:case t.TYPES.double:return 0!==e;case t.TYPES.string:return e.length>0;case t.TYPES.bytes:return e.remaining()>0;case t.TYPES.enum:return 0!==e;case t.TYPES.message:return null!==e;default:return!0}},d.encode=function(e,n,r){var o,s,a,u,c;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return n;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<e.length;o++)this.element.encodeValue(this.id,e[o],n);a=n.offset-s,(u=i.calculateVarint32(a))>1&&(c=n.slice(s,n.offset),s+=u-1,n.offset=s,n.append(c)),n.writeVarint32(a,s-u)}else for(o=0;o<e.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e[o],n);else this.map?e.forEach((function(e,r){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,r)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);n.writeVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,r,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,n)}),this):this.hasWirePresence(e,r)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,e,n))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return n},d.calculate=function(e,n){var r,o,s;if(e=this.verifyValue(e),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===e||this.repeated&&0==e.length)return 0;r=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);r+=i.calculateVarint32(s),r+=s}else for(o=0;o<e.length;o++)r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,n){var o=i.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+i.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);r+=i.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),r+=i.calculateVarint32(o),r+=o}),this):this.hasWirePresence(e,n)&&(r+=i.calculateVarint32(this.id<<3|this.type.wireType),r+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return r},d.decode=function(e,n,i){var r,o,s,u,c,l,h;if(!(!this.map&&e==this.type.wireType||!i&&this.repeated&&this.options.packed&&e==t.WIRE_TYPES.LDELIM||this.map&&e==t.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+e+" ("+this.type.wireType+" expected)");if(e==t.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!i){for(o=n.readVarint32(),o=n.offset+o,s=[];n.offset<o;)s.push(this.decode(this.type.wireType,n,!0));return s}if(this.map){if(u=a.defaultFieldValue(this.keyType),r=a.defaultFieldValue(this.type),o=n.readVarint32(),n.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+n.remaining());for((c=n.clone()).limit=c.offset+o,n.offset+=o;c.remaining()>0;)if(e=7&(l=c.readVarint32()),1===(h=l>>>3))u=this.keyElement.decode(c,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");r=this.element.decode(c,e,h)}return[u,r]}return this.element.decode(n,e,this.id)},C.Message.Field=h,g=function(t,e,n,i,r,o,s){h.call(this,t,e,n,null,i,r,o,s),this.extension},g.prototype=Object.create(h.prototype),C.Message.ExtensionField=g,p=function(t,e,n){m.call(this,t,e,n),this.fields=[]},C.Message.OneOf=p,f=function(t,e,n,i,r){o.call(this,t,e,n,i,r),this.className="Enum",this.object=null},f.getName=function(t,e){var n,i,r=Object.keys(t);for(i=0;i<r.length;++i)if(t[n=r[i]]===e)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(e){var n,i,r,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,r=0,o=(i=this.getChildren(f.Value)).length;o>r;++r)n[i[r].name]=i[r].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},C.Enum=f,_=function(t,e,n,i){m.call(this,t,e,n),this.className="Enum.Value",this.id=i},_.prototype=Object.create(m.prototype),C.Enum.Value=_,E=function(t,e,n,i){m.call(this,t,e,n),this.field=i},E.prototype=Object.create(m.prototype),C.Extension=E,T=function(t,e,n,i){o.call(this,t,e,n,i),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(e){return this.clazz&&!e?this.clazz:this.clazz=function(t,e){var n,r=function(e){t.Builder.Service.call(this),this.rpcImpl=e||function(t,e,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=r.prototype=Object.create(t.Builder.Service.prototype),s=e.getChildren(t.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(t){o[t.name]=function(n,r){try{try{n=t.resolvedRequestType.clazz.decode(i.wrap(n))}catch(t){if(!(t instanceof TypeError))throw t}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof t.resolvedRequestType.clazz||(n=new t.resolvedRequestType.clazz(n)),this.rpcImpl(t.fqn(),n,(function(n,i){if(!n){try{i=t.resolvedResponseType.clazz.decode(i)}catch(t){}return i&&i instanceof t.resolvedResponseType.clazz?void r(null,i):void r(Error("Illegal response type received in service method "+e.name+"#"+t.name))}r(n)}))}catch(t){setTimeout(r.bind(this,t),0)}},r[t.name]=function(e,n,i){new r(e)[t.name](n,i)},Object.defineProperty&&(Object.defineProperty(r[t.name],"$options",{value:t.buildOpt()}),Object.defineProperty(o[t.name],"$options",{value:r[t.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(r,"$options",{value:e.buildOpt()}),Object.defineProperty(o,"$options",{value:r.$options}),Object.defineProperty(r,"$type",{value:e}),Object.defineProperty(o,"$type",{value:e})),r}(t,this)},C.Service=T,v=function(t,e,n,i){m.call(this,t,e,n),this.className="Service.Method",this.options=i||{}},(v.prototype=Object.create(m.prototype)).buildOpt=s.buildOpt,C.Service.Method=v,y=function(t,e,n,i,r,o,s,a){v.call(this,t,e,n,a),this.className="Service.RPCMethod",this.requestName=i,this.responseName=r,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},y.prototype=Object.create(v.prototype),C.Service.RPCMethod=y,C}(o),o.Builder=function(t,e,n){function i(t){t.messages&&t.messages.forEach((function(e){e.syntax=t.syntax,i(e)})),t.enums&&t.enums.forEach((function(e){e.syntax=t.syntax}))}var r=function(t){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=t||{}},o=r.prototype;return r.isMessage=function(t){return"string"==typeof t.name&&(void 0===t.values&&void 0===t.rpc)},r.isMessageField=function(t){return"string"==typeof t.rule&&"string"==typeof t.name&&"string"==typeof t.type&&void 0!==t.id},r.isEnum=function(t){return"string"==typeof t.name&&!(void 0===t.values||!Array.isArray(t.values)||0===t.values.length)},r.isService=function(t){return!("string"!=typeof t.name||"object"!=typeof t.rpc||!t.rpc)},r.isExtend=function(t){return"string"==typeof t.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(t){if("string"!=typeof t||!e.TYPEREF.test(t))throw Error("illegal namespace: "+t);return t.split(".").forEach((function(t){var e=this.ptr.getChild(t);null===e&&this.ptr.addChild(e=new n.Namespace(this,this.ptr,t)),this.ptr=e}),this),this},o.create=function(e){var i,o,s,a,u;if(!e)return this;if(Array.isArray(e)){if(0===e.length)return this;e=e.slice()}else e=[e];for(i=[e];i.length>0;){if(e=i.pop(),!Array.isArray(e))throw Error("not a valid namespace: "+JSON.stringify(e));for(;e.length>0;){if(o=e.shift(),r.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(t){s.addChild(a[t]=new n.Message.OneOf(this,s,t))}),this),o.fields&&o.fields.forEach((function(t){if(null!==s.getChild(0|t.id))throw Error("duplicate or invalid field id in "+s.name+": "+t.id);if(t.options&&"object"!=typeof t.options)throw Error("illegal field options in "+s.name+"#"+t.name);var e=null;if("string"==typeof t.oneof&&!(e=a[t.oneof]))throw Error("illegal oneof in "+s.name+"#"+t.name+": "+t.oneof);t=new n.Message.Field(this,s,t.rule,t.keytype,t.type,t.name,t.id,t.options,e,o.syntax),e&&e.fields.push(t),s.addChild(t)}),this),u=[],o.enums&&o.enums.forEach((function(t){u.push(t)})),o.messages&&o.messages.forEach((function(t){u.push(t)})),o.services&&o.services.forEach((function(t){u.push(t)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),u.length>0){i.push(e),e=u,u=null,this.ptr=s,s=null;continue}u=null}else if(r.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(t){s.addChild(new n.Enum.Value(this,s,t.name,t.id))}),this),this.ptr.addChild(s);else if(r.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(t){var e=o.rpc[t];s.addChild(new n.Service.RPCMethod(this,s,t,e.request,e.response,!!e.request_stream,!!e.response_stream,e.options))}),this),this.ptr.addChild(s);else{if(!r.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(e){var i,r,o,a;if(null!==s.getChild(0|e.id))throw Error("duplicate extended field id in "+s.name+": "+e.id);if(s.extensions&&(i=!1,s.extensions.forEach((function(t){e.id>=t[0]&&e.id<=t[1]&&(i=!0)})),!i))throw Error("illegal extended field id in "+s.name+": "+e.id+" (not within valid ranges)");r=e.name,this.options.convertFieldsToCamelCase&&(r=t.Util.toCamelCase(r)),o=new n.Message.ExtensionField(this,s,e.rule,e.type,this.ptr.fqn()+"."+r,e.id,e.options),a=new n.Extension(this,this.ptr,e.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}e=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(e,n){var r,o,s,a,u,c,l,h,d="/";if("string"==typeof n){if(t.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(r=n.root,t.Util.IS_NODE,(r.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=r+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(e.imports&&e.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,u=0;u<e.imports.length;u++)if("string"==typeof e.imports[u]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(c=e.imports[u]))continue;if(c=s+d+c,!0===this.files[c])continue;if(/\.proto$/i.test(c)&&!t.DotProto&&(c=c.replace(/\.proto$/,".json")),null===(l=t.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(t.DotProto.Parser.parse(l),c)}else n?/\.(\w+)$/.test(n)?this.import(e.imports[u],n.replace(/^(.+)\.(\w+)$/,(function(t,e,n){return e+"_import"+u+"."+n}))):this.import(e.imports[u],n+"_import"+u):this.import(e.imports[u]);a&&(this.importRoot=null)}return e.package&&this.define(e.package),e.syntax&&i(e),h=this.ptr,e.options&&Object.keys(e.options).forEach((function(t){h.options[t]=e.options[t]})),e.messages&&(this.create(e.messages),this.ptr=h),e.enums&&(this.create(e.enums),this.ptr=h),e.services&&(this.create(e.services),this.ptr=h),e.extends&&this.create(e.extends),this.reset()},o.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(t){this.ptr=t,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(e.TYPE.test(this.ptr.type))this.ptr.type=t.TYPES[this.ptr.type];else{if(!e.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=t.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?t.TYPES.group:t.TYPES.message}}if(this.ptr.map){if(!e.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=t.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof t.Reflect.Service.Method){if(!(this.ptr instanceof t.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 t.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 t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=i}else if(!(this.ptr instanceof t.Reflect.Message.OneOf||this.ptr instanceof t.Reflect.Extension||this.ptr instanceof t.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(t){var e,n,i;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!t)return this.result;for(e="string"==typeof t?t.split("."):t,n=this.result,i=0;i<e.length;i++){if(!n[e[i]]){n=null;break}n=n[e[i]]}return n},o.lookup=function(t,e){return t?this.ns.resolve(t,e):this.ns},o.toString=function(){return"Builder"},r.Message=function(){},r.Enum=function(){},r.Service=function(){},r}(o,o.Lang,o.Reflect),o.Map=function(t,e){function n(t){var e=0;return{next:function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}}var i=function(t,n){var i,r,o,s;if(!t.map)throw Error("field is not a map");if(this.field=t,this.keyElem=new e.Element(t.keyType,null,!0,t.syntax),this.valueElem=new e.Element(t.type,t.resolvedType,!1,t.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++)o=this.keyElem.valueFromString(i[r]),s=this.valueElem.verifyValue(n[i[r]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},r=i.prototype;return r.clear=function(){this.map={}},r.delete=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t)),n=e in this.map;return delete this.map[e],n},r.entries=function(){var t,e,i=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)i.push([(t=this.map[r[e]]).key,t.value]);return n(i)},r.keys=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].key);return n(e)},r.values=function(){var t,e=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)e.push(this.map[i[t]].value);return n(e)},r.forEach=function(t,e){var n,i,r=Object.keys(this.map);for(i=0;i<r.length;i++)t.call(e,(n=this.map[r[i]]).value,n.key,this)},r.set=function(t,e){var n=this.keyElem.verifyValue(t),i=this.valueElem.verifyValue(e);return this.map[this.keyElem.valueToString(n)]={key:n,value:i},this},r.get=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t));return e in this.map?this.map[e].value:void 0},r.has=function(t){return this.keyElem.valueToString(this.keyElem.verifyValue(t))in this.map},i}(0,o.Reflect),o.loadProto=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=void 0),o.loadJson(o.DotProto.Parser.parse(t),e,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadProto(i,n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadProto(i,n,t)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(t){return void 0===(t=t||{}).convertFieldsToCamelCase&&(t.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===t.populateAccessors&&(t.populateAccessors=o.populateAccessors),new o.Builder(t)},o.loadJson=function(t,e,n){return("string"==typeof e||e&&"string"==typeof e.file&&"string"==typeof e.root)&&(n=e,e=null),e&&"object"==typeof e||(e=o.newBuilder()),"string"==typeof t&&(t=JSON.parse(t)),e.import(t,n),e.resolveAll(),e},o.loadJsonFile=function(t,e,n){if(e&&"object"==typeof e?(n=e,e=null):e&&"function"==typeof e||(e=null),e)return o.Util.fetch("string"==typeof t?t:t.root+"/"+t.file,(function(i){if(null!==i)try{e(null,o.loadJson(JSON.parse(i),n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var i=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===i?null:o.loadJson(JSON.parse(i),n,t)},r=t,o.loadProto(r,void 0,"").build("Modules").probuf}(n,e);return i}var Qn,Wn,Jn=function(){function t(t,e,n){this.pbmaps=t,this.logger=n,this.pbModules=jn(e)}return t.prototype.getModule=function(t){return new this.pbModules[t]},t.prototype.encode=function(t,e,n){var i=new this.pbModules[t];if(e)try{this.pbmaps[t].forEach((function(t){var n=e[t];void 0!==n&&i["set".concat(function(t,e,n){if(void 0===e||void 0===n)return t.toUpperCase();var i=t.slice(e,n);return t.replace(i,(function(t){return t.toUpperCase()}))}(t,0,1))](n)}))}catch(e){var r="pbname: ".concat(t,", stack: ").concat(e.stack);this.logger?this.logger.error(pt.L_PB_ENCODE_E,r):null===console||void 0===console||console.error(pt.L_PB_ENCODE_E,r)}return n?i:i.toArrayBuffer()},t.prototype.decode=function(t,e){var n=this.pbModules[t].decode(e);return this.fixInt64Values(n)},t.prototype.fixInt64Values=function(t){var e=this;if(t instanceof Array)return t.map((function(t){return e.fixInt64Values(t)}));if(!ae(t))return t;if(void 0!==t.low&&void 0!==t.high&&Object.prototype.hasOwnProperty.call(t,"unsigned")){var n=t.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var i in t)t[i]=this.fixInt64Values(t[i]);return t},t}();!function(t){t[t.BJ=1]="BJ",t[t.SG=2]="SG",t[t.NA=3]="NA"}(Wn||(Wn={}));var Xn=((Qn={})[Wn.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="]},Qn[Wn.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"]},Qn[Wn.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:wt.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[]},Qn);function Zn(t){return t>=Wn.BJ&&t<=3?t:Wn.BJ}wt.HTTPS;var zn=function(){function t(){this.initOption={}}return t.prototype.init=function(t){this.initOption=t},t.prototype.getNaviUrlList=function(t){var e,n=this.initOption||{},i=n.areaCode,r=n.navigators,o=(e=i,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].naviUrlBase64).map((function(t){return xe(t)})),s=t.split("@")[1],a=s?s.split(";"):[],u=r&&r.length>0?h(h([],a,!0),r,!0):h(h([],a,!0),o,!0);return u.filter((function(t,e){return u.indexOf(t)===e})).map((function(t){return nn(t)}))},t.prototype.getLogUrlPolicyList=function(t,e){var n,i=t||{},r=i.log,o=i.logPolicy,s=this.initOption||{},a=s.areaCode,c=s.logServerUrl,l=(n=a,void 0===n&&(n=Wn.BJ),Xn[Zn(n)].logUrlBase64).map((function(t){return u(u({},t),{addr:xe(t.addr)})})),d=[],g={level:1,itv:6,times:5};if(r)d.push.apply(d,r.addrs),Object.assign(g,r.policy);else if(o)try{var p=JSON.parse(o);d.push({addr:p.url,protocol:wt.HTTPS,weight:1}),g.level=p.level,g.itv=p.itv,g.times=p.times}catch(n){e.warn(pt.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:t.logPolicy}))}var f=c?h([{addr:c,protocol:wt.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:g,addrs:f.filter((function(t,e){return f.findIndex((function(e){return e.addr===t.addr&&e.protocol===t.protocol}))===e})).map((function(t){return u(u({},t),{addr:nn(t.addr,t.protocol)})})).sort((function(t,e){return e.weight-t.weight}))}},t.prototype.getMiniCmpUrlList=function(){var t,e,n=(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].miniCmpBase64).map((function(t){return xe(t)})),i=(this.initOption||{}).miniCMPProxy;return i&&i.length>0?i:n},t.prototype.getStaticConfigUrl=function(){var t,e;return(e=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===e&&(e=Wn.BJ),Xn[Zn(e)].staticConfigUrlBase64).map((function(t){return xe(t)}))},t}(),$n=new zn,ti=function(){function t(t,e,n){void 0===n&&(n=Wn.BJ),this.appkey=t,this.logger=e,this.areaCode=n,this.staticUrls=[]}return t.prototype.getStaticConfig=function(){var t;return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:if(!(e=this.getCache()))return[3,6];s.label=1;case 1:return s.trys.push([1,4,,5]),n=JSON.parse(e),Date.now()-(null==n?void 0:n.time)<q?[4,this.decryptData(n.val)]:[3,3];case 2:return[2,{navi:s.sent().resources.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return nn(t.addr,t.protocol)}))||[]}];case 3:return[3,5];case 4:return i=s.sent(),this.logger.error(pt.L_GET_STATIC_CONF_E,JSON.stringify({error:null==i?void 0:i.stack})),[3,5];case 5:this.clearCache(),s.label=6;case 6:return[4,this._requestHandle()];case 7:return(r=s.sent())?[4,this.decryptData(r)]:[2];case 8:return(null==(o=s.sent())?void 0:o.areaCode)!==this.areaCode?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:r})),this.staticUrls=(null==o?void 0:o.bootstrap)||[],[2,{navi:(null===(t=null==o?void 0:o.resources)||void 0===t?void 0:t.navi.sort((function(t,e){return e.weight-t.weight})).map((function(t){return nn(t.addr,t.protocol)})))||[]}])}}))}))},t.prototype._requestHandle=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:t=(t=h(h([],this.staticUrls,!0),$n.getStaticConfigUrl(),!0).map((function(t){return nn(t)}))).filter((function(e,n){return t.indexOf(e)===n})),e=0,n=t,u.label=1;case 1:return e<n.length?(i=n[e],this.logger.info(pt.L_GET_STATIC_CONF_T,JSON.stringify({url:i})),r=Date.now(),[4,this.sendRequest("".concat(i,"/").concat(this.appkey))]):[3,4];case 2:if(o=u.sent(),s=o.code,a=o.data,200===s)return this.logger.info(pt.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),[2,a];this.logger.warn(pt.L_GET_STATIC_CONF_R,JSON.stringify({url:i,code:s,duration:Date.now()-r})),u.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.setAreaCode=function(t){this.areaCode=t},t}(),ei=be(),ni=Date.now(),ii=null,ri="RC_LOGS",oi="RC_CONF",si=null,ai=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(ri,"readwrite").objectStore(ri),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),si=setTimeout((function(){return ai(t)}),6e5),[2]}}))}))},ui=function(t,e,n,i){void 0===i&&(i=168),ii||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==fn(n).type?ii=new Promise((function(n){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(t),s=r.open(o,1);s.onerror=function(t){e.error(pt.L_LOGDB_OPEN_FAILED_E,t.target.error),n(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(pt.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(pt.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(pt.L_LOGDB_ABORT_S,t.target.error)},ai(3600*Math.max(24,Math.min(168,i))*1e3),n({appkey:t,db:o})):n(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(ri)&&e.deleteObjectStore(ri);var n=e.createObjectStore(ri,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(oi,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(pt.L_UNSUPPORT_INDEXDB_O))},ci=function(){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return ii?(si&&(clearTimeout(si),si=null),[4,ii]):[2];case 1:return(t=e.sent())&&t.db.close(),ii=null,[2]}}))}))},li=[],hi=!1,di=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return hi||0===li.length?[2]:(hi=!0,e=li.splice(0),[4,new Promise((function(n){var i=t.transaction(ri,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(ri);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),hi=!1,setTimeout((function(){return di(t)})),[2]}}))}))};function gi(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(oi,"readonly").objectStore(oi).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var pi,fi=0,_i=function(){return{setTimestamp4RealtimeLog:function(t){fi=t},getTimestamp4RealtimeLog:function(){return fi},getLogs:function(t,e,n,i){return c(this,void 0,void 0,(function(){var r;return l(this,(function(o){switch(o.label){case 0:return[4,ii];case 1:return(r=o.sent())?[2,new Promise((function(o){var s=r.db.transaction(ri,"readonly").objectStore(ri),a=[],u=IDBKeyRange.bound(t,e),c=s.index("time").openCursor(u);c.onsuccess=function(t){var e=t.target.result;if(e){var r=e.value;r.level<=n&&(i?r.sessionId===ei:r.level>=0)&&a.push(r),e.continue()}else o({dbReady:!0,logs:a})},c.onerror=function(t){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ei="REPORT_SESSION",Ti=function(t,e){return c(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Ei,"_").concat(t),[4,gi("".concat(Ei,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,ii];case 1:return(n=r.sent())?(i=n.db,i.transaction(oi,"readwrite").objectStore(oi).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))};!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD",t[t.FATAL=0]="FATAL",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG"}(pi||(pi={}));var vi=function(t){return[pi.DEBUG,pi.INFO,pi.WARN,pi.ERROR].some((function(e){return e===t}))},yi=0,Ci=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.outputLevel=pi.WARN,this.debug=this._log.bind(this,pi.DEBUG),this.info=this._log.bind(this,pi.INFO),this.warn=this._log.bind(this,pi.WARN),this.error=this._log.bind(this,pi.ERROR),this.__statistics=this._log.bind(this,pi.STATISTICS)}return t.prototype._stdout=function(t,e,n,i,r){if(!(t<=pi.FATAL)&&console&&!(t>this.outputLevel)){var o=["error","warn","info","debug"][t-1];null===console||void 0===console||console[o]("".concat(n,"[").concat(this._id,"][").concat(o.toUpperCase(),"]: ").concat(e," | ").concat(i," | ").concat(r))}},t.prototype.setOutputLevel=function(t){vi(t)&&(this.outputLevel=t)},t.prototype._log=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)?(this._stdout(t,e,r.toISOString(),n,i),t!==pi.DEBUG&&this.flush({time:+r,sessionId:ei,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})):this._stdout(pi.ERROR,"L_LOG_TAG_INVALID_E",r.toISOString(),e,i)},t.prototype.createTraceId=function(){return"".concat(++yi)},t.prototype.getSessionId=function(){return ei},t}(),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){!function(t){c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,ii];case 1:return(e=n.sent())?(li.push(t),di(e.db),[2]):[2]}}))}))}(t)},e}(Ci),Ii=function(){function t(t,e,n,i,r){this.appkey=t,this.deviceId=e,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 t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=$n.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.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])}))}))},t.prototype.realtimeReport=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.logDB.getTimestamp4RealtimeLog()||ni,o=Math.max(i-5e3,r),s=this.logger.createTraceId(),this.logger.debug(pt.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e,itv:n}),s),[4,this.logDB.getLogs(r,o,e,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(pt.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(pt.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressLogs(c)]):[3,5];case 3:return h=l.sent(),d=h.success,g=h.data,d||this.logger.warn(pt.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(pt.L_REALTIME_LOG_O,"compress done",s),p=he(t)?t:"https://".concat(t),p+="?version=".concat("5.8.4-alpha.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:g,method:"POST"})];case 4:f=l.sent().status,this.logger.info(pt.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(c[c.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(pt.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o}),s),[4,this.logDB.getLogs(t,e,pi.DEBUG,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(pt.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),h=he(i)?i:"https://".concat(i),h+="?version=".concat("5.8.4-alpha.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressLogs(c)]:[3,3]:[3,5];case 2:return g=l.sent(),p=g.success,f=g.data,d=p?f:"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(pt.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(pt.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),Ri=48,Si=64,Oi=80,Ni=96,Mi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Ui=Mi.length,Li=function(t){for(var e={},n=0;n<t.length-1;n++){var i=t.charAt(n)+t.charAt(n+1);e.hasOwnProperty(i)?e[i].push(n):e[i]=[n]}for(var r=[],o=[],s=function(){if(o.length>0){var t=o.join("");if(o=[],t.length>26){var e=wi(t.length),n=String.fromCharCode(Oi|e.length);r.push(n+e)}else{var i=String.fromCharCode(Ni|t.length);r.push(i)}r.push(t)}},a=0;a<t.length;){var u=Ai(e,t,a);if(u.length<2)o.push(t.charAt(a++));else if(u.length<4)o.push(t.substr(a,u.length)),a+=u.length;else{var c=wi(a-u.offset),l=wi(u.length);if(c.length+l.length>=u.length)o.push(t.substr(a,u.length)),a+=u.length;else{s();var h=String.fromCharCode(Si|c.length<<2|l.length);r.push(h+c+l),a+=u.length}}}s();var d=wi(t.length),g=String.fromCharCode(Ri|d.length);return r.push(g+d),r.join("")},Ai=function(t,e,n){var i={length:0,offset:-1};if(e.length,n>=e.length-1)return i;var r=t[e.charAt(n)+e.charAt(n+1)];if(r[0]===n)return i;for(var o=e.length-n,s=0,a=r.length;s<a;s++){var u=r[s],c=n-u;if(!(c>238327)){var l=Math.min(o,c);if(l<=i.length)break;if(!(i.length>2&&e.charAt(u+i.length-1)!==e.charAt(n+i.length-1))){for(var h=2,d=h;d<l&&e.charAt(u+d)===e.charAt(n+d);d++)h++;h>=i.length&&(i.length=h,i.offset=u)}}}return i},wi=function(t){var e=[],n=0;do{n=t%Ui,e.push(Mi.charAt(n)),t=(t-n)/Ui}while(t>0);return e.join("")},bi=function(t){var e="RCDeviceId",n=i(t),r="",o=n.get(e);return o?r=o:(r=be(),n.set(e,r)),r},Pi=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,i=navigator.userAgent,r={IE:/rv:([\d.]+)\) like Gecko|MSIE ([\d.]+)/,Edge:/Edge\/([\d.]+)/,Firefox:/Firefox\/([\d.]+)/,Opera:/(?:OPERA|OPR).([\d.]+)/,WeChat:/MicroMessenger\/([\d.]+)/,QQBrowser:/QQBrowser\/([\d.]+)/,Chrome:/Chrome\/([\d.]+)/,Safari:/Version\/([\d.]+).*Safari/,iOSChrome:/Mobile\/([\d.]+).*Safari/};for(var o in r)if(r.hasOwnProperty(o)){var s=i.match(r[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},Di=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,u=t.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Vi=function(t){function e(e,n,i,r){var o=this,s=bi(n),a=Pi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=t.call(this,e,s,u,_i(),i)||this).runtime=n,o.clientReportLevel=r,vi(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Ti(e.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressLogs=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:Li(t.map(Di).join(""))}]}))}))},e.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.logger.getSessionId(),c(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,gi("".concat(Ei,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s){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,t.prototype.report.call(this,e,n,i,r,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(Ii),Gi=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(t,e,n){return void 0===e&&(e=Date.now()-Gi),void 0===n&&(n=Date.now()),c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return e=e<0?Date.now()+e:e,(n=n<=0?Date.now():n)-e>Gi&&(e=n-Gi),(i=new mi(t,"RC-IM","IM")).debug(pt.T,"get logs: startTime ".concat(e," endTime ").concat(n)),ui(t,i,{tag:"browser"}),[4,_i().getLogs(e,n,pi.DEBUG,!1)];case 1:return r=o.sent().logs,i.debug(pt.T,"get logs ".concat(r.length)),function(t,e){var n=e.map((function(t){var e=t.sessionId,n=t.time,i=t.type,r=t.level,o=t.tag,s=t.traceId,a=t.loggerId,u=t.content;return"".concat(e,",").concat(n,",").concat(i,",").concat(r,",").concat(o,",").concat(s,",").concat(a,',"').concat(u,'"\n')})),i=new Blob(n,{type:"text/csv"}),r=URL.createObjectURL(i),o=document.createElement("a");o.href=r,o.download="".concat(t,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}("".concat(t,"-").concat(e,"-").concat(n),r),[2]}}))}))}}}}var Bi,ki,xi,Fi,Ki,Hi,qi,Yi=function(){function t(t){this._context=t}return t.prototype.__getContext=function(){return this._context},t.prototype.createCodec=function(t,e){return this._context.createCodec(t,e)},t.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._context.refetchNaviInfo()]}))}))},t.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},t.prototype.getCoreVersion=function(){return"5.8.4-alpha.8"},t.prototype.getAPIVersion=function(){return"5.8.4-alpha.8"},t.prototype.getAppkey=function(){return this._context.appkey},t.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},t.prototype.getDeviceId=function(){return this._context.getDeviceId()},t.prototype.sendMessage=function(t,e,n){return this._context.sendMessage(t,e,n)},t.prototype.registerMessageType=function(t,e,n,i){void 0===i&&(i=[]),this._context.registerMessageType(t,e,n,i)},t.prototype.getServerTime=function(){return this._context.getServerTime()},t.prototype.getOSInfo=function(){return this._context.getOSInfo()},t.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._context.setCallInfo(t,e,n)},t.prototype.createLogger=function(t,e){return this._context.createLogger(t,e)},t}(),ji="pgMsgP",Qi="chatMsg",Wi="pcMsgP",Ji="pbMsgP",Xi={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Zi="delMsg",zi="joinChrm",$i="joinChrmR",tr="exitChrm",er="setKV",nr="delKV",ir="setKVS",rr="delKVS",or="qryRelationR",sr="delRelation",ar="setSeAtt",ur={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},cr="reqCall",lr="pullKvMsg",hr="qryPMsg",dr="qryGMsg",gr="qryCHMsg",pr="qryCMsg",fr="qrySMsg",_r=((Bi={})["ppMsgP"]=$.PRIVATE,Bi[ji]=$.GROUP,Bi[Qi]=$.CHATROOM,Bi[Wi]=$.CUSTOMER_SERVICE,Bi[Ji]=$.SYSTEM,Bi),Er=((ki={})[$.PRIVATE]=hr,ki[$.GROUP]=dr,ki[$.CHATROOM]=gr,ki[$.CUSTOMER_SERVICE]=pr,ki[$.SYSTEM]=fr,ki),Tr=((xi={})[$.PRIVATE]=ur.PRIVATE,xi[$.GROUP]=ur.GROUP,xi[$.ULTRA_GROUP]=ur.ULTRA_GROUP,xi[$.CUSTOMER_SERVICE]=ur.CUSTOMER_SERVICE,xi[$.SYSTEM]=ur.SYSTEM,xi),vr="1",yr="0",Cr=1,mr=2,Ir=3;!function(t){t[t.AT_MOST_ONCE=0]="AT_MOST_ONCE",t[t.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",t[t.EXACTLY_ONCE=2]="EXACTLY_ONCE",t[t.DEFAULT=3]="DEFAULT"}(Fi||(Fi={})),function(t){t[t.SYMMETRIC=0]="SYMMETRIC",t[t.CONNECT=1]="CONNECT",t[t.CONN_ACK=2]="CONN_ACK",t[t.PUBLISH=3]="PUBLISH",t[t.PUB_ACK=4]="PUB_ACK",t[t.QUERY=5]="QUERY",t[t.QUERY_ACK=6]="QUERY_ACK",t[t.QUERY_CONFIRM=7]="QUERY_CONFIRM",t[t.SUBSCRIBE=8]="SUBSCRIBE",t[t.SUB_ACK=9]="SUB_ACK",t[t.UNSUBSCRIBE=10]="UNSUBSCRIBE",t[t.UNSUB_ACK=11]="UNSUB_ACK",t[t.PING_REQ=12]="PING_REQ",t[t.PING_RESP=13]="PING_RESP",t[t.DISCONNECT=14]="DISCONNECT",t[t.RESERVER2=15]="RESERVER2"}(Ki||(Ki={})),function(t){t.PUB="pub",t.QUERY="qry"}(Hi||(Hi={})),function(t){t[t.V4=4]="V4",t[t.V3=3]="V3"}(qi||(qi={}));var Rr,Sr=function(){function t(t,e,n,i){void 0===e&&(e=!1),void 0===n&&(n=Fi.AT_LEAST_ONCE),void 0===i&&(i=!1),this._retain=!1,this.qos=Fi.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,t&&t>0&&1===arguments.length?(this._retain=(1&t)>0,this.qos=(6&t)>>1,this._dup=(8&t)>0,this.type=t>>4&15,this.syncMsg=8==(8&t)):(this.type=t,this._retain=e,this.qos=n,this._dup=i)}return t.prototype.encode=function(){var t=this.type<<4;return t|=this._retain?1:0,t|=this.qos<<1,t|=this._dup?8:0},t}(),Or=function(){function t(){}return t.writeUTF=function(t,e){for(var n=this._getBackAndByteSize(t),i=n.back,r=n.byteSize,o=0,s=i.length;o<s;o++)i[o]>255&&(i[o]&=255);return e?i:r<=255?[0,r].concat(i):[r>>8,255&r].concat(i)},t._getBackAndByteSize=function(t){var e=[],n=0;if(te(t))for(var i=0,r=t.length;i<r;i++){var o=t.charCodeAt(i);o>=0&&o<=127?(n+=1,e.push(o)):o>=128&&o<=2047?(n+=2,e.push(192|31&o>>6),e.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,e.push(224|15&o>>12),e.push(128|63&o>>6),e.push(128|63&o))}return{byteSize:n,back:e}},t.readUTF=function(t){for(var e,n,i=[],r=-1,o=t,s="";++r<o.length;){var a=Number(o[r]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++r])<<6|128^o[++r])<<6|128^o[++r]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++r])<<6|128^o[++r]:192==(192&a)&&(a=(a^=192)<<6|128^o[++r])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?i.push(a):(e=(a-=65536)>>10|55296,n=a%1024|56320,i.push(e,n)),(r+1===o.length||i.length>16384)&&(s+=String.fromCharCode.apply(null,i),i.length=0)}return s},t}(),Nr=function(){function t(t){this._position=0,this._poolLen=0,this._pool=t,this._poolLen=t.length}return t.prototype.check=function(){return this._position>=this._pool.length},t.prototype.read2Byte=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<2;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readInt=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<4;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i.toString()}return parseInt(e,16)},t.prototype.readLong=function(){var t=this;if(t.check())return-1;for(var e="",n=0;n<8;n++){var i=t._pool[t._position++].toString(16);1===i.length&&(i="0".concat(i)),e+=i}return parseInt(e,16)},t.prototype.readByte=function(){if(this.check())return-1;var t=this._pool[this._position++];return t>255&&(t&=255),t},t.prototype.readUTF=function(){if(this.check())return"";var t=this.readByte()<<8|this.readByte(),e=this._position;this._position+=t;var n=this._pool.subarray(e,this._position);return Or.readUTF(n)},t.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},t}(),Mr=function(){function t(){this._pool=[],this._position=0,this._writen=0}return t.prototype.write=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")?this._pool=this._pool.concat(t):t>=0&&(t>255&&(t&=255),this._pool.push(t),this._writen++),t},t.prototype.writeArr=function(t){return this._pool=this._pool.concat(t),t},t.prototype.writeUTF=function(t){var e=Or.writeUTF(t);this._pool=this._pool.concat(e),this._writen+=e.length},t.prototype.getBytesArray=function(){return this._pool},t}(),Ur=function(t,e){return t&&e?"".concat(e,"_").concat(t):t||Date.now()},Lr=function(){function t(t){this.header=t,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ur(t,e)},t.prototype.read=function(t,e,n,i){this.readMessage(t,e,n,i)},t.prototype.readMessage=function(t,e,n,i){return{stream:e,length:n}},t}(),Ar=function(){function t(t){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new Sr(t,!1,Fi.AT_MOST_ONCE,!1)}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return Ur(t,e)},t.prototype.write=function(t){var e=this.getHeaderFlag();t.write(e),this.writeMessage(t)},t.prototype.setHeaderQos=function(t){this._header.qos=t},t.prototype.getHeaderFlag=function(){return this._header.encode()},t.prototype.getLengthSize=function(){return this.lengthSize},t.prototype.getBufferData=function(){var t=new Mr;this.write(t);var e=t.getBytesArray();return new Int8Array(e)},t}(),wr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=null,e.userId=null,e.timestamp=0,e}return a(e,t),e.prototype.readMessage=function(t,n,i,r){if(n.readByte(),this.status=+n.readByte(),i<=e.MESSAGE_LENGTH)return{stream:n,length:i};if(r===qi.V4){var o=n.readByte();1&o&&(this.userId=n.readUTF()),2&o&&n.readUTF(),4&o&&(this.timestamp=n.readLong()),8&o&&(this.messageId=n.read2Byte())}else{this.userId=n.readUTF();var s=n.readUTF();t.debug(pt.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:i}},e.MESSAGE_LENGTH=2,e}(Lr),br=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){return e.readByte(),this.status=+e.readByte(),{stream:e,length:n}},e.MESSAGE_LENGTH=2,e}(Lr),Pr=function(t){function e(){return t.call(this,Ki.PING_REQ)||this}return a(e,t),e.prototype.writeMessage=function(t){},e}(Ar),Dr=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e}(Lr),Vr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.messageId=0,e}return a(e,t),e.prototype.readMessage=function(t,e,n){var i=256*e.readByte()+e.readByte();return this.messageId=parseInt(i.toString(),10),{stream:e,length:n}},e}(Lr),Gr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.writeMessage=function(t){var e=this.messageId,n=255&e,i=(65280&e)>>8;t.write(i),t.write(n)},e}(Ar),Br=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=Hi.PUB,e}return a(e,t),e.prototype.readMessage=function(e,n,i){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),t.prototype.readMessage.call(this,e,n,i),this.data=n.readAll(),{stream:n,length:i}},e}(Vr),kr=function(t){function e(e,n,i){var r=t.call(this,Ki.PUBLISH)||this;return r.syncMsg=!1,r.identifier=Hi.PUB,r.topic=e,r.data=te(n)?Or.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Gr),xr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.date=0,e.millisecond=0,e.messageUId="",e.timestamp=0,e.identifier=Hi.PUB,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,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}},e}(Vr),Fr=function(t){function e(e){var n=t.call(this,Ki.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=e,n}return a(e,t),e.prototype.writeMessage=function(e){t.prototype.writeMessage.call(this,e)},e}(Gr),Kr=function(t){function e(e,n,i){var r=t.call(this,Ki.QUERY)||this;return r.identifier=Hi.QUERY,r.topic=e,r.data=te(n)?Or.writeUTF(n):n,r.targetId=i,r}return a(e,t),e.prototype.writeMessage=function(e){e.writeUTF(this.topic),e.writeUTF(this.targetId),t.prototype.writeMessage.call(this,e),e.write(this.data)},e}(Gr),Hr=function(t){function e(e){var n=t.call(this,Ki.QUERY_CONFIRM)||this;return n.messageId=e,n}return a(e,t),e}(Gr),qr=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.identifier=Hi.QUERY,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,i){return t.prototype.readMessage.call(this,e,n,i),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:i}},e}(Vr),Yr=function(t,e,n){var i=new Uint8Array(e),r=new Nr(i),o=r.readByte(),s=function(t,e){var n,i=t.type;switch(i){case Ki.CONN_ACK:n=new wr(t);break;case Ki.PUBLISH:(n=new Br(t)).syncMsg=t.syncMsg;break;case Ki.PUB_ACK:n=new xr(t);break;case Ki.QUERY_ACK:n=new qr(t);break;case Ki.SUB_ACK:case Ki.UNSUB_ACK:case Ki.PING_RESP:n=new Dr(t);break;case Ki.DISCONNECT:n=new br(t);break;default:n=new Lr(t),e.error(pt.O,"No support for deserializing ".concat(i," messages"))}return n}(new Sr(o),t);return s.read(t,r,i.length-1,n),s};!function(t){t[t.ppMsgP=1]="ppMsgP",t[t.ppMsgN=2]="ppMsgN",t[t.ppMsgS=3]="ppMsgS",t[t.pgMsgP=4]="pgMsgP",t[t.chatMsg=5]="chatMsg",t[t.pcMsgP=6]="pcMsgP",t[t.qryPMsg=7]="qryPMsg",t[t.qryGMsg=8]="qryGMsg",t[t.qryCHMsg=9]="qryCHMsg",t[t.qryCMsg=10]="qryCMsg",t[t.qrySMsg=11]="qrySMsg",t[t.recallMsg=12]="recallMsg",t[t.prMsgS=13]="prMsgS",t[t.pbMsgP=14]="pbMsgP",t[t.rrMsg=15]="rrMsg",t[t.rrList=16]="rrList",t[t.s_ntf=17]="s_ntf",t[t.s_msg=18]="s_msg",t[t.s_stat=19]="s_stat",t[t.s_cmd=20]="s_cmd",t[t.s_us=21]="s_us",t[t.pullUS=22]="pullUS",t[t.pgMsgS=23]="pgMsgS",t[t.chatMsgS=24]="chatMsgS",t[t.qrySessionsAtt=25]="qrySessionsAtt",t[t.pullMsg=26]="pullMsg",t[t.qrySessions=27]="qrySessions",t[t.delSessions=28]="delSessions",t[t.delMsg=29]="delMsg",t[t.updRRTime=30]="updRRTime",t[t.chrmPull=31]="chrmPull",t[t.joinChrm=32]="joinChrm",t[t.joinChrmR=33]="joinChrmR",t[t.exitChrm=34]="exitChrm",t[t.queryChrmI=35]="queryChrmI",t[t.setKV=36]="setKV",t[t.delKV=37]="delKV",t[t.pullKV=38]="pullKV",t[t.qryRelation=39]="qryRelation",t[t.delRelation=40]="delRelation",t[t.pullSeAtts=41]="pullSeAtts",t[t.setSeAtt=42]="setSeAtt",t[t.qnTkn=43]="qnTkn",t[t.qnUrl=44]="qnUrl",t[t.aliUrl=45]="aliUrl",t[t.s3Url=46]="s3Url",t[t.stcUrl=47]="stcUrl",t[t.minioUrl=48]="minioUrl",t[t.cleanPMsg=49]="cleanPMsg",t[t.cleanGMsg=50]="cleanGMsg",t[t.cleanCMsg=51]="cleanCMsg",t[t.cleanSMsg=52]="cleanSMsg",t[t.rtcPing=53]="rtcPing",t[t.rtc_ntf=54]="rtc_ntf",t[t.rtcSetOutData=55]="rtcSetOutData",t[t.rtcQryUserOutData=56]="rtcQryUserOutData",t[t.addSeTag=57]="addSeTag",t[t.delSeTag=58]="delSeTag",t[t.addTag=59]="addTag",t[t.delTag=60]="delTag",t[t.disTag=61]="disTag",t[t.reportsdk=62]="reportsdk",t[t.pullUgSes=63]="pullUgSes",t[t.pullUgMsg=64]="pullUgMsg",t[t.ugMsg=65]="ugMsg",t[t.qryUgMsg=66]="qryUgMsg",t[t.updUgRTime=67]="updUgRTime",t[t.upMsgEx=68]="upMsgEx",t[t.modifyMsg=69]="modifyMsg",t[t.qryMsgChange=70]="qryMsgChange",t[t.qryMsg=71]="qryMsg",t[t.operate=72]="operate",t[t.s_opNtf=73]="s_opNtf",t[t.ugUnpushQuery=74]="ugUnpushQuery",t[t.ugUnpushSet=75]="ugUnpushSet",t[t.setRtcRoomId=76]="setRtcRoomId",t[t.qryUgUal=77]="qryUgUal",t[t.s_pubCall=78]="s_pubCall"}(Rr||(Rr={}));var jr=Rr,Qr=function(){function t(t,e){this._runtime=t,this._appkey=e,this._users={}}return t.prototype._getMemData=function(t){return this._users[t]=this._users[t]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[t]},t.prototype.setInboxTime=function(t,e){var n=this._getMemData(e);if(!(n.inboxTime>t)){n.inboxTime=t;var i=Y.INBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getInboxTime=function(t){var e=this._getMemData(t);if(0===e.inboxTime){var n=Y.INBOX_TIME_KEY(this._appkey,t);e.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.inboxTime},t.prototype.setBroadcastSyncTime=function(t,e){var n=this._getMemData(e);if(!(n.broadcastSyncTime>=t||ce(t))){n.broadcastSyncTime=t;var i=Y.BROADCASTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getBroadcastSyncTime=function(t){var e=this._getMemData(t);if(!e||0===e.broadcastSyncTime){var n=Y.BROADCASTBOX_TIME_KEY(this._appkey,t);e.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return e.broadcastSyncTime},t.prototype.setOutboxTime=function(t,e){var n=this._getMemData(e);if(!(n.outboxTime>=t)){n.outboxTime=t;var i=Y.OUTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(i,t.toString())}},t.prototype.getOutboxTime=function(t){var e=this._getMemData(t);if(0===e.outboxTime){var n=Y.OUTBOX_TIME_KEY(this._appkey,t);e.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.outboxTime},t}(),Wr={_caches:{},set:function(t,e){this._caches[t]=e},get:function(t){return this._caches[t]||0},clear:function(t){this._caches[t]=0}},Jr=function(){function t(t,e,n){this.logger=t,this._kvCaches={},this._chatroomId=e,this._currentUserId=n}return t.prototype._add=function(t){var e=t.key;t.isDeleted=!1,this._kvCaches[e]=t},t.prototype._remove=function(t){var e=t.key,n=this._kvCaches[e];n&&(n.isDeleted=!0,this._kvCaches[e]=n)},t.prototype._setEntry=function(t,e){var n=t.key,i=t.type,r=t.isOverwrite,o=t.userId,s=this._getSetUserId(n),a=i===Et.DELETE,u=s===o,c=!this._isExisted(n),l=a?this._remove:this._add;(e||r||u||c)&&l.call(this,t)},t.prototype.getValue=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.value},t.prototype.getVersion=function(t){var e=this._kvCaches[t]||{};return e.isDeleted?null:e.version},t.prototype.getAllValue=function(){var t={};for(var e in this._kvCaches)this._kvCaches[e].isDeleted||(t[e]=this._kvCaches[e].value);return t},t.prototype._getSetUserId=function(t){return(this._kvCaches[t]||{}).userId},t.prototype._isExisted=function(t){var e=this._kvCaches[t]||{},n=e.value,i=e.isDeleted;return n&&!i},t.prototype.setEntries=function(t){var e=this,n=t.kvEntries,i=t.isFullUpdate;n=n||[],(i=i||!1)&&this.clear(),n.forEach((function(t){e._setEntry(t,i)}))},t.prototype.clear=function(){this._kvCaches={}},t}(),Xr=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}return t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],e=t.chrmId,n=t.timestamp,(i=Wr.get(e))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(e,i)]);case 1:return r=a.sent(),o=r.code,s=r.data,this._isPulling=!1,o===Z.SUCCESS?(Wr.set(e,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.reset=function(t){Wr.clear(t);var e=this._storeCaches[t];null==e||e.clear()},t.prototype.pullEntry=function(t,e){this._pullQueue.push({chrmId:t,timestamp:e}),this._startPull()},t.prototype.setLocal=function(t,e,n){var i=this._storeCaches[t];de(i)||(i=new Jr(this._engine.getInnerLogger(),t,n)),i.setEntries(e),this._storeCaches[t]=i},t.prototype.getValue=function(t,e){var n=this._storeCaches[t];return n?n.getValue(e):null},t.prototype.getVersion=function(t,e){var n=this._storeCaches[t];return n?n.getVersion(e):null},t.prototype.getAll=function(t){var e=this._storeCaches[t],n={};return e&&(n=e.getAllValue()),n},t}(),Zr=function(){function t(t){this._canJoinMulipleChrm=t,this._joinedChrmsInfo={}}return t.prototype.set=function(t,e){void 0===e&&(e=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[t]=e},t.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},t.prototype.remove=function(t){delete this._joinedChrmsInfo[t]},t.prototype.clear=function(){this._joinedChrmsInfo={}},t}(),zr="converStatusChanged",$r=function(){function t(t,e,n){this._eventEmitter=new ve,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(e,"-").concat(n),this._oldStorage=i(t.runtime),this._storage=new o(t.runtime,Y.CONVER_STATE_PULL_TIME_KEY(e,n)),this._appkey=e,this._currentUserId=n,this._engine=t,this.adaptOldStatus()}return t.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var t=this._oldStorage.get(this._storagePullTimeKey)||0;if(!t)return;this._storage.set(this._storagePullTimeKey,t),this._oldStorage.remove(this._storagePullTimeKey)}catch(t){this._engine.getInnerLogger().error(pt.A_CALLBACK_E,"adaptOldStatus error: ".concat(t.message))}},t.prototype._set=function(t){var e=this;if(!ce(t)&&Array.isArray(t)){var n=this._storage.get(this._storagePullTimeKey)||0,i=t.length;t.forEach((function(t,r){var o=t.updatedTime||0;n=o>n?o:n,t.conversationType=t.type,e._eventEmitter.emit(zr,{statusItem:t,isLastPull:r===i-1})})),this._storage.set(this._storagePullTimeKey,n)}},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(t)]);case 1:return e=r.sent(),n=e.code,i=e.data,n===Z.SUCCESS?(this._isPulling=!1,this._set(i),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.pull=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},t.prototype.watch=function(t){this._eventEmitter.on(zr,(function(e){t(e)}))},t.prototype.setConversationUpdatedTime=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;return t&&t>e?(this._storage.set(this._storagePullTimeKey,t),t):e},t.prototype.getConversationUpdatedTime=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(),to={c:{keyName:"unreadMessageCount",defaultVal:0},hm:{keyName:"hasMentioned",defaultVal:!1},m:{keyName:"mentionedInfo",defaultVal:null},t:{keyName:"lastUnreadTime",defaultVal:0},lt:{keyName:"lastReadTime",defaultVal:0},nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0},to:{keyName:"isTop",defaultVal:!1},tg:{keyName:"tags",defaultVal:{}},mc:{keyName:"unreadMentionedCount",defaultVal:0},st:{keyName:"lastMessageSentTime",defaultVal:0}},eo={};for(var no in to){var io=to[no].keyName;eo[io]=no}var ro,oo=function(){function t(t,e,n,i){this._appkey=e,this._currentUserId=n,this.logger=i,this.storage=new o(t,Y.OLD_CONVER_STATE_KEY(e,n)),this._localStore=new o(t,Y.CONVER_STATE_KEY(e,n))}return t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t.prototype._getConOptionByKey=function(t){var e=(t=t||"").split("_");if(e.length>=2){var n=e.shift(),i=e.shift(),r=e.join("_");return{conversationType:Number(i),targetId:r,channelId:n}}return{conversationType:$.PRIVATE,targetId:"",channelId:""}},t.prototype._updateMentionedUserList=function(t,e,n){var i=this,r=t.conversationType,o=t.messageType,s=t.isMentioned,a=t.senderUserId;s&&r===$.GROUP&&((n.userIdList||[]).forEach((function(t){t===i._currentUserId&&e.indexOf(a)<0&&e.push(a)})),n.type===ct.ALL&&e.indexOf(a)<0&&e.push(a));if(o===it.RECALL&&r===$.GROUP){var u=e.indexOf(a);u>=0&&e.splice(u,1)}return e},t.prototype.updateMentionedData=function(t){var e=t.conversationType,n=t.targetId,i=t.content,r=t.channelId,o=t.senderUserId,s=i.mentionedInfo;if(s&&o!==this._currentUserId){var a=this._getStoreKey(e,n,r),u=this._localStore.get(a)||{},c=eo.mentionedInfo,l=eo.hasMentioned,h=u[c]||{},d=h.userIdList||[];s={userIdList:d=this._updateMentionedUserList(t,d,s),type:(null==s?void 0:s.type)||h.type},0!==d.length?(u[c]=s,u[l]=!0):(delete u[c],delete u[l]),de(u)?this._localStore.set(a,u):this._localStore.remove(a)}},t.prototype._setLocal=function(t,e){if("tags"===t)for(var n in e)e[n].isTop||delete e[n].isTop;return e},t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=eo[s],u=n[s];if(!ce(a)&&!ce(u)&&"hasMentioned"!==s&&"MentionedInfo"!==s)u===to[a].defaultVal||"tags"===s&&!de(u)?delete o[a]:o[a]=this._setLocal(s,u),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var c=Object.keys(o);1===c.length&&c.includes("st")&&delete o.st,de(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in to){var a=to[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||gn(c)}return o},t.prototype.getValue=function(t){var e=this._localStore.getValues()||{},n=[];for(var i in e){var r=this._getConOptionByKey(i),o={conversationType:r.conversationType,targetId:r.targetId,channelId:r.channelId},s=e[i];for(var a in s)if(to[a]){var u=to[a],c=u.keyName,l=u.defaultVal;o[c]=s[a]||gn(l)}o=t?t(o):o,n.push(o)}return n},t.prototype.getValueForTag=function(){var t=this._localStore.getValues()||{},e={};for(var n in t){var i=this._getConOptionByKey(n),r=i.conversationType,o=i.targetId,s={},a=t[n];for(var c in a){var l=to[c],h=l.keyName,d=l.defaultVal;s[h]=a[c]||gn(d)}for(var g in s.tags){ce(e[g])&&(e[g]=[]);var p=u(u({},s),{conversationType:r,targetId:o});delete p.tags,e[g].push(p)}}return e},t.prototype.adaptOldStore=function(){try{var t=this.storage.getValues();if(0===Object.keys(t).length)return;for(var e in t){var n="_".concat(e);this._localStore.set(n,t[e])}this.storage.clear()}catch(t){this.logger.error(pt.O,"adaptOldStore error: ".concat(t.message))}},t.prototype.remove=function(t,e,n){var i=this._getStoreKey(t,e,n);this._localStore.remove(i)},t}(),so=[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE,$.APP_PUBLIC_SERVICE],ao={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},uo=1e3,co=function(){function t(t,e,n,i,r){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new ve,this._draftMap={},this._recallMsgTimeMap={},this._appkey=e,this._loginUserId=n,this._store=new oo(t.runtime,e,n,t.getInnerLogger()),this._statusManager=new $r(t,e,n),this._statusManager.watch((function(t){var e=t.statusItem,n=t.isLastPull;o.addStatus(e,n)})),this._eventEmitter.on(ao.CHANGED,(function(t){i(t)})),this._eventEmitter.on(ao.CON_TAG_STATUS_CHANGED,(function(){r()}));var s=this._store.getValue();s.length>uo&&(s=s.sort((function(t,e){var n=t.lastMessageSentTime,i=void 0===n?0:n,r=e.lastMessageSentTime;return(void 0===r?0:r)-i})),s.splice(uo,s.length).forEach((function(t){o._store.remove(t.conversationType,t.targetId,t.channelId)})))}return t.prototype._calcMsg=function(t,e,n,i){var r=!this._recallMsgTimeMap[t]||this._recallMsgTimeMap[t]&&!this._recallMsgTimeMap[t].find((function(t){return t===i.sentTime})),o=e>=i.sentTime;return n&&(o=n<i.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:r}},t.prototype._calcUnreadCount=function(t,e){var n=t.content,i=t.messageType,r=t.sentTime,o=t.isCounted,s=t.messageDirection,a=t.senderUserId,u=s===J.SEND&&a===this._loginUserId,c=i===it.RECALL,l=ae(n),h=!1,d={},g=e.lastUnreadTime,p=e.lastReadTime,f=e.unreadMessageCount;if(g>r||u)return{hasChanged:h,localConversation:e,updateItems:d};if(o&&(e.unreadMessageCount=f+1,e.lastUnreadTime=r,h=!0),c&&l){var _="".concat(t.conversationType,"_").concat(t.channelId,"_").concat(t.targetId),E=this._calcMsg(_,g,p,n),T=E.isNotRead,v=E.isNotRepeadRecallSendTime;T&&f&&v&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),e.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:e.unreadMessageCount||0,time:r}),{hasChanged:h,localConversation:e,updateItems:d}},t.prototype._calcMentionedInfo=function(t,e){var n=t.content,i=t.messageDirection,r=t.isMentioned,o=t.sentTime,s=i===J.SEND,a=ae(n),u=!1,c={};return!s&&r&&a&&n.mentionedInfo&&(e.hasMentioned=!0,u=!0,c.hasMentioned={val:!0,time:o},c.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:u,localConversation:e,updateItems:c}},t.prototype._calcMentionedCount=function(t,e){var n=t.content,i=t.messageDirection,r=!1;if(t.isMentioned&&i===J.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===ct.ALL||(a||[]).includes(this._loginUserId)){r=!0;var u=e.unreadMentionedCount||0;e.unreadMentionedCount=u+1}if((a||[]).includes(this._loginUserId)){r=!0;u=e.unreadMentionedMeCount||0;e.unreadMentionedCount=u+1}}return{hasChanged:r,localConversation:e}},t.prototype._setUpdatedConversation=function(t){if(ae(t)){var e=t.conversationType,n=t.targetId,i=t.channelId,r="".concat(e,"_").concat(n),o=this._store.get(e,n,i)||{};this._updatedConversations[r]=Object.assign(o,t)}},t.prototype._setConTagStatusChanged=function(t,e,n,i){var r=(this._store.get(t,e,i)||{}).tags||{};if(Object.keys(r).length===Object.keys(n).length){for(var o in r)if(!n[o]||!!r[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},t.prototype.addStatus=function(t,e){var n=t.conversationType,i=t.targetId,r=t.updatedTime,o=t.notificationStatus,s=t.notificationLevel,a=t.isTop,u=t.tags,c=t.channelId,l={},h={};if(n!==$.ULTRA_GROUP){ce(o)||(h.notificationStatus={time:r,val:o}),ce(s)||(h.notificationLevel={time:r,val:s}),ce(a)||(h.isTop={time:r,val:a}),ce(u)||(h.tags={time:r,val:u},null==u||u.forEach((function(t){l[t.tagId]={isTop:t.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:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},c),this._setUpdatedConversation({conversationType:n,targetId:i,updatedItems:h,channelId:c}),e&&this._notifyConversationChanged()}},t.prototype._notifyConversationChanged=function(){var t=[];for(var e in this._updatedConversations)t.push(this._updatedConversations[e]);0!==t.length&&(this._eventEmitter.emit(ao.CHANGED,t),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(ao.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},t.prototype.setConversationCacheByMessage=function(t,e){var n=this,i=t.conversationType,r=t.isPersited,o=t.targetId,s=t.channelId,a=t.sentTime;if(so.indexOf(i)>=0){var c=!1,l=this._store.get(i,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(e){var i=e.call(n,t,l),r=i.hasChanged,o=i.localConversation,s=i.updateItems;c=c||r,h=u(u({},h),s),l=gn(o)})),this._store.set(i,o,l,s),this._store.updateMentionedData(t),r){var d=this._store.get(i,o,s);d.updatedItems=u({latestMessage:{time:t.sentTime,val:t}},h),d.latestMessage=t;var g=Object.assign(d,{conversationType:i,targetId:o,channelId:s});this._setUpdatedConversation(g)}(c||r)&&this._notifyConversationChanged()}},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t.prototype.getAllUnreadCount=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(t){var i=t.unreadMessageCount,o=t.notificationStatus,s=t.notificationLevel,a=t.conversationType;i=i||0,(n||void 0!==s&&s<=0||void 0===s&&o!==ot.OPEN)&&(e.length>0?e.includes(Number(a))&&(r+=Number(i)):r+=Number(i))})),r},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){var i=this._store.getValue(),r=0;return i.forEach((function(i){var o=i.unreadMessageCount,s=i.notificationLevel,a=void 0===s?0:s,u=i.conversationType,c=i.unreadMentionedCount;t.includes(u)&&(0===e.length||e.includes(a))&&(r+=(n?c:o)||0)})),r},t.prototype.getUnreadCountByTag=function(t,e){var n=this._store.getValueForTag()[t]||[],i=0;return n.forEach((function(t){var n=t.unreadMessageCount,r=t.notificationStatus,o=t.notificationLevel;(e||1!==r||-1===o||0===o)&&(n=n||0,i+=Number(n))})),i},t.prototype.getUnreadCount=function(t,e,n){return this._store.get(t,e,n).unreadMessageCount||0},t.prototype.clearUnreadCount=function(t,e,n,i){void 0===i&&(i=!0);var r=this._store.get(t,e,n);r.lastReadTime=r.lastUnreadTime,this._recallMsgTimeMap["".concat(t,"_").concat(n,"_").concat(e)]=[];var o=r.unreadMessageCount,s=r.hasMentioned,a={};if(o&&(r.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(r.hasMentioned=!1,r.unreadMentionedCount=0,r.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(t,e,r,n),i&&0!==Object.keys(a).length){var u=Object.assign(r,{conversationType:t,targetId:e,channelId:n,updatedItems:a});this._setUpdatedConversation(u),this._notifyConversationChanged()}},t.prototype.clearAllUnreadCount=function(){var t=this;this._store.getValue().forEach((function(e){e.unreadMessageCount&&(e.unreadMessageCount=0,e.lastReadTime=e.lastUnreadTime,t._recallMsgTimeMap={},t._store.set(e.conversationType,e.targetId,e,e.channelId))}))},t.prototype.startPullConversationStatus=function(t){this._statusManager.pull(t)},t.prototype.setDraft=function(t,e,n,i){var r="".concat(t,"_").concat(e,"_").concat(i);this._draftMap[r]=n},t.prototype.getDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);return this._draftMap[i]},t.prototype.clearDraft=function(t,e,n){var i="".concat(t,"_").concat(e,"_").concat(n);delete this._draftMap[i]},t.prototype.addTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i),o=r.tags;o=Object.assign(o,n);var s=r.lastMessageSentTime||(new Date).getTime();this._store.set(t,e,{tags:o,lastMessageSentTime:s},i)},t.prototype.deleteTagStatus=function(t,e,n,i){void 0===i&&(i="");var r=this._store.get(t,e,i).tags;n.forEach((function(t){delete r[t]})),this._store.set(t,e,{tags:r},i)},t.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},t.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(t){return t.notificationStatus===ot.OPEN||t.notificationLevel&&t.notificationLevel>0})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,notificationLevel:t.notificationLevel||0,notificationStatus:t.notificationStatus||2}}))},t.prototype.getTopConversationList=function(t,e){return(this._store.getValue()||{}).filter((function(n){return t.includes(n.conversationType)&&(ce(e)||e===n.channelId)&&n.isTop})).map((function(t){return{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount||0,latestMessage:null,hasMentioned:t.hasMentioned||!1,mentionedInfo:t.mentionedInfo,notificationStatus:t.notificationStatus||0,notificationLevel:t.notificationLevel,isTop:t.isTop||!1,lastUnreadTime:t.lastUnreadTime||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.adaptOldStore=function(){this._store.adaptOldStore()},t.prototype.getUnreadMentionedCount=function(t,e,n){return void 0===n&&(n=""),this.get(t,e,n).unreadMentionedCount||0},t.prototype.getAllUnreadMentionedCount=function(){var t=this._store.getValue(),e=0;return t.forEach((function(t){var n=t.unreadMentionedCount;n=n||0,e+=Number(n)})),e},t.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(t){return t.unreadMessageCount||t.unreadMentionedCount})).map((function(t){return{conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,unreadCount:t.unreadMessageCount||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.getUnreadConversationList=function(t){return(this._store.getValue()||{}).filter((function(e){return t.includes(e.conversationType)&&e.unreadMessageCount&&e.unreadMessageCount>0})).map((function(t){return{channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount||0,latestMessage:null,hasMentioned:t.hasMentioned||!1,mentionedInfo:t.mentionedInfo,notificationStatus:t.notificationStatus||0,notificationLevel:t.notificationLevel,isTop:t.isTop||!1,lastUnreadTime:t.lastUnreadTime||0,unreadMentionedCount:t.unreadMentionedCount||0}}))},t.prototype.setConversationUpdatedTime=function(t){return this._statusManager.setConversationUpdatedTime(t)},t.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},t}(),lo=function(){function t(t,e,n,r){this._pullQueue=[],this._isPulling=!1,this._storageTagKey=Y.TAG_STATE_KEY(e,n),this._storagePullTimeKey=Y.USER_SETTING_TIME_KEY(e,n),this._storage=i(t.runtime),this._engine=t,this._tagWatcherFunc=r}return t.prototype._updateTag=function(t){var e=t.tags,n={};e.forEach((function(t){n[t.tagId]={tagName:t.tagName,createdTime:t.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},t.prototype.addTag=function(t,e){var n=this._storage.get(this._storageTagKey)||{};t.forEach((function(t){var e,i=(null===(e=n[t.tagId])||void 0===e?void 0:e.createdTime)||t.createdTime||0;n[t.tagId]={tagName:t.tagName,createdTime:i}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,e)},t.prototype.deleteTag=function(t,e){var n=this._storage.get(this._storageTagKey)||{};t.forEach((function(t){delete n[t]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,e)},t.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},t.prototype.getTags=function(){var t=this._storage.get(this._storageTagKey)||{},e=[];for(var n in t)e.push({tagId:n,tagName:t[n].tagName,createdTime:t[n].createdTime,conversationCount:0});return e.sort((function(t,e){return(t.createdTime||0)-(e.createdTime||0)}))},t.prototype.getTagById=function(t){var e=this._storage.get(this._storageTagKey)||{};return e[t]?{tagId:t,tagName:e[t].tagName,createdTime:e[t].createdTime,conversationCount:0}:null},t.prototype._startPull=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,t=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(t)]);case 1:return e=u.sent(),n=e.code,i=e.data,n!==Z.SUCCESS||ce(i)?(this._isPulling=!1,this._startPull()):(o=(r=i).settings,s=r.version,a=o.Tag,ce(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},t.prototype.pullUserSettings=function(t){var e=this._storage.get(this._storagePullTimeKey)||0;(t>e||0===t)&&(this._pullQueue.push(e),this._startPull())},t.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},t}(),ho=function(t){return t.replace(/@.+$/,"@")},go=function(){function t(t,e,n,i,r){void 0===r&&(r=!0),this.appkey=t,this.logger=e,this.statisticLog=n,this.staticConfigManager=i,this.isRequestProfile=r,this.crtRequest=null}return t.prototype.request=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(u){switch(u.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(t,e,n,i,r),[4,this.crtRequest]);case 1:return o=u.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},t.prototype.sendRequest=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u,c,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return o=ho(t),!e&&(s=this.getNaviCache(o))&&(a=s.timestamp,u=s.naviInfo,n||Date.now()-a<v)?(this.logger.info(pt.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:u}),i),c={bid:tn(),ptc:Ft.NAVI,cod:Z.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:u.type||0,hos:"",cache:Kt.LOCAL,v:Ht.CURRENT,rsn:null==r?void 0:r.reason,cid:"".concat(null==r?void 0:r.uuid,"_").concat(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.statisticLog.__statistics(ft.IM_NAVI,JSON.stringify(c),i),[2,{code:Z.SUCCESS,data:u}]):(h=$n.getNaviUrlList(t),this.logger.info(pt.L_GET_NAVI_T,JSON.stringify({token:t,uris:h}),i),[4,this.requestHandler(h,t,i,r)]);case 1:return d=l.sent(),g=d.code,p=d.data,g===Z.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(f=l.sent())?void 0:f.navi)&&(null==f?void 0:f.navi.length)>0?(_=f.navi,[4,this.requestHandler(_,t,i,r)]):[3,4];case 3:E=l.sent(),g=E.code,p=E.data,l.label=4;case 4:return g!==Z.SUCCESS?(this.logger.warn(pt.L_GET_NAVI_R,g,i),[2,{code:g}]):(T=p,this.logger.info(pt.L_GET_NAVI_R,JSON.stringify({naviInfo:T}),i),this.setNaviCache(o,T),[2,{code:g,data:T}])}}))}))},t.prototype.requestHandler=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:r=0,o=t.length,l.label=1;case 1:return r<o?(s=r===t.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,a.call(this,t[r],this.appkey,e,n,s)]):[3,4];case 2:if(c=l.sent(),h=c.code,d=c.data,g={bid:tn(),ptc:Ft.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:t[r],cache:Kt.REQUEST,v:Ht.CURRENT,rsn:null==i?void 0:i.reason,cid:"".concat(null==i?void 0:i.uuid,"_").concat(null==i?void 0:i.retryCount),count:null==i?void 0:i.retryCount},this.statisticLog.__statistics(ft.IM_NAVI,JSON.stringify(g),n),[Z.SUCCESS,Z.RC_CONN_TOKEN_INCORRECT,Z.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:Z.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.transHttpCode=function(t){switch(t){case 401:case 403:return Z.RC_CONN_TOKEN_INCORRECT;case 416:return Z.RC_LICENSE_EXPIRED;default:return Z.RC_NAVI_REQ_FAILED}},t.prototype.getNaviInfoFromCache=function(t){var e=this.getNaviCache(ho(t));return e?e.naviInfo:null},t.prototype.updateVoipCallInfo=function(t,e){var n=this.getNaviInfoFromCache(t);n&&this.setNaviCache(ho(t),u(u({},n),{voipCallInfo:e}))},t.prototype.getNaviV2RequestOption=function(t){var e,n=t.uri,i=t.token,r=t.platform,o=t.protocol;e="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(i),"&version=").concat("5.8.4-alpha.8","&platfrom=").concat(r);return{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2")},body:s,url:e,timeout:C}},t.prototype.useV2Navi=function(){return!0},t}(),po={},fo=function(t){function e(e,n,i,r,o){var s=t.call(this,e,n,i,o,r.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol))||this;return s.runtime=r,s}return a(e,t),e.prototype.httpRequest=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return o="".concat(t,"/navi.js?appId=").concat(e,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(F,"&r=").concat(Date.now()),this.logger.debug(pt.L_REQUEST_T,"req navi => ".concat(o),i),[4,this.runtime.httpReq({url:o,timeout:C,dataType:"text"})];case 1:if(200!==(s=c.sent()).status)return this.logger.debug(pt.L_REQUEST_R,"request navi failed: ".concat(s.status),i),!this.runtime.useNavi&&r?(u={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:$n.getMiniCmpUrlList().join(",")},[2,{code:Z.SUCCESS,data:u}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(u=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",this.runtime.useNavi||(u.server="",u.backupServer=$n.getMiniCmpUrlList().join(","),u.logSwitch=0),[2,{code:Z.SUCCESS,data:u}]}catch(t){this.logger.error(pt.L_PARSE_NAVI_E,s.data,i)}return[2,{code:Z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.httpRequestV2=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return r=this.getNaviV2RequestOption({appkey:e,token:n,uri:t,platform:this.runtime.tag,protocol:(/^https/.test(t)?wt.WSS:wt.WS).toString()}),this.logger.debug(pt.L_REQUEST_T,"req navi => ".concat(r.url),i),[4,this.runtime.httpReq(r)];case 1:if(200!==(o=c.sent()).status)return this.logger.debug(pt.L_REQUEST_R,"request navi failed: ".concat(o.status),i),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(r.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,u=$n.getMiniCmpUrlList(),a.serverAddr=u.map((function(t,e){return{addr:t,protocol:/^https/.test(r.url)?wt.WSS:wt.WS,weight:u.length-e}}))),[2,{code:Z.SUCCESS,data:a}]}catch(t){this.logger.error(pt.L_PARSE_NAVI_E,o.data,i)}return[2,{code:Z.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.getNaviCache=function(t){if(po[t])return po[t];var e,n=Y.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var r=i.getItem(n);e=r?JSON.parse(r):[]}catch(t){e=[]}if(0===e.length)return null;var o=e.find((function(e){return e.token===t}))||null;return po[t]=o,o},e.prototype.setNaviCache=function(t,e){var n,i=Y.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var o=r.getItem(i);n=o?JSON.parse(o):[]}catch(t){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(e){return s-e.timestamp<v&&t!==e.token})));var a={timestamp:s,naviInfo:e,token:t};n.push(a),r.setItem(i,JSON.stringify(n)),po[t]=a},e}(go),_o=function(){function t(t,e){this._runtime=t,this._appkey=e,this._sendMessageMap={},this._userId=""}return t.prototype.init=function(t){this._userId=t;var e=Y.SEND_MSG_KEY(this._appkey,t);this._sendMessageMap=this._getLocalInfo(e)},t.prototype._getLocalInfo=function(t){var e=this._runtime.localStorage.getItem(t);try{return e?JSON.parse(e):{}}catch(t){return{}}},t.prototype.setMessage=function(t,e){this._sendMessageMap[t]=e;var n=Y.SEND_MSG_KEY(this._appkey,this._userId),i=this._getLocalInfo(n);i[t]=e,this._runtime.localStorage.setItem(n,JSON.stringify(i))},t.prototype.getSendMessageMap=function(){return this._sendMessageMap},t.prototype.removeByUID=function(t){delete this._sendMessageMap[t]},t.prototype.removeByTimestamp=function(t){var e=Y.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(e);Object.keys(n).forEach((function(e){n[e]<t&&delete n[e]})),this._runtime.localStorage.setItem(e,JSON.stringify(n))},t}();(ro={})[$.PRIVATE]=jr.qryPMsg,ro[$.GROUP]=jr.qryGMsg,ro[$.CHATROOM]=jr.qryCHMsg,ro[$.CUSTOMER_SERVICE]=jr.qryCMsg,ro[$.SYSTEM]=jr.qrySMsg;var Eo=[jr[jr.recallMsg],jr[jr.ppMsgS],jr[jr.pgMsgS],jr[jr.ppMsgP],jr[jr.pgMsgP],jr[jr.chatMsg],jr[jr.pcMsgP],jr[jr.prMsgS],jr[jr.updUgRTime],jr[jr.pbMsgP]],To=function(){function t(t,e,n){this._localStore=new o(t,Y.ULTRA_GROUP_STATE_KEY(e,n))}return t.prototype.set=function(t,e,n,i){var r=this._getStoreKey(t,e,i),o=this._localStore.get(r)||{};for(var s in n){var a=yo[s],u=n[s];if(!ce(a)&&!ce(u))u===vo[a].defaultVal?delete o[a]:o[a]=u}de(o)?this._localStore.set(r,o):this._localStore.remove(r)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var i=this._getStoreKey(t,e,n),r=this._localStore.get(i)||{},o={};for(var s in vo){var a=vo[s],u=a.keyName,c=a.defaultVal;o[u]=r[s]||gn(c)}return o},t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t}(),vo={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},yo={};for(var Co in vo){var mo=vo[Co].keyName;yo[mo]=Co}var Io,Ro=function(){function t(t,e,n){this._store=new To(t.runtime,e,n)}return t.prototype.addUltraGroupStatus=function(t){var e=t.conversationType,n=t.targetId,i=t.notificationStatus,r=t.notificationLevel,o=t.channelId;e===$.ULTRA_GROUP&&this._store.set(e,n,{notificationStatus:i,notificationLevel:r},o)},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t}(),So="UpStreamMessage",Oo="PushExtra",No="DownStreamMessage",Mo="DownStreamMessages",Uo="SessionsAttQryInput",Lo="SessionsAttOutput",Ao="SyncRequestMsg",wo="ChrmPullMsg",bo="NotifyMsg",Po="HistoryMsgInput",Do="HistoryMsgOuput",Vo="RelationQryInput",Go="RelationsOutput",Bo="UnreadMsgInfo",ko="DeleteSessionsInput",xo="SessionInfo",Fo="DeleteSessionsOutput",Ko="RelationsInput",Ho="DeleteMsgInput",qo="CleanHisMsgInput",Yo="SessionMsgReadInput",jo="ChrmInput",Qo="ChrmOutput",Wo="QueryChatRoomInfoInput",Jo="QueryChatRoomInfoOutput",Xo="GetQNupTokenInput",Zo="GetQNupTokenOutput",zo="GetQNdownloadUrlInput",$o="GetDownloadUrlInput",ts="GetQNdownloadUrlOutput",es="GetDownloadUrlOutput",ns="ChrmKVEntity",is="SetChrmKV",rs="SetChrmKVS",os="DeleteChrmKVS",ss="ChrmKVOutput",as="ChrmKVSOutput",us="ChrmKVSVersionEntity",cs="ChrmKVSOutputEntity",ls="QueryChrmKV",hs="SetUserSettingInput",ds="SetUserSettingOutput",gs="PullUserSettingInput",ps="PullUserSettingOutput",fs="UserSettingNotification",_s="SessionReq",Es="SessionStates",Ts="SessionState",vs="SessionStateItem",ys="SessionStateModifyReq",Cs="SessionStateModifyResp",ms="GroupUnpushQuery",Is="GroupUnpushSet",Rs="QryRemindListReq",Ss="QryRemindListResp",Os="GroupUnpushResult",Ns="GrpReadReceiptMsg",Ms="GrpReadReceiptQryReq",Us="GrpReadReceiptQryResp",Ls="GrpMsgReadUser",As="SessionTagAddInput",ws="SessionTagItem",bs="SessionTagDelInput",Ps="SessionDisTagReq",Ds="ReportSDKInput",Vs="ReportSDKOutput",Gs="UltraGrpPullSes",Bs="UltraGrpPullMsg",ks="MsgChangeReq",xs="QueryMsgChange",Fs="MsgChange",Ks="MsgChangeList",Hs="MsgQuery",qs="MessageQueryInfo",Ys="MsgQueryAck",js="OperateStatus",Qs="OperateStatusNotify",Ws="OperateInfo",Js="OperateSummary",Xs="SetRtcRoomIdInput",Zs="SetRtcRoomIdOutput",zs="CallInfoUpStream",$s="CallInfoDownStream",ta="KvInput",ea="KvOutput";(Io={})[So]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Io[Mo]=["list","syncTime","finished","broadcastSyncTime"],Io[No]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Io[Oo]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Io[Uo]=["nothing"],Io[Lo]=["inboxTime","sendboxTime","totalUnreadCount"],Io[Ao]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Io[wo]=["syncTime","count"],Io[bo]=["type","time","chrmId"],Io[Po]=["targetId","time","count","order","busChannel"],Io[Do]=["list","syncTime","hasMsg"],Io[Vo]=["type","count","startTime","order"],Io[Go]=["info","isFinished"],Io[Bo]=["msgId","msgTime","remindType","className"],Io[ko]=["sessions"],Io[xo]=["type","channelId","busChannel"],Io[Fo]=["nothing"],Io[Ko]=["type","msg","count","busChannel","startTime","endTime"],Io[Ho]=["type","conversationId","msgs","busChannel"],Io[qo]=["targetId","dataTime","conversationType","busChannel"],Io[Yo]=["type","msgTime","channelId","busChannel"],Io[jo]=["nothing"],Io[Qo]=["nothing","sessionId","joinTime"],Io[Wo]=["count","order"],Io[Jo]=["userTotalNums","userInfos"],Io[Xo]=["type","key","httpMethod","queryString","url"],Io[zo]=["type","key","fileName"],Io[$o]=["type","key","fileName"],Io[Zo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Io[ts]=["downloadUrl"],Io[es]=["downloadUrl"],Io[ns]=["key","value","status","timestamp","uid","version"],Io[is]=["entry","bNotify","notification","type"],Io[rs]=["entry","bNotify","notification","type"],Io[os]=["entry","bNotify","notification","type"],Io[ss]=["entries","bFullUpdate","syncTime"],Io[as]=["timestamp","errorKeys","keysVersion"],Io[us]=["version","key"],Io[cs]=["key","errorCode"],Io[ls]=["timestamp"],Io[hs]=["version","value"],Io[ds]=["version","reserve"],Io[gs]=["version","reserve"],Io[ps]=["items","version"],Io.UserSettingItem=["targetId","type","key","value","version","status","tags"],Io[_s]=["time"],Io[Es]=["version","state"],Io[Ts]=["type","channelId","time","stateItem","busChannel"],Io[vs]=["sessionStateType","value","tags"],Io[ys]=["version","state"],Io[Cs]=["version"],Io[Is]=["busChannel","unpushLevel"],Io[Rs]=["groupId","busChannel","msgTime","size"],Io[ms]=["busChannel"],Io[Os]=["groupId","busChannel","unpushLevel"],Io[Ns]=["msgId","busChannel"],Io[Ms]=["msgId","busChannel"],Io[Us]=["totalMemberNum","list"],Io[Ls]=["readTime","userId"],Io[As]=["version","tags"],Io[ws]=["tagId","name","createdTime","isTop"],Io[bs]=["version","tags"],Io[Ps]=["tagId"],Io[fs]=["version","reserve"],Io[Ds]=["sdkInfo"],Io[Vs]=["nothing"],Io[Gs]=["syncTime","isEraseMsgContent"],Io[Bs]=["syncTime"],Io[ks]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Io[xs]=["syncTime"],Io[Ks]=["list","syncTime","hasNext"],Io[Fs]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Io[Hs]=["targetId","type","query"],Io[qs]=["msgTime","msgUID","busChannel"],Io[Ys]=["list"],Io[js]=["targetId","type","opType","busChannel"],Io[Qs]=["type","notifyType","info","summary"],Io[Ws]=["targetId","busChannel","userId","opType","optime"],Io[Js]=["targetId","busChannel","count","opType"],Io[Xs]=["rtcRoomId"],Io[Zs]=["nothing"];var na,ia,ra,oa,sa="\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 ".concat(bo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(Ao," {\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 ").concat(So," {\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 userId = 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 ").concat(Oo," {\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 ").concat(Mo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(No," {\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 toUserId = 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 = ").concat(Q.IMAGE,";\n audio = ").concat(Q.AUDIO,";\n video = ").concat(Q.VIDEO,";\n file = ").concat(Q.FILE,";\n sight = ").concat(Q.SIGHT,";\n html = ").concat(Q.COMBINE_HTML,";\n }\n message ").concat(Xo," {\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 ").concat(zo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat($o," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Zo," {\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 ").concat(ts," {\n required string downloadUrl = 1;\n }\n message ").concat(es," {\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 ").concat(jo," {\n required int32 nothing = 1;\n }\n message ").concat(Qo," {\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 ").concat(wo," {\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 ").concat(Vo,"\n {\n optional ChannelType type = 1;\n optional int32 count = 2;\n optional int64 startTime = 3;\n optional int32 order = 4;\n }\n message ").concat(Ko,"\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 ").concat(Go,"\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 ").concat(Bo," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(Bo," //未读消息摘要信息\n {\n required string msgId = 1; //消息唯一标示\n required int64 msgTime= 2;//消息时间\n optional int32 remindType= 3;//@类型。查询会话时无此字段。查询未读@列表时返回\n optional string className = 4; //消息类型\n }\n message ").concat(Rs," // 新增 查询未读@列表入参\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 ").concat(Ss," //查询未读@列表出参\n {\n repeated ").concat(Bo," 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 ").concat(qo,"\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 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 ").concat(Wo,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(Jo,"\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 ").concat(Po,"\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 ").concat(Do,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(Uo,"{\n required int32 nothing = 1;\n }\n message ").concat(Lo,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(Yo,"\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 ").concat(ko,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(xo,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Fo,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Ho,"\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 ").concat(is," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(rs," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(os," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(ss," {\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 ").concat(as," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(cs,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(ls," {\n required int64 timestamp = 1;\n }\n message ").concat(hs," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(ds," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(gs," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(ps," {\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 ").concat(_s," {\n required int64 time = 1;\n }\n message ").concat(Es," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Ts," {\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 ").concat(vs," {\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 ").concat(ys," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(ms," {\n optional string busChannel = 1;\n }\n message ").concat(Is,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(Os," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Cs," {\n required int64 version=1;\n }\n message ").concat(Ns," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Ms," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(Us," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(Ls," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(As," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ws," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(bs," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(Ps," {\n repeated string tagId=1;\n }\n message ").concat(fs," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Ds,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(Vs,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(Gs,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(Bs,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(ks,"\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 ").concat(xs," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Ks," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Fs," //变更详情\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 ").concat(Hs," //请求\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 ").concat(Ys," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(js," //客户端发送\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 ").concat(Qs," //服务端发送\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 ").concat(Ws," {\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 ").concat(Js," {\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 ").concat(Xs,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Zs,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(zs,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat($s,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(ta,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(ea,"\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}\n"),aa=function(t,e,n,i,r,o){var s=r?Object.keys(r).map((function(e){return t.encode(an.RtcValueInfo,{key:e,value:r[e]},!0)})):void 0,a=o?Object.keys(o).map((function(e){return t.encode(an.RtcValueInfo,{key:e,value:o[e]},!0)})):void 0;return t.encode(an.RtcInput,{roomType:e,broadcastType:n,joinType:i,innerDatas:s,outerDatas:a})},ua=function(t,e){var n=t.decode(an.RtcUserListOutput,e),i=n.users,r=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,u=n.offlineKickTime,c={};return un(i,(function(t){var e=t.userId,n=t.userData,i={};un(n,(function(t){var e=t.key,n=t.value;i[e]=n})),c[e]=i})),{users:c,token:r,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:u}};!function(t){t[t.ACCEPTED=0]="ACCEPTED",t[t.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",t[t.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",t[t.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",t[t.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",t[t.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",t[t.REDIRECT=6]="REDIRECT",t[t.PACKAGE_ERROR=7]="PACKAGE_ERROR",t[t.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",t[t.BLOCK=9]="BLOCK",t[t.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",t[t.DEVICE_ERROR=11]="DEVICE_ERROR",t[t.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",t[t.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",t[t.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",t[t.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",t[t.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",t[t.OTP_USED=17]="OTP_USED",t[t.PLATFORM_ERROR=18]="PLATFORM_ERROR",t[t.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",t[t.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(na||(na={})),function(t){t[t.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",t[t.BLOCK=2]="BLOCK",t[t.BLOCK_NEW=5]="BLOCK_NEW",t[t.REDIRECT_NEW=6]="REDIRECT_NEW",t[t.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",t[t.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",t[t.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(ia||(ia={}));var ca,la=((ra={})[ia.OTHER_DEVICE_LOGIN]=Z.RC_DISCONN_KICK,ra[ia.BLOCK]=Z.RC_DISCONN_EXCEPTION,ra[ia.BLOCK_NEW]=Z.RC_DISCONN_EXCEPTION,ra[ia.REDIRECT_NEW]=Z.RC_CONN_REDIRECTED,ra[ia.TOKEN_EXPIRED]=Z.RC_CONN_TOKEN_EXPIRED,ra[ia.ILLEGAL_PROTOCOL_VERSION]=Z.RC_CONN_PROTO_VERSION_ERROR,ra[ia.ACCOUNT_CANCELLATION]=Z.RC_ACCOUNT_CANCELLATION,ra),ha=((oa={})[na.ACCEPTED]=Z.SUCCESS,oa[na.UNACCEPTABLE_PROTOCOL_VERSION]=Z.RC_CONN_PROTO_VERSION_ERROR,oa[na.IDENTIFIER_REJECTED]=Z.RC_CONN_IDENTIFIER_REJECTED,oa[na.SERVER_UNAVAILABLE]=Z.RC_CONN_SERVER_UNAVAILABLE,oa[na.TOKEN_INCORRECT]=Z.RC_CONN_TOKEN_INCORRECT,oa[na.NOT_AUTHORIZED]=Z.RC_CONN_NOT_AUTHRORIZED,oa[na.REDIRECT]=Z.RC_CONN_REDIRECTED,oa[na.PACKAGE_ERROR]=Z.RC_CONN_PACKAGE_NAME_INVALID,oa[na.APP_BLOCK_OR_DELETE]=Z.RC_CONN_APP_BLOCKED_OR_DELETED,oa[na.BLOCK]=Z.RC_CONN_USER_BLOCKED,oa[na.TOKEN_EXPIRE]=Z.RC_CONN_TOKEN_EXPIRED,oa[na.DEVICE_ERROR]=Z.RC_CONN_DEVICE_ERROR,oa[na.HOSTNAME_ERROR]=Z.RC_CONN_HOSTNAME_ERROR,oa[na.HASOHTERSAMECLIENTONLINE]=Z.RC_DISCONN_SAME_CLIENT_ON_LINE,oa[na.OUT_OF_LIMIT]=Z.RC_LISCENSE_COUNT_OUT_OF_LIMIT,oa[na.IN_OTHER_CLUSTER]=Z.RC_CONN_WRONG_CLUSTER,oa[na.APP_AUTH_NOT_PASS]=Z.RC_APP_AUTH_NOT_PASS,oa[na.OTP_USED]=Z.RC_OTP_USED,oa[na.PLATFORM_ERROR]=Z.RC_PLATFORM_ERROR,oa[na.ACCOUNT_CANCELLATION]=Z.RC_ACCOUNT_CANCELLATION,oa[na.LICENSE_EXPIRED]=Z.RC_LICENSE_EXPIRED,oa),da=function(t){return t===Z.RC_CONN_REDIRECTED},ga=function(t){return Object.keys(la).some((function(e){return la[e]===t}))},pa=function(t){return Object.keys(ha).some((function(e){return ha[e]===t}))};!function(t){t[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.SUSPENDED=3]="SUSPENDED"}(ca||(ca={}));var fa,_a=function(){function t(t,e,n,i,r){this.appkey=t,this.navi=e,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:qe.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=ca.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return t.prototype.getToken=function(){return this.token},t.prototype.getCurrentUserId=function(){return this._crtUserId},t.prototype.setConnectionStatus=function(t,e){if(this._crtConnectionStatus!==t){if(this._crtConnectionStatus=t,this._connectDurSwitch&&t!==ca.CONNECTED&&t!==ca.CONNECTING){var n={bid:tn(),cod:e,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(ft.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(t){case ca.CONNECTED:this.logger.info(pt.L_CONNECT_S,t),this.checkAlive(),this.listener.onConnected();break;case ca.CONNECTING:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.listener.onConnecting();break;case ca.SUSPENDED:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),da(e)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(e);break;default:this.logger.warn(pt.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(e)}}},t.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},t.prototype.setNetwork=function(t,e){if(!e){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:t.type,on:this._network.type};this.statisticLog.__statistics(ft.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=t},t.prototype.getNetwork=function(){return this._network},t.prototype.connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._crtConnectionStatus===ca.CONNECTED?[2,{code:Z.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=we(),this.token=t,this.reconnectKick=e,this.setConnectionStatus(ca.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Yt.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(ft.IM_STATS_CS,JSON.stringify(r),i),[4,this.try2Connect(t,e,!1,i)]);case 1:return o=u.sent(),s=o.code,a=o.data,s!==Z.SUCCESS?(this.setConnectionStatus(ca.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(ca.CONNECTED),[2,{code:s,data:a}])}}))}))},t.prototype.try2Connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(t,e,n,i),[4,this._crtConnectionTask]);case 1:return r=a.sent(),o=r.code,s=r.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},t.prototype.createConnectionTask=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,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(t,n,!1,i,r)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==Z.SUCCESS?[2,{code:s}]:1===(u=a).type?[2,{code:Z.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(pt.L_CONNECT_T,JSON.stringify({token:t,reconnectKickEnable:e}),i),[4,this.connectWithToken(t.replace(/@.+$/,"@"),u,e,i)]);case 2:return c=l.sent(),h=c.code,d=c.data,da(h)?(this.logger.warn(pt.L_CONNECT_R,"redirect code: ".concat(h),i),this.clearCmpWeightCache(),[2,this.createConnectionTask(t,e,!0,i)]):[Z.RC_TCP_RESET,Z.RC_CONN_ACK_TIMEOUT,Z.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(pt.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),i),this.setConnectionStatus(ca.SUSPENDED,h),this.setConnectionStatus(ca.CONNECTING),[2,this.createConnectionTask(t,e,!1,i)]):h!==Z.SUCCESS?(this.logger.warn(pt.L_CONNECT_R,"code: ".concat(h),i),[2,{code:h}]):(this.logger.info(pt.L_CONNECT_R,"userId: ".concat(d),i),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},t.prototype.setReconnectReason=function(t){switch(t){case Z.TIMEOUT:return void(this.reason=Yt.TIMEOUT);case Z.RC_CONN_REDIRECTED:return void(this.reason=Yt.REDIRECTED);default:this.reason=Yt.RECONNECT}},t.prototype.try2Reconnect=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(pt.T,"try2Reconnect -> ignoreNaviCache: ".concat(t,", reason: ").concat(e),n),this.stopReconnectTimer(),i=function(){return c(r,void 0,void 0,(function(){var r,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==ca.SUSPENDED?[2]:(this.setConnectionStatus(ca.CONNECTING,e),this.setReconnectReason(e),this.retryCount+=1,r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(ft.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,t,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===Z.SUCCESS?(this.setConnectionStatus(ca.CONNECTED),[2]):[Z.SERVER_UNAVAILABLE,Z.TIMEOUT,Z.RC_SOCKET_DISCONNECTED,Z.RC_SOCKET_NOT_CREATED,Z.RC_CONN_ACK_TIMEOUT,Z.RC_TCP_RESET,Z.RC_NAVI_REQ_FAILED,Z.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==ca.CONNECTING||(this.setConnectionStatus(ca.SUSPENDED,o),this.reconnectTimer=setTimeout(i,5e3)),[2]):(this.setConnectionStatus(ca.DISCONNECTED,o),[2])}}))}))},i(),[2]}))}))},t.prototype.onDisconnectByServer=function(t,e){var n=this;return da(t)?(this.setConnectionStatus(ca.SUSPENDED,t),void this.try2Reconnect(!0,t)):t===Z.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ca.SUSPENDED,t),void setTimeout((function(){n.try2Reconnect(!0,t)}),1e3*(e||0))):void this.setConnectionStatus(ca.DISCONNECTED,t)},t.prototype.onDisconenctUnusual=function(t){this.setConnectionStatus(ca.SUSPENDED,t),this.try2Reconnect(!1,t)},t.prototype.checkAlive=function(){return c(this,void 0,void 0,(function(){var t,e,n=this;return l(this,(function(i){switch(i.label){case 0:return this._crtConnectionStatus!==ca.CONNECTED?(this._failedCount=0,this.logger.debug(pt.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(t=this.logger.createTraceId(),this.logger.info(pt.L_CHECK_ALIVE_IM_T,null,t),[4,this.sendPing(15e3)]);case 1:return(e=i.sent())===Z.SUCCESS?(this.logger.info(pt.L_CHECK_ALIVE_IM_R,e,t),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==ca.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(pt.L_CHECK_ALIVE_IM_R,"code: ".concat(e,", count: ").concat(this._failedCount),t),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(pt.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(ca.SUSPENDED,Z.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,Z.RC_PING_EXCEED_LIMIT),[2]))}}))}))},t.prototype.disconnect=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:e.sent(),e.label=2;case 2:return this.setConnectionStatus(ca.DISCONNECTED,Z.ACTIVE_DISCONNECT),this.close(!1,t),[2]}}))}))},t.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},t.prototype.getCmpList=function(t,e){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var n=t.server,i=t.backupServer,r=t.serverAddr,o=t.protocol,s=t.openTLS;if(r)return this.cmpWeightCache=h([],r,!0),h([],r,!0);var a=[],u=[];return n&&u.push(n),null==i||i.split(",").forEach((function(t){u.indexOf(t)<0&&u.push(t)})),u.forEach((function(t,i){var r;r=e?1===s?wt.TLS:wt.RMTP:"http"===o?wt.WS:wt.WSS,a.push({addr:t,protocol:r,weight:n.length-i,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},t.prototype.updateCmpWeight=function(t,e,n){if(this.cmpWeightCache){var i=this.cmpWeightCache.find((function(e){return n?e.addr===t&&e.protocol===wt.QUIC:e.addr===t}));if(i)if(e){var r=Math.max.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==r&&(i.weight=r+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));i.weight!==o&&(i.weight=o-1)}}},t.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},t}(),Ea=function(){function t(e){this.logger=e,this._codec=t.createPBCodec()}return t.createPBCodec=function(){var t=jn(sa);return t.getModule=function(e){var n=new t[e];return n.getArrayData=function(){var t=n.toArrayBuffer();return t=re(t)?[].slice.call(new Int8Array(t)):t},n},t},t.prototype.decodeByPBName=function(t,e,n){var i,r=this,o=t,s=((i={})[Mo]=r._formatSyncMessages,i[No]=r._formatReceivedMessage,i[So]=r._formatSentMessage,i[Do]=r._formatHistoryMessages,i[Go]=r._formatConversationList,i[Jo]=r._formatChatRoomInfos,i[ss]=r._formatChatRoomKVList,i[ps]=r._formatUserSetting,i[Es]=r._formatConversationStatus,i[Us]=r._formatGrpReadReceiptQryResp,i[ds]=r._formatSetUserSettingOutput,i[fs]=r._formatUserSettingNotification,i[Ks]=r._formatUltraMsgChangeList,i[Qs]=r._formatUltraOperateStatusNotifyList,i[Ys]=r._formatUltraMsgList,i[Ss]=r._formatUltraGroupUnreadMentionedList,i[Qo]=r._formatChrmKVVersion,i[ea]=r._formatCallKVInfo,i[$s]=r._fromatCallInfoDownStream,i)[e];try{o=t.length>0&&r._codec[e].decode(t),ae(o)&&(o=function(t){for(var e in t)ae(t[e])&&(t[e]=je(t[e]));return t}(o)),ue(s)&&(o=s.call(this,o,n))}catch(t){this.logger.error(pt.L_PB_DECODE_E,e)}return o},t.prototype._readBytes=function(t){var e=t.offset,n=t.buffer,i=t.limit;if(e)try{var r=re(n)?new Uint8Array(n):n;return Or.readUTF(r.subarray(e,i))}catch(t){this.logger.error(pt.O,null==t?void 0:t.stack)}return t},t.prototype._formatBytes=function(t){if(!t)return t;var e=this._readBytes(t);try{e=e?JSON.parse(e):e}catch(t){this.logger.error(pt.O,null==t?void 0:t.stack)}return e||t},t.prototype._formatSyncMessages=function(t,e){e=e||{};var n=this,i=t.list,r=t.syncTime,o=t.finished;return(ce(o)||null===o)&&(t.finished=!0),t.syncTime=je(r),t.list=cn(i,(function(t){return n._formatReceivedMessage(t,e)})),t},t.prototype._getUtfContent=function(t){if(t.user){var e=t.user,n=e.portrait,i=e.portraitUri,r=n||i;r&&(t.user.portrait=t.user.portraitUri=r)}return t},t.prototype._setExpansion=function(t){var e;return t&&(e=function(t){var e={},n=JSON.parse(t);return un(n,(function(t,n){e[n]=t.v})),e}(t)),e},t.prototype._setPushConfig=function(t,e){var n=t.pushContent,i=t.pushExt,r=t.configFlag,o={};return i&&(o=Xe(e,i.pushConfigs,i.pushId)),u(u({},o),{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})},t.prototype._formatReceivedMessage=function(t,e){if(!t)return t;var i=this,r=e||{},o=r.currentUserId,s=r.connectedTime,a=t.content,u=t.fromUserId,c=t.type,l=t.groupId,h=t.status,d=t.dataTime,g=t.extraContent,p=t.configFlag,f=t.extStatus,_=t.clientUniqueId,E=t.busChannel,T=t.msgId,v=t.classname,y=t.direction||J.RECEIVE,C=function(t){var e=n.READ;return{isPersited:!!(16&t),isCounted:!!(32&t),isMentioned:!!(64&t),disableNotification:!!(512&t),receivedStatus:e=2&t?n.RETRIEVED:e,canIncludeExpansion:!!(1024&t)}}(h),m=C.isPersited,I=C.isCounted,R=C.isMentioned,S=C.disableNotification,O=C.receivedStatus,N=C.canIncludeExpansion,M=!!(2&(f||0)),U=!!(4&(f||0)),L=!!(8&(f||0))?Pt.PRIVATE:Pt.PUBLIC,A=[$.GROUP,$.CHATROOM,$.RTC_ROOM,$.ULTRA_GROUP].indexOf(c)>-1?l:u,w=u,b=J.RECEIVE;y===J.SEND&&(w=o,b=J.SEND);var P=je(d),D=P<s,V=c===$.CHATROOM,G=i._setExpansion(g),B=i._formatBytes(a);B=i._getUtfContent(B);var k=i._setPushConfig(t,this.logger);V&&u===o&&(b=J.SEND);var x={conversationType:c,targetId:A,senderUserId:w,messageType:v,messageUId:T,isPersited:m,isCounted:I,isMentioned:R,sentTime:P,messageDirection:b,receivedTime:Tn.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:N,content:B,expansion:G,configFlag:p,pushConfig:k,channelId:E||"",isInterrupt:M,isModifyMessage:U,messageId:je(_)||0,sentStatus:It.SENT};return c!==$.ULTRA_GROUP?(x.isOffLineMessage=D,x):(x.channelType=L,x)},t.prototype._formatSentMessage=function(t,e){var n=this,i=t.content,r=t.classname,o=t.sessionId,s=t.msgId,a=t.extraContent,c=t.pushExt,l=t.pushContent,h=t.configFlag,d=t.extStatus,g=t.clientUniqueId,p=t.systemId,f=e.signal,_=e.currentUserId,E=f.date,T=f.topic,v=f.targetId,y=!!(2&(d||0)),C=function(t){return{isPersited:!!(1&t),isCounted:!!(2&t),disableNotification:!!(32&t),canIncludeExpansion:!!(64&t)}}(o),m=C.isPersited,I=C.isCounted,R=C.disableNotification,S=C.canIncludeExpansion,O=_r[T]||$.PRIVATE,N=dn(Xi,T),M=n._formatBytes(i),U=p||v;r===it.RECALL&&(O=M.conversationType||O,U=M.targetId||v);var L=n._setExpansion(a),A=n._setPushConfig(t,this.logger),w=u(u({},A),{pushTitle:null==c?void 0:c.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==c?void 0:c.templateId});return{conversationType:O,targetId:U,messageType:r,messageUId:s,isPersited:m,isCounted:I,isStatusMessage:N,senderUserId:_,content:n._formatBytes(i),sentTime:1e3*E,receivedTime:Tn.getTime(),messageDirection:J.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:S,expansion:L,pushConfig:w,channelId:t.busChannel||"",isInterrupt:y,messageId:je(g)||0}},t.prototype._formatHistoryMessages=function(t,e){var n=this,i=e.conversation||{},r=t.list,o=t.hasMsg,s=i.targetId,a=je(t.syncTime),u=[];return un(r,(function(t){var r=n._formatReceivedMessage(t,e);i.conversationType===$.ULTRA_GROUP?r.targetId=t.groupId||i.targetId:r.targetId=s,u.push(r)}),{isReverse:!0}),{syncTime:a,list:u,hasMore:!!o}},t.prototype._formatUltraMsgChangeList=function(t){var e=t.list,n=t.syncTime,i=t.hasNext;return{syncTime:n,list:e&&e.map((function(t){var e=t.targetId,n=t.type,i=t.time,r=t.changeType,o=t.msgUID,s=t.msgTime,a=t.busChannel,u=t.isAdmin,c=t.isDel,l=t.operatorId,h=t.subChangeType,d=t.userGroupIds,g=t.busChannelType,p=t.remindType;return{targetId:e,conversationType:n,changeType:r,messageUId:o,changeTime:je(i),sendTime:je(s),channelId:a||"",isAdmin:u,isDel:c,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:g,mentionedType:p}})),hasNext:i}},t.prototype._formatUltraOperateStatusNotifyList=function(t){var e=t.type,n=t.notifyType,i=t.info,r=t.summary,o=[],s=[],a=2==(2&n),u=1==(1&n);return u&&Array.isArray(i)&&i.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.userId,r=t.opType,s=t.optime,a=je(s);o.push({targetId:e,channelId:n,userId:i,operationType:r,operationTime:a})})),a&&Array.isArray(r)&&r.forEach((function(t){var e=t.targetId,n=t.busChannel,i=t.count,r=t.opType;s.push({targetId:e,channelId:n,count:i,operationType:r})})),{conversationType:e,info:o,summary:s,hasInfo:u,hasSummary:a}},t.prototype._formatUltraMsgList=function(t,e){var n=this,i=t.list;return{list:i&&i.map((function(t){return n._formatReceivedMessage(t,e)}))}},t.prototype._formatUltraGroupUnreadMentionedList=function(t){var e=t.msgInfo;return(void 0===e?[]:e).map((function(t){return{messageUId:t.msgId,senTtime:je(t.msgTime),mentionedType:t.remindType,messageType:t.className||""}}))},t.prototype._getUltraGroupConversationInfo=function(t,e){var n=e.versionTime,i=e.unreadCount,r=e.remindCount,o=e.busChannelType,s=e.msgInfo,a=e.remindMeCount;return t.versionTime=je(n)||0,t.unreadMessageCount=this._getUnreadCount(je(i)||0),t.unreadMentionedCount=this._getUnreadCount(je(r)||0),t.unreadMentionedMeCount=this._getUnreadCount(je(a)||0),t.channelType=o||Pt.PUBLIC,t.lastReadTime=0,s&&(t.firstUnreadMessage={sentTime:je(s.msgTime)},t.lastReadTime=je(s.msgTime)-1),t},t.prototype._getUnreadCount=function(t){return t>999?999:t},t.prototype._formatConversationList=function(t,e){var n=this,i=this,r=t.info,o=e.afterDecode,s={list:(r=cn(r,(function(t){var r=t.msg,s=t.userId,a=t.type,u=t.unreadCount,c=t.busChannel,l=null;r&&((l=i._formatReceivedMessage(r,e)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:je(u)||0,latestMessage:l||{},channelId:c||""};return a===$.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,t)),(null==o?void 0:o(h))||h})))||[]};return((null==e?void 0:e.conversationType)||$.NONE)===$.ULTRA_GROUP&&(s.isFinished=t.isFinished),s},t.prototype._formatSetUserSettingOutput=function(t){return t},t.prototype._formatChatRoomInfos=function(t){var e=t.userTotalNums,n=t.userInfos;return{userCount:e,userInfos:cn(n,(function(t){var e=t.id,n=t.time;return{id:e,time:je(n)}}))}},t.prototype._formatChatRoomKVList=function(t){var e=t.entries,n=t.bFullUpdate,i=t.syncTime;return e=cn(e=e||[],(function(t){var e=t.key,n=t.value,i=t.status,r=t.timestamp,o=t.uid,s=t.version,a=function(t){return{isAutoDelete:!!(1&t),isOverwrite:!!(2&t),type:4&t?Et.DELETE:Et.UPDATE}}(i);return{key:e,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:je(r),version:je(s)}})),{kvEntries:e,isFullUpdate:n,syncTime:i}},t.prototype._formatUserSetting=function(t){var e=this,n=t.items,i=t.version,r={};return un(n||[],(function(t){var n=t.key,i=t.version,o=t.value;t.version=je(i),t.value=e._readBytes(o),"Tag"===n&&t.tags.forEach((function(t){t.createdTime=je(t.createdTime),t.tagName=t.name})),r[n]=t})),{settings:r,version:i}},t.prototype._formatConversationStatus=function(t){var e=t.state,n=[];return un(e,(function(t){var e=t.type,i=t.channelId,r=t.time,o=t.stateItem,s=t.busChannel,a=ot.CLOSE,u=at.NOT_SET,c=!1,l=[];un(o,(function(t){var e=t.sessionStateType,n=t.value,i=t.tags;switch(e){case Cr:a=n===vr?ot.OPEN:ot.CLOSE,u=Number(n)||at.NOT_SET;break;case mr:c=n===vr;break;case Ir:l=i}})),n.push({conversationType:e,type:e,targetId:i,notificationStatus:a,notificationLevel:u,isTop:c,updatedTime:je(r),tags:l,channelId:s||""})})),n},t.prototype._formatGrpReadReceiptQryResp=function(t){var e=t.totalMemberNum,n=t.list;return n.forEach((function(t){t.readTime=je(t.readTime)})),{totalMemberCount:e,list:n}},t.prototype._formatUserSettingNotification=function(t){return t},t.prototype._formatChrmKVVersion=function(t){var e=t.joinTime,n=t.createTime,i=t.memberCount,r=t.chatroomBanState;return{joinTime:e,createTime:n||0,memberCount:i||0,isAllChatroomBanned:!!(1&r),isCurrentUserBanned:!!(2&r),isCurrentChatroomBanned:!!(4&r),isCurrentChatroomInWhitelist:!!(1&t.whiteListState)}},t.prototype._formatRTCJoinedUserInfo=function(t){return(t.info||[]).map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:je(t.joinTime)}}))},t.prototype._formatCallKVInfo=function(t){return t},t.prototype._fromatCallInfoDownStream=function(t){return t},t.prototype.encodeServerConfParams=function(){var t=this._codec.getModule(Uo);return t.setNothing(1),t.getArrayData()},t.prototype._updateMentionedInfo=function(t,e,n){var i,r,o;return{userIdList:(null===(i=t.mentionedInfo)||void 0===i?void 0:i.userIdList)||e,type:(null===(r=t.mentionedInfo)||void 0===r?void 0:r.type)||n||ct.ALL,mentionedContent:(null===(o=t.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}},t.prototype._calculateFlag=function(t){var e=t.isFilerWhiteBlacklist,n=t.isVoipPush,i=t.pushConfig||{},r=0;return r|=n?1:0,r|=e?2:0,r|=i.disablePushTitle?4:0,r|=i.forceShowDetailContent?8:0},t.prototype._getPushExtraModule=function(t){var e=t.pushTitle,n=t.iOSConfig,i=t.androidConfig,r=t.templateId,o=void 0===r?"":r,s=this._codec.getModule(Oo);if(e&&s.setTitle(e),n||i){var a=Je(n,i);s.setPushConfigs(a)}return(null==i?void 0:i.notificationId)&&s.setPushId(null==i?void 0:i.notificationId),s.setTemplateId(o),s},t.prototype._getUpMsgModule=function(t,e){var n=e.messageType,i=e.isMentioned,r=e.mentionedType,o=e.content,s=e.directionalUserIdList,a=e.canIncludeExpansion,u=e.expansion,c=e.pushConfig,l=e.channelId,h=e.pushData,d=void 0===h?"":h,g=e.mentionedUserIdList,p=void 0===g?[]:g,f=e.pushContent,_=void 0===f?"":f,E=e.messageId,T=void 0===E?0:E,v=t.conversationType,y=t.targetId,C=this._codec.getModule(So),m=function(t){var e=t.isStatusMessage,n=t.isPersited,i=t.isCounted;e&&(n=i=!1);var r=0;return n&&(r|=1),i&&(r|=2),t.isMentioned&&(r|=4),t.disableNotification&&(r|=32),t.canIncludeExpansion&&(r|=64),r}(e),I=c||{},R=I.pushContent,S=void 0===R?_:R,O=I.pushData,N=void 0===O?d:O;C.setSessionId(m),i&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,p,r)),S&&C.setPushText(S),N&&C.setAppData(N),s&&C.setUserId(s);var M=this._calculateFlag(e);if(C.setConfigFlag(M),C.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),C.setContent(JSON.stringify(o)),a&&u){var U={};un(u,(function(t,e){U[e]={v:t}})),C.setExtraContent(JSON.stringify(U))}if(c){var L=this._getPushExtraModule(c);C.setPushExt(L)}return C.setClientUniqueId(T),ce(l)||C.setBusChannel(l),v===$.SYSTEM&&C.setSystemId(y),C},t.prototype.encodeUpMsg=function(t,e){return this._getUpMsgModule(t,e).getArrayData()},t.prototype.encodeSyncMsg=function(t){var e=t.sendboxTime,n=t.inboxTime,i=t.broadcastSyncTime,r=this._codec.getModule(Ao);return r.setIspolling(!1),r.setIsPullSend(!0),r.setSendBoxSyncTime(e),r.setSyncTime(n),r.setBroadcastSyncTime(i),r.getArrayData()},t.prototype.encodeChrmSyncMsg=function(t,e){t=t||0,e=e||0;var n=this._codec.getModule(wo);return n.setCount(e),n.setSyncTime(t),n.getArrayData()},t.prototype.encodeGetHistoryMsg=function(t,e){var n=e.count,i=e.order,r=e.timestamp,o=e.channelId,s=this._codec.getModule(Po);return s.setTargetId(t),s.setTime(r),s.setCount(n),s.setOrder(i),s.setBusChannel(o||""),s.getArrayData()},t.prototype.encodeSuperSyncMsg=function(t){var e=this._codec.getModule(Bs);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeGetConversationList=function(t){var e=(t=t||{}).count,n=t.startTime,i=this._codec.getModule(Vo);return i.setType(1),i.setCount(e),i.setStartTime(n),i.getArrayData()},t.prototype.encodeOldConversationList=function(t){var e=(t=t||{}).count,n=t.type,i=t.startTime,r=t.order;e=e||0,i=i||0,r=r||0;var o=this._codec.getModule(Vo);return o.setType(n),o.setCount(e),o.setStartTime(i),o.setOrder(r),o.getArrayData()},t.prototype.encodeRemoveOldConversationList=function(t){var e=(t=t||{}).conversationType,n=t.channelId,i=this._codec.getModule(Ko);return i.setType(e),n&&i.setBusChannel([n]),i.getArrayData()},t.prototype.encodeRemoveConversationList=function(t){var e=this,n=this._codec.getModule(ko),i=[];return un(t,(function(t){var n=t.conversationType,r=t.targetId,o=e._codec.getModule(xo);o.setType(n),o.setChannelId(r),i.push(o)})),n.setSessions(i),n.getArrayData()},t.prototype.encodeDeleteMessages=function(t,e,n,i){var r=this._codec.getModule(Ho),o=[];return un(n,(function(t){o.push({msgId:t.messageUId,msgDataTime:t.sentTime,direct:t.messageDirection})})),r.setType(t),r.setConversationId(e),r.setMsgs(o),r.setBusChannel(i),r.getArrayData()},t.prototype.encodeClearMessages=function(t,e,n,i){var r=this._codec.getModule(qo);return e=e||(new Date).getTime(),r.setDataTime(e),r.setTargetId(t),r.setBusChannel(n),r.setConversationType(i),r.getArrayData()},t.prototype.encodeClearUnreadCount=function(t,e){var n=t.conversationType,i=t.targetId,r=t.channelId,o=e.timestamp,s=this._codec.getModule(Yo);return o=o||+new Date,s.setType(n),s.setChannelId(i),s.setMsgTime(o),s.setBusChannel(r),s.getArrayData()},t.prototype.encodeExpandUltraMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.keys,u={mid:o,put:t.expansion,del:a,clear:t.removeAll?1:0},c=this._codec.getModule(ks);return c.setFromUserId(e),c.setTargetId(n),c.setType(i),c.setBusChannel(r||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(u)),c.getArrayData()},t.prototype.encodemodifyMessage=function(t,e){var n=t.targetId,i=t.conversationType,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.content,u=this._codec.getModule(ks);return u.setFromUserId(e),u.setTargetId(n),u.setType(i),u.setBusChannel(r||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(a)),u.getArrayData()},t.prototype.encodeQueryMsgChange=function(t){var e=this._codec.getModule(xs);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeMsgQuery=function(t){var e=t.targetId,n=t.conversationType,i=t.messages,r=this._codec.getModule(Hs),o=i.map((function(t){return{msgTime:t.sendTime,msgUID:t.messageUId,busChannel:t.channelId}}));return r.setTargetId(e),r.setType(n),r.setQuery(o),r.getArrayData()},t.prototype.encodeUnreadMentionedMsgQuery=function(t){var e=t.targetId,n=t.channelId,i=t.sentTime,r=t.count,o=this._codec.getModule(Rs);return o.setGroupId(e),o.setBusChannel(n),o.setMsgTime(i),o.setSize(r),o.getArrayData()},t.prototype.encodeOperateStatus=function(t,e,n,i){var r=this._codec.getModule(js);return r.setTargetId(t),r.setType(e),r.setBusChannel(n),r.setOpType(i),r.getArrayData()},t.prototype.encodeJoinOrQuitChatRoom=function(){var t=this._codec.getModule(jo);return t.setNothing(1),t.getArrayData()},t.prototype.encodeGetChatRoomInfo=function(t,e){var n=this._codec.getModule(Wo);return n.setCount(t),n.setOrder(e),n.getArrayData()},t.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(t,e){var n=this._codec.getModule(Is);return n.setUnpushLevel(t),n.setBusChannel(e),n.getArrayData()},t.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(t){var e=this._codec.getModule(ms);return e.setBusChannel(t),e.getArrayData()},t.prototype.encodeGetFileToken=function(t,e,n,i,r){var o=this._codec.getModule(Xo);return o.setType(t),o.setKey(e),o.setHttpMethod(n),o.setQueryString(i),o.setUrl(r),o.getArrayData()},t.prototype.encodeGetFileUrl=function(t,e,n,i){var r=this._codec.getModule(t);return r.setType(e),r.setKey(n),i&&r.setFileName(i),r.getArrayData()},t.prototype.encodeModifyChatRoomKV=function(t,e,n){var i=this._codec.getModule(is),r=e.key,o=e.value,s=e.notificationExtra,a=e.isSendNotification,u=e.type,c=e.timestamp,l=u||Et.UPDATE,h=vn(e,l),d={key:r,value:o||"",uid:n,version:c};if(ce(h)||(d.status=h),i.setEntry(d),a){var g={conversationType:$.CHATROOM,targetId:t},p={key:r,value:o,extra:s,type:l},f=this._getUpMsgModule(g,{messageType:it.CHRM_KV_NOTIFY,content:p,isPersited:!1,isCounted:!1});i.setNotification(f),i.setBNotify(!0),i.setType($.CHATROOM)}return i.getArrayData()},t.prototype.encodeModifyChatRoomKVS=function(t,e,n){var i=this._codec.getModule(rs),r=e.entries,o=e.type||Et.UPDATE,s=vn(e,o),a=[];return r.forEach((function(t){var e={key:t.key,value:t.value||"",uid:n,version:t.timestamp};ce(s)||(e.status=s),a.push(e)})),i.setEntry(a),i.getArrayData()},t.prototype.encodePullChatRoomKV=function(t){var e=this._codec.getModule(ls);return e.setTimestamp(t),e.getArrayData()},t.prototype.encodePullUserSetting=function(t){var e=this._codec.getModule(gs);return e.setVersion(t),e.getArrayData()},t.prototype.encodeGetConversationStatus=function(t){var e=this._codec.getModule(_s);return e.setTime(t),e.getArrayData()},t.prototype.encodeSetConversationStatus=function(t,e){var n=this,i=this._codec.getModule(ys),r=Tn.getTime(),o=[];return un(t,(function(t){var e=n._codec.getModule(Ts),i=t.conversationType,s=t.targetId,a=t.notificationStatus,u=t.isTop,c=t.channelId,l=t.notificationLevel,h=[];e.setType(i),e.setChannelId(s),e.setTime(r),e.setBusChannel(c);var d=a===ot.OPEN,g={};ce(a)||(g[Cr]=d),ce(l)||(g[Cr]=l),ce(u)||(g[mr]=u),un(g,(function(t,e){if(!ce(t)){var i=n._codec.getModule(vs);t=t?vr:yr,ce(l)||Number(e)!==Cr||(t=String(l)),i.setSessionStateType(Number(e)),i.setValue(t),h.push(i)}})),e.setStateItem(h),o.push(e)})),i.setVersion(e||r),i.setState(o),i.getArrayData()},t.prototype.encodeReadReceipt=function(t,e){var n=this._codec.getModule(Ns);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeCreateTag=function(t,e){var n=this,i=this._codec.getModule(As),r=[];return t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t.tagId),e.setName(t.tagName),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeMessageReader=function(t,e){var n=this._codec.getModule(Ns);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeRemoveTag=function(t,e){var n=this,i=this._codec.getModule(bs),r=[];return t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t),r.push(e)})),i.setTags(r),i.setVersion(e),i.getArrayData()},t.prototype.encodeDisConversationTag=function(t){var e=this._codec.getModule(Ps);return e.setTagId(t),e.getArrayData()},t.prototype.encodeUpdateConversationTag=function(t,e){var n=this,i=this._codec.getModule(ys),r=[];return e.forEach((function(e){var i=n._codec.getModule(Ts),o=n._codec.getModule(vs),s=[];t.forEach((function(t){var e=n._codec.getModule(ws);e.setTagId(t.tagId),ce(t.isTop)||e.setIsTop(t.isTop),s.push(e)})),o.setSessionStateType(Ir),o.setValue(JSON.stringify(s)),o.setTags(s),i.setType(e.conversationType),i.setChannelId(e.targetId),i.setTime(Date.now()),i.setStateItem([o]),r.push(i)})),i.setState(r),i.setVersion(Tn.getTime()),i.getArrayData()},t.prototype.encodeReportSDKInfo=function(t){var e=this._codec.getModule(Ds);return e.setSdkInfo(t),e.getArrayData()},t.prototype.encodeUltraGroup=function(t,e){var n=this._codec.getModule(Gs);return n.setSyncTime(t),n.setIsEraseMsgContent(e),n.getArrayData()},t.prototype.encodebindRTCRoomForChatroom=function(t){var e=this._codec.getModule(Xs);return e.setRtcRoomId(t.rtcRoomId),e.getArrayData()},t.prototype.encodeSetCallInfo=function(t,e){var n=this._codec.getModule(zs);return n.setKey(t),n.setDataContent(e),n.getArrayData()},t.prototype.encodePullKVMsg=function(t){var e=this._codec.getModule(ta);return e.setSyncTime(t),e.getArrayData()},t}(),Ta=function(t){function e(e,n,i,r,o,s){var a=t.call(this,e,n,i,r,s)||this;return a.runtime=o,a.wsListener=s,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 Ea(a.logger),a}return a(e,t),e.prototype.getConnectedTime=function(){return this._connectedTime},e.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},e.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},e.prototype.connectWithToken=function(t,e,n,i){return c(this,void 0,void 0,(function(){var n,r,o,s,a,u,c,h,d;return l(this,(function(g){switch(g.label){case 0:if(n=e.openAnti,r=e.type,o=this.getCmpList(e),0===(s=o.filter((function(t,e){return o.findIndex((function(e){return e.addr===t.addr}))===e})).sort((function(t,e){return t.weight>e.weight?-1:1}))).length)return this.logger.error(pt.L_NAVI_CONF_E,"no service available",i),[2,{code:Z.SERVER_UNAVAILABLE}];a=1===n?qi.V4:qi.V3,u=function(e){var n,o,u,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return n=s[e],o=n.protocol,u=n.addr,h=n.weight,d=function(t,e,n,i,r,o,s){var a=Pi(r),u=a.type,c=a.version,l="browser"===r.tag?"|".concat(u,"|").concat(c):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(t,"://").concat(e,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(i),"&sdkVer=").concat(F,"&pid=").concat(o,"&apiVer=").concat(r.isFromUniapp?"uniapp":r.tag+encodeURIComponent(l)).concat(r.connectPlatform?"&platform=".concat(r.connectPlatform):"").concat(h)}(o===wt.WS?"ws":"wss",u,c.appkey,t,c.runtime,"",a),g=Date.now(),[4,c.connectWebSocket(d,a,i)];case 1:return p=l.sent(),f=p.code,_=p.data,E=c.cmpWeightCache.findIndex((function(t){return t.addr===u})),T={bid:tn(),ptc:Ft.WS,cod:f,net:c.getNetwork().type,dur:Date.now()-g,spr:0,pr:r||0,hos:u,idx:E,rct:c.retryCount?qt.RECONNECT:qt.CONNECT,cid:"".concat(c.uuid,"_").concat(c.retryCount),v:Ht.CURRENT,rsn:c.reason,count:c.retryCount,weight:h},c.statisticLog.__statistics(ft.IM_WEBSOCKET,JSON.stringify(T),i),f===Z.RC_SOCKET_DISCONNECTED||f===Z.TIMEOUT?[2,"continue"]:f!==Z.SUCCESS?[2,{value:{code:f}}]:(c._localConnectedTime=Math.floor((Date.now()+g)/2),c._socket=_.socket,c.updateCmpWeight(s[e].addr,!0),c.curCmpUrl=s[e].addr,[2,{value:{code:f,data:_.userId}}])}}))},c=this,h=0,g.label=1;case 1:return h<s.length?[5,u(h)]:[3,4];case 2:if("object"==typeof(d=g.sent()))return[2,d.value];g.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:Z.SERVER_UNAVAILABLE}]}}))}))},e.prototype.connectWebSocket=function(t,e,n){return c(this,void 0,void 0,(function(){var i=this;return l(this,(function(r){return this.logger.info(pt.T,"connect start: ".concat(t),n),[2,new Promise((function(r){var o=i.runtime.createWebSocket(t);i._socketIndex=o.id;var s=setTimeout((function(){i.logger.info(pt.T,"connect timeout: ".concat(t),n),r({code:Z.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),i.logger.info(pt.T,"socket open",n)})),o.onMessage((function(t){if(i._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var s,a=Yr(i.logger,t,e);if(a instanceof wr){var u=a.status;if(u!==na.ACCEPTED)return i.logger.info(pt.T,"connect failed: ".concat(u),n),void r({code:(s=u,ha[s])});i.logger.info(pt.T,"connect success",n);var c=a.timestamp,l=a.userId,h=a.messageId;return i._connectedTime=c,i._idCount=h,void r({code:Z.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof br){var d=a.status;return i.logger.info(pt.T,"recv disconnect signal -> status: ".concat(d)),void i.onRecvDisconnect(d,o)}i._onReceiveSignal(a)}}else i.logger.warn(pt.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:i._socketIndex,curSocketId:o.id}))})),o.onClose((function(){i.logger.info(pt.T,"socket close",n);var t=Z.RC_SOCKET_DISCONNECTED;r({code:t}),i.onSocketEnd(o,t)})),o.onError((function(t){i.logger.info(pt.T,"socket error",n);var e=Z.RC_SOCKET_DISCONNECTED;r({code:e}),i.onSocketEnd(o,e)}))}))]}))}))},e.prototype._qosNeedAck=function(t,e){t.header&&t.header.qos!==Fi.AT_MOST_ONCE&&(t instanceof Br&&!t.syncMsg&&(this.logger.debug(pt.O,"send pubAck -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Fr(e))),t instanceof qr&&(this.logger.debug(pt.O,"send queryCon -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Hr(e))))},e.prototype._publishReader=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return n=t.syncMsg,i=t.topic,this.logger.debug(pt.O,"recv PublishReader -> messageId: ".concat(e," ").concat(i)),i===Mn?[2]:!n||function(t){return[jr.ppMsgS,jr.pgMsgS,jr.chatMsgS].map((function(t){return jr[t]})).indexOf(t)>=0}(i)?(this.wsListener.signal(t),[2]):[4,new Promise((function(t){o._syncMessageIds[e]=t}))];case 1:return r=s.sent(),delete this._syncMessageIds[e],this.wsListener.signal(t,r),[2]}}))}))},e.prototype._onReceiveSignal=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return e=t.messageId,t instanceof Dr&&this._pingResolve?(this._pingResolve(Z.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(t,e),e>0&&(t instanceof xr||t instanceof qr)&&(this.logger.debug(pt.O,"recv ack -> messageId: ".concat(e," ").concat(t.topic)),(n=this._messageIds[e])&&(n(t),delete this._messageIds[e]),(i=this._syncMessageIds[e])&&(delete this._syncMessageIds[e],i(t))),t instanceof Br?[4,this._publishReader(t,e)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.onRecvDisconnect=function(t,e){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(t){return la[t]}(t)))},e.prototype.onSocketEnd=function(t,e){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(e),this._pingResolve&&(this._pingResolve(e),this._pingResolve=void 0))},e.prototype.clearResolves=function(){for(var t in this._messageIds){var e=this._messageIds[t];delete this._messageIds[t],e(Z.RC_SOCKET_DISCONNECTED)}},e.prototype.sendPing=function(t){var e=this;return new Promise((function(n){e._pingResolve=n,setTimeout((function(){return n(Z.TIMEOUT)}),t),e.sendOnly(new Pr)}))},e.prototype.sendOnly=function(t){this._socket&&((t instanceof kr||t instanceof Kr)&&(t.messageId=this._generateMessageId()),this._socket.send(t.getBufferData().buffer))},e.prototype.send=function(t,e,n,i){return void 0===i&&(i=3e4),c(this,void 0,void 0,(function(){var r,o,s,a,u=this;return l(this,(function(c){switch(c.label){case 0:return this._socket?(r=this._generateMessageId(),t.messageId=r,this._socket.send(t.getBufferData().buffer),[4,new Promise((function(t){u._messageIds[r]=t,setTimeout((function(){u._messageIds[r]&&delete u._messageIds[r],t()}),i)}))]):[2,{code:Z.RC_NET_CHANNEL_INVALID}];case 1:return(o=c.sent())?o instanceof qr||o instanceof xr?(s=e&&o.data&&[Z.SUCCESS,Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,e,n):o,0!==o.status?(this.logger.warn(pt.O,"send failed -> message: ".concat(r,", respPBName: ").concat(e,", status: ").concat(o.status)),[2,{code:o.status,data:e&&o.data?a:null}]):[2,{code:Z.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(pt.O,"send timeout -> message: ".concat(r,", respPBName: ").concat(e,", timeout: ").concat(i)),[2,{code:Z.TIMEOUT}])}}))}))},e.prototype.close=function(t){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},e}(_a);!function(t){t[t.STATISTICS=-2]="STATISTICS",t[t.RECORD=-1]="RECORD"}(fa||(fa={}));var va=null,ya="RC_CONF",Ca="RC_STATISTICS",ma=null,Ia=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(e=n.sent())?[4,new Promise((function(n){var i=e.db.transaction(Ca,"readwrite").objectStore(Ca),r=IDBKeyRange.lowerBound(Date.now()-t),o=i.getAllKeys(r);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var r=i.delete(IDBKeyRange.bound(t[0],t[e-1]));r.onsuccess=n,r.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),ma=setTimeout((function(){return Ia(t)}),6e5),[2]}}))}))},Ra=function(t,e,n){void 0===n&&(n=168),va||("undefined"!=typeof window&&window&&window.indexedDB?va=new Promise((function(i){var r=window.indexedDB;r.databases&&r.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&r.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(t),s=r.open(o,2);s.onerror=function(t){e.error(pt.L_LOGDB_OPEN_FAILED_E,t.target.error),i(null)},s.onsuccess=function(r){var o=r.target.result;o?(o.onclose=function(t){e.warn(pt.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(pt.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(pt.L_LOGDB_ABORT_S,t.target.error)},Ia(3600*Math.max(24,Math.min(168,n))*1e3),i({appkey:t,db:o})):i(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(Ca)&&e.deleteObjectStore(Ca);var n=e.createObjectStore(Ca,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(ya,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(pt.L_UNSUPPORT_INDEXDB_O))},Sa=function(){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return va?(ma&&(clearTimeout(ma),ma=null),[4,va]):[2];case 1:return(t=e.sent())&&t.db.close(),va=null,[2]}}))}))};function Oa(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,va];case 1:return(e=n.sent())?[2,new Promise((function(n){var i=e.db.transaction(ya,"readonly").objectStore(ya).get(t);i.onsuccess=function(t){var e;n({value:null===(e=i.result)||void 0===e?void 0:e.value,success:!0})},i.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Na="REPORT_SESSION",Ma=function(t,e){return c(void 0,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Na,"_").concat(t),[4,Oa("".concat(Na,"_").concat(t))];case 1:return i=s.sent(),r=i.success,o=i.value,r?(e===(null==o?void 0:o.sessionId)||function(t,e){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(ya,"readwrite").objectStore(ya).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))},Ua=function(){return va},La=function(t){var e=t.sessionId,n=t.level,i=t.loggerId,r=t.traceId,o=t.time,s=t.tag,a=t.type,u=t.content,c=n<0?u||"":JSON.stringify({content:u,traceId:r,from:i});return c='"'.concat(c.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(c,"\n")},Aa=be(),wa=Date.now(),ba=0,Pa=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.__statistics=this._writer.bind(this,fa.STATISTICS)}return t.prototype._writer=function(t,e,n,i){var r=new Date;/^[\w-]+$/.test(e)&&this.flush({time:+r,sessionId:Aa,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:i})},t.prototype.createTraceId=function(){return"".concat(Aa,"-").concat(++ba)},t.prototype.getSessionId=function(){return Aa},t}(),Da=function(){function t(t,e,n,i,r,o){void 0===o&&(o=r),this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.statisticDB=i,this.logger=r,this.reportClass=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return t.prototype.checkStart=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=$n.getLogUrlPolicyList(t,this.logger),n=e.policy,i=e.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])}))}))},t.prototype.realtimeReport=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return i=Date.now(),r=this.statisticDB.getTimestamp4RealtimeLog()||wa,o=Math.max(i-5e3,r),s=this.reportClass.createTraceId(),this.logger.debug(pt.L_REALTIME_LOG_T,JSON.stringify({startTime:r,endTime:o,level:e}),s),[4,this.statisticDB.getStatistics(r,o,e,!0)];case 1:return a=l.sent(),u=a.dbReady,c=a.logs,u?[3,2]:(this.logger.warn(pt.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return c.length>0?(this.logger.info(pt.L_REALTIME_LOG_O,JSON.stringify({count:c.length}),s),[4,this.compressStatistics(c)]):[3,5];case 3:return h=l.sent(),d=h.success,g=h.data,d||this.logger.warn(pt.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(pt.L_REALTIME_LOG_O,"compress done",s),p=he(t)?t:"https://".concat(t),p+="?version=".concat("5.8.4-alpha.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:p,body:g,method:"POST"})];case 4:f=l.sent().status,this.logger.info(pt.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(c[c.length-1].time+1)):(this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++),l.label=5;case 5:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return _.realtimeReport(t,e,n)}),1e3*n)),[2]}}))}))},t.prototype.report=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(pt.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:r,messageUId:o}),s),[4,this.statisticDB.getStatistics(t,e,fa.STATISTICS,!1)]);case 1:return a=l.sent(),u=a.dbReady,c=a.logs,this.logger.info(pt.L_REPORT_FULL_LOG_O,JSON.stringify({count:c.length}),s),h=he(i)?i:"https://".concat(i),h+="?version=".concat("5.8.4-alpha.8","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),u?c.length>0?[4,this.compressStatistics(c)]:[3,3]:[3,5];case 2:return g=l.sent(),p=g.success,f=g.data,d=p?f:"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(pt.L_REPORT_FULL_LOG_O,"compress done",s),[4,this.send({url:h,body:d,method:"POST"})];case 7:return _=l.sent().status,this.logger.info(pt.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),Va="RC_STATISTICS",Ga=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){Fa(t)},e}(Pa),Ba=!1,ka=[],xa=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return Ba||0===ka.length?[2]:(Ba=!0,e=ka.splice(0),[4,new Promise((function(n){var i=t.transaction(Va,"readwrite");i.oncomplete=n,i.onabort=n;var r=i.objectStore(Va);e.forEach((function(t){try{r.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),Ba=!1,setTimeout((function(){return xa(t)})),[2]}}))}))},Fa=function(t){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Ua()];case 1:return(e=n.sent())?(ka.push(t),xa(e.db),[2]):[2]}}))}))},Ka=0,Ha=function(){return{setTimestamp4RealtimeLog:function(t){Ka=t},getTimestamp4RealtimeLog:function(){return Ka},getStatistics:function(t,e){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){switch(i.label){case 0:return[4,Ua()];case 1:return(n=i.sent())?[2,new Promise((function(i){var r=n.db.transaction(Va,"readonly").objectStore(Va),o=[],s=IDBKeyRange.bound(t,e),a=r.index("time").openCursor(s);a.onsuccess=function(t){var e=t.target.result;if(e){var n=e.value;o.push(n),e.continue()}else i({dbReady:!0,logs:o})},a.onerror=function(t){i({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},qa=function(t){function e(e,n,i,r){var o=this,s=bi(n),a=Pi(n),u="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=t.call(this,e,s,u,Ha(),i,r)||this).runtime=n,o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Ma(e.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressStatistics=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:Li(t.map(La).join(""))}]}))}))},e.prototype.isReporter=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,(e=this.userId,n=this.reportClass.getSessionId(),c(void 0,void 0,void 0,(function(){var t,i,r;return l(this,(function(o){switch(o.label){case 0:return[4,Oa("".concat(Na,"_").concat(e))];case 1:return t=o.sent(),i=t.success,r=t.value,[2,i&&(null==r?void 0:r.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,i,r,o,s){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,t.prototype.report.call(this,e,n,i,r,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,t.prototype.realtimeReport.call(this,e,n,i)]}))}))},e}(Da),Ya=function(t){function e(e,n,i,r){void 0===r&&(r=Wn.BJ);var o=t.call(this,e,n,r)||this;return o.appkey=e,o.logger=n,o.runtime=i,o.areaCode=r,o._storageKey="",o._storageKey=Y.STATIC_CONFIG_KEY(e),o}return a(e,t),e.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},e.prototype.setCache=function(t){this.runtime.localStorage.setItem(this._storageKey,t)},e.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},e.prototype.sendRequest=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.runtime.httpReq({url:t})];case 1:return e=r.sent(),n=e.status,i=e.data,[2,{code:n,data:i}]}}))}))},e.prototype.decryptData=function(t){return c(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,en(t,A,w)];case 1:return e=i.sent(),[2,JSON.parse(e)];case 2:return n=i.sent(),this.logger.error(pt.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},e}(ti),ja=function(t,e,i,r,o,s,a){return{conversationType:t,targetId:e,senderUserId:s,messageDirection:J.SEND,isCounted:!!i.isCounted,isMentioned:!!i.isMentioned,content:i.content,messageType:i.messageType,isOffLineMessage:!1,isPersited:!!i.isPersited,messageUId:r,sentTime:o,receivedTime:0,disableNotification:!!i.disableNotification,isStatusMessage:!!i.isStatusMessage,canIncludeExpansion:!!i.canIncludeExpansion,expansion:i.canIncludeExpansion?i.expansion:null,receivedStatus:n.UNREAD,pushConfig:i.pushConfig,channelId:i.channelId,isInterrupt:i.isInterrupt,messageId:a||0,sentStatus:It.SENT}},Qa=function(t){return t.sort((function(t,e){var n,i,r=(null===(n=t.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(i=e.latestMessage)||void 0===i?void 0:i.sentTime)||0)-r})),t},Wa=function(t){function e(e,n,i,r){var o=t.call(this,e,n,i,r,new mi(r.appkey,"RC-E","IM"),new Ga(r.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,o._pullingMsg=!1,o._pullQueue=[],o._chrmsQueue={},o._latestSyncTimestamp=0,o._intervalTimer=-1,o._latestPullKVMsgTimestamp=0,o._intervalTimerForChrmPull=-1,o._lastSyncUltraMsgTimeStamp=0,o._lastSyncUltraMsgLocalTimeStamp=0,o._ultraGroupTimer=-1,o._isUltraPulling=!1,o._ultraGroupTimeQue=[],o._isUltraGroupListExist=!1,o._ultraGroupMap={},o._ultraMsgMap={},o._pullUltraChangeMessageQue=[],o._isPullingUltraChangeMessage=!1,o._lastPullingUltraChangeMessageTime=0;var s=r.appkey,a=r.logOutputLevel,u=r.logExpireTime,c=r.navigators,l=r.areaCode,h=r.logServerUrl,d=r.miniCMPProxy;return o.logger.setOutputLevel(a),ui(s,o.logger,e,u),o.reporter=new Vi(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new fo(s,o.logger,o.statisticLog,e,new Ya(s,o.logger,e,l)),Ra(s,o.logger,u),o.reporterStatistic=new qa(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new Qr(e,s),o._sendMessageStore=new _o(e,s),o._chrmEntryHandler=new Xr(o),o._connMgr=new Ta(s,o.navi,o.logger,o.statisticLog,o.runtime,{signal:o._signalHandler.bind(o),onConnected:o.onConnected.bind(o),onDisconnected:o.onDisconnected.bind(o),onConnecting:o._watcher.onConnecting,onSuspend:o._watcher.onSuspend}),$n.init({areaCode:l,navigators:c,logServerUrl:h,miniCMPProxy:d}),o}return a(e,t),e.prototype.onConnected=function(){var t=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),e=this._connMgr.getCurrentUserId();this.currentUserId=e,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new Zr(t.joinMChrm)),this._conversationManager||(this._conversationManager=new co(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Ro(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new lo(this,this._appkey,this.currentUserId,this._watcher.tag)),this._watcher.onConnected(),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===t.ugMsg&&this._notificationOnline(),this.reporter.checkStart(t),this.reporterStatistic.checkStart(t)},e.prototype.onDisconnected=function(t){this._resetMemoryState(),this._watcher.onDisconnected(t)},e.prototype.createLogger=function(t,e){return new mi(this._appkey,t,e)},e.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},e.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},e.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},e.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},e.prototype.connect=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return this._openCallPlus=n,[2,this._connMgr.connect(t,e,n,i)]}))}))},e.prototype._signalHandler=function(t,e){var n=t.syncMsg,i=t.topic;if(n)this._receiveSyncMsg(t,e);else{var r=this.logger.createTraceId();this.logger.debug(pt.L_RECV_RMTP_O,i,r);var o=jr[i];if(o)switch(o){case jr.s_ntf:this._pullMsg(t);break;case jr.s_msg:this._receiveMsg(t);break;case jr.s_cmd:this._receiveStateNotify(t);break;case jr.s_us:this._receiveSettingNotify(t);break;case jr.rtc_ntf:this._receiveRtcKv(t.data);break;case jr.s_opNtf:this._pullOperateStatusNotify(t);break;case jr.s_pubCall:this._pubCallInfo(t)}else this.logger.error(pt.L_RECV_RMTP_E,i,r)}},e.prototype._receiveStateNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,bo),n=e.time,i=e.type,r=e.chrmId;switch(i){case 2:this._chrmEntryHandler.pullEntry(r,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(r),this._watcher.chatroom({chatroomDestroyed:t.targetId});break;case 6:this._ultraGroupTimeQue.push(n),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(n),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},e.prototype._receiveSettingNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,fs).version;this._userSettingManager.pullUserSettings(e)},e.prototype._receiveMessageExpansion=function(t){var e=t.content,n=e.put,i=e.del,r=e.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:r,expansion:n}}),i&&this._watcher.expansion({deletedExpansion:{messageUId:r,deletedKeys:i}})},e.prototype._clearUltraGroupUnreadCount=function(t,e){var n=this._connMgr.codec.decodeByPBName(t.data,Yo),i=n.channelId,r=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(r,"_").concat(i)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(En([s]))),e&&(this._ultraMsgMap[e.messageUId]=e.timestamp)},e.prototype._receiveSyncMsg=function(t,e){if(Eo.includes(t.topic))if(t.topic!==jr[jr.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(t.data,So,{currentUserId:this.currentUserId,signal:t});((n=this._handleMsgProperties(n)).conversationType!==$.CHATROOM||this._chrmsQueue[n.targetId])&&(this._pullingMsg?this._pullQueue.push((null==e?void 0:e.timestamp)||n.sentTime):(e&&(n.sentTime=e.timestamp,n.messageUId=e.messageUId,this._sendMessageStore.setMessage(e.messageUId,e.timestamp)),this.logger.info(pt.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==it.EXPANSION_NOTIFY?((n.messageType===it.SYNC_READ_STATUS||n.messageType===it.READ_RECEIPT&&n.senderUserId===this.currentUserId)&&this._conversationManager.clearUnreadCount(n.conversationType,n.targetId,n.channelId),this._conversationManager.setConversationCacheByMessage(n,!0),this._batchMessage([n])):this._receiveMessageExpansion(n)))}else this._clearUltraGroupUnreadCount(t,e)},e.prototype._batchMessage=function(t){for(var e=this,n=[],i=[],r=t.length-1;r>=0;r-=1){var o=t[r];o.messageType!==it.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):i.unshift(o)}this._watcher.batchMessage(n),0!==i.length&&i.forEach((function(t){var n=t.content,i=n.startTime,r=n.endTime,o=n.platform,s=n.logId,a=n.uri;e.reporter.report(parseInt(i,10),parseInt(r,10),o,a,s,t.messageUId)}))},e.prototype._pubCallInfo=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,$s),n=e.key,i=e.dataContent,r=e.maxTime;this._latestPullKVMsgTimestamp=r,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:i}]}))},e.prototype._pullMsg=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,bo),n=e.type,i=e.chrmId,r=e.time;if(this.logger.info(pt.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(r)),2===n){var o=this._chrmsQueue[i];if(!o)return;o.queue.push(r),this._pullChrmMsg(i)}else this._pullQueue.push(r),this._syncMsg()},e.prototype._startSyncInterval=function(){var t=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-t._latestSyncTimestamp>=18e4&&t._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},e.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},e.prototype._syncCallPullKVMsg=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),e=new Kr(lr,t,this.currentUserId),[4,this._connMgr.send(e,ea)]):[2];case 1:return n=o.sent(),i=n.code,r=n.data,i===Z.SUCCESS&&r?(this._latestPullKVMsgTimestamp=r.maxTime,this._watcher.callInfo(JSON.stringify({list:r.info})),[2]):[2]}}))}))},Object.defineProperty(e.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===ca.CONNECTED},enumerable:!1,configurable:!0}),e.prototype._messageProcessor=function(t){var e=this,n=0,i=[],r=[];return t.forEach((function(t){if((i.push(t.messageUId),t.messageDirection===J.SEND)&&(n=Math.max(t.sentTime,n),e._sendMessageStore.getSendMessageMap()[t.messageUId]))return void e._sendMessageStore.removeByUID(t.messageUId);if(t.messageType!==it.DELIVERED&&t.messageType!==it.DELIVERED_MSG)if(t.messageType!==it.EXPANSION_NOTIFY){if(t.messageType!==it.SYNC_READ_STATUS||t.senderUserId===e.currentUserId){(t.messageType===it.SYNC_READ_STATUS||t.messageType===it.READ_RECEIPT&&t.senderUserId===e.currentUserId)&&e._conversationManager.clearUnreadCount(t.conversationType,t.targetId,t.channelId);var o=e._handleMsgProperties(t);e._conversationManager.setConversationCacheByMessage(o,!0),r.push(o)}}else e._receiveMessageExpansion(t)})),{newOutboxTime:n,messageUIds:i,messages:r}},e.prototype._syncMsg=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,u,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,t=this._letterbox.getOutboxTime(this.currentUserId),e=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),i=this._connMgr.codec.encodeSyncMsg({sendboxTime:t,inboxTime:e,broadcastSyncTime:n}),r=new Kr(jr[jr.pullMsg],i,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(pt.L_PULL_MSG_T,JSON.stringify({outboxTime:t,inboxTime:e,broadcastSyncTime:n}),o),[4,this._connMgr.send(r,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,u=s.data,this._latestSyncTimestamp=Date.now(),a!==Z.SUCCESS||!u||ce(u.finished)||ce(u.list)||ce(u.syncTime)?(this.logger.warn(pt.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(c=u.list,h=u.finished,d=u.syncTime,g=u.broadcastSyncTime,p=void 0===g?1:g,this.logger.info(pt.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:c.map((function(t){return{messageUId:t.messageUId,messageId:t.messageId,sentTime:t.sentTime}}))}),o),f=this._messageProcessor(c),_=f.newOutboxTime,E=f.messageUIds,T=f.messages,this._batchMessage(T),this._letterbox.setInboxTime(d,this.currentUserId),this._letterbox.setOutboxTime(_,this.currentUserId),this._letterbox.setBroadcastSyncTime(p,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,v=this._pullQueue.filter((function(t){return t>d})),this._pullQueue.length=0,(y=this._pullQueue).push.apply(y,v),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(pt.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:v}),o),h?(this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg()),[2]):(this._syncMsg(),[2]))}}))}))},e.prototype._receiveMsg=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,No,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(e=this._handleMsgProperties(e),this.logger.info(pt.L_RECV_S_MSG_O,JSON.stringify({messageUId:e.messageUId,messgeId:e.messageId,sentTime:e.sentTime})),e.messageType!==it.DELIVERED&&e.messageType!==it.DELIVERED_MSG){if(e.conversationType!==$.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}e.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(e.messageUId,e.sentTime),e.isStatusMessage||e.senderUserId===this.currentUserId||this._letterbox.setInboxTime(e.sentTime,this.currentUserId),e.messageType!==it.EXPANSION_NOTIFY?e.messageType===it.SYNC_READ_STATUS&&e.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(e,!0),this._batchMessage([e])):this._receiveMessageExpansion(e)}}},e.prototype._handleMsgProperties=function(t,e){void 0===e&&(e=!1);var n,i=t.messageType,r=t.isStatusMessage,o=t.isCounted,s=void 0!==o&&o,a=t.isPersited,c=void 0!==a&&a,l=i in b,h=i in this._customMessageType;if(n=l?u(u({},b[i]),{isStatusMessage:D.includes(i)}):h?this._customMessageType[i]:{isCounted:s,isPersited:c,isStatusMessage:!1},Object.assign(t,n),e&&!ce(r)&&(t.isStatusMessage=r),!e){var d=t.content.user;if(d){var g=d.portrait,p=d.portraitUri,f=g||p;f&&(d.portrait=d.portraitUri=f)}}return t},e.prototype._fixDownstreamData=function(t,e,n){return t&&2===e.list.length&&(e.hasMore=!0,0===n?e.list.shift():e.list.pop()),e},e.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){var u;return void 0===o&&(o=""),c(this,void 0,void 0,(function(){var s,c,h,d,g,p,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return c=(s=this).currentUserId,h=s._connMgr,d=Er[t]||hr,g=1===i&&0===n,h?(p=h.codec.encodeGetHistoryMsg(e,{timestamp:n,count:g?2:i,order:r,channelId:o}),this.logger.info(pt.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:t,channelId:o,timestamp:n,count:i,order:r}),a),[4,h.send(new Kr(d,p,c),Do,{currentUserId:c,connectedTime:h.getConnectedTime(),conversation:{targetId:e}})]):[3,2];case 1:return f=l.sent(),(_=f.code)===Z.SUCCESS&&p?(E=f.data,E=this._fixDownstreamData(g,E,r),T=[],null===(u=E.list)||void 0===u||u.forEach((function(t){t&&T.push(t.messageUId)})),this.logger.info(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:T.join(",")}),a),[2,{code:_,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:Z.RC_NET_CHANNEL_INVALID}]}}))}))},e.prototype.getMessages=function(t,e,n,i,r,o,s){return this.getHistoryMessage(t,e,n,i,r,o,s)},e.prototype.reportSDKInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=this.logger.createTraceId(),o=JSON.stringify(t),this.logger.debug(pt.L_VER_REPORT_T,o,r),s=i.codec.encodeReportSDKInfo(o),a=new Kr(jr[jr.reportsdk],s,n),[4,i.send(a)]):[2];case 1:return(u=c.sent().code)!==Z.SUCCESS&&this.logger.warn(pt.L_VER_REPORT_R,u,r),[2]}}))}))},e.prototype.deleteRemoteMessage=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeDeleteMessages(t,e,n,i),u=new Kr(Zi,a,o),[4,s.send(u)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),[2,c.code]}}))}))},e.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,a=s.codec.encodeClearMessages(e,n,i,t),u=Tr[t],c=new Kr(u,a,o),[4,s.send(c)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},e.prototype.getConversationList=function(t,e,n,i,r){return void 0===t&&(t=300),c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(r=this).currentUserId,s=r._connMgr,e=e||$.PRIVATE,a=s.codec.encodeOldConversationList({count:t,type:e,startTime:n,order:i}),u=new Kr(or,a,o),[4,s.send(u,Go,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(t){var e=t.conversationType,n=t.targetId,i=t.channelId,r=g._conversationManager.get(e,n,i);return Object.assign(t,r),t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,h!==Z.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},e.prototype.removeConversation=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeRemoveOldConversationList({conversationType:t,channelId:n,targetId:e}),o=new Kr(sr,r,e),[4,i.send(o)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},e.prototype.getConversation=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return t!==$.ULTRA_GROUP?[3,1]:(i=this._ultraGroupMap["".concat(n,"_").concat(e)])?[3,3]:[2,{code:Z.CONVER_GET_ERROR}];case 1:return(r=this._conversationManager.get(t,e,n))?[4,this.getHistoryMessage(t,e,0,1,0)]:[2,{code:Z.CONVER_GET_ERROR}];case 2:if(o=c.sent(),s=o.code,a=o.data,s!==Z.SUCCESS)return[2,{code:Z.CONVER_GET_ERROR}];u=(null==a?void 0:a.list[0])||null,i={conversationType:t,targetId:e,channelId:n,unreadMessageCount:r.unreadMessageCount||0,latestMessage:u,notificationStatus:r.notificationStatus||ot.CLOSE,notificationLevel:r.notificationLevel||at.NOT_SET,isTop:r.isTop||!1,lastUnreadTime:r.lastUnreadTime||0,unreadMentionedCount:r.unreadMentionedCount||0},c.label=3;case 3:return[2,{code:Z.SUCCESS,data:i}]}}))}))},e.prototype.getAllConversationUnreadCount=function(t,e,n){var i=this._conversationManager.getAllUnreadCount(t,e,n);return Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.getTotalUnreadCountByLevels=function(t,e,n){void 0===n&&(n=!1);var i=0;if(t.includes($.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});for(var r in this._ultraGroupMap){var o=this._ultraGroupMap[r];(0===e.length||e.includes(o.notificationLevel))&&(i+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return i+=this._conversationManager.getTotalUnreadCountByLevels(t,e,n),Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.getConversationUnreadCount=function(t,e,n){var i,r;return t===$.ULTRA_GROUP?(r=(null===(i=this._ultraGroupMap["".concat(n,"_").concat(e)])||void 0===i?void 0:i.unreadMessageCount)||0,r=this._getUnreadCount(r)):r=this._conversationManager.getUnreadCount(t,e,n),Promise.resolve({code:Z.SUCCESS,data:r})},e.prototype.clearConversationUnreadCount=function(t,e,n){return this._conversationManager.clearUnreadCount(t,e,n,!1),Promise.resolve(Z.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(Z.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.saveConversationMessageDraft=function(t,e,n,i){return this._conversationManager.setDraft(t,e,n,i),Promise.resolve(Z.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,e,n){var i=this._conversationManager.getDraft(t,e,n);return Promise.resolve({code:Z.SUCCESS,data:i})},e.prototype.clearConversationMessageDraft=function(t,e,n){return this._conversationManager.clearDraft(t,e,n),Promise.resolve(Z.SUCCESS)},e.prototype.pullConversationStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this)._connMgr,i=e.currentUserId,r=n.codec.encodeGetConversationStatus(t),o=new Kr(jr[jr.pullSeAtts],r,i),[4,n.send(o,Es)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,this.logger.info(pt.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:t,userId:i})),a!==Z.SUCCESS?[2,{code:a}]:(c=[],Array.isArray(u)&&u.forEach((function(t){var e=t.conversationType,n=t.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),e===$.ULTRA_GROUP?h._setUltraConversationStatus(t):c.push(t)})),[2,{code:a,data:c}])}}))}))},e.prototype._setUltraConversationStatus=function(t){var e=t.targetId,n=t.notificationStatus,i=t.notificationLevel,r=t.channelId,o=t.isTop,s=this._ultraGroupMap["".concat(r,"_").concat(e)];return s&&void 0!==i&&(s.notificationLevel=i,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==n&&(s.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==o&&(s.isTop=o),s},e.prototype.batchSetConversationStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,c,h,d,g,p,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this).currentUserId,i=e._connMgr,r=this._conversationManager.getConversationUpdatedTime(),o=i.codec.encodeSetConversationStatus(t,r),s=new Kr(ar,o,n),[4,i.send(s,Cs)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return a=l.sent(),c=a.code,h=a.data,c!==Z.SUCCESS?[2,c]:(d=h,this._conversationManager.setConversationUpdatedTime(d.version),g=[],t.forEach((function(t){if(t.conversationType!==$.ULTRA_GROUP)f._conversationManager.addStatus(u(u({},t),{updatedTime:d.version}),!0);else{var e=f._setUltraConversationStatus(t);e&&g.push(e)}})),g.length>0&&(p=En(g),p=Qa(p),this._watcher.conversation(p)),[2,c])}}))}))},e.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this.batchSetConversationStatus([{conversationType:t,targetId:e,notificationLevel:n,channelId:i}])]}))}))},e.prototype._joinChrm=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeJoinOrQuitChatRoom(),a=new Kr(s=n?$i:zi,o,t),this.logger.info(pt.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:e,topic:s}),i),[4,r.send(a,Qo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,d=c===Z.SUCCESS?"info":"warn",this.logger[d](pt.L_JOIN_CHATROOM_R,JSON.stringify({code:c,timestamp:(new Date).getTime()}),i),c===Z.SUCCESS?(p=(g=h).joinTime,f=g.createTime,_=g.memberCount,E=g.isAllChatroomBanned,T=g.isCurrentUserBanned,v=g.isCurrentChatroomBanned,y=g.isCurrentChatroomInWhitelist,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,e,p),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,e),this._startSyncIntervalForChrmPull(),[2,{code:c,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:v,isCurrentChatroomInWhitelist:y}}]):[2,{code:c}]}}))}))},e.prototype._rejoinChrm=function(){return c(this,void 0,void 0,(function(){var t,e,n,i,r,o,s,a,c,h;return l(this,(function(l){switch(l.label){case 0:for(n in t=this._joinedChrmManager.get(),e=[],t)e.push(n);i=0,l.label=1;case 1:return i<e.length?(r=e[i],this.logger.info(pt.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:r,count:t[r]||10,topic:$i})),o=this.logger.createTraceId(),[4,this._joinChrm(r,t[r]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,c=s.data,h=a===Z.SUCCESS?"info":"warn",this.logger[h](pt.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===Z.SUCCESS)return this._watcher.chatroom({rejoinedRoom:u({chatroomId:r,count:t[r]},c)}),[2];a===Z.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]}}))}))},e.prototype._pullChrmMsg=function(t,e,n){return void 0===e&&(e=10),void 0===n&&(n=0),c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._chrmsQueue[t],r=i.pulling,o=i.timestamp,r?[2]:(i.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,e),a=new Kr(jr[jr.chrmPull],s,t),this.logger.info(pt.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:t,timestamp:o})),[4,this._connMgr.send(a,Mo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return u=l.sent(),c=u.code,h=u.data,i.pulling=!1,c===Z.SUCCESS&&h?(d=h.list,g=h.syncTime,p=h.finished,i.timestamp=n?Math.max(g,n):g,i.queue=i.queue.filter((function(t){return t>g})),f=[],_=[],d.forEach((function(t){t.sentTime<o||(f.push(t.messageUId),_.push(t))})),this._batchMessage(_),this.logger.info(pt.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:f.join(",")})),(!p||i.queue.length>0)&&this._pullChrmMsg(t),[2]):(this.logger.warn(pt.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:c,timestamp:o,messageUIds:""})),[2])}}))}))},e.prototype.joinChatroom=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._joinChrm(t,e,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.joinExistChatroom=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._joinChrm(t,e,!0,n)]}))}))},e.prototype.quitChatroom=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr,n=e.codec.encodeJoinOrQuitChatRoom(),i=new Kr(tr,n,t),[4,e.send(i)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return r=s.sent(),(o=r.code)===Z.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,o]}}))}))},e.prototype.getChatroomInfo=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(i=this._connMgr,r=i.codec.encodeGetChatRoomInfo(e,n),o=new Kr(jr[jr.queryChrmI],r,t),[4,i.send(o,Jo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,a!==Z.SUCCESS?[2,{code:a}]:[2,{code:a,data:u}]}}))}))},e.prototype.getChatroomHistoryMessages=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr,o=r.codec.encodeGetHistoryMsg(t,{timestamp:e,count:n,order:i}),s=new Kr(gr,o,t),[4,r.send(s,Do,{conversation:{targetId:t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,u!==Z.SUCCESS?[2,{code:u}]:[2,{code:u,data:{list:c.list,hasMore:c.hasMore}}]}}))}))},e.prototype._modifyChatroomKV=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=this._chrmEntryHandler.getVersion(t,e.key),e.version=null==o?this.getServerTime():o,s=i.codec.encodeModifyChatRoomKV(t,e,r),a=e.type===Et.UPDATE?er:nr,u=new Kr(a,s,t),[4,i.send(u,Qo)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return c=l.sent(),(h=c.code)===Z.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[e],syncTime:this.getServerTime()},r),[2,h]):[2,h]}}))}))},e.prototype._chatroomKVStoreNotAllSuccess=function(t,e){var n=e.data,i=t;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(t){var e=i.findIndex((function(e){return t.key===e.key}));-1!==e&&i.splice(e,1)})),i},e.prototype._modifyChatroomKVS=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,c,h,d,g,p,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,e.entries.forEach((function(e){var n=_._chrmEntryHandler.getVersion(t,e.key);e.version=null==n?_.getServerTime():n})),o=i.codec.encodeModifyChatRoomKVS(t,e,r),s=e.type===Et.UPDATE?ir:rr,a=new Kr(s,o,t),[4,i.send(a,as)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,-1!==[Z.SUCCESS,Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(g=[],delete(p=u({},e)).entries,e.entries.forEach((function(t){g.push(u(u({},t),p))})),h===Z.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=c.data,d=f.errorKeys,g=this._chatroomKVStoreNotAllSuccess(g,c)),this._chrmEntryHandler.setLocal(t,{kvEntries:g,syncTime:(new Date).getTime()},r)),[2,{code:h,data:d}]}}))}))},e.prototype.setChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.setChatroomEntries=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceSetChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.UPDATE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntries=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceRemoveChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=Et.DELETE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.getChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return(n=this._chrmEntryHandler.getValue(t,e))?[2,{code:Z.SUCCESS,data:n}]:this._isConnected?(i=this._connMgr,r=i.codec.encodePullChatRoomKV(0),o=new Kr(jr[jr.pullKV],r,t),[4,i.send(o,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(u=a.kvEntries.find((function(t){return t.key===e})),void 0!==u)?[2,{code:Z.SUCCESS,data:null==u?void 0:u.value}]:[2,{code:Z.CHATROOM_KEY_NOT_EXIST}]}}))}))},e.prototype.getAllChatroomEntry=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return(e=this._chrmEntryHandler.getAll(t))&&Object.keys(e).length?[2,{code:Z.SUCCESS,data:e}]:this._isConnected?(n=this._connMgr,e={},i=n.codec.encodePullChatRoomKV(0),r=new Kr(jr[jr.pullKV],i,t),[4,n.send(r,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),(s=o.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(t){t.key&&(e[t.key]=t.value||"")})),[2,{code:Z.SUCCESS,data:e}]}}))}))},e.prototype.pullChatroomEntry=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c,h,d,g,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(n=this)._connMgr,r=n.currentUserId,o=i.codec.encodePullChatRoomKV(e),s=new Kr(jr[jr.pullKV],o,t),this.logger.info(pt.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:t,timestamp:e})),[4,i.send(s,ss)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),u=a.code,c=a.data,h=u===Z.SUCCESS?"info":"warn",this.logger[h](pt.L_PULL_CHATROOM_KV_R,JSON.stringify({code:u,timestamp:e})),u===Z.SUCCESS&&c?(d=c.kvEntries,g=[],d.length>0&&(d.forEach((function(e){var n=e.key,i=e.value,r=e.type,o=e.timestamp,s=e.userId;p._chrmEntryHandler.getValue(t,n)===i&&s===p.getCurrentUserId()||g.push({key:n,value:i,type:r,timestamp:o,chatroomId:t})})),this._chrmEntryHandler.setLocal(t,c,r),g.length>0&&this._watcher.chatroom({updatedEntries:g})),[2,{code:u,data:c}]):[2,{code:u}]}}))}))},e.prototype._startSyncIntervalForChrmPull=function(){var t=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var e=Object.keys(t._chrmsQueue);0!==e.length&&t._isConnected?e.forEach((function(e){t._pullChrmMsg(e),t.getNaviInfoFromCache().kvStorage&&t._chrmEntryHandler.pullEntry(e,0)})):t._stopSyncIntervalForChrmPull()}),M)},e.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},e.prototype.sendMessage=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,c,h,d,g,p,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=function(t,e){return"RC:SRSMsg"===t.messageType&&Object.assign(t,{directionalUserIdList:[e]}),t}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![$.PRIVATE,$.GROUP].includes(t)&&n.isStatusMessage,s=o?function(t){var e;return(e={},e[$.PRIVATE]=jr.ppMsgS,e[$.GROUP]=jr.pgMsgS,e)[t]}(t):function(t){var e;return(e={},e[$.PRIVATE]=jr.ppMsgP,e[$.GROUP]=jr.pgMsgP,e[$.CHATROOM]=jr.chatMsg,e[$.CUSTOMER_SERVICE]=jr.pcMsgP,e[$.RTC_ROOM]=jr.prMsgS,e[$.SYSTEM]=jr.pbMsgP,e)[t]}(t)||jr.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:$e(),n.messageId=a,c=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},n),(h=new kr(jr[s],c,t===$.SYSTEM?this.currentUserId:e)).setHeaderQos(Fi.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(h),[2,{code:Z.SUCCESS,data:ja(t,e,u({},n),"",0,this.currentUserId,a)}]):(d=this._connMgr.getCrtServerTime(),g=ja(t,e,u({},n),"",d,this.currentUserId,a),null==i||i(a),this.logger.info(pt.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:t,targetId:e,channelId:n.channelId}),r),[4,this._connMgr.send(h)])):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return p=l.sent(),f=p.code,_=p.data,f!==Z.SUCCESS?(this.logger.warn(pt.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:g.messageUId,messageId:g.messageId}),r),g.sentStatus=It.FAILED,[2,{code:f,data:g}]):(this.logger.info(pt.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:null==_?void 0:_.messageUId,messageId:null==_?void 0:_.messageId}),r),E=_,this._sendMessageStore.setMessage(E.messageUId,E.timestamp),g.sentTime=E.timestamp,g.messageUId=E.messageUId,this._conversationManager.setConversationCacheByMessage(g,!0),[2,{code:Z.SUCCESS,data:g}])}}))}))},e.prototype.recallMsg=function(t,e,n,i,r){var o;return c(this,void 0,void 0,(function(){var s,a,c,h,d,g,p,f,_,E,T,v,y;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=r.user,a=r.extra,c=r.isDelete,h={conversationType:t,targetId:e,messageUId:n,sentTime:i,channelId:r.channelId||"",isDelete:c||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==r?void 0:r.disableNotification,pushConfig:null==r?void 0:r.pushConfig,pushContent:(null===(o=r.pushConfig)||void 0===o?void 0:o.pushContent)||r.pushContent||"",channelId:r.channelId},g=jr[jr.recallMsg],p=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},d),(f=new kr(g,p,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,T=_.data,t===$.ULTRA_GROUP&&this.logger.debug(pt.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:t,targetId:e,channelId:r.channelId})),E!==Z.SUCCESS?[2,{code:E}]:(v=T,t===$.ULTRA_GROUP?(this._ultraMsgMap[v.messageUId]=v.timestamp,this._updateUltraGroupWhenRecallMsg(e,r.channelId||"",n),[2,{code:Z.SUCCESS}]):(this._sendMessageStore.setMessage(v.messageUId,v.timestamp),y=ja(t,e,u(u({},d),{isPersited:!0}),v.messageUId,v.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(y,!0),[2,{code:Z.SUCCESS,data:y}]))}}))}))},e.prototype.sendReadReceiptMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeReadReceipt(e,n),r=new Kr(jr[jr.rrMsg],i,t),[2,this._connMgr.send(r)]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getMessageReader=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){return this._isConnected?(i=this._connMgr.codec.encodeMessageReader(e,n),r=new Kr(jr[jr.rrList],i,t),[2,this._connMgr.send(r,Us)]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.pullUserSettings=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullUserSetting(t),n=new Kr(jr[jr.pullUS],e,this.currentUserId),[4,this._connMgr.send(n,ps)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&this._naviChangeHandler(o),[2,{code:r,data:o}]}}))}))},e.prototype._naviChangeHandler=function(t){var e;if(t){var n=t.settings,i=null===(e=null==n?void 0:n.VoipInfo)||void 0===e?void 0:e.value;if(i){var r=this._connMgr.getToken();this.navi.updateVoipCallInfo(r,i);var o=this.navi.getNaviInfoFromCache(r);this._watcher.onNaviDataChange(u({},o))}}else this.logger.warn(pt.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:t}))},e.prototype.getFileToken=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=i&&"uploads"!==i?e||"":Qe(t,e),s=this._connMgr.codec.encodeGetFileToken(t,o,n||"",i||"",r||""),a=new Kr(jr[jr.qnTkn],s,this.currentUserId),[4,this._connMgr.send(a,Zo)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,d=u(u({},d),{fileName:o,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),h===Z.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},e.prototype.getFileUrl=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r="",o="",s="",e===ht.QINIU?(o=zo,s=ts):(o=$o,s=es),r=e===ht.QINIU?jr[jr.qnUrl]:e===ht.AWS?jr[jr.s3Url]:e===ht.STC?jr[jr.stcUrl]:e===ht.MINIO?jr[jr.minioUrl]:jr[jr.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,t,n,i),u=new Kr(r,a,this.currentUserId),[4,this._connMgr.send(u,s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),h=c.code,d=c.data,g=d,h===Z.SUCCESS?[2,{code:h,data:g}]:[2,{code:h}]}}))}))},e.prototype.disconnect=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return t.sent(),this._resetMemoryState(),[2]}}))}))},e.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._chrmsQueue={}},e.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},e.prototype.registerMessageType=function(t,e,n,i,r){this._customMessageType[t]={isPersited:e,isCounted:n,isStatusMessage:r}},e.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([t],e),i=new Kr(jr[jr.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=c.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([u(u({},t),{createdTime:a})],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([t],e),i=new Kr(jr[jr.delSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([t],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.updateTag=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([t],e),i=new Kr(jr[jr.addSeTag],n,this.currentUserId),[4,this._connMgr.send(i,ds)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([t],a),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){var t,e;return l(this,(function(n){return t=this._userSettingManager.getTags(),e=this._conversationManager.getConversationListForTag(),t.forEach((function(t){t.conversationCount=e[t.tagId]?e[t.tagId].length:0})),[2,{code:Z.SUCCESS,data:t}]}))}))},e.prototype.addTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s=this;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(t)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e),i=new Kr(jr[jr.addTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:Z.TAG_NOT_EXIST}]:[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(r=a.sent().code)!==Z.SUCCESS?[2,{code:r}]:((o={})[t]={},e.forEach((function(t){s._conversationManager.addTagStatus(t.conversationType,t.targetId,o,t.channelId)})),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e),i=new Kr(jr[jr.delTag],n,this.currentUserId),[4,this._connMgr.send(i)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(r=s.sent().code)!==Z.SUCCESS?[2,{code:r}]:(e.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.removeTagsForConversation=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=t.conversationType,i=t.targetId,r=t.channelId,o=e.map((function(t){return{tagId:t}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[t]),a=new Kr(jr[jr.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(u=c.sent().code)!==Z.SUCCESS?[2,{code:u}]:(this._conversationManager.deleteTagStatus(n,i,e,r),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getConversationListByTag=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(i=this).currentUserId,o=i._connMgr,s=o.codec.encodeOldConversationList({count:n,type:$.PRIVATE,startTime:e}),a=new Kr(or,s,r),[4,o.send(a,Go,{currentUserId:r,connectedTime:o.getConnectedTime()})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),c=u.code,h=u.data,c!==Z.SUCCESS?[2,{code:c}]:(d=this._conversationHasTagFilter(t,null==h?void 0:h.list),[2,{code:c,data:d}])}}))}))},e.prototype._conversationHasTagFilter=function(t,e){var n=this,i=[],r=[];function o(t,e){return t.latestMessage&&e.latestMessage?t.latestMessage.sentTime-e.latestMessage.sentTime:0}return e.forEach((function(e){var o=e.conversationType,s=e.targetId,a=e.channelId,c=n._conversationManager.get(o,s,a),l=c.hasMentioned,h=c.mentionedInfo,d=c.lastUnreadTime,g=c.notificationStatus,p=c.isTop,f=c.tags,_=c.unreadMessageCount,E=f&&f[t];if(E){var T=u(u({},e),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:g,isTop:p,unreadMessageCount:_});E.isTop?i.push(u(u({},T),{isTopInTag:!0})):r.push(u(u({},T),{isTopInTag:!1}))}})),i.sort(o),r.sort(o),h(h([],i,!0),r,!0)},e.prototype.getUnreadCountByTag=function(t,e){return c(this,void 0,void 0,(function(){var n;return l(this,(function(i){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(t,e),[2,{code:Z.SUCCESS,data:n}]):[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.setConversationStatusInTag=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c,h,d,g;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=e.targetId,r=e.conversationType,o=e.channelId,s=n.isTop,a=[{tagId:t,isTop:s}],(u=this._conversationManager.get(r,i,o)).tags&&Object.hasOwnProperty.call(u.tags,t)?(c=this._connMgr.codec.encodeUpdateConversationTag(a,[e]),h=new Kr(jr[jr.addTag],c,this.currentUserId),[4,this._connMgr.send(h)]):[2,{code:Z.NO_TAG_IN_CONVER}]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(d=l.sent().code)!==Z.SUCCESS?[2,{code:d}]:((g={})[t]={},s&&(g[t].isTop=!0),this._conversationManager.addTagStatus(r,i,g,o),[2,{code:Z.SUCCESS}])}}))}))},e.prototype.getTagsForConversation=function(t){var e;return c(this,void 0,void 0,(function(){var n,i,r,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:Z.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),i=this._userSettingManager.getTagsInfo(),r=[],n.tags)for(o in n.tags)r.push({tagId:o,tagName:null===(e=i[o])||void 0===e?void 0:e.tagName});return[2,{code:Z.SUCCESS,data:r}]}))}))},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:Z.SUCCESS,data:t})},e.prototype.getTopConversationList=function(t,e){var n=this._conversationManager.getTopConversationList(t,e);return Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUnreadConversationList=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){return e=this._conversationManager.getUnreadConversationList(t),[2,Promise.resolve({code:Z.SUCCESS,data:e})]}))}))},e.prototype.getUnreadMentionedCount=function(t){var e,n;return n=t.conversationType===$.ULTRA_GROUP?(null===(e=this._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)])||void 0===e?void 0:e.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(t.conversationType,t.targetId,t.channelId),n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:Z.SUCCESS,data:t})},e.prototype.getConversationNotificationLevel=function(t,e,n){if(!this._isUltraGroupListExist&&t===$.ULTRA_GROUP)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var i;if(!(i=t===$.ULTRA_GROUP?this._ultraGroupManager.get($.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n)))return Promise.resolve({code:Z.SUCCESS,data:at.NOT_SET});var r=i.notificationLevel;return ce(i.notificationLevel)&&!ce(i.notificationStatus)&&(r=ot.OPEN===i.notificationStatus?1:0),Promise.resolve({code:Z.SUCCESS,data:r})},e.prototype.getConversationNotificationStatus=function(t,e,n){var i;return(i=t===$.ULTRA_GROUP?this._ultraGroupManager.get($.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n))?Promise.resolve({code:Z.SUCCESS,data:i.notificationStatus}):Promise.resolve({code:Z.SUCCESS,data:ot.CLOSE})},e.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this.getHistoryMessage(t,e,n,i,r,o)},e.prototype.getUltraGroupList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o=this;return l(this,(function(s){return e=t.targetId,n=t.channelType,this._isUltraGroupListExist?(i=(i=Object.values(this._ultraGroupMap).filter((function(t){return!(t.targetId!==e&&e||t.channelType!==n&&ne(n))}))).map((function(t){var e=t.unreadMessageCount,n=t.unreadMentionedCount,i=t.unreadMentionedMeCount;return e=o._getUnreadCount(e),n=o._getUnreadCount(n),i=o._getUnreadCount(i),u(u({},t),{unreadMessageCount:e,unreadMentionedCount:n,unreadMentionedMeCount:i})})),i=Qa(i),r=En(i),[2,{code:Z.SUCCESS,data:r}]):[2,{code:Z.METHOD_NOT_AVAILABLE}]}))}))},e.prototype._getUnreadCount=function(t){return t>999?999:t},e.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){(t.notificationStatus===ot.OPEN||t.notificationLevel>0)&&e.push({conversationType:$.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){!0===t.isTop&&e.push({conversationType:$.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var n=0;for(var i in this._ultraGroupMap){i.match(/_.*/g)[0].substring(1)!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=this._ultraGroupMap[i].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){var n=0;for(var i in this._ultraGroupMap){var r=this._ultraGroupMap[i];r.targetId!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[i].notificationLevel)||(n+=r.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadInfoList=function(t){var e=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(i){var r=e._ultraGroupMap[i];t.includes(r.targetId)&&n.push({type:r.conversationType,targetId:r.targetId,channelId:r.channelId,unreadMessageCount:e._getUnreadCount(r.unreadMessageCount),mentionedCount:e._getUnreadCount(r.unreadMentionedCount),mentionedMeCount:e._getUnreadCount(r.unreadMentionedMeCount),notificationLevel:r.notificationLevel})})),Promise.resolve({code:Z.SUCCESS,data:n})},e.prototype.getAllUltraGroupUnreadCount=function(t){if(void 0===t&&(t=!1),!this._isUltraGroupListExist)return Promise.resolve({code:Z.METHOD_NOT_AVAILABLE});var e=0;for(var n in this._ultraGroupMap)e+=t?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return e=this._getUnreadCount(e),Promise.resolve({code:Z.SUCCESS,data:e})},e.prototype.clearUltraUnreadcount=function(t,e){return void 0===e&&(e=""),c(this,void 0,void 0,(function(){var n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),i=this._connMgr.codec.encodeClearUnreadCount({conversationType:$.ULTRA_GROUP,targetId:t,channelId:e},{timestamp:n}),(r=new kr(jr[jr.updUgRTime],i,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(r)]):[2,Z.RC_NET_UNAVAILABLE]:[2,Promise.resolve(Z.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===Z.SUCCESS&&((s=this._ultraGroupMap["".concat(e,"_").concat(t)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},e.prototype._getUltraGroupList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d,g,p,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,e=this._connMgr.codec.encodeUltraGroup(t,false),n=new Kr(jr[jr.pullUgSes],e,this.currentUserId),[4,this._connMgr.send(n,Go,{currentUserId:this.currentUserId,conversationType:$.ULTRA_GROUP})]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&o?(a=o.list,u=o.isFinished,a.forEach((function(t){t.notificationStatus=ot.CLOSE,t.notificationLevel=at.NOT_SET,t.isTop=!1,f._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)]=t,f._ultraGroupManager.addUltraGroupStatus(t)})),!1!==u?[3,2]:(c=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(c),[3,4])):(this.logger.warn(pt.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(r,", try again")),s=setTimeout((function(){f._getUltraGroupList(t),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(pt.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,g=h.data,d!==Z.SUCCESS&&this.logger.warn(pt.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(g)),p=Object.values(this._ultraGroupMap),p=Qa(p),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(En(p)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.label=4;case 4:return[2]}}))}))},e.prototype._startUltraSyncInterval=function(){var t=this,e=function(){t._ultraGroupTimer=setTimeout((function(){Date.now()-t._lastSyncUltraMsgLocalTimeStamp>=18e4&&t._syncUltraMsg(t._lastSyncUltraMsgTimeStamp),t._stopUltraSyncInterval(),e()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),e()},e.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},e.prototype._notificationOnline=function(){return c(this,void 0,void 0,(function(){var t,e,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return t=r.sent(),e=t.code,n=t.data,e===Z.SUCCESS&&n?(this.logger.info(pt.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(pt.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){i._notificationOnline()}),3e3),[2])}}))}))},e.prototype._fetchUltraMsg=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return e=this._connMgr.codec.encodeSuperSyncMsg(t),n=new Kr(jr[jr.pullUgMsg],e,this.currentUserId),i=this.logger.createTraceId(),this.logger.info(pt.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:t}),i),[4,this._connMgr.send(n,Mo,{currentUserId:this.currentUserId,conversation:{conversationType:$.ULTRA_GROUP}})];case 1:return r=l.sent(),o=r.code,s=r.data,o===Z.SUCCESS&&s?(a=s.list,u=s.syncTime,c=a.map((function(t){return t.messageUId})).join(","),this.logger.info(pt.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:c,timestamp:t,syncTime:u}),i)):this.logger.warn(pt.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:t}),i),[2,{code:o,data:s}]}}))}))},e.prototype._getUltraGroup=function(t,e,n){var i,r,o,s=t.targetId,a=t.messageType,u=t.channelId,c=t.isCounted,l=t.channelType,h=t.sentTime,d=t.senderUserId,g=t.content,p=t.isMentioned,f=this._ultraGroupMap["".concat(u,"_").concat(s)],_=f||{conversationType:$.ULTRA_GROUP,targetId:s,channelId:u,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:ot.CLOSE,notificationLevel:at.NOT_SET,isTop:!1};return c&&d!==this.currentUserId&&a!==it.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=e,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),p&&(null===(i=null==g?void 0:g.mentionedInfo)||void 0===i?void 0:i.type)!==ct.ALL&&(null===(o=null===(r=null==g?void 0:g.mentionedInfo)||void 0===r?void 0:r.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=t,_.channelType=l,f||(this._ultraGroupMap["".concat(u,"_").concat(s)]=_),_},e.prototype._syncUltraMsg=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,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(t)]);case 1:return e=l.sent(),n=e.code,i=e.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===Z.SUCCESS&&i?(r=i.list,o=i.syncTime,s=i.finished,a={},u=[],r.forEach((function(t){var e,n,i,r=t.targetId,s=t.content,c=t.messageUId,l=t.channelId,d=t.isMentioned;if(h._ultraMsgMap[c])delete h._ultraMsgMap[c];else{var g=0;d&&((null===(e=null==s?void 0:s.mentionedInfo)||void 0===e?void 0:e.type)===ct.ALL||(null===(i=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===i?void 0:i.includes(h.currentUserId)))&&(g=1);var p=h._getUltraGroup(t,g,o);a["".concat(l,"_").concat(r)]=p,h._ultraGroupManager.addUltraGroupStatus(p),u.push(t)}})),Object.keys(a).length>0&&(this.logger.debug(pt.O,"notice ultragroups"),c=Object.values(a),c=Qa(c),this._watcher.conversation(En(c))),this.logger.debug(pt.O,"notice ultragroup message"),this._batchMessage(u),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(t){return t>o})),this._lastSyncUltraMsgTimeStamp=o,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(o)),[2]):(this._syncUltraMsg(o),[2])):[2]}}))}))},e.prototype.sendUltraMessage=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,c,h,d,g,p,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===e.messageType&&this.logger.warn(pt.O,"ultra group -> direction message convert to message"),e=this._handleMsgProperties(e,!0),r=e.messageId?e.messageId:$e(),e.messageId=r,o=this._connMgr.codec.encodeUpMsg({conversationType:$.ULTRA_GROUP,targetId:t},e),(s=new kr(jr[jr.ugMsg],o,t)).setHeaderQos(Fi.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),c=ja($.ULTRA_GROUP,t,u({},e),"",a,this.currentUserId,r),n&&n(r),this.logger.info(pt.L_SEND_MSG_T,JSON.stringify({messageType:e.messageType,conversationType:$.ULTRA_GROUP,targetId:t,channelId:e.channelId}),i),[4,this._connMgr.send(s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return h=l.sent(),d=h.code,g=h.data,d!==Z.SUCCESS?(this.logger.warn(pt.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:c.messageUId,messageId:c.messageId}),i),c.sentStatus=It.FAILED,[2,{code:d,data:c}]):(this.logger.info(pt.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:null==g?void 0:g.messageUId,messageId:null==g?void 0:g.messageId}),i),p=g,c.sentTime=p.timestamp,c.messageUId=p.messageUId,this._ultraMsgMap[p.messageUId]=p.timestamp,f=e.channelId||"",(_=this._ultraGroupMap["".concat(f,"_").concat(t)])?(_.latestMessage=c,ne(_.channelType)&&(c.channelType=_.channelType)):(_={conversationType:$.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:c.sentTime,latestMessage:c,notificationStatus:ot.CLOSE,notificationLevel:at.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(f,"_").concat(t)]=_,this._ultraGroupManager.addUltraGroupStatus(_)),this._watcher.conversation(En([_])),[2,{code:d,data:c}])}}))}))},e.prototype.sendUltraGroupTypingStatus=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=t.conversationType,i=t.channelId,r=t.targetId,o=this._connMgr.codec.encodeOperateStatus(r,n,i||"",e||0),(s=new kr(jr[jr.operate],o,r)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(a=u.sent().code)!==Z.SUCCESS?[2,{code:a,msg:Z[a]}]:[2,{code:a}]}}))}))},e.prototype.getUltraGroupMessageListByMessageUId=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?t.messages&&t.messages.length<1||t.messages&&t.messages.length>20?[2,{code:Z.MSG_LIMIT_ERROR}]:(e={},t.messages.forEach((function(t){e[t.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(t),(i=new Kr(jr[jr.qryMsg],n,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ys,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=u.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o,msg:Z[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(t){var n=t.messageUId;e[n]=t})),[2,{code:0,data:e}])}}))}))},e.prototype._pullOperateStatusNotify=function(t){if(this._isConnected){var e=this._connMgr.codec.decodeByPBName(t.data,Qs),n=e.conversationType,i=e.info,r=e.summary;this.logger.debug(pt.O,"s_opNtf -> type: ".concat(n,", info: ").concat(i,", summary: ").concat(r)),this._watcher.operateStatus(e)}},e.prototype.expandUltraMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i;return l(this,(function(r){switch(r.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeExpandUltraMessage(t,this.currentUserId),(n=new Kr(jr[jr.upMsgEx],e,t.targetId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return(i=r.sent().code)!==Z.SUCCESS?[2,{code:i,msg:Z[i]}]:[2,{code:i}]}}))}))},e.prototype.modifyMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodemodifyMessage(t,this.currentUserId),(n=new Kr(jr[jr.modifyMsg],e,t.targetId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=a.sent(),r=i.code,o=i.data,r!==Z.SUCCESS?[2,{code:r,msg:Z[r]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:r}])}}))}))},e.prototype._pullUltraChangeMessageList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,e=this._connMgr.codec.encodeQueryMsgChange(t),(n=new Kr(jr[jr.qryMsgChange],e,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(n,Ks)]):[2];case 1:return i=l.sent(),r=i.code,o=i.data,this._isPullingUltraChangeMessage=!1,r===Z.SUCCESS&&o?(s=o.hasNext,a=o.list,u=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),c=this._pullUltraChangeMessageQue.filter((function(t){return t>u})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,c),s?this._pullUltraChangeMessageList(u):this._lastPullingUltraChangeMessageTime=u,[2]):[2]}}))}))},e.prototype._handleUltraChangeList=function(t){var e={};t.forEach((function(t){var n=t.changeType;e[n]||(e[n]=[]),e[n].push(t)}));var n=Vt.CHANNEL_CHANGE,i=Vt.MSG_RECALL,r=Vt.MSG_EXPANSION,o=Vt.MSG_MODIFY,s=Vt.USER_GROUP_CHANGE;e[n]&&this._handleUltraChannelChange(e[n]),e[i]&&this._handleMsgRecall(e[i]),e[r]&&this._handleMsgUpdate(e[r]),e[o]&&this._handleMsgUpdate(e[o]),e[s]&&this._handleUserGroupStatus(e[s])},e.prototype._handleUltraChannelChange=function(t){var e=this,n=[],i=[],r=[];t.forEach((function(t){var o=t.subChangeType,s=t.targetId,a=t.channelId,u=t.sendTime,c=t.operatorId,l="".concat(a,"_").concat(s),h=e._ultraGroupMap[l];if(h){var d=Gt.PUBLIC_TO_PRIVATE,g=Gt.PRIVATE_TO_PUBLIC,p=Gt.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=Gt.CHANNEL_DELETE,_=Gt.CHANNEL_USER_KICKED;switch(o){case g:h.channelType=Pt.PUBLIC,n.push({targetId:s,channelId:a,changeType:Dt.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=Pt.PRIVATE,n.push({targetId:s,channelId:a,changeType:Dt.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case p:n.push({targetId:s,channelId:a,changeType:Dt.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete e._ultraGroupMap[l];break;case f:i.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:u}),delete e._ultraGroupMap[l];break;case _:r.push({targetId:s,channelId:a,userId:c,channelType:Pt.PRIVATE}),c===e.currentUserId&&delete e._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),i.length>0&&this._watcher.ultraGroupChannelDelete(i),r.length>0&&this._watcher.ultraGroupChannelUserKicked(r)},e.prototype._handleMsgRecall=function(t){var e=this,n=[];t.forEach((function(t){var i=t.targetId,r=t.channelId,o=t.messageUId,s=t.sendTime,a=t.conversationType,u=t.operatorId,c=t.mentionedType;e._updateUltraGroupWhenRecallMsg(i,r,o,s,c),n.push({targetId:i,conversationType:a,sentTime:s,messageUId:o,senderUserId:u,channelId:r,content:{conversationType:a,targetId:i,messageUId:o,channelId:r},messageDirection:1,messageType:it.RECALL,isOffLineMessage:!1,receivedTime:Date.now(),isPersited:!1,isCounted:!1,isMentioned:!1,disableNotification:!1,isStatusMessage:!1,canIncludeExpansion:!1,expansion:null,receivedStatus:0})})),this._watcher.ultraGroupMessageRecalled(n)},e.prototype._handleMsgUpdate=function(t){var e={};for(var n in t.forEach((function(t){var n=t.targetId,i=t.conversationType,r=t.sendTime,o=t.messageUId,s=t.channelId,a="".concat(i,"_").concat(n);e[a]||(e[a]=[]),e[a].push({messageUId:o,channelId:s,sendTime:r})})),e){var i=n.split("_"),r=i.shift(),o=i.join("_");this._pullUltraMessageList(t[0].changeType,{targetId:o,conversationType:Number(r),messages:h([],e[n],!0)})}},e.prototype._pullUltraMessageList=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u,c=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(e),(i=new Kr(jr[jr.qryMsg],n,this.currentUserId)).setHeaderQos(Fi.AT_LEAST_ONCE),[4,this._connMgr.send(i,Ys,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return r=l.sent(),o=r.code,s=r.data,o!==Z.SUCCESS?[2,{code:o,msg:Z[o]}]:(a=(s||{}).list,u=[],Array.isArray(a)&&a.forEach((function(t){var e=t.targetId,n=t.channelId,i=t.messageUId,r=c._ultraGroupMap["".concat(n,"_").concat(e)];r&&r.latestMessage.messageUId===i&&(r.latestMessage=t),u.push(t)})),t===Vt.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(u),t===Vt.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(u),[2])}}))}))},e.prototype._handleUserGroupStatus=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d;return l(this,(function(l){return e=Bt.REMOVE_USER_GROUP,n=Bt.JOIN_USER_GROUP,i=Bt.EXIT_USER_GROUP,r=Bt.CHANNEL_BIND_USER_GROUP,o=Bt.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],u=[],c=[],h=[],t.forEach((function(t){var l=t.conversationType,d=t.targetId,g=t.userGroupIds,p=t.busChannelType,f=t.channelId;switch(t.subChangeType){case e:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case i:u.push({conversation:{conversationType:l,targetId:d},userGroupIds:g});break;case r:c.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:p,userGroupIds:g});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:p,userGroupIds:g})}})),d={},s.length>0&&(d.userGroupDisband=s),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]}))}))},e.prototype.getUltraHistoryMsg=function(t,e,n){var i;return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._connMgr.codec.encodeGetHistoryMsg(t,e),o=new Kr(jr[jr.qryUgMsg],r,this.currentUserId),this.logger.info(pt.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:$.ULTRA_GROUP,channelId:e.channelId,timestamp:null==e?void 0:e.timestamp,count:null==e?void 0:e.count}),n),[4,this._connMgr.send(o,Do,{currentUserId:this.currentUserId,conversation:{conversationType:$.ULTRA_GROUP,targetId:t}})]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,u=s.data,a===Z.SUCCESS&&u?(c=[],null===(i=u.list)||void 0===i||i.forEach((function(t){t&&c.push(t.messageUId)})),this.logger.info(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:c.join(",")}),n),[2,{code:a,data:u}]):(this.logger.warn(pt.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},e.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(i=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(e,n),r=new Kr(jr[jr.ugUnpushSet],i,t),[4,this._connMgr.send(r)]):[2,{code:Z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,Z.SUCCESS,[2,{code:s}]}}))}))},e.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return c(this,void 0,void 0,(function(){var n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,i=n.codec.encodeGetUltraGroupDefaultNotificationLevel(e),r=new Kr(jr[jr.ugUnpushQuery],i,t),[4,n.send(r,Os)]):[2,{code:Z.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})];case 1:return o=c.sent(),s=o.code,a=o.data,s===Z.SUCCESS&&a?(u=a.unpushLevel,[2,{code:s,data:u}]):[2,{code:s}]}}))}))},e.prototype._updateUltraGroupWhenRecallMsg=function(t,e,n,i,r){var o="".concat(e,"_").concat(t);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,u=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),i&&u<i&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(r===kt.ALL||r===kt.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,r===kt.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(En([s])))}},e.prototype.getAllConversationState=function(){return Promise.resolve({code:Z.SUCCESS,data:this._conversationManager.getAllConversationState()})},e.prototype.getUltraGroupUnreadMentionedMessages=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(e=this._connMgr.codec.encodeUnreadMentionedMsgQuery(t),n=new Kr(jr[jr.qryUgUal],e,this.currentUserId),[4,this._connMgr.send(n,Ss)]):[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})]:[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return i=s.sent(),r=i.code,o=i.data,r===Z.SUCCESS&&o?[2,{code:r,data:o}]:[2,{code:r}]}}))}))},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(e=t.targetId,n=t.channelId,i=this._ultraGroupMap["".concat(n,"_").concat(e)]||{},r=i.firstUnreadMessage||null,[2,{code:Z.SUCCESS,data:r}]):[2,Promise.resolve({code:Z.METHOD_NOT_AVAILABLE})]:[2,{code:Z.RC_NET_UNAVAILABLE}]}))}))},e.prototype.bindRTCRoomForChatroom=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=t.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(t),i=new Kr(jr[jr.setRtcRoomId],n,e),[4,this._connMgr.send(i)]):[2,Z.RC_NET_UNAVAILABLE];case 1:return r=o.sent(),[2,r.code]}}))}))},e.prototype.rtcSignaling=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,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,o=n?new Kr(e,r,t):new kr(e,r,t),[4,this._connMgr.send(o)]):[2,{code:Z.RC_NET_UNAVAILABLE}];case 1:return s=c.sent(),a=s.code,u=s.data,[2,{code:a,buffer:null==u?void 0:u.data}]}}))}))},e.prototype.rtcPing=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=aa(this.rtcCodec,e,n),[4,this.rtcSignaling(t,jr[jr.rtcPing],!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o!==Z.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(an.RtcOutput,s)).version=je(a.version),[2,{code:o,data:a}])}}))}))},e.prototype.getDeviceId=function(){return bi(this.runtime)},e.prototype.getOSInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.getProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.getMainProcessInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:Z.NOT_SUPPORT}]}))}))},e.prototype.destroy=function(){ci(),Sa()},e.prototype.callExtra=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},e.prototype.getConversationListWithAllChannelByPage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getConversationsByPage=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.clearConversations=function(){throw new Error("Method not implemented.")},e.prototype.setUserStatusListener=function(t,e){throw new Error("Method not implemented.")},e.prototype.setUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.subscribeUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.getUserStatus=function(t){throw new Error("Method not implemented.")},e.prototype.addToBlacklist=function(t){return Promise.resolve(Z.NOT_SUPPORT)},e.prototype.removeFromBlacklist=function(t){return Promise.resolve(Z.NOT_SUPPORT)},e.prototype.getBlacklist=function(){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getBlacklistStatus=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.insertMessage=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.batchInsertMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.getMessageCount=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.deleteMessages=function(t){throw new Error("Method not implemented.")},e.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.clearMessages=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setMessageContent=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.setMessageSearchField=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchConversationByContent=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.searchConversationByContentWithAllChannel=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.searchMessageByContent=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessagesByUser=function(t,e,n,i,r,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){throw new Error("Method not implemented.")},e.prototype.getUnreadMentionedMessages=function(t,e){throw new Error("Method not implemented.")},e.prototype.setMessageSentStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.updateMessageReceiptStatus=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setMessageReceivedStatus=function(t,e){throw new Error("Method not implemented.")},e.prototype.clearData=function(){throw new Error("Method not implemented.")},e.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){throw new Error("Method not implemented.")},e.prototype.setCallInfo=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return(i=this._connMgr)?(r=i.codec.encodeSetCallInfo(e,n),[4,i.send(new Kr(cr,r,t),zs)]):[3,2];case 1:return o=u.sent(),s=o.code,a=o.data,s===Z.SUCCESS&&a?[2,Promise.resolve({code:s,data:{key:a.key,value:a.dataContent}})]:[2,Promise.resolve({code:s})];case 2:return[2,Promise.resolve({code:Z.RC_NET_CHANNEL_INVALID})]}}))}))},e.prototype.getGroupMessageDeliverList=function(t,e,n){throw new Error("Method not implemented.")},e.prototype.getPrivateMessageDeliverTime=function(t,e){throw new Error("Method not implemented.")},e.prototype.setCheckDuplicateMessage=function(t){throw new Error("Method not implemented.")},e.prototype.setProxy=function(t){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.getProxy=function(){return Promise.resolve({code:Z.NOT_SUPPORT})},e.prototype.testProxy=function(t,e){return Promise.resolve({status:Z.NOT_SUPPORT})},e.prototype.setNetwork=function(t,e){this._connMgr.setNetwork(t,e)},e}(Yn),Ja=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.joinRTCRoom=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return s=aa(this._context.rtcCodec,e,n,i,r,o),[4,this.rtcSignaling(t,Cn,!0,s)];case 1:return a=l.sent(),u=a.code,c=a.buffer,u===Z.SUCCESS&&c&&(h=ua(this._context.rtcCodec,c)),[2,{code:u,data:h}]}}))}))},e.prototype.quitRTCRoom=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e=this._context.rtcCodec.encode(an.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,mn,!0,e)];case 1:return[2,n.sent().code]}}))}))},e.prototype.rtcPing=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,this._context.rtcPing(t,e,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.rtcPingResVersion=function(t,e,n){return this._context.rtcPing(t,e,n)},e.prototype.getRTCRoomInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,In,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r&&(o=this._context.rtcCodec.decode(an.RtcRoomInfoOutput,r)),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfoList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s;return l(this,(function(a){switch(a.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,Rn,!0,e)];case 1:return n=a.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r&&(s=ua(this._context.rtcCodec,r),o={users:s.users}),[2,{code:i,data:o}]}}))}))},e.prototype.getRTCUserInfo=function(t){throw new Error("Method not implemented.")},e.prototype.setRTCUserInfo=function(t,e,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(an.RtcValueInfo,{key:e,value:n}),[4,this.rtcSignaling(t,Sn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.removeRTCUserInfo=function(t,e){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(an.RtcKeyDeleteInput,{key:e}),[4,this.rtcSignaling(t,On,!1,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.setRTCData=function(t,e,n,i,r,o){return c(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(an.RtcSetDataInput,{interior:i,target:r,key:e,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(t,Nn,!1,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCTotalRes=function(t,e,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:i,content:this._context.rtcCodec.encode(an.RtcValueInfo,{key:e.name,value:e.content},!0),valueInfo:[this._context.rtcCodec.encode(an.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(an.RtcValueInfo,{key:"mcu_uris",value:r},!0)]},s=this._context.rtcCodec.encode(an.RtcUserSetDataInput,o),[4,this.rtcSignaling(t,Mn,!0,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCCDNUris=function(t,e,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(an.RtcUserSetDataInput,{objectName:e,valueInfo:this._context.rtcCodec.encode(an.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(t,Mn,!0,i)];case 1:return[2,r.sent().code]}}))}))},e.prototype.getRTCData=function(t,e,n,i){return c(this,void 0,void 0,(function(){var r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return r=this._context.rtcCodec.encode(an.RtcDataInput,{interior:n,target:i,key:e}),[4,this.rtcSignaling(t,Un,!0,r)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===Z.SUCCESS&&a?(u=this._context.rtcCodec.decode(an.RtcQryOutput,a).outInfo,c={},u.forEach((function(t){c[t.key]=t.value})),[2,{code:s,data:c}]):[2,{code:s}]}}))}))},e.prototype.removeRTCData=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(an.RtcDataInput,{interior:n,target:i,key:e,objectName:null==r?void 0:r.name,content:null==r?void 0:r.content}),[4,this.rtcSignaling(t,Ln,!1,o)];case 1:return[2,s.sent().code]}}))}))},e.prototype.setRTCOutData=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCOutData=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(t){throw new Error("JSEngine's method not implemented.")}))}))},e.prototype.getRTCToken=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=aa(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,An,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=this._context.rtcCodec.decode(an.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},e.prototype.setRTCState=function(t,e){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(an.MCFollowInput,{state:e}),[4,this.rtcSignaling(t,wn,!0,n)];case 1:return[2,i.sent().code]}}))}))},e.prototype.getRTCUserList=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,bn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r?(o=ua(this._context.rtcCodec,r),[2,{code:i,data:o}]):[2,{code:i}]}}))}))},e.prototype.joinLivingRoomAsAudience=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a,u,c;return l(this,(function(l){switch(l.label){case 0:return i=aa(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,Pn,!0,i)];case 1:return r=l.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=this._context.rtcCodec.decode(an.RtcViewerJoinedOutput,s),u=a.rtcToken,c=a.entries,[2,{code:o,data:{token:u,kvEntries:c}}]):[2,{code:o}]}}))}))},e.prototype.quitLivingRoomAsAudience=function(t){return c(this,void 0,void 0,(function(){var e,n;return l(this,(function(i){switch(i.label){case 0:return e=this._context.rtcCodec.encode(an.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,Dn,!0,e)];case 1:return n=i.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},e.prototype.rtcIdentityChange=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return i=this._context.rtcCodec.encode(an.RtcInput,{roomType:jt.LIVE,broadcastType:n,identityChangeType:e,needSysChatroom:!1}),[4,this.rtcSignaling(t,Gn,!0,i)];case 1:return r=u.sent(),o=r.code,s=r.buffer,o===Z.SUCCESS&&s?(a=ua(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},e.prototype.requestRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u;return l(this,(function(c){switch(c.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteTimeout,o=t.inviteInfo,s=t.roomId,a=this._context.rtcCodec.encode(an.RtcInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,timeoutTime:r,inviteInfo:o}),[4,this.rtcSignaling(s,Bn,!0,a)];case 1:return u=c.sent().code,this._context.rtcKVManager.reset(),[2,u]}}))}))},e.prototype.cancelRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,i=t.inviteSessionId,r=t.inviteInfo,o=t.roomId,s=this._context.rtcCodec.encode(an.RtcCancelInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:i,inviteInfo:r}),[4,this.rtcSignaling(o,kn,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.responseRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return e=t.inviteUserId,n=t.inviteRoomId,i=t.inviteSessionId,r=t.content,o=t.key,s=t.value,a=t.agree,u=t.roomId,c=this._context.rtcCodec.encode(an.RtcInviteAnswerInput,{inviteUserId:e,inviteRoomId:n,inviteSessionId:i,content:r,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(u,xn,!0,c)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},e.prototype.endRoomPK=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.endRoomId,n=t.sessionId,i=t.content,r=t.keys,o=t.roomId,s=this._context.rtcCodec.encode(an.RtcEndInviteInput,{inviteRoomId:e,inviteSessionId:n,inviteContent:i,inviteRoomKeys:r}),[4,this.rtcSignaling(o,Fn,!0,s)];case 1:return a=u.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.registerRTCSignalListener=function(t){this._context.registerRTCSignalingListener(t)},e.prototype.rtcSignaling=function(t,e,n,i){return this._context.rtcSignaling(t,e,n,i)},e.prototype.getRTCJoinedUserInfo=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(an.RtcQueryUserJoinedInput,{userId:t}),[4,this.rtcSignaling("",Kn,!0,e)];case 1:return n=s.sent(),i=n.code,r=n.buffer,i===Z.SUCCESS&&r?(o=this._context.rtcCodec.decode(an.RtcQueryUserJoinedOutput,r).info||[],[2,{code:i,data:o.map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:je(t.joinTime)}}))}]):[2,{code:i}]}}))}))},e}(Yi);function Xa(t){return u({},t)}var Za=function(){function t(t,e){var n,i;this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[it.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[it.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[it.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[it.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[it.INTERCEPT]=this._processInterceptMessage.bind(this),n[it.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[it.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[it.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((i={})[it.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),i[it.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),i[it.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},this._typingInternalTimer=-1,this._typingExpireTime=2e3,this._typingChangedList=[],this._registerMessageSearchPropsMapping={},this.getChatRoomHistoryMessages=this.getChatroomHistoryMessages,this._options=u({},e),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((function(t){return t.replace(/\/$/g,"")}));var r={onConnected:this._onConnectionStatusChange.bind(this,ca.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,ca.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,ca.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,ca.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)};this.rtcCodec=this.createCodec(Hn,qn),this._engine=pn()?new RCCppEngine(t,this.rtcCodec,r,this._options):new Wa(t,this.rtcCodec,r,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new yn(this._engine)}return t.init=function(e,n){if(this._context)return this._context.logger.warn(pt.A_INIT_REPEAT_O),this._context;this._context=new t(e,n),this._context.logger.info(pt.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(pt.L_IMSDK_VER_O,JSON.stringify({commitId:"b7e690205859acd67b630416d435d73ae257c6cb",version:"5.8.4-alpha.8"}));var i=this._context._engine;return e.setNetworkStatusListener(i.setNetwork.bind(i)),this._context},t.destroy=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._context?(this._context.logger.info(pt.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return t.sent(),this._context=void 0,[2]}}))}))},t.prototype.createCodec=function(t,e){return new Jn(t,e)},t.prototype.install=function(t,e){var n=this.logger.createTraceId();if(this.logger.info(pt.L_INSTALL_PLUGIN_T,JSON.stringify({tag:t.tag}),n),this._pluginInstanseMap[t.tag])return this.logger.warn(pt.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[t.tag];var i="RCRTC"===t.tag?new Ja(this):new Yi(this),r=null;try{if(!t.verify(this._runtime))return null;r=t.setup(i,this._runtime,e)}catch(t){this.logger.error(pt.L_INSTALL_PLUGIN_R,null==t?void 0:t.stack,n)}return["RCRTC","RCCall"].includes(t.tag)&&t.version&&t.name&&(this._versionInfo[t.name]=t.version),r&&(this._pluginContextQueue.push(i),this._pluginInstanseMap[t.tag]=r),r},t.prototype._onConnectionStatusChange=function(t,e){var n,i;this.logger.warn(pt.A_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),null===(i=(n=this._watcher).connection)||void 0===i||i.call(n,t,e),this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onconnectionstatechange)||void 0===i||i.call(n,t,e)}))},t.prototype._processChatrormMessage=function(t){var e;if("function"==typeof this._watcher.chatroomState)return this._watcher.chatroomState({userChange:{users:(e={},e[t.senderUserId]="RC:ChrmQuitNtf"===t.messageType?yt.QUIT:yt.JOIN,e),chatroomId:t.targetId}}),!0},t.prototype._processChrmMemChangeMessage=function(t){if("function"==typeof this._watcher.chatroomState){var e={};Array.isArray(t.content.userList)&&t.content.userList.forEach((function(t){e[t.userId]=t.status})),this._watcher.chatroomState({userChange:{users:e,chatroomId:t.targetId}})}return!0},t.prototype._processTypingStatusMessage=function(t){if(this._addTypingInfo(Xa(t)),this._watcher.typingState)return!0},t.prototype._processInterceptMessage=function(t){var e={conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId||"",blockType:t.content.interceptType,blockedMessageUId:t.content.msgUId,extra:t.content.extra};if(t.conversationType===$.ULTRA_GROUP){var n=t.content.sourceType;if(e.sourceType=n,(n===vt.MSG_EXPANSION||n===vt.MSG_MODIFY)&&t.content.sourceContent)try{e.sourceContent=JSON.parse(t.content.sourceContent)}catch(t){this.logger.warn(pt.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:t.message}))}}return this._MessageBlockedListener(e),!0},t.prototype._processChrmSyncMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:t.content.chatroomId,status:t.content.status,reason:t.content.reason,time:t.content.time,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBlockMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:t.content.chatroomId,operateType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processChrmMemBanMessage=function(t){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:t.content.chatroomId,banType:t.content.operateType,durationTime:t.content.durationTime,operateTime:t.content.operateTime,userIdList:t.content.userList,extra:t.content.extra||null}}),!0},t.prototype._processReadReceiptMessage=function(t){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.content.lastMessageSendTime)},t.prototype._processReadReceiptRequestMessage=function(t){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.content.messageUId,t.senderUserId)},t.prototype._processReadReceiptResponseMessage=function(t){var e,n=null===(e=t.content)||void 0===e?void 0:e.receiptMessageDic,i=this._engine.getCurrentUserId();n&&Array.isArray(n[i])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.senderUserId,n[i])},t.prototype._messageReceiver=function(t,e,n){var i,r,o,s,a=this;if(!(null===(r=(i=this._compatibleMessageProccessor)[t.messageType])||void 0===r?void 0:r.call(i,t))&&!this._pluginContextQueue.some((function(e){if(!e.onmessage)return!1;try{return e.onmessage(Xa(t))}catch(t){return a.logger.error(pt.A_MSG_LISTENER_E,null==t?void 0:t.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Xa(t),e,n),!this._messageProccessor[t.messageType])return t;this._messageProccessor[t.messageType](t)}},t.prototype._batchMessageReceiver=function(t,e,n){var i=this,r=[];t.forEach((function(t){var o=i._messageReceiver(t,e,n);o&&r.push(o)})),r.length&&this._watcher.batchMessage&&(this.logger.debug(pt.L_BATCH_MESSAGE_O,r.map((function(t){return t.messageUId})).join(",")),this._watcher.batchMessage(r))},t.prototype._chatroomInfoListener=function(t){var e,n;null===(n=(e=this._watcher).chatroomState)||void 0===n||n.call(e,t)},t.prototype._conversationInfoListener=function(t){var e,n;null===(n=(e=this._watcher).conversationState)||void 0===n||n.call(e,t)},t.prototype._expansionInfoListener=function(t){var e,n;null===(n=(e=this._watcher).expansion)||void 0===n||n.call(e,t)},t.prototype._tagListener=function(){var t,e;null===(e=(t=this._watcher).tag)||void 0===e||e.call(t)},t.prototype._conversationTagListener=function(){var t,e;null===(e=(t=this._watcher).conversationTagChanged)||void 0===e||e.call(t)},t.prototype._typingStatusListener=function(t){var e,n;null===(n=(e=this._watcher).typingState)||void 0===n||n.call(e,t)},t.prototype._pullFinishedListener=function(){var t,e;null===(e=(t=this._watcher).pullFinished)||void 0===e||e.call(t)},t.prototype._MessageBlockedListener=function(t){var e,n;null===(n=(e=this._watcher).messageBlocked)||void 0===n||n.call(e,t)},t.prototype._messageDeliveredListerer=function(t){var e,n;null===(n=(e=this._watcher).messageDelivered)||void 0===n||n.call(e,t)},t.prototype._groupMessageDeliveredStatusListerer=function(t){var e,n;null===(n=(e=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(e,t)},t.prototype._callInfoListener=function(t){var e=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(t)}catch(t){e.logger.warn(pt.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype._ultraGroupEnableListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupEnable)||void 0===n||n.call(e,t)},t.prototype._operateStatusListener=function(t){var e,n;null===(n=(e=this._watcher).operateStatus)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageExpansionUpdatedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageModifiedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(e,t)},t.prototype._ultraGroupMessageRecalledListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelChangeTypeListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelUserKickedListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(e,t)},t.prototype._ultraGroupChannelDeleteListener=function(t){var e,n;null===(n=(e=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(e,t)},t.prototype._userGroupStatusListener=function(t){var e,n;null===(n=(e=this._watcher).userGroupStatus)||void 0===n||n.call(e,t)},t.prototype._rtcDataChange=function(t,e){this._pluginContextQueue.forEach((function(n){var i;null===(i=n.onrtcdatachange)||void 0===i||i.call(n,t,e)}))},t.prototype._naviDataChange=function(t){this._pluginContextQueue.forEach((function(e){var n;null===(n=e.onnavidatachange)||void 0===n||n.call(e,t)}))},t.prototype.assignWatcher=function(t){var e=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];e._watcher[n]=ue(i)||ae(i)?i:void 0}}))},t.prototype._resetWatcher=function(){var t=this;Object.keys(this._watcher).forEach((function(e){t._watcher[e]=void 0}))},t.prototype._addTypingInfo=function(t){var e=t.senderUserId,n=t.conversationType,i=t.targetId,r=t.content,o=t.channelId,s=r.typingContentType,a=o||"",u="".concat(n,"#").concat(i,"#").concat(a);this._typingInfo[u]||(this._typingInfo[u]=[]);var c=this._typingInfo[u].findIndex((function(t){return t.userId===e}));c>=0&&this._typingInfo[u][c].messageType===s?this._typingInfo[u][c].timestamp=Date.now():(c>=0&&this._typingInfo[u].splice(c,1),this._typingInfo[u].push({userId:e,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(u)||this._typingChangedList.push(u),this._startCheckTypingInfo())},t.prototype._startCheckTypingInfo=function(){var t=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var e in t._typingInfo){var n=t._typingInfo[e].length;t._typingInfo[e]=t._typingInfo[e].filter((function(e){return Date.now()-e.timestamp<t._typingExpireTime})),t._typingInfo[e].length===n||t._typingChangedList.includes(e)||t._typingChangedList.push(e),0===t._typingInfo[e].length&&delete t._typingInfo[e]}t._notifyTypingChanged()}),500))},t.prototype._notifyTypingChanged=function(){var t=this;if(this._typingChangedList.length>0){var e=this._typingChangedList.map((function(e){return{conversationType:Number(e.split("#")[0]),targetId:e.split("#")[1],channelId:e.split("#")[2],list:t._typingInfo[e]||[]}}));this._typingStatusListener(e),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},t.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},t.prototype.getServerTime=function(){return this._engine.getServerTime()},t.prototype.getDeviceId=function(){return this._engine.getDeviceId()},t.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},t.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),t.prototype.refetchNaviInfo=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.refetchNaviInfo()]}))}))},t.prototype.connect=function(t,e,n){var i,r;return c(this,void 0,void 0,(function(){var o,s,a,u,c,h;return l(this,(function(l){switch(l.label){case 0:return this._token=t,[4,this._runtime.getNetworkType()];case 1:return o=l.sent(),this._engine.setNetwork({status:!0,type:o},!0),s=!!this._pluginInstanseMap.RCCallPlus,[4,this._engine.connect(t,e,s,n)];case 2:return a=l.sent(),u=a.code,c=a.data,u!==Z.SUCCESS?[2,{code:u}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=Ce.getInfo(),null===(r=(i=this._engine).reportSDKInfo)||void 0===r||r.call(i,h)),[2,{code:u,userId:c}])}}))}))},t.prototype.disconnect=function(t){return c(this,void 0,void 0,(function(){var e=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(t)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondisconnect)try{t.ondisconnect()}catch(t){e.logger.error(pt.L_CALLBACK_E,null==t?void 0:t.stack)}})),[2,Promise.resolve()]}}))}))},t.prototype.reconnect=function(t){return this.connect(this.token,!!t,this.logger.createTraceId())},t.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},t.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},t.prototype.registerMessageType=function(t,e,n,i,r){void 0===i&&(i=[]),void 0===r&&(r=!1),ie(i)&&i.length>0&&(this._registerMessageSearchPropsMapping[t]=i),this._engine.registerMessageType(t,e,n,i,r)},t.prototype.registerRTCSignalingListener=function(t){this._engine.registerRTCSignalingListener(t)},t.prototype.checkSearchPropsMsg=function(t,e){var n=this._registerMessageSearchPropsMapping[t],i={};return n&&ae(e)&&Object.keys(e).forEach((function(t){if(n.includes(t)){var r=e[t];ne(r)&&(r>-Math.pow(2,64)&&r<Math.pow(2,64)&&Number.isInteger(r)||(i[t]=r))}})),Object.keys(i).length>0?{msg:JSON.stringify(i),code:Z.SEARCH_PROPS_LIMIT_ERROR}:{code:Z.SUCCESS}},t.prototype.sendMessage=function(t,e,n,i,r){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==Z.SUCCESS)return Promise.resolve({code:s,msg:a});if(t===$.SYSTEM&&n.messageType!==it.SYNC_READ_STATUS)return Promise.resolve({code:Z.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(t!==$.ULTRA_GROUP){var u=this.getNaviInfoFromCache();if(1===((null==u?void 0:u.grpRRVer)||0)&&n.messageType===it.READ_RECEIPT_RESPONSE)return Promise.resolve({code:Z.READ_RECEIPT_ERROR})}var c=n.canIncludeExpansion,l=void 0!==c&&c,h=n.expansion;if(l){var d=Te(h),g=d.isIllgalEx,p=d.isExKeyOrValLengthExceedLimit;if(d.isExceedLimit||p)return Promise.resolve({code:Z.EXPANSION_LIMIT_EXCEET});if(g)return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}var f,T,v=JSON.stringify(n.content);return f=v,void 0===T&&(T="utf-8"),("utf-16"===T?_(f):E(f))>N?Promise.resolve({code:Z.RC_MSG_CONTENT_EXCEED_LIMIT}):t===$.ULTRA_GROUP?this._engine.sendUltraMessage(e,n,i,r):this._engine.sendMessage(t,e,n,i,r)},t.prototype.sendExpansionMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return e=t.channelId,n=t.conversationType,i=t.targetId,r=t.messageUId,o=t.keys,s=t.expansion,a=t.removeAll,t.canIncludeExpansion?(u=Te(s),c=u.isIllgalEx,h=u.isExKeyOrValLengthExceedLimit,u.isExceedLimit||h?[2,Promise.resolve({code:Z.EXPANSION_LIMIT_EXCEET})]:c?[2,Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:r},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,i,{content:d,messageType:it.EXPANSION_NOTIFY,channelId:e})])):[2,{code:Z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},t.prototype.sendReadReceiptMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Z.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(t,e,n)]}))}))},t.prototype.getMessageReader=function(t,e,n){return c(this,void 0,void 0,(function(){var i;return l(this,(function(r){return i=this.getNaviInfoFromCache(),0===((null==i?void 0:i.grpRRVer)||0)?[2,{code:Z.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(t,e,n)]}))}))},t.prototype._destroy=function(){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(e){switch(e.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return e.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondestroy)try{e.ondestroy()}catch(e){t.logger.error(pt.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},t.prototype.getHistoryMessage=function(t,e,n,i,r,o,s,a){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),void 0===s&&(s=""),t===$.ULTRA_GROUP){var u={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,u,a)}return this._engine.getHistoryMessage(t,e,n,i,r,o,s||"",a)},t.prototype.getMessages=function(t,e,n,i,r,o,s){if(void 0===n&&(n=0),void 0===i&&(i=20),void 0===r&&(r=0),void 0===o&&(o=""),t===$.ULTRA_GROUP){var a={timestamp:n,count:i,order:r,channelId:o};return this._engine.getUltraHistoryMsg(e,a,s)}return this._engine.getMessages(t,e,n,i,r,o,s)},t.prototype.getHistoryMessagesByObjectNames=function(t,e,n,i,r,o,s){return this._engine.getHistoryMessagesByObjectNames(t,e,n,i,r,o,s)},t.prototype.getConversationList=function(t,e,n,i,r){if(void 0===t&&(t=300),void 0===r&&(r=""),e===$.ULTRA_GROUP){var o=Z.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:Z[o]})}return this._engine.getConversationList(t,e,n,i,r)},t.prototype.getConversationsByPage=function(t,e,n,i){return this._engine.getConversationsByPage(t,e,n,i)},t.prototype.getConversation=function(t,e,n){return this._engine.getConversation(t,e,n)},t.prototype.removeConversation=function(t,e,n){return void 0===n&&(n=""),t===$.ULTRA_GROUP?Promise.resolve(Z.METHOD_NOT_SUPPORT):this._engine.removeConversation(t,e,n)},t.prototype.getUltraGroupList=function(t){return this._engine.getUltraGroupList(t)},t.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},t.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},t.prototype.clearUnreadCount=function(t,e,n){return void 0===n&&(n=""),t===$.ULTRA_GROUP?this._engine.clearUltraUnreadcount(e,n):this._engine.clearConversationUnreadCount(t,e,n)},t.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},t.prototype.getUnreadCount=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(t,e,n)},t.prototype.getTotalUnreadCount=function(t,e,n){if(e&&e.includes($.ULTRA_GROUP)){var i=Z.METHOD_NOT_SUPPORT;return Promise.resolve({code:i,msg:Z[i]})}return this._engine.getAllConversationUnreadCount(t,e&&e.length>0?e:[$.PRIVATE,$.GROUP,$.SYSTEM,$.PUBLIC_SERVICE],!!n)},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){return this._engine.getTotalUnreadCountByLevels(t,e,n)},t.prototype.getFirstUnreadMessage=function(t,e,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(t,e,n)},t.prototype.setConversationNotificationLevel=function(t,e,n,i){return void 0===i&&(i=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setConversationNotificationLevel(t,e,n,i)]}))}))},t.prototype.setConversationStatus=function(t,e,n,i,r){if(void 0===r&&(r=""),t===$.ULTRA_GROUP&&void 0!==n)return Promise.resolve(Z.METHOD_NOT_SUPPORT);var o=[{conversationType:t,targetId:e,isTop:n,notificationStatus:i,channelId:r}];return this._engine.batchSetConversationStatus(o)},t.prototype.saveConversationMessageDraft=function(t,e,n,i){return void 0===i&&(i=""),this._engine.saveConversationMessageDraft(t,e,n,i)},t.prototype.getConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(t,e,n)},t.prototype.clearConversationMessageDraft=function(t,e,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(t,e,n)},t.prototype.recallMessage=function(t,e,n,i,r){return this._engine.recallMsg(t,e,n,i,r)},t.prototype.deleteRemoteMessage=function(t,e,n,i){return void 0===i&&(i=""),t===$.ULTRA_GROUP?Promise.resolve(Z.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(t,e,n,i)},t.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.deleteRemoteMessageByTimestamp(t,e,n,i)},t.prototype.joinChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinChatroom(t,e,n)},t.prototype.joinExistChatroom=function(t,e,n){return void 0===e&&(e=10),this._engine.joinExistChatroom(t,e,n)},t.prototype.quitChatroom=function(t){return this._engine.quitChatroom(t)},t.prototype.getChatroomInfo=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this._engine.getChatroomInfo(t,e,n)},t.prototype.setChatroomEntry=function(t,e){var n=e.key,i=e.value;return Ze(n)&&ze(i)?this._engine.setChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.setChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n],r=i.key,o=i.value;if(!Ze(r)||!ze(o))return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}var s=u(u({},e),{isOverwrite:e.isForce});return this._engine.setChatroomEntries(t,s)},t.prototype.forceSetChatroomEntry=function(t,e){var n=e.key,i=e.value;return Ze(n)&&ze(i)?this._engine.forceSetChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntry=function(t,e){var n=e.key;return Ze(n)?this._engine.removeChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var i=e.entries[n].key;if(!Ze(i))return Promise.resolve({code:Z.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(t,e)},t.prototype.forceRemoveChatroomEntry=function(t,e){var n=e.key;return Ze(n)?this._engine.forceRemoveChatroomEntry(t,e):Promise.resolve(Z.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.getChatroomEntry=function(t,e){return this._engine.getChatroomEntry(t,e)},t.prototype.getAllChatroomEntries=function(t){return this._engine.getAllChatroomEntry(t)},t.prototype.getChatroomHistoryMessages=function(t,e,n,i){return void 0===e&&(e=20),void 0===n&&(n=0),void 0===i&&(i=0),this._engine.getChatroomHistoryMessages(t,i,e,n)},t.prototype.getFileToken=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){var o,s,a,u,c,h,d;return l(this,(function(l){switch(l.label){case 0:return o=this.getNaviInfoFromCache(),s=(null==o?void 0:o.bosAddr)||"",a=(null==o?void 0:o.uploadServer)||"",u=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(t,e,n,i,r)];case 1:return c=l.sent(),h=c.code,d=c.data,h===Z.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:u}))]:[2,Promise.reject(h)]}}))}))},t.prototype.getFileUrl=function(t,e,n,i,r){return void 0===r&&(r=ht.QINIU),c(this,void 0,void 0,(function(){var o,s,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(t,r,e,n)];case 1:return o=u.sent(),s=o.code,a=o.data,s===Z.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},t.prototype.createTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.createTag(t)]}))}))},t.prototype.removeTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeTag(t)]}))}))},t.prototype.updateTag=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.updateTag(t)]}))}))},t.prototype.getTagList=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getTagList()]}))}))},t.prototype.addTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return e.length>1e3?[2,Promise.reject(Z.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(t,e)]}))}))},t.prototype.removeTagForConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagForConversations(t,e)]}))}))},t.prototype.removeTagsForConversation=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagsForConversation(t,e)]}))}))},t.prototype.getConversationListByTag=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getConversationListByTag(t,e,n,i)]}))}))},t.prototype.getUnreadCountByTag=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(t,e)]}))}))},t.prototype.setConversationStatusInTag=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationStatusInTag(t,e,n)]}))}))},t.prototype.getTagsForConversation=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagsForConversation(t)]}))}))},t.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},t.prototype.getTopConversationList=function(t,e){return t&&0!==t.length||(t=[$.PRIVATE,$.CHATROOM,$.GROUP,$.SYSTEM,$.APP_PUBLIC_SERVICE,$.PUBLIC_SERVICE]),this._engine.getTopConversationList(t,e)},t.prototype.getUnreadConversationList=function(t){return t&&0!==t.length||(t=[$.PRIVATE,$.CHATROOM,$.GROUP,$.SYSTEM,$.APP_PUBLIC_SERVICE,$.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(t)},t.prototype.getUnreadMentionedCount=function(t){return this._engine.getUnreadMentionedCount(t)},t.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},t.prototype.sendUltraGroupTypingStatus=function(t){if(t.conversationType!==$.ULTRA_GROUP){var e=Z.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:Z[e]})}return this._engine.sendUltraGroupTypingStatus(t)},t.prototype.getUltraGroupMessageListByMessageUId=function(t){return this._engine.getUltraGroupMessageListByMessageUId(t)},t.prototype.expandUltraMessage=function(t){return c(this,void 0,void 0,(function(){var e,n,i,r,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=t.conversationType,n=t.expansion,i=t.canIncludeExpansion,e!==$.ULTRA_GROUP?[2,{code:r=Z.CONVERSATION_TYPE_NOT_SUPPORT,msg:Z[r]}]:i?(o=Te(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:Z.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:Z.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(t)]):[2,{code:Z.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:u.sent().code}]}}))}))},t.prototype.modifyMessage=function(t){return c(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return t.conversationType!==$.ULTRA_GROUP?[2,{code:e=Z.CONVERSATION_TYPE_NOT_SUPPORT,msg:Z[e]}]:[4,this._engine.modifyMessage(t)];case 1:return[2,{code:n.sent().code}]}}))}))},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(t,e)},t.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){return this._engine.getUltraGroupUnreadCountByTargetId(t,e)},t.prototype.getAllUltraGroupUnreadCount=function(t){return void 0===t&&(t=!1),this._engine.getAllUltraGroupUnreadCount(t)},t.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},t.prototype.getUltraGroupUnreadMentionedMessages=function(t){return this._engine.getUltraGroupUnreadMentionedMessages(t)},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return this._engine.getUltraGroupFirstUnreadMessageTimestamp(t)},t.prototype.getUltraGroupUnreadInfoList=function(t){return this._engine.getUltraGroupUnreadInfoList(t)},t.prototype.callExtra=function(t){for(var e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return(e=this._engine).callExtra.apply(e,h([t],n,!1))},t.prototype.getOSInfo=function(){return this._engine.getOSInfo()},t.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},t.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},t.prototype.setCallInfo=function(t,e,n){return this._engine.setCallInfo(t,e,n)},t.prototype.getGroupMessageDeliverList=function(t,e,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(t,e,n)},t.prototype.getPrivateMessageDeliverTime=function(t,e){return void 0===e&&(e=""),this._engine.getPrivateMessageDeliverTime(t,e)},t.prototype.clearConversations=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(t,e)]}))}))},t.prototype.setUserStatusListener=function(t,e){var n=this;return this._engine.setUserStatusListener(t,(function(t){try{e(t)}catch(t){n.logger.error(pt.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype.addToBlacklist=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.addToBlacklist(t)]}))}))},t.prototype.removeFromBlacklist=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeFromBlacklist(t)]}))}))},t.prototype.getBlacklist=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklist()]}))}))},t.prototype.getBlacklistStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklistStatus(t)]}))}))},t.prototype.insertMessage=function(t,e,n){return c(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=this.checkSearchPropsMsg(n.messageType,n.content),r=i.code,o=i.msg,r!==Z.SUCCESS?[2,Promise.resolve({code:r,msg:o})]:[2,this._engine.insertMessage(t,e,n)]}))}))},t.prototype.batchInsertMessage=function(t,e){return this._engine.batchInsertMessage(t,e)},t.prototype.getMessageCount=function(t,e,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getMessageCount(t,e,n)]}))}))},t.prototype.deleteMessages=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.deleteMessages(t)]}))}))},t.prototype.deleteMessagesByTimestamp=function(t,e,n,i,r){return void 0===r&&(r=""),c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(t,e,n,i,r)]}))}))},t.prototype.clearMessages=function(t,e,n){return void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.clearMessages(t,e,n)]}))}))},t.prototype.getMessage=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getMessage(t)]}))}))},t.prototype.setMessageContent=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageContent(t,e,n)]}))}))},t.prototype.setMessageSearchField=function(t,e,n){return c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setMessageSearchField(t,e,n)]}))}))},t.prototype.setMessageSentStatus=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(t,e)]}))}))},t.prototype.setMessageReceivedStatus=function(t,e){return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(t,e)]}))}))},t.prototype.setMessageStatusToRead=function(t,e,n,i){return c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.updateMessageReceiptStatus(t,e,n,i)]}))}))},t.prototype.setUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.setUserStatus(t)]}))}))},t.prototype.subscribeUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.subscribeUserStatus(t)]}))}))},t.prototype.getUserStatus=function(t){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getUserStatus(t)]}))}))},t.prototype.searchConversationByContent=function(t,e,n,i){return void 0===e&&(e=[]),void 0===n&&(n=""),c(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContent(t,e,n,i)]}))}))},t.prototype.searchConversationByContentWithAllChannel=function(t,e,n){return void 0===e&&(e=[]),c(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContentWithAllChannel(t,e,n)]}))}))},t.prototype.searchMessageByContent=function(t,e,n,i,r,o,s){return void 0===s&&(s=""),c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(t,e,n,i,r,o,s)]}))}))},t.prototype.searchMessagesByUser=function(t,e,n,i,r,o){return void 0===r&&(r=5),void 0===o&&(o=""),c(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(t,e,n,i,r,o)]}))}))},t.prototype.searchMessageByContentWithAllChannel=function(t,e,n,i,r){return c(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(t,e,n,i,r)]}))}))},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,i,r,o,s){return c(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(t,e,n,i,r,o,s)]}))}))},t.prototype.getUnreadMentionedMessages=function(t,e,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(t,e,n)},t.prototype.clearUnreadCountByTimestamp=function(t,e,n,i){return void 0===i&&(i=""),this._engine.clearUnreadCountByTimestamp(t,e,n,i)},t.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return void 0===e&&(e=""),this._engine.getUltraGroupDefaultNotificationLevel(t,e)},t.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(t,e,n)},t.prototype.getConversationNotificationLevel=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(t,e,n)},t.prototype.getConversationNotificationStatus=function(t,e,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(t,e,n)},t.prototype.getRemoteHistoryMessages=function(t,e,n,i,r,o){return this._engine.getRemoteHistoryMessages(t,e,n,i,r,o)},t.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},t.prototype.getConversationListWithAllChannelByPage=function(t,e){return this._engine.getConversationListWithAllChannelByPage(t,e)},t.prototype.clearData=function(){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.clearData()]}))}))},t.prototype.createLogger=function(t,e){return this._engine.createLogger(t,e)},t.prototype.setCheckDuplicateMessage=function(t){return this._engine.setCheckDuplicateMessage(t)},t.prototype.rtcSignaling=function(t,e,n,i){return this._engine.rtcSignaling(t,e,n,i)},t.prototype.rtcPing=function(t,e,n){return this._engine.rtcPing(t,e,n)},t.prototype.bindRTCRoomForChatroom=function(t){return this._engine.bindRTCRoomForChatroom(t)},t.prototype.setProxy=function(t){return this._engine.setProxy(t)},t.prototype.getProxy=function(){return this._engine.getProxy()},t.prototype.testProxy=function(t,e){return this._engine.testProxy(t,e)},t}(),za=x;export{_a as AConnectionMgr,Yn as AEngine,Za as APIContext,o as AppStorage,Wn as AreaCode,Se as AssertRules,Ci as BasicLogger,go as BasicNavi,Ii as BasicReporter,ti as BasicStaticConfigManager,Pa as BasicStatistic,Da as BasicStatisticReporter,P as CPP_PROTOCAL_MSGTYPE_OPTION,$t as CallLibMsgType,Et as ChatroomEntryType,Jt as ChatroomSyncStatusReason,yt as ChatroomUserChangeType,At as ChrmMemBanType,Ut as ChrmMemOperateType,Nt as ChrmSyncStatus,Jn as Codec,Yt as ConnectReason,qt as ConnectType,et as ConnectionStatus,$ as ConversationType,B as DB_LOG_FLUSH_FREQUENCY,G as DB_LOG_MAX_SIZE,Tn as DelayTimer,wt as EConnectProtocol,xt as EnterpriseType,Z as ErrorCode,ve as EventEmitter,F as FORMATED_VERSION,Q as FileType,y as HTTP_TIMEOUT,He as HttpMethod,M as IM_CHATROOM_PULL_INTERVAL_TIME,R as IM_PING_INTERVAL_TIME,O as IM_PING_MIN_TIMEOUT,S as IM_PING_TIMEOUT,I as IM_SIGNAL_TIMEOUT,mi as IndexDBLogger,Vi as IndexDBReporter,Ga as IndexDBStatistic,qa as IndexDBStatisticReporter,Y as LOCAL_STORAGE_KEYS,Wt as LiveRole,Qt as LiveType,pi as LogL,dt as LogLevel,gt as LogSource,pt as LogTagId,N as MAX_MESSAGE_CONTENT_BYTES,U as MAX_MESSAGE_EXPANSION_KEY_LENGTH,L as MAX_MESSAGE_EXPANSION_VAL_LENGTH,K as MAX_UPLOAD_FILE_SIZE,ct as MentionedType,vt as MessageBlockSourceType,mt as MessageBlockType,J as MessageDirection,it as MessageType,v as NAVI_CACHE_DURATION,C as NAVI_REQ_TIMEOUT,Kt as NaviCacheType,qe as NetworkType,at as NotificationLevel,ot as NotificationStatus,k as ONE_LOG_SIZE_MAX,St as OperateStatus,Yi as PluginContext,Ft as ProtocalType,Ve as RCAssertError,ca as RCConnectionStatus,V as REAT_TIME_LOG_SIZE,Xt as RTCApiType,Zt as RTCIdentityChangeType,zt as RTCJoinType,jt as RTCMode,Ja as RTCPluginContext,n as ReceivedStatus,b as SEND_MESSAGE_TYPE_OPTION,q as STATIC_CONFIG_CACHE_TIME,w as STATIC_CONFIG_IV,A as STATIC_CONFIG_KEY,D as STATUS_MESSAGE,It as SentStatus,fa as StatisticL,ft as StatisticsTag,Ht as StatisticsVersion,bt as StoreKeys,Pe as SuspendablePromise,Ye as TagChangeType,H as UPLOAD_FILE_CHUNK_SIZE,Dt as UltraGroupChannelChangeType,Pt as UltraGroupChannelType,kt as UltraMentionedType,Vt as UltraMsgChangeType,Gt as UltraMsgSubChangeType,ht as UploadMethod,Bt as UserGroupChangeType,x as VERSION,Ce as VersionManage,m as WEB_SOCKET_TIMEOUT,fo as WebSocketNavi,T as appendUrl,Ge as assert,En as clone,gn as cloneByJSON,ci as deInitLogDB,en as decryptCBC,nn as fixUrlProtocol,un as forEach,fn as getBrowser,$e as getClientMessageId,We as getMimeKey,we as getUUID,be as getUUID22,Qe as getUploadFileName,tn as getbundleId,on as httpRequest,ln as indexOf,ui as initLogDB,Ra as initStatisticDB,ie as isArray,re as isArrayBuffer,ee as isBoolean,pa as isConnnectAck,ga as isDisconnectedByServer,ue as isFunction,he as isHttpUrl,dn as isInObject,hn as isInclude,le as isNull,ne as isNumber,ae as isObject,te as isString,_e as isTypeInConversationList,ce as isUndefined,fe as isValidChannelId,Ze as isValidChrmEntryKey,ze as isValidChrmEntryValue,ge as isValidConversationType,Te as isValidExpansion,Ee as isValidFileType,pe as isValidNotificationLevel,Ae as logger,cn as map,se as notEmptyArray,de as notEmptyObject,oe as notEmptyString,Je as pushConfigsToJSON,Xe as pushJSONToConfigs,La as statisticTranscsv,f as todo,Di as transcsv,Sa as unInitStatisticDB,$n as urlCenter,pn as usingCppEngine,Be as validate,za as version};