@rongcloud/engine 5.8.4 → 5.8.5

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.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(e||(e={}));var t,n=e,r=function(e){return t||(t={set:function(t,n){e.localStorage.setItem(t,JSON.stringify(n))},get:function(t){var n;try{n=JSON.parse(e.localStorage.getItem(t))}catch(e){n=null}return n},remove:function(t){return e.localStorage.removeItem(t)},getKeys:function(){var t=[];for(var n in e.localStorage)t.push(n);return t}}),t},i=function(){function e(e){this._caches={},e&&(this._caches=e)}return e.prototype.set=function(e,t){this._caches[e]=t},e.prototype.remove=function(e){var t=this.get(e);return delete this._caches[e],t},e.prototype.get=function(e){return this._caches[e]},e.prototype.getKeys=function(){var e=[];for(var t in this._caches)e.push(t);return e},e}(),o=function(){function e(e,t){var n;this._rootStorage=r(e);var o=this._rootStorage.get(t)||{};this._cache=new i(((n={})[t]=o,n)),this._storageKey=t}return e.prototype._get=function(){var e=this._storageKey;return this._cache.get(e)||{}},e.prototype._set=function(e){var t=this._storageKey;e=e||{},this._cache.set(t,e),this._rootStorage.set(t,e)},e.prototype.set=function(e,t){var n=this._get();n[e]=t,this._set(n)},e.prototype.remove=function(e){var t=this._get();delete t[e],this._set(t)},e.prototype.clear=function(){var e=this._storageKey;this._rootStorage.remove(e),this._cache.remove(e)},e.prototype.get=function(e){return this._get()[e]},e.prototype.getKeys=function(){var e=this._get(),t=[];for(var n in e)t.push(n);return t},e.prototype.getValues=function(){return this._get()||{}},e}(),s=function(e,t){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},s(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function u(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function l(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[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(c){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,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var d,p=function(e){function t(t){return e.call(this,"TODO => ".concat(t))||this}return a(t,e),t}(Error),f=function(e){for(var t=0,n=0,r=e.length;n<r;n++)t+=e.charCodeAt(n)<=65535?2:4;return t},_=function(e){for(var t,n=0,r=0,i=e.length;r<i;r++)n+=(t=e.charCodeAt(r))<127?1:t<=2047?2:t<=65535?3:4;return n},E=function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e},T=72e5,C=6e4,v=1e4,I=131072,y=18e4,m="cd4936151214ce45dc1d12673a59d94c",R="51ad078e5eb17a91",S={"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: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}},O=["RC:TypSts","RC:InterceptMsg","RC:RL"],N="5.8.4",M=N.replace(/-.+$/,""),L=18e5,U={NAVI_KEY:function(e){return"navi_".concat(e)},CONVER_STATE_PULL_TIME_KEY:function(e,t){return"RCV4-con-s-".concat(e,"-").concat(t)},OLD_CONVER_STATE_KEY:function(e,t){return"RCV4-con-".concat(e,"-").concat(t)},CONVER_STATE_KEY:function(e,t){return"RCV4-CONVER-".concat(e,"-").concat(t)},ULTRA_GROUP_STATE_KEY:function(e,t){return"RCV4-ultragroupconversation-".concat(e,"-").concat(t)},OUTBOX_TIME_KEY:function(e,t){return"outbox_".concat(e,"_").concat(t)},INBOX_TIME_KEY:function(e,t){return"inbox_".concat(e,"_").concat(t)},BROADCASTBOX_TIME_KEY:function(e,t){return"broadcastbox_".concat(e,"_").concat(t)},SEND_MSG_KEY:function(e,t){return"send_msg_".concat(e,"_").concat(t)},USER_SETTING_TIME_KEY:function(e,t){return"us-s-".concat(e,"-").concat(t)},TAG_STATE_KEY:function(e,t){return"tag-".concat(e,"-").concat(t)},STATIC_CONFIG_KEY:function(e){return"rc-static-config-".concat(e)}};!function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(d||(d={}));var A,w=d;!function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(A||(A={}));var P,b=A;!function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.EXTRA_METHOD_UNDEFINED=-4]="EXTRA_METHOD_UNDEFINED",e[e.PARAMETER_CHANGED=-6]="PARAMETER_CHANGED",e[e.CANCEL=1]="CANCEL",e[e.REJECT=2]="REJECT",e[e.HANGUP=3]="HANGUP",e[e.BUSYLINE=4]="BUSYLINE",e[e.NO_RESPONSE=5]="NO_RESPONSE",e[e.ENGINE_UN_SUPPORTED=6]="ENGINE_UN_SUPPORTED",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.REMOTE_CANCEL=11]="REMOTE_CANCEL",e[e.REMOTE_REJECT=12]="REMOTE_REJECT",e[e.REMOTE_HANGUP=13]="REMOTE_HANGUP",e[e.REMOTE_BUSYLINE=14]="REMOTE_BUSYLINE",e[e.REMOTE_NO_RESPONSE=15]="REMOTE_NO_RESPONSE",e[e.REMOTE_ENGINE_UN_SUPPORTED=16]="REMOTE_ENGINE_UN_SUPPORTED",e[e.REMOTE_NETWORK_ERROR=17]="REMOTE_NETWORK_ERROR",e[e.VOIP_NOT_AVALIABLE=18]="VOIP_NOT_AVALIABLE",e[e.JOIN_IN_DISCUSSION=21407]="JOIN_IN_DISCUSSION",e[e.CREATE_DISCUSSION=21408]="CREATE_DISCUSSION",e[e.INVITE_DICUSSION=21409]="INVITE_DICUSSION",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.VOIPISNULL=24013]="VOIPISNULL",e[e.NOENGINETYPE=24010]="NOENGINETYPE",e[e.NULLCHANNELNAME=24011]="NULLCHANNELNAME",e[e.VOIPDYANMICERROR=24012]="VOIPDYANMICERROR",e[e.NOVOIP=24014]="NOVOIP",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.VOIPCLOSE=24016]="VOIPCLOSE",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.SUBSCRIBE_ERROR=39001]="SUBSCRIBE_ERROR",e[e.QNTKN_FILETYPE_ERROR=41001]="QNTKN_FILETYPE_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.COOKIE_ENABLE=51001]="COOKIE_ENABLE"}(P||(P={}));var x,D=P;!function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(x||(x={}));var V,G=x;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DOMAIN_INCORRECT=12]="DOMAIN_INCORRECT",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e[e.REDIRECT=14]="REDIRECT",e[e.USER_LOGOUT=19]="USER_LOGOUT",e[e.APPKEY_IS_FAKE=20]="APPKEY_IS_FAKE",e[e.FORBID_RECONNECT_BY_OTHER_SAME_CLIENT=31023]="FORBID_RECONNECT_BY_OTHER_SAME_CLIENT",e[e.ULTRALIMIT=1101]="ULTRALIMIT",e[e.REQUEST_NAVI=201]="REQUEST_NAVI",e[e.RESPONSE_NAVI=202]="RESPONSE_NAVI",e[e.RESPONSE_NAVI_ERROR=203]="RESPONSE_NAVI_ERROR",e[e.RESPONSE_NAVI_TIMEOUT=204]="RESPONSE_NAVI_TIMEOUT",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR"}(V||(V={}));var B,k=V;!function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_JOIN="RC:ChrmJoinNtf",e.CHATROOM_LEFT="RC:ChrmQuitNtf",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg"}(B||(B={}));var F,H=B;!function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(F||(F={}));var K,q=F;!function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(K||(K={}));var Y,j=K;!function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Y||(Y={}));var Q,W=Y;!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(Q||(Q={}));var J,X=Q;!function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(J||(J={}));var Z,z,$,ee,te,ne=J;exports.LogLevel=void 0,(Z=exports.LogLevel||(exports.LogLevel={}))[Z.LOG=0]="LOG",Z[Z.DEBUG=0]="DEBUG",Z[Z.INFO=1]="INFO",Z[Z.WARN=2]="WARN",Z[Z.ERROR=3]="ERROR",Z[Z.FATAL=4]="FATAL",Z[Z.STATISTICS=6]="STATISTICS",Z[Z.NONE=1e3]="NONE",exports.LogSource=void 0,(z=exports.LogSource||(exports.LogSource={})).IM="IM",z.RTC="RTC",exports.LogTagId=void 0,($=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",$.A_INIT_O="A-init-O",$.A_INIT_REPEAT_O="A_INIT_REPEAT_O",$.L_INIT_O="L-init-O",$.A_DESTROY_O="A_DESTROY_O",$.L_DESTROY_O="L_DESTROY_O",$.A_CONNECT_T="A-connect-T",$.A_CONNECT_R="A-connect-R",$.A_CONNECT_S="A-connect-S",$.A_DISCONNECT_O="A-disconnect-O",$.A_RECONNECT_T="A-reconnect-T",$.A_RECONNECT_R="A_RECONNECT_R",$.L_CONNECT_T="L-connect-T",$.L_CONNECT_R="L-connect-R",$.L_CONNECT_S="L-connect-S",$.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",$.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",$.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",$.A_MSG_LISTENER_E="A-MSG_LISTENER-E",$.O="L-original-O",$.T="L-TEST-O",$.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",$.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",$.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",$.A_SEND_MSG_T="A-send_msg-T",$.A_SEND_MSG_R="A-send_msg-R",$.L_SEND_MSG_T="L-send_msg-T",$.L_SEND_MSG_R="L-send_msg-R",$.L_PULL_MSG_T="L-pull_msg-T",$.L_PULL_MSG_R="L-pull_msg-R",$.L_PULL_MSG_O="L-pull_msg-O",$.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",$.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",$.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",$.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",$.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",$.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",$.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",$.L_RECV_S_MSG_O="L-recv_s_msg-O",$.A_DELETE_MESSAGES_S="A-delete_messages-S",$.P_DELETE_MSG_S="P-delete_msg-S",$.L_PULL_CONVERSATION_S="L-pull_conversation-S",$.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",$.A_REGTYP_O="A-regtyp-O",$.P_REGTYP_E="P-regtype-E",$.L_GET_NAVI_T="L-get_navi-T",$.L_GET_NAVI_R="L-get_navi-R",$.L_REQUEST_T="L-request-T",$.L_REQUEST_R="L-request-R",$.L_PARSE_NAVI_E="L-parse_navi-E",$.L_ENV_S="L-Env-S",$.L_GET_INDEX_NAVI_S="L-get_index_navi-S",$.A_JOIN_CHATROOM_T="A-join_chatroom-T",$.A_JOIN_CHATROOM_R="A-join_chatroom-R",$.L_JOIN_CHATROOM_T="L-join_chatroom-T",$.L_JOIN_CHATROOM_R="L-join_chatroom-R",$.A_QUIT_CHATROOM_T="A-quit_chatroom-T",$.A_QUIT_CHATROOM_R="A-quit_chatroom-R",$.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",$.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",$.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",$.L_MEDIA_S="L-media-S",$.L_MEDIA_UPLOAD_T="L-media_upload-T",$.L_MEDIA_UPLOAD_R="L-media_upload-R",$.G_UPLOAD_LOG_S="G-upload_log-S",$.G_REPORT_LOG_S="G-report_log-S",$.G_UPLOAD_LOG_E="G-upload_log-E",$.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",$.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",$.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",$.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",$.A_GET_HISTORY_MSG_T="A-get_history_msg-T",$.A_GET_HISTORY_MSG_R="A-get_history_msg-R",$.L_GET_HISTORY_MSG_T="L-get_history_msg-T",$.L_GET_HISTORY_MSG_R="L-get_history_msg-R",$.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",$.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",$.A_CALLBACK_O="A-callback-O",$.A_CALLBACK_E="A-callback-E",$.L_CALLBACK_E="L-callback-E",$.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",$.L_PB_ENCODE_E="L-pb-encode-E",$.L_PB_DECODE_E="L-pb-decode-E",$.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",$.L_REPORT_FULL_LOG_O="L-report_full_log-O",$.L_REPORT_FULL_LOG_T="L-report_full_log-T",$.L_REPORT_FULL_LOG_R="L-report_full_log-R",$.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",$.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",$.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",$.L_LOGDB_CLOSED_S="L-logDB_closed-S",$.L_LOGDB_ERROR_E="L-logDB_error-S",$.L_LOGDB_ABORT_S="L-logDB_abort-S",$.L_REALTIME_LOG_R="L_REALTIME_LOG_R",$.L_REALTIME_LOG_O="L_REALTIME_LOG_O",$.L_REALTIME_LOG_T="L_REALTIME_LOG_T",$.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",$.L_RECV_RMTP_O="L_RECV_RMTP_O",$.L_RECV_RMTP_E="L_RECV_RMTP_E",$.L_RECV_S_NTF_O="L-recv_s_ntf_O",$.L_VER_REPORT_T="L-VER_REPORT-T",$.L_VER_REPORT_R="L-VER_REPORT-R",$.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",$.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",$.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",$.A_REMOVE_PROXY_O="A-remove_proxy-O",$.A_SET_PROXY_O="A-set_proxy-O",$.A_TEST_PROXY_O="A-test_proxy-O",$.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",$.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",$.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",$.L_GET_STATIC_CONF_T="L-get_static_conf-T",$.L_GET_STATIC_CONF_R="L-get_static_conf-R",$.L_GET_STATIC_CONF_E="L-get_static_conf-E",exports.StatisticsTag=void 0,(ee=exports.StatisticsTag||(exports.StatisticsTag={})).IM_NAVI="IM-stats_navi-S",ee.IM_WEBSOCKET="IM-stats_websocket-S",ee.IM_CONNECTION_DURATION="IM-stats_con_dur-S",ee.IM_CMP="IM-stats_cmp-S",ee.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",ee.IM_STATS_CS="IM-stats_cs-S",ee.IM_NETWORK_CHANGE="IM-stats_network_change-S",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(te||(te={}));var re,ie,oe=te;!function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(re||(re={})),exports.MessageBlockSourceType=void 0,(ie=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[ie.MSG_ORIGINAL=0]="MSG_ORIGINAL",ie[ie.MSG_EXPANSION=1]="MSG_EXPANSION",ie[ie.MSG_MODIFY=2]="MSG_MODIFY";var se,ae=re;!function(e){e[e.typing=0]="typing"}(se||(se={}));var ce,ue,le=se;exports.SentStatus=void 0,(ce=exports.SentStatus||(exports.SentStatus={}))[ce.SENDING=10]="SENDING",ce[ce.FAILED=20]="FAILED",ce[ce.SENT=30]="SENT",ce[ce.RECEIVED=40]="RECEIVED",ce[ce.READ=50]="READ",ce[ce.DESTROYED=60]="DESTROYED",function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(ue||(ue={}));var he,de=ue;!function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(he||(he={}));var pe,ge=he;!function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(pe||(pe={}));var fe,_e=pe;!function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(fe||(fe={}));var Ee,Te,Ce,ve,Ie,ye,me,Re,Se,Oe,Ne,Me,Le,Ue,Ae,we,Pe,be=fe;exports.EConnectProtocol=void 0,(Ee=exports.EConnectProtocol||(exports.EConnectProtocol={}))[Ee.RMTP=1]="RMTP",Ee[Ee.TLS=2]="TLS",Ee[Ee.RPP=3]="RPP",Ee[Ee.QUIC=4]="QUIC",Ee[Ee.WS=5]="WS",Ee[Ee.WSS=6]="WSS",Ee[Ee.HTTP=11]="HTTP",Ee[Ee.HTTPS=12]="HTTPS",exports.StoreKeys=void 0,(Te=exports.StoreKeys||(exports.StoreKeys={})).NAVI="rc-navi",Te.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp",exports.UltraGroupChannelType=void 0,(Ce=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[Ce.PUBLIC=0]="PUBLIC",Ce[Ce.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(ve=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[ve.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",ve[ve.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",ve[ve.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UltraMsgChangeType=void 0,(Ie=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[Ie.MSG_EXPANSION=1]="MSG_EXPANSION",Ie[Ie.MSG_MODIFY=2]="MSG_MODIFY",Ie[Ie.MSG_RECALL=3]="MSG_RECALL",Ie[Ie.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",Ie[Ie.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",exports.UltraMsgSubChangeType=void 0,(ye=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[ye.CHANNEL_DELETE=1]="CHANNEL_DELETE",ye[ye.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",ye[ye.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",ye[ye.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",ye[ye.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",ye[ye.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UserGroupChangeType=void 0,(me=exports.UserGroupChangeType||(exports.UserGroupChangeType={}))[me.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",me[me.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",me[me.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",me[me.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",me[me.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP",exports.UltraMentionedType=void 0,(Re=exports.UltraMentionedType||(exports.UltraMentionedType={}))[Re.NOT_MENTIONED=0]="NOT_MENTIONED",Re[Re.ALL=1]="ALL",Re[Re.ME=2]="ME",exports.EnterpriseType=void 0,(Se=exports.EnterpriseType||(exports.EnterpriseType={}))[Se.PRIVATE=1]="PRIVATE",Se[Se.OPEN=0]="OPEN",exports.ProtocalType=void 0,(Oe=exports.ProtocalType||(exports.ProtocalType={}))[Oe.NAVI=1]="NAVI",Oe[Oe.TCP=2]="TCP",Oe[Oe.WS=3]="WS",exports.NaviCacheType=void 0,(Ne=exports.NaviCacheType||(exports.NaviCacheType={}))[Ne.REQUEST=0]="REQUEST",Ne[Ne.LOCAL=1]="LOCAL",exports.StatisticsVersion=void 0,(Me=exports.StatisticsVersion||(exports.StatisticsVersion={}))[Me.CURRENT=2]="CURRENT",exports.ConnectType=void 0,(Le=exports.ConnectType||(exports.ConnectType={}))[Le.CONNECT=0]="CONNECT",Le[Le.RECONNECT=1]="RECONNECT",exports.ConnectReason=void 0,(Ue=exports.ConnectReason||(exports.ConnectReason={}))[Ue.CONNECT=0]="CONNECT",Ue[Ue.RECONNECT=1]="RECONNECT",Ue[Ue.REDIRECTED=3]="REDIRECTED",Ue[Ue.TIMEOUT=4]="TIMEOUT",exports.RTCMode=void 0,(Ae=exports.RTCMode||(exports.RTCMode={}))[Ae.RTC=0]="RTC",Ae[Ae.LIVE=2]="LIVE",Ae[Ae.SIP=4]="SIP",Ae[Ae.CALL=5]="CALL",Ae[Ae.MEETING=6]="MEETING",Ae[Ae.CROSS_MUTI=7]="CROSS_MUTI",Ae[Ae.CROSS_LIVE=8]="CROSS_LIVE",exports.LiveType=void 0,(we=exports.LiveType||(exports.LiveType={}))[we.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",we[we.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(Pe=exports.LiveRole||(exports.LiveRole={}))[Pe.ANCHOR=1]="ANCHOR",Pe[Pe.AUDIENCE=2]="AUDIENCE";var xe,De,Ve;exports.RTCApiType=void 0,(xe=exports.RTCApiType||(exports.RTCApiType={}))[xe.ROOM=1]="ROOM",xe[xe.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(De=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[De.AnchorToViewer=1]="AnchorToViewer",De[De.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(Ve=exports.RTCJoinType||(exports.RTCJoinType={}))[Ve.KICK=0]="KICK",Ve[Ve.REFUSE=1]="REFUSE",Ve[Ve.COEXIST=2]="COEXIST";var Ge=function(e){return"string"==typeof e},Be=function(e){return"number"==typeof e&&!Number.isNaN(e)},ke=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},Fe=function(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)},He=function(e){return Ge(e)&&e.length>0},Ke=function(e){return"[object Object]"===Object.prototype.toString.call(e)},qe=function(e){return"[object Function]"===Object.prototype.toString.call(e)},Ye=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},je=function(e){return Ge(e)&&/https?:\/\//.test(e)},Qe=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},We=function(e){return Be(e)&&Object.prototype.hasOwnProperty.call(G,e)},Je=function(e){var t=!1;return Ge(e)&&!/_/g.test(e)&&e.length<=20&&(t=!0),t},Xe=function(e){var t=!1,n=!1,r=!1;if(Ke(e)){var i=Object.keys(e).length;for(var o in t=i>20,e)if(n||(n=Ge(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=e[o];r=o.length>32||s.length>4096}}return{isExceedLimit:t,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},Ze=function(){function e(){this._map={}}return e.prototype.on=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n})},e.prototype.once=function(e,t,n){var r=this._map[e]||(this._map[e]=[]);r.some((function(e){return e.listener===t&&e.target===n}))||r.push({listener:t,target:n,once:!0})},e.prototype.off=function(e,t,n){var r=this._map[e];r&&((r=r.filter((function(e){return e.listener!==t||e.target!==n}))).length?this._map[e]=r:delete this._map[e])},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this._map[e];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,c=o.listener;a&&r.splice(i,1);try{c.call.apply(c,h([s],t,!1))}catch(e){null===console||void 0===console||console.error(e)}}},e.prototype.removeAll=function(e){delete this._map[e]},e.prototype.clear=function(){Object.keys(this._map).forEach(this.removeAll,this)},e}(),ze="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};ze.engine="5.8.4";var $e=function(){function e(){}return e.add=function(e,t){ze[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return ze.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return ze},e}(),et=null;function tt(e,t,n,r){void 0===n&&(n={});var i=["error","warn","info","debug"][3-e];if(et&&e<exports.LogLevel.FATAL)try{var o=JSON.stringify(n);et[i](t,o)}catch(e){console.error(e)}}var nt,rt,it=tt.bind(null,exports.LogLevel.DEBUG),ot=tt.bind(null,exports.LogLevel.INFO),st=tt.bind(null,exports.LogLevel.WARN),at=tt.bind(null,exports.LogLevel.ERROR),ct=tt.bind(null,exports.LogLevel.FATAL),ut=Object.freeze({__proto__:null,init:function(e){et=e},log:tt,debug:it,info:ot,warn:st,error:at,fatal:ct}),lt=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},ht=function(){var e=lt();if(e="".concat(e.replace(/-/g,""),"a"),e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=t.length+1,r=+e,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(t[o])}while(r);return i.join("")}(e=parseInt(e,16)),e.length>22&&(e=e.slice(0,22)),e.length<22)for(var t=22-e.length,n=0;n<t;n++)e+="0";return e};exports.AssertRules=void 0,(rt=exports.AssertRules||(exports.AssertRules={}))[rt.STRING=0]="STRING",rt[rt.ONLY_STRING=1]="ONLY_STRING",rt[rt.NUMBER=2]="NUMBER",rt[rt.BOOLEAN=3]="BOOLEAN",rt[rt.OBJECT=4]="OBJECT",rt[rt.ARRAY=5]="ARRAY",rt[rt.CALLBACK=6]="CALLBACK",rt[rt.CHANNEL_ID=7]="CHANNEL_ID",rt[rt.CONVERSATION=8]="CONVERSATION";var dt=((nt={})[exports.AssertRules.STRING]=He,nt[exports.AssertRules.ONLY_STRING]=Ge,nt[exports.AssertRules.NUMBER]=Be,nt[exports.AssertRules.BOOLEAN]=function(e){return"boolean"==typeof e},nt[exports.AssertRules.OBJECT]=Ke,nt[exports.AssertRules.ARRAY]=ke,nt[exports.AssertRules.CALLBACK]=function(e){var t=!0;return Ke(e)||(t=!1),(e=e||{}).onSuccess&&!qe(e.onSuccess)&&(t=!1),e.onError&&!qe(e.onError)&&(t=!1),t},nt[exports.AssertRules.CHANNEL_ID]=Je,nt[exports.AssertRules.CONVERSATION]=function(e){var t=!0;return Ke(e)||(t=!1),Ge(e.targetId)||(t=!1),We(e.conversationType)||(t=!1),Ye(e.channelId)||Je(e.channelId)||(t=!1),t},nt),pt=function(e){function t(t){var n=e.call(this,t)||this;return n.name="RCAssertError",n}return a(t,e),t}(Error),gt=function(e,t,n,r){void 0===r&&(r=!1),n=dt[n]||n;var i=r?n(t):Ye(t)||null==t||n(t);return i||null===console||void 0===console||console.error("'".concat(e,"' is invalid: ").concat(JSON.stringify(t))),i},ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function _t(e){var t,n,r,i,o,s,a="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c<e.length;)t=ft.indexOf(e.charAt(c++))<<2|(i=ft.indexOf(e.charAt(c++)))>>4,n=(15&i)<<4|(o=ft.indexOf(e.charAt(c++)))>>2,r=(3&o)<<6|(s=ft.indexOf(e.charAt(c++))),a+=String.fromCharCode(t),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a}function Et(e){for(var t=null===window||void 0===window?void 0:window.atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n.buffer}var Tt,Ct,vt,It,yt=function(e){if(!Ke(e)||void 0===e.low||void 0===e.high)return e;var t=e.low;return t<0&&(t+=4294967296),t=t.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(t.length,"}$")),t),16)},mt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),r=lt(),i=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),r=t.getMonth()+1,i=t.getDate();return"".concat(n).concat(e).concat(r).concat(e).concat(i)}(),o=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},Rt=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,r=e.apnsCollapseId,i=e.category,o=e.richMediaUri,s=t.channelIdMi,a=t.channelIdHW,c=t.channelIdOPPO,u=t.typeVivo,l=t.googleConfig,h=t.miLargeIconUrl,d=t.importanceHW,p=t.categoryHW,g=t.imageUrlHW,f=t.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=r||"",_.category=i||"",_.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 C=[{HW:{channelId:a||"",importance:d||"NORMAL",image:g||"",category:p||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(C)},St=function(e,t,n){var r={},i={notificationId:n||""};if(!t)return{iOSConfig:r,androidConfig:i};try{var o=JSON.parse(t);null==o||o.forEach((function(e){var t,n,o,s,a,c,u,l,h,d=Object.keys(e);if(0!==d.length){var p=d[0];switch(p){case"HW":return i.channelIdHW=null===(t=e[p])||void 0===t?void 0:t.channelId,i.importanceHW=null===(n=e[p])||void 0===n?void 0:n.importance,i.imageUrlHW=null===(o=e[p])||void 0===o?void 0:o.image,void(i.categoryHW=null===(s=e[p])||void 0===s?void 0:s.category);case"MI":return i.channelIdMi=null===(a=e[p])||void 0===a?void 0:a.channelId,void(i.miLargeIconUrl=null===(c=e[p])||void 0===c?void 0:c.large_icon_uri);case"OPPO":return void(i.channelIdOPPO=null===(u=e[p])||void 0===u?void 0:u.channelId);case"VIVO":return i.typeVivo=null===(l=e[p])||void 0===l?void 0:l.classification,void(i.categoryVivo=null===(h=e[p])||void 0===h?void 0:h.category);case"APNS":return r.threadId=e[p]["thread-id"],r.apnsCollapseId=e[p]["apns-collapse-id"],r.category=e[p].category,void(r.richMediaUri=e[p].richMediaUri);case"FCM":i.googleConfig={collapseKey:e[p].collapse_key||"",imageUrl:e[p].imageUrl||"",priority:e[p].priority||""}}}}))}catch(n){e.error(exports.LogTagId.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:r,androidConfig:i}},Ot=function(e){var t=/^[A-Za-z0-9_=+-]+$/.test(e),n=e.length;return t&&(n<=128&&n>=1)},Nt=function(e){var t=e.length;return t<=4096&&t>=1},Mt=(Tt=0,function(){var e=((4294967295&Date.now())>>>0).toString(2),t=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=e+Tt.toString(2).padStart(11,"0")+t.toString(2).padStart(20,"0");return Tt=2047&++Tt,parseInt(n,2)}),Lt=function(){var e=$e.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t},Ut=function(e,t,n){return u(void 0,void 0,void 0,(function(){var r,i;return l(this,(function(o){switch(o.label){case 0:return[4,window.crypto.subtle.importKey("raw",(new TextEncoder).encode(t),"AES-CBC",!0,["decrypt"])];case 1:return r=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},r,Et(e))];case 2:return i=o.sent(),[2,(new TextDecoder).decode(i)]}}))}))};function At(e,t){var n;if(!e)return"";var r="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?r?e.replace(/^https?:\/\//i,"https://"):e:t!==exports.EConnectProtocol.HTTP||r?"https://".concat(e):"http://".concat(e)}exports.HttpMethod=void 0,(Ct=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",Ct.POST="POST",Ct.PUT="PUT",exports.NetworkType=void 0,(vt=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",vt.FOUR_G="4g",vt.THREE_G="3g",vt.TWO_G="2g",vt.FIVE_G="2g",vt.THREE_GENT="3gnet",vt.UNKONWN="unknown",exports.TagChangeType=void 0,(It=exports.TagChangeType||(exports.TagChangeType={}))[It.add=1]="add",It[It.update=2]="update",It[It.delete=3]="delete";var wt=function(){var e="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;return"undefined"!=typeof XMLHttpRequest&&e?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")};var Pt,bt,xt=function(e,t,n){var r=null==n?void 0:n.isReverse;Ke(e)&&function(){for(var n in e)t(e[n],n,e)}(),(ke(e)||Ge(e))&&function(){if(r)for(var n=e.length-1;n>=0;n--)t(e[n],n);else for(var i=0,o=e.length;i<o;i++)t(e[i],i)}()},Dt=function(e,t){return xt(e,(function(n,r){e[r]=t(n,r)})),e},Vt=function(e,t){if(e.indexOf)return e.indexOf(t);var n=-1;return xt(e,(function(e,r){t===e&&(n=r)})),n},Gt=function(e,t){var n=[];return xt(e,(function(e){n.push(e)})),-1!==Vt(n,t)},Bt=function(e){return JSON.parse(JSON.stringify(e))},kt=function(){return"undefined"!=typeof RCCppEngine},Ft=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},Ht=function(e){var t;if("object"==typeof e&&null!==e)if(Array.isArray(e))for(var n in t=[],e)t.push(Ht(e[n]));else for(var n in t={},e)t[n]=Ht(e[n]);else t=e;return t},Kt=function(e){var t;try{t=Ht(e)}catch(n){t=JSON.parse(JSON.stringify(e))}return t},qt={_delayTime:0,setTime:function(e){var t=(new Date).getTime();qt._delayTime=t-e},getTime:function(){var e=qt._delayTime;return(new Date).getTime()-e}},Yt=function(e,t){var n=0;return e.isAutoDelete&&(n|=1),e.isOverwrite&&(n|=2),2===t&&(n|=4),n},jt=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=e}return e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.roomId,n=e.timestamp,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===D.SUCCESS?(this._isPulling=!1,this._pullTime=s.syncTime||0,this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pullEntry=function(e,t){this._pullQueue.push({roomId:e,timestamp:t}),this._startPull()},e.prototype.reset=function(){this._pullTime=0,this._isPulling=!1},e}(),Qt="rtcRJoin_data",Wt="rtcRExit",Jt="rtcRInfo",Xt="rtcUData",Zt="rtcUPut",zt="rtcUDel",$t="rtcSetData",en="userSetData",tn="rtcQryData",nn="rtcDelData",rn="rtcToken",on="rtcUserState",sn="rtcUList",an="viewerJoinR",cn="viewerExitR",un="rtcPullKv",ln="rtcIdentityChange",hn="rtcInvite",dn="rtcCancelInvite",pn="rtcInviteAnswer",gn="rtcEndInvite",fn="rtcQueryJoined";!function(e){e.RtcInput="RtcInput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcOutput="RtcOutput"}(bt||(bt={}));var _n=((Pt={})[bt.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],Pt[bt.RtcUserListOutput]=["users","token","sessionId","roomInfo"],Pt[bt.SetUserStatusInput]=["status"],Pt[bt.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Pt[bt.RtcUserSetDataInput]=["valueInfo","objectName","content"],Pt[bt.RtcDataInput]=["interior","target","key","objectName","content"],Pt[bt.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Pt[bt.MCFollowInput]=["state"],Pt[bt.RtcTokenOutput]=["rtcToken"],Pt[bt.RtcQryOutput]=["outInfo"],Pt[bt.RtcQryUserOutDataInput]=["userId"],Pt[bt.RtcUserOutDataOutput]=["user"],Pt[bt.RtcQueryListInput]=["order"],Pt[bt.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Pt[bt.RtcValueInfo]=["key","value"],Pt[bt.RtcKeyDeleteInput]=["key"],Pt[bt.RtcNotifyMsg]=["type","time","roomId"],Pt[bt.RtcPullKV]=["timestamp","roomId"],Pt[bt.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Pt[bt.RtcQueryUserJoinedInput]=["userId"],Pt[bt.RtcQueryUserJoinedOutput]=["info"],Pt[bt.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Pt[bt.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Pt[bt.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Pt[bt.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Pt),En="\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(bt.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(bt.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(bt.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(bt.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(bt.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(bt.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(bt.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(bt.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(bt.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(bt.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(bt.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(bt.RtcQryOutput,"{\n repeated ").concat(bt.RtcValueInfo," outInfo=1;\n }\n message ").concat(bt.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(bt.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(bt.RtcUserSetDataInput," {\n repeated ").concat(bt.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(bt.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(bt.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(bt.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(bt.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(bt.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(bt.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(bt.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(bt.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(bt.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(bt.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(bt.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(bt.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(bt.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(bt.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(bt.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(bt.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"),Tn=function(){function e(e,t,n,r,i,o){this.runtime=e,this.rtcCodec=t,this._watcher=n,this._options=r,this.logger=i,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new jt(this)}return e.prototype.registerRTCSignalingListener=function(e){this._rtcSignalingListener=e},e.prototype.getInnerLogger=function(){return this.logger},e.prototype.getInnerStatisticLog=function(){return this.statisticLog},e.prototype.pullRTCRoomEntry=function(e,t){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(u){switch(u.label){case 0:return t=this.rtcCodec.encode(bt.RtcPullKV,{timestamp:0,roomId:e}),[4,this.rtcSignaling(e,un,!0,t)];case 1:return n=u.sent(),r=n.code,i=n.buffer,r!==D.SUCCESS?[2,{code:r}]:(o=this.rtcCodec.decode(bt.RtcKVOutput,i),s=o.entries,a=o.syncTime,s=(s||[]).map((function(e){return c(c({},e),{timestamp:yt(e.timestamp)})})),this._watcher.onRTCDataChange(s,e),[2,{code:r,data:{kvEntries:s,syncTime:yt(a)}}])}}))}))},e.prototype._receiveRtcKv=function(e){if(this._rtcSignalingListener)this._rtcSignalingListener(e);else{var t=this.rtcCodec.decode(bt.RtcNotifyMsg,e),n=t.time,r=t.type,i=t.roomId;1===r&&this._rtcKVManager.pullEntry(i,yt(n))}},e.prototype.destroy=function(){},e}();function Cn(e){var t=function(){function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,r,o;return t?(o=(e>>>=0)>=0&&e<256)&&(r=c[e])?r:(n=i(e,(0|e)<0?-1:0,!0),o&&(c[e]=n),n):(o=(e|=0)>=-128&&e<128)&&(r=a[e])?r:(n=i(e,e<0?-1:0,!1),o&&(a[e]=n),n)}function r(e,t){if(isNaN(e)||!isFinite(e))return t?f:g;if(t){if(e<0)return f;if(e>=h)return v}else{if(-d>=e)return I;if(e+1>=d)return C}return e<0?r(-e,t).neg():i(0|e%l,0|e/l,t)}function i(t,n,r){return new e(t,n,r)}function o(e,t,n){var i,s,a,c,l,h,d;if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||n>36)throw RangeError("radix");if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(e.substring(1),t,n).neg();for(s=r(u(n,8)),a=g,c=0;c<e.length;c+=8)l=Math.min(8,e.length-c),h=parseInt(e.substring(c,c+l),n),l<8?(d=r(u(n,l)),a=a.mul(d).add(r(h))):a=(a=a.mul(s)).add(r(h));return a.unsigned=t,a}function s(t){return t instanceof e?t:"number"==typeof t?r(t):"string"==typeof t?o(t):i(t.low,t.high,t.unsigned)}var a,c,u,l,h,d,p,g,f,_,E,T,C,v,I,y;return e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t,a={},c={},e.fromInt=n,e.fromNumber=r,e.fromBits=i,u=Math.pow,e.fromString=o,e.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),e.ZERO=g,f=n(0,!0),e.UZERO=f,_=n(1),e.ONE=_,E=n(1,!0),e.UONE=E,T=n(-1),e.NEG_ONE=T,C=i(-1,2147483647,!1),e.MAX_VALUE=C,v=i(-1,-1,!0),e.MAX_UNSIGNED_VALUE=v,I=i(0,-2147483648,!1),e.MIN_VALUE=I,(y=e.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},y.toString=function(e){var t,n,i,o,s,a,c,l;if((e=e||10)<2||e>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(I)?(t=r(e),i=(n=this.div(t)).mul(t).sub(this),n.toString(e)+i.toInt().toString(e)):"-"+this.neg().toString(e);for(o=r(u(e,6),this.unsigned),s=this,a="";;){if(c=s.div(o),l=(s.sub(c.mul(o)).toInt()>>>0).toString(e),(s=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){var e,t;if(this.isNegative())return this.eq(I)?64:this.neg().getNumBitsAbs();for(e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},y.isZero=function(){return 0===this.high&&0===this.low},y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},y.eq=y.equals,y.notEquals=function(e){return!this.eq(e)},y.neq=y.notEquals,y.lessThan=function(e){return this.comp(e)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(e){return this.comp(e)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(e){return this.comp(e)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(e){return this.comp(e)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(_)},y.neg=y.negate,y.add=function(e){var n,r,o,a,c,u,l,h,d,p,g;return t(e)||(e=s(e)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,c=e.high>>>16,u=65535&e.high,l=e.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&e.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=r+u)>>>16,h+=n+c,i((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},y.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},y.sub=y.subtract,y.multiply=function(e){var n,o,a,c,u,l,h,d,f,_,E,T;return this.isZero()?g:(t(e)||(e=s(e)),e.isZero()?g:this.eq(I)?e.isOdd()?I:g:e.eq(I)?this.isOdd()?I:g:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(p)&&e.lt(p)?r(this.toNumber()*e.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=0,_=0,E=0,T=0,E+=(T+=c*(d=65535&e.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=c*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=c*l)>>>16,f+=n*d+o*h+a*l+c*u,i((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},y.mul=y.multiply,y.divide=function(e){var n,i,o,a,c,l,h;if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return E;o=f}else{if(this.eq(I))return e.eq(_)||e.eq(T)?I:e.eq(I)?_:(n=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?_:T:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(I))return this.unsigned?f:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=g}for(i=this;i.gte(e);){for(n=Math.max(1,Math.floor(i.toNumber()/e.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),h=(l=r(n)).mul(e);h.isNegative()||h.gt(i);)h=(l=r(n-=c,this.unsigned)).mul(e);l.isZero()&&(l=_),o=o.add(l),i=i.sub(h)}return o},y.div=y.divide,y.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},y.mod=y.modulo,y.not=function(){return i(~this.low,~this.high,this.unsigned)},y.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},y.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},y.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},y.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(e){var n;return t(e)&&(e=e.toInt()),0===(e&=63)?this:(n=this.high,e<32?i(this.low>>>e|n<<32-e,n>>>e,this.unsigned):i(32===e?n:n>>>e-32,0,this.unsigned))},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},y.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,255&t>>>8,255&t>>>16,255&t>>>24,255&e,255&e>>>8,255&e>>>16,255&e>>>24]},y.toBytesBE=function(){var e=this.high,t=this.low;return[255&e>>>24,255&e>>>16,255&e>>>8,255&e,255&t>>>24,255&t>>>16,255&t>>>8,255&t]},e}(),n=function(e){function t(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function n(){var e=[],t=[];return function(){return 0===arguments.length?t.join("")+a.apply(String,e):(e.length+arguments.length>1024&&(t.push(a.apply(String,e)),e.length=0),void Array.prototype.push.apply(e,arguments))}}function r(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+e[t+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)}function i(e,t,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=255&a,p+=g,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[n+p]=255&s,p+=g,s/=256,u-=8);e[n+p-g]|=128*f}var o,s,a,c,u,l=function(e,t,n){if(void 0===e&&(e=l.DEFAULT_CAPACITY),void 0===t&&(t=l.DEFAULT_ENDIAN),void 0===n&&(n=l.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");t=!!t,n=!!n}this.buffer=0===e?s:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=t,this.noAssert=n};return l.VERSION="5.0.1",l.LITTLE_ENDIAN=!0,l.BIG_ENDIAN=!1,l.DEFAULT_CAPACITY=16,l.DEFAULT_ENDIAN=l.BIG_ENDIAN,l.DEFAULT_NOASSERT=!1,l.Long=e||null,(o=l.prototype).__isByteBuffer__,Object.defineProperty(o,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1}),s=new ArrayBuffer(0),a=String.fromCharCode,l.accessor=function(){return Uint8Array},l.allocate=function(e,t,n){return new l(e,t,n)},l.concat=function(e,t,n,r){var i,o,s,a,c,u;for(("boolean"==typeof t||"string"!=typeof t)&&(r=n,n=t,t=void 0),i=0,s=0,a=e.length;a>s;++s)l.isByteBuffer(e[s])||(e[s]=l.wrap(e[s],t)),(o=e[s].limit-e[s].offset)>0&&(i+=o);if(0===i)return new l(0,n,r);for(u=new l(i,n,r),s=0;a>s;)(o=(c=e[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},l.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(e,t,n,r){var i,s;if("string"!=typeof t&&(r=n,n=t,t=void 0),"string"==typeof e)switch(void 0===t&&(t="utf8"),t){case"base64":return l.fromBase64(e,n);case"hex":return l.fromHex(e,n);case"binary":return l.fromBinary(e,n);case"utf8":return l.fromUTF8(e,n);case"debug":return l.fromDebug(e,n);default:throw Error("Unsupported encoding: "+t)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");if(l.isByteBuffer(e))return(i=o.clone.call(e)).markedOffset=-1,i;if(e instanceof Uint8Array)i=new l(0,n,r),e.length>0&&(i.buffer=e.buffer,i.offset=e.byteOffset,i.limit=e.byteOffset+e.byteLength,i.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)i=new l(0,n,r),e.byteLength>0&&(i.buffer=e,i.offset=0,i.limit=e.byteLength,i.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");for((i=new l(e.length,n,r)).limit=e.length,s=0;s<e.length;++s)i.view[s]=e[s]}return i},o.writeBitSet=function(e,t){var n,r,i,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for(r=t,o=(i=e.length)>>3,s=0,t+=this.writeVarint32(i,t);o--;)n=1&!!e[s++]|(1&!!e[s++])<<1|(1&!!e[s++])<<2|(1&!!e[s++])<<3|(1&!!e[s++])<<4|(1&!!e[s++])<<5|(1&!!e[s++])<<6|(1&!!e[s++])<<7,this.writeByte(n,t++);if(i>s){for(a=0,n=0;i>s;)n|=(1&!!e[s++])<<a++;this.writeByte(n,t++)}return c?(this.offset=t,this):t-r},o.readBitSet=function(e){var t,n,r,i,o,s,a,c=void 0===e;for(c&&(e=this.offset),i=(r=(n=this.readVarint32(e)).value)>>3,o=0,s=[],e+=n.length;i--;)t=this.readByte(e++),s[o++]=!!(1&t),s[o++]=!!(2&t),s[o++]=!!(4&t),s[o++]=!!(8&t),s[o++]=!!(16&t),s[o++]=!!(32&t),s[o++]=!!(64&t),s[o++]=!!(128&t);if(r>o)for(a=0,t=this.readByte(e++);r>o;)s[o++]=!!(1&t>>a++);return c&&(this.offset=e),s},o.readBytes=function(e,t){var n,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+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}return n=this.slice(t,t+e),r&&(this.offset+=e),n},o.writeBytes=o.append,o.writeInt8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeByte=o.writeInt8,o.readInt8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return 128==(128&(t=this.view[e]))&&(t=-(255-t+1)),n&&(this.offset+=1),t},o.readByte=o.readInt8,o.writeUint8=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=1)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},o.writeUInt8=o.writeUint8,o.readUint8=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=this.view[e],n&&(this.offset+=1),t},o.readUInt8=o.readUint8,o.writeInt16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeShort=o.writeInt16,o.readInt16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),32768==(32768&t)&&(t=-(65535-t+1)),n&&(this.offset+=2),t},o.readShort=o.readInt16,o.writeUint16=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=2)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},o.writeUInt16=o.writeUint16,o.readUint16=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e],t|=this.view[e+1]<<8):(t=this.view[e]<<8,t|=this.view[e+1]),n&&(this.offset+=2),t},o.readUInt16=o.readUint16,o.writeInt32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeInt=o.writeInt32,o.readInt32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),t|=0,n&&(this.offset+=4),t},o.readInt=o.readInt32,o.writeUint32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,this.littleEndian?(this.view[t+3]=255&e>>>24,this.view[t+2]=255&e>>>16,this.view[t+1]=255&e>>>8,this.view[t]=255&e):(this.view[t]=255&e>>>24,this.view[t+1]=255&e>>>16,this.view[t+2]=255&e>>>8,this.view[t+3]=255&e),r&&(this.offset+=4),this},o.writeUInt32=o.writeUint32,o.readUint32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=0,this.littleEndian?(t=this.view[e+2]<<16,t|=this.view[e+1]<<8,t|=this.view[e],t+=this.view[e+3]<<24>>>0):(t=this.view[e+1]<<16,t|=this.view[e+2]<<8,t|=this.view[e+3],t+=this.view[e]<<24>>>0),n&&(this.offset+=4),t},o.readUInt32=o.readUint32,e&&(o.writeInt64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,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,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&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(t,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),(n+=8)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=t.low,o=t.high,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,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&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}return n=0,r=0,this.littleEndian?(n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0,t+=4,r=this.view[t+2]<<16,r|=this.view[t+1]<<8,r|=this.view[t],r+=this.view[t+3]<<24>>>0):(r=this.view[t+1]<<16,r|=this.view[t+2]<<8,r|=this.view[t+3],r+=this.view[t]<<24>>>0,t+=4,n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0),i=new e(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=4)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=4,i(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},o.writeFloat=o.writeFloat32,o.readFloat32=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,23,4),n&&(this.offset+=4),t},o.readFloat=o.readFloat32,o.writeFloat64=function(e,t){var n,r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}return(t+=8)>(n=this.buffer.byteLength)&&this.resize((n*=2)>t?n:t),t-=8,i(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},o.writeDouble=o.writeFloat64,o.readFloat64=function(e){var t,n=void 0===e;if(n&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}return t=r(this.view,e,this.littleEndian,52,8),n&&(this.offset+=8),t},o.readDouble=o.readFloat64,l.MAX_VARINT32_BYTES=5,l.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:1<<21>e?3:1<<28>e?4:5},l.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},l.zigZagDecode32=function(e){return 0|e>>>1^-(1&e)},o.writeVarint32=function(e,t){var n,r,i,o=void 0===t;if(o&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}for((t+=r=l.calculateVarint32(e))>(i=this.buffer.byteLength)&&this.resize((i*=2)>t?i:t),t-=r,e>>>=0;e>=128;)n=128|127&e,this.view[t++]=n,e>>>=7;return this.view[t++]=e,o?(this.offset=t,this):r},o.writeVarint32ZigZag=function(e,t){return this.writeVarint32(l.zigZagEncode32(e),t)},o.readVarint32=function(e){var t,n,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}n=0,r=0;do{if(!this.noAssert&&e>this.limit)throw(i=Error("Truncated")).truncated=!0,i;t=this.view[e++],n<5&&(r|=(127&t)<<7*n),++n}while(0!=(128&t));return r|=0,o?(this.offset=e,r):{value:r,length:n}},o.readVarint32ZigZag=function(e){var t=this.readVarint32(e);return"object"==typeof t?t.value=l.zigZagDecode32(t.value):t=l.zigZagDecode32(t),t},e&&(l.MAX_VARINT64_BYTES=10,l.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var n=t.toInt()>>>0,r=t.shiftRightUnsigned(28).toInt()>>>0,i=t.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<128?9:10},l.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},l.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},o.writeVarint64=function(t,n){var r,i,o,s,a,c=void 0===n;if(c&&(n=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}switch("number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),r=l.calculateVarint64(t),i=t.toInt()>>>0,o=t.shiftRightUnsigned(28).toInt()>>>0,s=t.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return c?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(e,t){return this.writeVarint64(l.zigZagEncode64(e),t)},o.readVarint64=function(t){var n,r,i,o,s,a,c=void 0===t;if(c&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}if(n=t,r=0,i=0,o=0,s=0,r=127&(s=this.view[t++]),128&s&&(r|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(r|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(i=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<7,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<14,(128&s||this.noAssert&&void 0===s)&&(i|=(127&(s=this.view[t++]))<<21,(128&s||this.noAssert&&void 0===s)&&(o=127&(s=this.view[t++]),(128&s||this.noAssert&&void 0===s)&&(o|=(127&(s=this.view[t++]))<<7,128&s||this.noAssert&&void 0===s))))))))))throw Error("Buffer overrun");return a=e.fromBits(r|i<<28,i>>>4|o<<24,!1),c?(this.offset=t,a):{value:a,length:t-n}},o.readVarint64ZigZag=function(t){var n=this.readVarint64(t);return n&&n.value instanceof e?n.value=l.zigZagDecode64(n.value):n=l.zigZagDecode64(n),n}),o.writeCString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),i=e.length,!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===e.charCodeAt(r))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 i=u.calculateUTF16asUTF8(t(e))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(e){var t,r,i,o=void 0===e;if(o&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,i=-1,u.decodeUTF8toUTF16(function(){if(0===i)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(i=this.view[e++])?null:i}.bind(this),r=n(),!0),o?(this.offset=e,r()):{string:r(),length:e-t}},o.writeIString=function(e,n){var r,i,o,s=void 0===n;if(s&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(i=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,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):(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),n+=4,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}return t=e,n=this.readUint32(e),r=this.readUTF8String(n,l.METRICS_BYTES,e+=4),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(e,n){var r,i,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 i=n,r=u.calculateUTF16asUTF8(t(e))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(e){return u.calculateUTF16asUTF8(t(e))[0]},l.calculateUTF8Bytes=function(e){return u.calculateUTF16asUTF8(t(e))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(e,t,r){var i,o,s,a,c;if("number"==typeof t&&(r=t,t=void 0),(i=void 0===r)&&(r=this.offset),void 0===t&&(t=l.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,t===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return e>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(e){++s,u.UTF8toUTF16(e,o)})),s!==e)throw RangeError("Illegal range: Truncated data, "+s+" == "+e);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(t===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+e+") <= "+this.buffer.byteLength)}if(c=r+e,u.decodeUTF8toUTF16(function(){return c>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+t)},o.readString=o.readUTF8String,o.writeVString=function(e,n){var r,i,o,s,a=void 0===n;if(a&&(n=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}if(o=n,r=u.calculateUTF16asUTF8(t(e),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),u.encodeUTF16toUTF8(t(e),function(e){this.view[n++]=e}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(e){var t,n,r,i=void 0===e;if(i&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}return t=e,n=this.readVarint32(e),r=this.readUTF8String(n.value,l.METRICS_BYTES,e+=n.length),e+=r.length,i?(this.offset=e,r.string):{string:r.string,length:e-t}},o.append=function(e,t,n){var r,i,o;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(e.view.subarray(e.offset,e.limit),n),e.offset+=i,r&&(this.offset+=i)),this},o.appendTo=function(e,t){return e.append(this,t),this},o.assert=function(e){return this.noAssert=!e,this},o.capacity=function(){return this.buffer.byteLength},o.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},o.clone=function(e){var t=new l(0,this.littleEndian,this.noAssert);return e?(t.buffer=new ArrayBuffer(this.buffer.byteLength),t.view=new Uint8Array(t.buffer)):(t.buffer=this.buffer,t.view=this.view),t.offset=this.offset,t.markedOffset=this.markedOffset,t.limit=this.limit,t},o.compact=function(e,t){var n,r,i;if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return 0===e&&t===this.buffer.byteLength?this:0===(n=t-e)?(this.buffer=s,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(e,t)),this.buffer=r,this.view=i,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=n,this)},o.copy=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(e===t)return new l(0,this.littleEndian,this.noAssert);var n=t-e,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=e),this.copyTo(r,0,e,t),r},o.copyTo=function(e,t,n,r){var i,o,s;if(!this.noAssert&&!l.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(t=(o=void 0===t)?e.offset:0|t,n=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,t<0||t>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+t+" <= "+e.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?e:(e.ensureCapacity(t+s),e.view.set(this.view.subarray(n,r),t),i&&(this.offset+=s),o&&(e.offset+=s),this)},o.ensureCapacity=function(e){var t=this.buffer.byteLength;return e>t?this.resize((t*=2)>e?t:e):this},o.fill=function(e,t,n){var r=void 0===t;if(r&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===n&&(n=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof n||n%1!=0)throw TypeError("Illegal end: Not an integer");if(n>>>=0,t<0||t>n||n>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+n+" <= "+this.buffer.byteLength)}if(t>=n)return this;for(;n>t;)this.view[t++]=e;return r&&(this.offset=t),this},o.flip=function(){return this.limit=this.offset,this.offset=0,this},o.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},o.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},o.LE=function(e){return this.littleEndian=void 0===e||!!e,this},o.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},o.prepend=function(e,t,n){var r,i,o,s,a;if(("number"==typeof t||"string"!=typeof t)&&(n=t,t=void 0),(r=void 0===n)&&(n=this.offset),!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: "+n+" (not an integer)");if((n>>>=0)<0||n+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+n+" (+0) <= "+this.buffer.byteLength)}return e instanceof l||(e=l.wrap(e,t)),(i=e.limit-e.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),this.buffer=s,this.view=a,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,n+=o):new Uint8Array(this.buffer),this.view.set(e.view.subarray(e.offset,e.limit),n-i),e.offset=e.limit,r&&(this.offset-=i)),this},o.prependTo=function(e,t){return e.prepend(this,t),this},o.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},o.remaining=function(){return this.limit-this.offset},o.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},o.resize=function(e){var t,n;if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}return this.buffer.byteLength<e&&(t=new ArrayBuffer(e),(n=new Uint8Array(t)).set(this.view),this.buffer=t,this.view=n),this},o.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},o.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},o.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var n=this.clone();return n.offset=e,n.limit=t,n},o.toBuffer=function(e){var t,n=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return e||0!==n||r!==this.buffer.byteLength?n===r?s:(t=new ArrayBuffer(r-n),new Uint8Array(t).set(new Uint8Array(this.buffer).subarray(n,r),0),t):this.buffer},o.toArrayBuffer=o.toBuffer,o.toString=function(e,t,n){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(n=t=e="utf8"),e){case"utf8":return this.toUTF8(t,n);case"base64":return this.toBase64(t,n);case"hex":return this.toHex(t,n);case"binary":return this.toBinary(t,n);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}},c=function(){var e,t,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(e=0,t=r.length;t>e;++e)i[r[e]]=e;return n.encode=function(e,t){for(var n,i;null!==(n=e());)t(r[63&n>>2]),i=(3&n)<<4,null!==(n=e())?(t(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=e())?(t(r[63&(i|3&n>>6)]),t(r[63&n])):(t(r[63&i]),t(61))):(t(r[63&i]),t(61),t(61))},n.decode=function(e,t){function n(e){throw Error("Illegal character code: "+e)}for(var r,o,s;null!==(r=e());)if(void 0===(o=i[r])&&n(r),null!==(r=e())&&(void 0===(s=i[r])&&n(r),t(o<<2>>>0|(48&s)>>4),null!==(r=e()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(t((15&s)<<4>>>0|(60&o)>>2),null!==(r=e())){if(void 0===(s=i[r])){if(61===r)break;n(r)}t((3&o)<<6>>>0|s)}}},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)},n}(),o.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return c.encode(function(){return t>e?this.view[e++]:null}.bind(this),r=n()),r()},l.fromBase64=function(e,n){if("string"!=typeof e)throw TypeError("str");var r=new l(e.length/4*3,n),i=0;return c.decode(t(e),(function(e){r.view[i++]=e})),r.limit=i,r},l.btoa=function(e){return l.fromBinary(e).toBase64()},l.atob=function(e){return l.fromBase64(e).toBinary()},o.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var n=[],r=[];t>e;)n.push(this.view[e++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(e,t){if("string"!=typeof e)throw TypeError("str");for(var n,r=0,i=e.length,o=new l(i,t);i>r;){if((n=e.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(e){for(var t,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(t=this.view[n])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(o+=t>32&&t<127?String.fromCharCode(t):".")),++n,e&&n>0&&n%16==0&&n!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=n===this.offset&&n===this.limit?n===this.markedOffset?"!":"|":n===this.offset?n===this.markedOffset?"[":"<":n===this.limit?n===this.markedOffset?"]":">":n===this.markedOffset?"'":e||0!==n&&n!==r?" ":""}if(e&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return e?s:i},l.fromDebug=function(e,t,n){for(var r,i,o=e.length,s=new l(0|(o+1)/3,t,n),a=0,c=0,u=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(r=e.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=c,u=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){g=!0;break}if(i=parseInt(r+e.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=i,u=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+o)}return s},o.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var n,r=new Array(t-e);t>e;)(n=this.view[e++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(e,t,n){var r,i,o,s,a;if(!n){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(i=e.length,o=new l(0|i/2,t),s=0,a=0;i>s;s+=2){if(r=parseInt(e.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},u=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<128?t(127&n):n<2048?(t(192|31&n>>6),t(128|63&n)):n<65536?(t(224|15&n>>12),t(128|63&n>>6),t(128|63&n)):(t(240|7&n>>18),t(128|63&n>>12),t(128|63&n>>6),t(128|63&n)),n=null},decodeUTF8:function(e,t){for(var n,r,i,o,s=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(n=e());)if(0==(128&n))t(n);else if(192==(224&n))null===(r=e())&&s([n,r]),t((31&n)<<6|63&r);else if(224==(240&n))(null===(r=e())||null===(i=e()))&&s([n,r,i]),t((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=e())||null===(i=e())||null===(o=e()))&&s([n,r,i,o]),t((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},UTF16toUTF8:function(e,t){for(var n,r=null;null!==(n=null!==r?r:e());)n>=55296&&n<=57343&&null!==(r=e())&&r>=56320&&r<=57343?(t(1024*(n-55296)+r-56320+65536),r=null):t(n);null!==r&&t(r)},UTF8toUTF16:function(e,t){var n=null;for("number"==typeof e&&(n=e,e=function(){return null});null!==n||null!==(n=e());)n<=65535?t(n):(t(55296+((n-=65536)>>10)),t(n%1024+56320)),n=null},encodeUTF16toUTF8:function(t,n){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,n)}))},decodeUTF8toUTF16:function(t,n){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,n)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,n=0;null!==(t=e());)n+=t<128?1:t<2048?2:t<65536?3:4;return n},calculateUTF16asUTF8:function(t){var n=0,r=0;return e.UTF16toUTF8(t,(function(e){++n,r+=e<128?1:e<2048?2:e<65536?3:4})),[n,r]}};return e}(),o.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{u.decodeUTF8toUTF16(function(){return t>e?this.view[e++]:null}.bind(this),r=n())}catch(n){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},l.fromUTF8=function(e,n,r){if(!r&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var i=new l(u.calculateUTF16asUTF8(t(e),!0)[1],n,r),o=0;return u.encodeUTF16toUTF8(t(e),(function(e){i.view[o++]=e})),i.limit=o,i},l}(t),r=function(t,n){var r,i,o={};return o.ByteBuffer=t,o.c=t,r=t,o.Long=n||null,o.VERSION="5.0.1",o.WIRE_TYPES={},o.WIRE_TYPES.VARINT=0,o.WIRE_TYPES.BITS64=1,o.WIRE_TYPES.LDELIM=2,o.WIRE_TYPES.STARTGROUP=3,o.WIRE_TYPES.ENDGROUP=4,o.WIRE_TYPES.BITS32=5,o.PACKABLE_WIRE_TYPES=[o.WIRE_TYPES.VARINT,o.WIRE_TYPES.BITS64,o.WIRE_TYPES.BITS32],o.TYPES={int32:{name:"int32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},uint32:{name:"uint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},sint32:{name:"sint32",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},int64:{name:"int64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},uint64:{name:"uint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.UZERO:void 0},sint64:{name:"sint64",wireType:o.WIRE_TYPES.VARINT,defaultValue:o.Long?o.Long.ZERO:void 0},bool:{name:"bool",wireType:o.WIRE_TYPES.VARINT,defaultValue:!1},double:{name:"double",wireType:o.WIRE_TYPES.BITS64,defaultValue:0},string:{name:"string",wireType:o.WIRE_TYPES.LDELIM,defaultValue:""},bytes:{name:"bytes",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},fixed32:{name:"fixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},sfixed32:{name:"sfixed32",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},fixed64:{name:"fixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.UZERO:void 0},sfixed64:{name:"sfixed64",wireType:o.WIRE_TYPES.BITS64,defaultValue:o.Long?o.Long.ZERO:void 0},float:{name:"float",wireType:o.WIRE_TYPES.BITS32,defaultValue:0},enum:{name:"enum",wireType:o.WIRE_TYPES.VARINT,defaultValue:0},message:{name:"message",wireType:o.WIRE_TYPES.LDELIM,defaultValue:null},group:{name:"group",wireType:o.WIRE_TYPES.STARTGROUP,defaultValue:null}},o.MAP_KEY_TYPES=[o.TYPES.int32,o.TYPES.sint32,o.TYPES.sfixed32,o.TYPES.uint32,o.TYPES.fixed32,o.TYPES.int64,o.TYPES.sint64,o.TYPES.sfixed64,o.TYPES.uint64,o.TYPES.fixed64,o.TYPES.bool,o.TYPES.string,o.TYPES.bytes],o.ID_MIN=1,o.ID_MAX=536870911,o.convertFieldsToCamelCase=!1,o.populateAccessors=!0,o.populateDefaults=!0,o.Util=function(){var e={};return e.IS_NODE=!("object"!=typeof process||process+""!="[object process]"||process.browser),e.XHR=function(){var e,t=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],n=null;for(e=0;e<t.length;e++){try{n=t[e]()}catch(e){continue}break}if(!n)throw Error("XMLHttpRequest is not supported");return n},e.fetch=function(t,n){if(n&&"function"!=typeof n&&(n=null),e.IS_NODE)if(n)g.readFile(t,(function(e,t){n(e?null:""+t)}));else try{return g.readFileSync(t)}catch(e){return null}else{var r=e.XHR();if(r.open("GET",t,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.send(null)}},e.toCamelCase=function(e){return e.replace(/_([a-zA-Z])/g,(function(e,t){return t.toUpperCase()}))},e}(),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(e,t){function n(e,n){var r=-1,i=1;if("-"==e.charAt(0)&&(i=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))r=parseInt(e);else if(t.NUMBER_HEX.test(e))r=parseInt(e.substring(2),16);else{if(!t.NUMBER_OCT.test(e))throw Error("illegal id value: "+(i<0?"-":"")+e);r=parseInt(e.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+e);return r}function r(e){var n=1;if("-"==e.charAt(0)&&(n=-1,e=e.substring(1)),t.NUMBER_DEC.test(e))return n*parseInt(e,10);if(t.NUMBER_HEX.test(e))return n*parseInt(e.substring(2),16);if(t.NUMBER_OCT.test(e))return n*parseInt(e.substring(1),8);if("inf"===e)return 1/0*n;if("nan"===e)return NaN;if(t.NUMBER_FLT.test(e))return n*parseFloat(e);throw Error("illegal number value: "+(n<0?"-":"")+e)}function i(e,t,n){void 0===e[t]?e[t]=n:(Array.isArray(e[t])||(e[t]=[e[t]]),e[t].push(n))}var o,s,a={},c=function(e){this.source=e+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._readString=function(){var e,n='"'===this._stringOpen?t.STRING_DQ:t.STRING_SQ;if(n.lastIndex=this.index-1,!(e=n.exec(this.source)))throw Error("unterminated string");return this.index=n.lastIndex,this.stack.push(this._stringOpen),this._stringOpen=null,e[1]},u.next=function(){var e,n,r,i,o;if(this.stack.length>0)return this.stack.shift();if(this.index>=this.source.length)return null;if(null!==this._stringOpen)return this._readString();do{for(e=!1;t.WHITESPACE.test(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,e=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,e=!0}}while(e);if(this.index===this.source.length)return null;if(i=this.index,t.DELIM.lastIndex=0,!t.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!t.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var e=this.next();if(null===e)return null;this.stack.push(e)}return this.stack[0]},u.skip=function(e){var t=this.next();if(t!==e)throw Error("illegal '"+t+"', '"+e+"' expected")},u.omit=function(e){return this.peek()===e&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(e){this.tn=new c(e),this.proto3=!1},(s=o.prototype).parse=function(){var e,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;e=this.tn.next();)switch(e){case"package":if(!r||null!==n.package)throw Error("unexpected 'package'");if(e=this.tn.next(),!t.TYPEREF.test(e))throw Error("illegal package name: "+e);this.tn.skip(";"),n.package=e;break;case"import":if(!r)throw Error("unexpected 'import'");"public"===(e=this.tn.peek())&&this.tn.next(),e=this._readString(),this.tn.skip(";"),n.imports.push(e);break;case"syntax":if(!r)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),r=!1;break;case"enum":this._parseEnum(n),r=!1;break;case"option":this._parseOption(n);break;case"service":this._parseService(n);break;case"extend":this._parseExtend(n);break;default:throw Error("unexpected '"+e+"'")}}catch(e){throw e.message="Parse error at line "+this.tn.line+": "+e.message,e}return delete n.name,n},o.parse=function(e){return new o(e).parse()},s._readString=function(){var e,t,n="";do{if("'"!==(t=this.tn.next())&&'"'!==t)throw Error("illegal string delimiter: "+t);n+=this.tn.next(),this.tn.skip(t),e=this.tn.peek()}while('"'===e||'"'===e);return n},s._readValue=function(e){var n=this.tn.peek();if('"'===n||"'"===n)return this._readString();if(this.tn.next(),t.NUMBER.test(n))return r(n);if(t.BOOL.test(n))return"true"===n.toLowerCase();if(e&&t.TYPEREF.test(n))return n;throw Error("illegal value: "+n)},s._parseOption=function(e,n){var r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!t.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),t.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(e,r),n||this.tn.skip(";")},s._parseOptionValue=function(e,n){var r=this.tn.peek();if("{"!==r)i(e.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!t.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(e.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(e,n+"."+r)}},s._parseService=function(e){var n,r=this.tn.next();if(!t.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),e.services.push(n)},s._parseServiceRPC=function(e){var n,r,i="rpc",o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!t.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.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()&&(r.response_stream=!0,o=this.tn.next()),r.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(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===e[i]&&(e[i]={}),e[i][n]=r},s._parseMessage=function(e,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!t.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),this.tn.skip("{");"}"!==(o=this.tn.next());)if(t.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(!t.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(";"),e.messages.push(s),s},s._parseIgnored=function(){for(;";"!==this.tn.peek();)this.tn.next();this.tn.skip(";")},s._parseMessageField=function(e,r,i){var o,s,a;if(!t.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);if(this.tn.skip("<"),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field type: "+s);if(o.keytype=s,this.tn.skip(","),s=this.tn.next(),!t.TYPE.test(s)&&!t.TYPEREF.test(s))throw Error("illegal message field: "+s);if(o.type=s,this.tn.skip(">"),s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}else if("group"===(i=void 0!==i?i:this.tn.next())){if(a=this._parseMessage(e,o),!/^[A-Z]/.test(a.name))throw Error("illegal group name: "+a.name);o.type=a.name,o.name=a.name.toLowerCase(),this.tn.omit(";")}else{if(!t.TYPE.test(i)&&!t.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,s=this.tn.next(),!t.NAME.test(s))throw Error("illegal message field name: "+s);o.name=s,this.tn.skip("="),o.id=n(this.tn.next()),"["===(s=this.tn.peek())&&this._parseFieldOptions(o),this.tn.skip(";")}return e.fields.push(o),o},s._parseMessageOneOf=function(e){var n,r,i,o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(e,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),e.oneofs[r]=i},s._parseFieldOptions=function(e){this.tn.skip("[");for(var t=!0;"]"!==this.tn.peek();)t||this.tn.skip(","),this._parseOption(e,!0),t=!1;this.tn.next()},s._parseEnum=function(e){var r,i={name:"",values:[],options:{}},o=this.tn.next();if(!t.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!t.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),e.enums.push(i)},s._parseExtensionRanges=function(){var t,n,i,o=[];do{for(n=[];;){switch(t=this.tn.next()){case"min":i=e.ID_MIN;break;case"max":i=e.ID_MAX;break;default:i=r(t)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(e){var n,r=this.tn.next();if(!t.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(t.RULE.test(r))this._parseMessageField(n,r);else{if(!t.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}return this.tn.omit(";"),e.messages.push(n),n},s.toString=function(){return"Parser at line "+this.tn.line},a.Parser=o,a}(o,o.Lang),o.Reflect=function(e){function n(t,n){if(t&&"number"==typeof t.low&&"number"==typeof t.high&&"boolean"==typeof t.unsigned&&t.low==t.low&&t.high==t.high)return new e.Long(t.low,t.high,void 0===n?t.unsigned:n);if("string"==typeof t)return e.Long.fromString(t,n||!1,10);if("number"==typeof t)return e.Long.fromNumber(t,n||!1);throw Error("not convertible to Long")}function i(t,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case e.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case e.WIRE_TYPES.BITS64:n.offset+=8;break;case e.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case e.WIRE_TYPES.STARTGROUP:i(s,n);break;case e.WIRE_TYPES.ENDGROUP:if(s===t)return!1;throw Error("Illegal GROUPEND after unknown group: "+s+" ("+t+" expected)");case e.WIRE_TYPES.BITS32:n.offset+=4;break;default:throw Error("Illegal wire type in unknown group "+t+": "+o)}return!0}var o,s,a,c,u,l,h,d,p,g,f,_,E,T,C,v,I={},y=function(e,t,n){this.builder=e,this.parent=t,this.name=n,this.className},m=y.prototype;return m.fqn=function(){for(var e=this.name,t=this;null!=(t=t.parent);)e=t.name+"."+e;return e},m.toString=function(e){return(e?this.className+" ":"")+this.fqn()},m.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},I.T=y,o=function(e,t,n,r,i){y.call(this,e,t,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(y.prototype)).getChildren=function(e){var t,n,r;if(null==(e=e||null))return this.children.slice();for(t=[],n=0,r=this.children.length;r>n;++n)this.children[n]instanceof e&&t.push(this.children[n]);return t},s.addChild=function(e){var t;if(t=this.getChild(e.name))if(t instanceof u.Field&&t.name!==t.originalName&&null===this.getChild(t.originalName))t.name=t.originalName;else{if(!(e instanceof u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName)))throw Error("Duplicate name in namespace "+this.toString(!0)+": "+e.name);e.name=e.originalName}this.children.push(e)},s.getChild=function(e){var t,n,r="number"==typeof e?"id":"name";for(t=0,n=this.children.length;n>t;++t)if(this.children[t][r]===e)return this.children[t];return null},s.resolve=function(e,t){var n,r="string"==typeof e?e.split("."):e,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof I.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof I.T&&(!t||n instanceof I.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(e,t)}while(null!=i);return i},s.qn=function(e){var t,n,r=[],i=e;do{r.unshift(i.name),i=i.parent}while(null!==i);for(t=1;t<=r.length;t++)if(n=r.slice(r.length-t),e===this.resolve(n,e instanceof I.Namespace))return n.join(".");return e.fqn()},s.build=function(){var e,t,n,r={},i=this.children;for(t=0,n=i.length;n>t;++t)(e=i[t])instanceof o&&(r[e.name]=e.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var e,t,n,r,i={},o=Object.keys(this.options);for(e=0,t=o.length;t>e;++e)n=o[e],r=this.options[o[e]],i[n]=r;return i},s.getOption=function(e){return void 0===e?this.options:void 0!==this.options[e]?this.options[e]:null},I.Namespace=o,a=function(t,n,r,i){if(this.type=t,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&e.MAP_KEY_TYPES.indexOf(t)<0)throw Error("Invalid map key type: "+t.name)},c=a.prototype,a.defaultFieldValue=function(t){if("string"==typeof t&&(t=e.TYPES[t]),void 0===t.defaultValue)throw Error("default value for type "+t.name+" is not supported");return t==e.TYPES.bytes?new r(0):t.defaultValue},c.verifyValue=function(r){var i,o,s,a=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this);switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case e.TYPES.uint32:case e.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:if(e.Long)try{return n(r,!1)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.uint64:case e.TYPES.fixed64:if(e.Long)try{return n(r,!0)}catch(e){a(typeof r,e.message)}else a(typeof r,"requires Long.js");case e.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case e.TYPES.float:case e.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case e.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case e.TYPES.bytes:return t.isByteBuffer(r)?r:t.wrap(r);case e.TYPES.enum:for(i=this.resolvedType.getChildren(e.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==r)return i[s].id;if(i[s].id==r)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case e.TYPES.group:case e.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof e.Builder.Message){for(s in o={},r)r.hasOwnProperty(s)&&(o[s]=r[s]);r=o}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},c.calculateLength=function(t,n){if(null===n)return 0;var i;switch(this.type){case e.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case e.TYPES.uint32:return r.calculateVarint32(n);case e.TYPES.sint32:return r.calculateVarint32(r.zigZagEncode32(n));case e.TYPES.fixed32:case e.TYPES.sfixed32:case e.TYPES.float:return 4;case e.TYPES.int64:case e.TYPES.uint64:return r.calculateVarint64(n);case e.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case e.TYPES.fixed64:case e.TYPES.sfixed64:return 8;case e.TYPES.bool:return 1;case e.TYPES.enum:return r.calculateVarint32(n);case e.TYPES.double:return 8;case e.TYPES.string:return i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case e.TYPES.message:return i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case e.TYPES.group:return(i=this.resolvedType.calculate(n))+r.calculateVarint32(t<<3|e.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(t,n,i){var o,s;if(null===n)return i;switch(this.type){case e.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case e.TYPES.uint32:i.writeVarint32(n);break;case e.TYPES.sint32:i.writeVarint32ZigZag(n);break;case e.TYPES.fixed32:i.writeUint32(n);break;case e.TYPES.sfixed32:i.writeInt32(n);break;case e.TYPES.int64:case e.TYPES.uint64:i.writeVarint64(n);break;case e.TYPES.sint64:i.writeVarint64ZigZag(n);break;case e.TYPES.fixed64:i.writeUint64(n);break;case e.TYPES.sfixed64:i.writeInt64(n);break;case e.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case e.TYPES.enum:i.writeVarint32(n);break;case e.TYPES.float:i.writeFloat32(n);break;case e.TYPES.double:i.writeFloat64(n);break;case e.TYPES.string:i.writeVString(n);break;case e.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");o=n.offset,i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case e.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case e.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(t<<3|e.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},c.decode=function(t,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,o;switch(this.type){case e.TYPES.int32:return 0|t.readVarint32();case e.TYPES.uint32:return t.readVarint32()>>>0;case e.TYPES.sint32:return 0|t.readVarint32ZigZag();case e.TYPES.fixed32:return t.readUint32()>>>0;case e.TYPES.sfixed32:return 0|t.readInt32();case e.TYPES.int64:return t.readVarint64();case e.TYPES.uint64:return t.readVarint64().toUnsigned();case e.TYPES.sint64:return t.readVarint64ZigZag();case e.TYPES.fixed64:return t.readUint64();case e.TYPES.sfixed64:return t.readInt64();case e.TYPES.bool:return!!t.readVarint32();case e.TYPES.enum:return t.readVarint32();case e.TYPES.float:return t.readFloat();case e.TYPES.double:return t.readDouble();case e.TYPES.string:return t.readVString();case e.TYPES.bytes:if(o=t.readVarint32(),t.remaining()<o)throw Error("Illegal number of bytes for "+this.toString(!0)+": "+o+" required but got only "+t.remaining());return(i=t.clone()).limit=i.offset+o,t.offset+=o,i;case e.TYPES.message:return o=t.readVarint32(),this.resolvedType.decode(t,o);case e.TYPES.group:return this.resolvedType.decode(t,-1,r)}throw Error("[INTERNAL] Illegal decode type")},c.valueFromString=function(t){if(!this.isMapKey)throw Error("valueFromString() called on non-map-key element");switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return this.verifyValue(parseInt(t));case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return this.verifyValue(t);case e.TYPES.bool:return"true"===t;case e.TYPES.string:return this.verifyValue(t);case e.TYPES.bytes:return r.fromBinary(t)}},c.valueToString=function(t){if(!this.isMapKey)throw Error("valueToString() called on non-map-key element");return this.type===e.TYPES.bytes?t.toString("binary"):t.toString()},I.Element=a,u=function(e,t,n,r,i,s){o.call(this,e,t,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=u.prototype=Object.create(o.prototype)).build=function(n){var i,o,s,a;if(this.clazz&&!n)return this.clazz;for(i=function(e,n){function i(t,n,o,s){var a,c,u,l,h,d,p;if(null===t||"object"!=typeof t)return s&&s instanceof e.Reflect.Enum&&null!==(a=e.Reflect.Enum.getName(s.object,t))?a:t;if(r.isByteBuffer(t))return n?t.toBase64():t.toBuffer();if(e.Long.isLong(t))return o?t.toString():e.Long.fromValue(t);if(Array.isArray(t))return c=[],t.forEach((function(e,t){c[t]=i(e,n,o,s)})),c;if(c={},t instanceof e.Map){for(l=(u=t.entries()).next();!l.done;l=u.next())c[t.keyElem.valueToString(l.value[0])]=i(l.value[1],n,o,t.valueElem.resolvedType);return c}for(p in h=t.$type,d=void 0,t)t.hasOwnProperty(p)&&(c[p]=h&&(d=h.getChild(p))?i(t[p],n,o,d.resolvedType):i(t[p],n,o));return c}var o,s,a=n.getChildren(e.Reflect.Message.Field),c=n.getChildren(e.Reflect.Message.OneOf),u=function(t){var i,o,s,l;for(e.Builder.Message.call(this),i=0,o=c.length;o>i;++i)this[c[i].name]=null;for(i=0,o=a.length;o>i;++i)this[(s=a[i]).name]=s.repeated?[]:s.map?new e.Map(s):null,!s.required&&"proto3"!==n.syntax||null===s.defaultValue||(this[s.name]=s.defaultValue);if(arguments.length>0)if(1!==arguments.length||null===t||"object"!=typeof t||!("function"!=typeof t.encode||t instanceof u)||Array.isArray(t)||t instanceof e.Map||r.isByteBuffer(t)||t instanceof ArrayBuffer||e.Long&&t instanceof e.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(l=arguments[i])&&this.$set(a[i].name,l);else this.$set(t)},l=u.prototype=Object.create(e.Builder.Message.prototype);for(l.add=function(t,r,i){var o=n._fieldsByName[t];if(!i){if(!o)throw Error(this+"#"+t+" is undefined");if(!(o instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+o.toString(!0));if(!o.repeated)throw Error(this+"#"+t+" is not a repeated field");r=o.verifyValue(r,!0)}return null===this[t]&&(this[t]=[]),this[t].push(r),this},l.$add=l.add,l.set=function(t,r,i){var o,s,a;if(t&&"object"==typeof t){for(o in i=r,t)t.hasOwnProperty(o)&&void 0!==(r=t[o])&&this.$set(o,r,i);return this}if(s=n._fieldsByName[t],i)this[t]=r;else{if(!s)throw Error(this+"#"+t+" is not a field: undefined");if(!(s instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+s.toString(!0));this[s.name]=r=s.verifyValue(r)}return s&&s.oneof&&(a=this[s.oneof.name],null!==r?(null!==a&&a!==s.name&&(this[a]=null),this[s.oneof.name]=s.name):a===t&&(this[s.oneof.name]=null)),this},l.$set=l.set,l.get=function(t,r){if(r)return this[t];var i=n._fieldsByName[t];if(!(i&&i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: undefined");if(!(i instanceof e.Reflect.Message.Field))throw Error(this+"#"+t+" is not a field: "+i.toString(!0));return this[i.name]},l.$get=l.get,o=0;o<a.length;o++)(s=a[o])instanceof e.Reflect.Message.ExtensionField||n.builder.options.populateAccessors&&function(e){var t,r,i,o=e.originalName.replace(/(_[a-zA-Z])/g,(function(e){return e.toUpperCase().replace("_","")}));o=o.substring(0,1).toUpperCase()+o.substring(1),t=e.originalName.replace(/([A-Z])/g,(function(e){return"_"+e})),r=function(t,n){return this[e.name]=n?t:e.verifyValue(t),this},i=function(){return this[e.name]},null===n.getChild("set"+o)&&(l["set"+o]=r),null===n.getChild("set_"+t)&&(l["set_"+t]=r),null===n.getChild("get"+o)&&(l["get"+o]=i),null===n.getChild("get_"+t)&&(l["get_"+t]=i)}(s);return l.encode=function(e,r){var i,o;"boolean"==typeof e&&(r=e,e=void 0),i=!1,e||(e=new t,i=!0),o=e.littleEndian;try{return n.encode(this,e.LE(),r),(i?e.flip():e).LE(o)}catch(t){throw e.LE(o),t}},u.encode=function(e,t,n){return new u(e).encode(t,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(e){var t,i=!1;return e||(e=new r,i=!0),t=(new r).LE(),n.encode(this,t).flip(),e.writeVarint32(t.remaining()),e.append(t),i?e.flip():e},l.encodeAB=function(){try{return this.encode().toArrayBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toArrayBuffer()),e}},l.toArrayBuffer=l.encodeAB,l.encodeNB=function(){try{return this.encode().toBuffer()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBuffer()),e}},l.toBuffer=l.encodeNB,l.encode64=function(){try{return this.encode().toBase64()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toBase64()),e}},l.toBase64=l.encode64,l.encodeHex=function(){try{return this.encode().toHex()}catch(e){throw e.encoded&&(e.encoded=e.encoded.toHex()),e}},l.toHex=l.encodeHex,l.toRaw=function(e,t){return i(this,!!e,!!t,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},u.decode=function(e,t){var i,o;"string"==typeof e&&(e=r.wrap(e,t||"base64")),i=(e=r.isByteBuffer(e)?e:r.wrap(e)).littleEndian;try{return o=n.decode(e.LE()),e.LE(i),o}catch(t){throw e.LE(i),t}},u.decodeDelimited=function(e,t){var i,o,s;if("string"==typeof e&&(e=r.wrap(e,t||"base64")),(e=r.isByteBuffer(e)?e:r.wrap(e)).remaining()<1)return null;if(i=e.offset,o=e.readVarint32(),e.remaining()<o)return e.offset=i,null;try{return s=n.decode(e.slice(e.offset,e.offset+o).LE()),e.offset+=o,s}catch(t){throw e.offset+=o,t}},u.decode64=function(e){return u.decode(e,"base64")},u.decodeHex=function(e){return u.decode(e,"hex")},u.decodeJSON=function(e){return new u(JSON.parse(e))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),u}(e,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 u||o instanceof T){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},l.encode=function(e,t,n){var r,i,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)i=e[(r=this._fields[o]).name],r.required&&null===i?null===c&&(c=r):r.encode(n?i:r.verifyValue(i),t,e);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=t,a;return t},l.calculate=function(e){for(var t,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=e[(t=this._fields[i]).name],t.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+t);r+=t.calculate(n,e)}return r},l.decode=function(t,n,r){var o,s,a,c,u,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,u=t.offset,l=new this.clazz;t.offset<u+n||-1===n&&t.remaining()>0;){if(a=(o=t.readVarint32())>>>3,(s=7&o)===e.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?l[c.name].push(c.decode(s,t)):c.map?(d=c.decode(s,t),l[c.name].set(d[0],d[1])):(l[c.name]=c.decode(s,t),c.oneof&&(null!==(p=l[c.oneof.name])&&p!==c.name&&(l[p]=null),l[c.oneof.name]=c.name));else switch(s){case e.WIRE_TYPES.VARINT:t.readVarint32();break;case e.WIRE_TYPES.BITS32:t.offset+=4;break;case e.WIRE_TYPES.BITS64:t.offset+=8;break;case e.WIRE_TYPES.LDELIM:h=t.readVarint32(),t.offset+=h;break;case e.WIRE_TYPES.STARTGROUP:for(;i(a,t););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(c=this._fields[g]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,_;e.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},I.Message=u,h=function(t,n,r,i,o,s,a,c,l,h){y.call(this,t,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=e.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(y.prototype)).build=function(){this.element=new a(this.type,this.resolvedType,!1,this.syntax),this.map&&(this.keyElement=new a(this.keyType,void 0,!0,this.syntax)),"proto3"!==this.syntax||this.repeated||this.map?void 0!==this.options.default&&(this.defaultValue=this.verifyValue(this.options.default)):this.defaultValue=a.defaultFieldValue(this.type)},d.verifyValue=function(t,n){var r,i,o;if(n=n||!1,r=function(e,t){throw Error("Illegal value for "+this.toString(!0)+" of type "+this.type.name+": "+e+" ("+t+")")}.bind(this),null===t)return this.required&&r(typeof t,"required"),"proto3"===this.syntax&&this.type!==e.TYPES.message&&r(typeof t,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(t)||(t=[t]),o=[],i=0;i<t.length;i++)o.push(this.element.verifyValue(t[i]));return o}return this.map&&!n?t instanceof e.Map?t:(t instanceof Object||r(typeof t,"expected ProtoBuf.Map or raw object for map field"),new e.Map(this,t)):(!this.repeated&&Array.isArray(t)&&r(typeof t,"no array expected"),this.element.verifyValue(t))},d.hasWirePresence=function(t,n){if("proto3"!==this.syntax)return null!==t;if(this.oneof&&n[this.oneof.name]===this.name)return!0;switch(this.type){case e.TYPES.int32:case e.TYPES.sint32:case e.TYPES.sfixed32:case e.TYPES.uint32:case e.TYPES.fixed32:return 0!==t;case e.TYPES.int64:case e.TYPES.sint64:case e.TYPES.sfixed64:case e.TYPES.uint64:case e.TYPES.fixed64:return 0!==t.low||0!==t.high;case e.TYPES.bool:return t;case e.TYPES.float:case e.TYPES.double:return 0!==t;case e.TYPES.string:return t.length>0;case e.TYPES.bytes:return t.remaining()>0;case e.TYPES.enum:return 0!==t;case e.TYPES.message:return null!==t;default:return!0}},d.encode=function(t,n,i){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return n;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.ensureCapacity(n.offset+=1),s=n.offset,o=0;o<t.length;o++)this.element.encodeValue(this.id,t[o],n);a=n.offset-s,(c=r.calculateVarint32(a))>1&&(u=n.slice(s,n.offset),s+=c-1,n.offset=s,n.append(u)),n.writeVarint32(a,s-c)}else for(o=0;o<t.length;o++)n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t[o],n);else this.map?t.forEach((function(t,i){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);n.writeVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),n.writeVarint32(o),n.writeVarint32(8|this.keyType.wireType),this.keyElement.encodeValue(1,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,t,n)}),this):this.hasWirePresence(t,i)&&(n.writeVarint32(this.id<<3|this.type.wireType),this.element.encodeValue(this.id,t,n))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return n},d.calculate=function(t,n){var i,o,s;if(t=this.verifyValue(t),null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===t||this.repeated&&0==t.length)return 0;i=0;try{if(this.repeated)if(this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),s=0,o=0;o<t.length;o++)s+=this.element.calculateLength(this.id,t[o]);i+=r.calculateVarint32(s),i+=s}else for(o=0;o<t.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t[o]);else this.map?t.forEach((function(t,n){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,t);i+=r.calculateVarint32(this.id<<3|e.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(o),i+=o}),this):this.hasWirePresence(t,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,t))}catch(e){throw Error("Illegal value for "+this.toString(!0)+": "+t+" ("+e+")")}return i},d.decode=function(t,n,r){var i,o,s,c,u,l,h;if(!(!this.map&&t==this.type.wireType||!r&&this.repeated&&this.options.packed&&t==e.WIRE_TYPES.LDELIM||this.map&&t==e.WIRE_TYPES.LDELIM))throw Error("Illegal wire type for field "+this.toString(!0)+": "+t+" ("+this.type.wireType+" expected)");if(t==e.WIRE_TYPES.LDELIM&&this.repeated&&this.options.packed&&e.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0&&!r){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(c=a.defaultFieldValue(this.keyType),i=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((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(t=7&(l=u.readVarint32()),1===(h=l>>>3))c=this.keyElement.decode(u,t,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,t,h)}return[c,i]}return this.element.decode(n,t,this.id)},I.Message.Field=h,p=function(e,t,n,r,i,o,s){h.call(this,e,t,n,null,r,i,o,s),this.extension},p.prototype=Object.create(h.prototype),I.Message.ExtensionField=p,g=function(e,t,n){y.call(this,e,t,n),this.fields=[]},I.Message.OneOf=g,f=function(e,t,n,r,i){o.call(this,e,t,n,r,i),this.className="Enum",this.object=null},f.getName=function(e,t){var n,r,i=Object.keys(e);for(r=0;r<i.length;++r)if(e[n=i[r]]===t)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(t){var n,r,i,o;if(this.object&&!t)return this.object;for(n=new e.Builder.Enum,i=0,o=(r=this.getChildren(f.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},I.Enum=f,_=function(e,t,n,r){y.call(this,e,t,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(y.prototype),I.Enum.Value=_,E=function(e,t,n,r){y.call(this,e,t,n),this.field=r},E.prototype=Object.create(y.prototype),I.Extension=E,T=function(e,t,n,r){o.call(this,e,t,n,r),this.className="Service",this.clazz=null},(T.prototype=Object.create(o.prototype)).build=function(t){return this.clazz&&!t?this.clazz:this.clazz=function(e,t){var n,i=function(t){e.Builder.Service.call(this),this.rpcImpl=t||function(e,t,n){setTimeout(n.bind(this,Error("Not implemented, see: https://github.com/dcodeIO/ProtoBuf.js/wiki/Services")),0)}},o=i.prototype=Object.create(e.Builder.Service.prototype),s=t.getChildren(e.Reflect.Service.RPCMethod);for(n=0;n<s.length;n++)!function(e){o[e.name]=function(n,i){try{try{n=e.resolvedRequestType.clazz.decode(r.wrap(n))}catch(e){if(!(e instanceof TypeError))throw e}if(null===n||"object"!=typeof n)throw Error("Illegal arguments");n instanceof e.resolvedRequestType.clazz||(n=new e.resolvedRequestType.clazz(n)),this.rpcImpl(e.fqn(),n,(function(n,r){if(!n){try{r=e.resolvedResponseType.clazz.decode(r)}catch(e){}return r&&r instanceof e.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+t.name+"#"+e.name))}i(n)}))}catch(e){setTimeout(i.bind(this,e),0)}},i[e.name]=function(t,n,r){new i(t)[e.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[e.name],"$options",{value:e.buildOpt()}),Object.defineProperty(o[e.name],"$options",{value:i[e.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:t.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:t}),Object.defineProperty(o,"$type",{value:t})),i}(e,this)},I.Service=T,C=function(e,t,n,r){y.call(this,e,t,n),this.className="Service.Method",this.options=r||{}},(C.prototype=Object.create(y.prototype)).buildOpt=s.buildOpt,I.Service.Method=C,v=function(e,t,n,r,i,o,s,a){C.call(this,e,t,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},v.prototype=Object.create(C.prototype),I.Service.RPCMethod=v,I}(o),o.Builder=function(e,t,n){function r(e){e.messages&&e.messages.forEach((function(t){t.syntax=e.syntax,r(t)})),e.enums&&e.enums.forEach((function(t){t.syntax=e.syntax}))}var i=function(e){this.ns=new n.Namespace(this,null,""),this.ptr=this.ns,this.resolved=!1,this.result=null,this.files={},this.importRoot=null,this.options=e||{}},o=i.prototype;return i.isMessage=function(e){return"string"==typeof e.name&&(void 0===e.values&&void 0===e.rpc)},i.isMessageField=function(e){return"string"==typeof e.rule&&"string"==typeof e.name&&"string"==typeof e.type&&void 0!==e.id},i.isEnum=function(e){return"string"==typeof e.name&&!(void 0===e.values||!Array.isArray(e.values)||0===e.values.length)},i.isService=function(e){return!("string"!=typeof e.name||"object"!=typeof e.rpc||!e.rpc)},i.isExtend=function(e){return"string"==typeof e.ref},o.reset=function(){return this.ptr=this.ns,this},o.define=function(e){if("string"!=typeof e||!t.TYPEREF.test(e))throw Error("illegal namespace: "+e);return e.split(".").forEach((function(e){var t=this.ptr.getChild(e);null===t&&this.ptr.addChild(t=new n.Namespace(this,this.ptr,e)),this.ptr=t}),this),this},o.create=function(t){var r,o,s,a,c;if(!t)return this;if(Array.isArray(t)){if(0===t.length)return this;t=t.slice()}else t=[t];for(r=[t];r.length>0;){if(t=r.pop(),!Array.isArray(t))throw Error("not a valid namespace: "+JSON.stringify(t));for(;t.length>0;){if(o=t.shift(),i.isMessage(o)){if(s=new n.Message(this,this.ptr,o.name,o.options,o.isGroup,o.syntax),a={},o.oneofs&&Object.keys(o.oneofs).forEach((function(e){s.addChild(a[e]=new n.Message.OneOf(this,s,e))}),this),o.fields&&o.fields.forEach((function(e){if(null!==s.getChild(0|e.id))throw Error("duplicate or invalid field id in "+s.name+": "+e.id);if(e.options&&"object"!=typeof e.options)throw Error("illegal field options in "+s.name+"#"+e.name);var t=null;if("string"==typeof e.oneof&&!(t=a[e.oneof]))throw Error("illegal oneof in "+s.name+"#"+e.name+": "+e.oneof);e=new n.Message.Field(this,s,e.rule,e.keytype,e.type,e.name,e.id,e.options,t,o.syntax),t&&t.fields.push(e),s.addChild(e)}),this),c=[],o.enums&&o.enums.forEach((function(e){c.push(e)})),o.messages&&o.messages.forEach((function(e){c.push(e)})),o.services&&o.services.forEach((function(e){c.push(e)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){r.push(t),t=c,c=null,this.ptr=s,s=null;continue}c=null}else if(i.isEnum(o))s=new n.Enum(this,this.ptr,o.name,o.options,o.syntax),o.values.forEach((function(e){s.addChild(new n.Enum.Value(this,s,e.name,e.id))}),this),this.ptr.addChild(s);else if(i.isService(o))s=new n.Service(this,this.ptr,o.name,o.options),Object.keys(o.rpc).forEach((function(e){var t=o.rpc[e];s.addChild(new n.Service.RPCMethod(this,s,e,t.request,t.response,!!t.request_stream,!!t.response_stream,t.options))}),this),this.ptr.addChild(s);else{if(!i.isExtend(o))throw Error("not a valid definition: "+JSON.stringify(o));if(s=this.ptr.resolve(o.ref,!0))o.fields.forEach((function(t){var r,i,o,a;if(null!==s.getChild(0|t.id))throw Error("duplicate extended field id in "+s.name+": "+t.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(e){t.id>=e[0]&&t.id<=e[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+t.id+" (not within valid ranges)");i=t.name,this.options.convertFieldsToCamelCase&&(i=e.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,t.rule,t.type,this.ptr.fqn()+"."+i,t.id,t.options),a=new n.Extension(this,this.ptr,t.name,o),o.extension=a,this.ptr.addChild(a),s.addChild(o)}),this);else if(!/\.?google\.protobuf\./.test(o.ref))throw Error("extended message "+o.ref+" is not defined")}o=null,s=null}t=null,this.ptr=this.ptr.parent}return this.resolved=!1,this.result=null,this},o.import=function(t,n){var i,o,s,a,c,u,l,h,d="/";if("string"==typeof n){if(e.Util.IS_NODE,!0===this.files[n])return this.reset();this.files[n]=!0}else if("object"==typeof n){if(i=n.root,e.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=i+d+n.file,!0===this.files[o])return this.reset();this.files[o]=!0}if(t.imports&&t.imports.length>0){for(a=!1,"object"==typeof n?(this.importRoot=n.root,a=!0,s=this.importRoot,n=n.file,(s.indexOf("\\")>=0||n.indexOf("\\")>=0)&&(d="\\")):"string"==typeof n?this.importRoot?s=this.importRoot:n.indexOf("/")>=0?""===(s=n.replace(/\/[^\/]*$/,""))&&(s="/"):n.indexOf("\\")>=0?(s=n.replace(/\\[^\\]*$/,""),d="\\"):s=".":s=null,c=0;c<t.imports.length;c++)if("string"==typeof t.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=t.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!e.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(l=e.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(l+""),u):this.import(e.DotProto.Parser.parse(l),u)}else n?/\.(\w+)$/.test(n)?this.import(t.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(e,t,n){return t+"_import"+c+"."+n}))):this.import(t.imports[c],n+"_import"+c):this.import(t.imports[c]);a&&(this.importRoot=null)}return t.package&&this.define(t.package),t.syntax&&r(t),h=this.ptr,t.options&&Object.keys(t.options).forEach((function(e){h.options[e]=t.options[e]})),t.messages&&(this.create(t.messages),this.ptr=h),t.enums&&(this.create(t.enums),this.ptr=h),t.services&&(this.create(t.services),this.ptr=h),t.extends&&this.create(t.extends),this.reset()},o.resolveAll=function(){var r;if(null==this.ptr||"object"==typeof this.ptr.type)return this;if(this.ptr instanceof n.Namespace)this.ptr.children.forEach((function(e){this.ptr=e,this.resolveAll()}),this);else if(this.ptr instanceof n.Message.Field){if(t.TYPE.test(this.ptr.type))this.ptr.type=e.TYPES[this.ptr.type];else{if(!t.TYPEREF.test(this.ptr.type))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);if(!(r=(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=r,r instanceof n.Enum){if(this.ptr.type=e.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.isGroup?e.TYPES.group:e.TYPES.message}}if(this.ptr.map){if(!t.TYPE.test(this.ptr.keyType))throw Error("illegal key type for map field in "+this.ptr.toString(!0)+": "+this.ptr.keyType);this.ptr.keyType=e.TYPES[this.ptr.keyType]}}else if(this.ptr instanceof e.Reflect.Service.Method){if(!(this.ptr instanceof e.Reflect.Service.RPCMethod))throw Error("illegal service type in "+this.ptr.toString(!0));if(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof e.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}else if(!(this.ptr instanceof e.Reflect.Message.OneOf||this.ptr instanceof e.Reflect.Extension||this.ptr instanceof e.Reflect.Enum.Value))throw Error("illegal object in namespace: "+typeof this.ptr+": "+this.ptr);return this.reset()},o.build=function(e){var t,n,r;if(this.reset(),this.resolved||(this.resolveAll(),this.resolved=!0,this.result=null),null===this.result&&(this.result=this.ns.build()),!e)return this.result;for(t="string"==typeof e?e.split("."):e,n=this.result,r=0;r<t.length;r++){if(!n[t[r]]){n=null;break}n=n[t[r]]}return n},o.lookup=function(e,t){return e?this.ns.resolve(e,t):this.ns},o.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(o,o.Lang,o.Reflect),o.Map=function(e,t){function n(e){var t=0;return{next:function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}}var r=function(e,n){var r,i,o,s;if(!e.map)throw Error("field is not a map");if(this.field=e,this.keyElem=new t.Element(e.keyType,null,!0,e.syntax),this.valueElem=new t.Element(e.type,e.resolvedType,!1,e.syntax),this.map={},Object.defineProperty(this,"size",{get:function(){return Object.keys(this.map).length}}),n)for(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e)),n=t in this.map;return delete this.map[t],n},i.entries=function(){var e,t,r=[],i=Object.keys(this.map);for(t=0;t<i.length;t++)r.push([(e=this.map[i[t]]).key,e.value]);return n(r)},i.keys=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].key);return n(t)},i.values=function(){var e,t=[],r=Object.keys(this.map);for(e=0;e<r.length;e++)t.push(this.map[r[e]].value);return n(t)},i.forEach=function(e,t){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)e.call(t,(n=this.map[i[r]]).value,n.key,this)},i.set=function(e,t){var n=this.keyElem.verifyValue(e),r=this.valueElem.verifyValue(t);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(e){var t=this.keyElem.valueToString(this.keyElem.verifyValue(e));return t in this.map?this.map[t].value:void 0},i.has=function(e){return this.keyElem.valueToString(this.keyElem.verifyValue(e))in this.map},r}(0,o.Reflect),o.loadProto=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=void 0),o.loadJson(o.DotProto.Parser.parse(e),t,n)},o.protoFromString=o.loadProto,o.loadProtoFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadProto(r,n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadProto(r,n,e)},o.protoFromFile=o.loadProtoFile,o.newBuilder=function(e){return void 0===(e=e||{}).convertFieldsToCamelCase&&(e.convertFieldsToCamelCase=o.convertFieldsToCamelCase),void 0===e.populateAccessors&&(e.populateAccessors=o.populateAccessors),new o.Builder(e)},o.loadJson=function(e,t,n){return("string"==typeof t||t&&"string"==typeof t.file&&"string"==typeof t.root)&&(n=t,t=null),t&&"object"==typeof t||(t=o.newBuilder()),"string"==typeof e&&(e=JSON.parse(e)),t.import(e,n),t.resolveAll(),t},o.loadJsonFile=function(e,t,n){if(t&&"object"==typeof t?(n=t,t=null):t&&"function"==typeof t||(t=null),t)return o.Util.fetch("string"==typeof e?e:e.root+"/"+e.file,(function(r){if(null!==r)try{t(null,o.loadJson(JSON.parse(r),n,e))}catch(e){t(e)}else t(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof e?e.root+"/"+e.file:e);return null===r?null:o.loadJson(JSON.parse(r),n,e)},i=e,o.loadProto(i,void 0,"").build("Modules").probuf}(n,t);return r}var vn,In,yn=function(){function e(e,t,n){this.pbmaps=e,this.logger=n,this.pbModules=Cn(t)}return e.prototype.getModule=function(e){return new this.pbModules[e]},e.prototype.encode=function(e,t,n){var r=new this.pbModules[e];if(t)try{this.pbmaps[e].forEach((function(e){var n=t[e];void 0!==n&&r["set".concat(function(e,t,n){if(void 0===t||void 0===n)return e.toUpperCase();var r=e.slice(t,n);return e.replace(r,(function(e){return e.toUpperCase()}))}(e,0,1))](n)}))}catch(t){var i="pbname: ".concat(e,", stack: ").concat(t.stack);this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,i):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,i)}return n?r:r.toArrayBuffer()},e.prototype.decode=function(e,t){var n=this.pbModules[e].decode(t);return this.fixInt64Values(n)},e.prototype.fixInt64Values=function(e){var t=this;if(e instanceof Array)return e.map((function(e){return t.fixInt64Values(e)}));if(!Ke(e))return e;if(void 0!==e.low&&void 0!==e.high&&Object.prototype.hasOwnProperty.call(e,"unsigned")){var n=e.low;return n<0&&(n+=4294967296),n=n.toString(16),parseInt(e.high.toString(16)+"00000000".replace(new RegExp("0{".concat(n.length,"}$")),n),16)}for(var r in e)e[r]=this.fixInt64Values(e[r]);return e},e}();exports.AreaCode=void 0,(In=exports.AreaCode||(exports.AreaCode={}))[In.BJ=1]="BJ",In[In.SG=2]="SG",In[In.NA=3]="NA";var mn=((vn={})[exports.AreaCode.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="]},vn[exports.AreaCode.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"]},vn[exports.AreaCode.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[]},vn);function Rn(e){return e>=exports.AreaCode.BJ&&e<=3?e:exports.AreaCode.BJ}exports.EConnectProtocol.HTTPS;var Sn=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e){var t,n=this.initOption||{},r=n.areaCode,i=n.navigators,o=(t=r,void 0===t&&(t=exports.AreaCode.BJ),mn[Rn(t)].naviUrlBase64).map((function(e){return _t(e)})),s=e.split("@")[1],a=s?s.split(";"):[],c=i&&i.length>0?h(h([],a,!0),i,!0):h(h([],a,!0),o,!0);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return At(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,r=e||{},i=r.log,o=r.logPolicy,s=this.initOption||{},a=s.areaCode,u=s.logServerUrl,l=(n=a,void 0===n&&(n=exports.AreaCode.BJ),mn[Rn(n)].logUrlBase64).map((function(e){return c(c({},e),{addr:_t(e.addr)})})),d=[],p={level:1,itv:6,times:5};if(i)d.push.apply(d,i.addrs),Object.assign(p,i.policy);else if(o)try{var g=JSON.parse(o);d.push({addr:g.url,protocol:exports.EConnectProtocol.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){t.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var f=u?h([{addr:u,protocol:exports.EConnectProtocol.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,addrs:f.filter((function(e,t){return f.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return c(c({},e),{addr:At(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=exports.AreaCode.BJ),mn[Rn(t)].miniCmpBase64).map((function(e){return _t(e)})),r=(this.initOption||{}).miniCMPProxy;return r&&r.length>0?r:n},e.prototype.getStaticConfigUrl=function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=exports.AreaCode.BJ),mn[Rn(t)].staticConfigUrlBase64).map((function(e){return _t(e)}))},e}(),On=new Sn,Nn=function(){function e(e,t,n){void 0===n&&(n=exports.AreaCode.BJ),this.appkey=e,this.logger=t,this.areaCode=n,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:if(!(t=this.getCache()))return[3,6];s.label=1;case 1:return s.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<L?[4,this.decryptData(n.val)]:[3,3];case 2:return[2,{navi:s.sent().resources.navi.sort((function(e,t){return t.weight-e.weight})).map((function(e){return At(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return r=s.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==r?void 0:r.stack})),[3,5];case 5:this.clearCache(),s.label=6;case 6:return[4,this._requestHandle()];case 7:return(i=s.sent())?[4,this.decryptData(i)]:[2];case 8:return(null==(o=s.sent())?void 0:o.areaCode)!==this.areaCode?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:i})),this.staticUrls=(null==o?void 0:o.bootstrap)||[],[2,{navi:(null===(e=null==o?void 0:o.resources)||void 0===e?void 0:e.navi.sort((function(e,t){return t.weight-e.weight})).map((function(e){return At(e.addr,e.protocol)})))||[]}])}}))}))},e.prototype._requestHandle=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:e=(e=h(h([],this.staticUrls,!0),On.getStaticConfigUrl(),!0).map((function(e){return At(e)}))).filter((function(t,n){return e.indexOf(t)===n})),t=0,n=e,c.label=1;case 1:return t<n.length?(r=n[t],this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_T,JSON.stringify({url:r})),i=Date.now(),[4,this.sendRequest("".concat(r,"/").concat(this.appkey))]):[3,4];case 2:if(o=c.sent(),s=o.code,a=o.data,200===s)return this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-i})),[2,a];this.logger.warn(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-i})),c.label=3;case 3:return t++,[3,1];case 4:return[2]}}))}))},e.prototype.setAreaCode=function(e){this.areaCode=e},e}(),Mn=ht(),Ln=Date.now(),Un=null,An="RC_LOGS",wn="RC_CONF",Pn=null,bn=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Un];case 1:return(t=n.sent())?[4,new Promise((function(n){var r=t.db.transaction(An,"readwrite").objectStore(An),i=IDBKeyRange.lowerBound(Date.now()-e),o=r.getAllKeys(i);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var i=r.delete(IDBKeyRange.bound(e[0],e[t-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),Pn=setTimeout((function(){return bn(e)}),6e5),[2]}}))}))},xn=function(e,t,n,r){void 0===r&&(r=168),Un||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==Ft(n).type?Un=new Promise((function(n){var i=window.indexedDB;i.databases&&i.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(e),s=i.open(o,1);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),n(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(e){t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},bn(3600*Math.max(24,Math.min(168,r))*1e3),n({appkey:e,db:o})):n(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(An)&&t.deleteObjectStore(An);var n=t.createObjectStore(An,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(wn,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},Dn=function(){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return Un?(Pn&&(clearTimeout(Pn),Pn=null),[4,Un]):[2];case 1:return(e=t.sent())&&e.db.close(),Un=null,[2]}}))}))},Vn=[],Gn=!1,Bn=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return Gn||0===Vn.length?[2]:(Gn=!0,t=Vn.splice(0),[4,new Promise((function(n){var r=e.transaction(An,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(An);t.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),Gn=!1,setTimeout((function(){return Bn(e)})),[2]}}))}))};function kn(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Un];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(wn,"readonly").objectStore(wn).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Fn,Hn=0,Kn=function(){return{setTimestamp4RealtimeLog:function(e){Hn=e},getTimestamp4RealtimeLog:function(){return Hn},getLogs:function(e,t,n,r){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return[4,Un];case 1:return(i=o.sent())?[2,new Promise((function(o){var s=i.db.transaction(An,"readonly").objectStore(An),a=[],c=IDBKeyRange.bound(e,t),u=s.index("time").openCursor(c);u.onsuccess=function(e){var t=e.target.result;if(t){var i=t.value;i.level<=n&&(r?i.sessionId===Mn:i.level>=0)&&a.push(i),t.continue()}else o({dbReady:!0,logs:a})},u.onerror=function(e){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},qn="REPORT_SESSION",Yn=function(e,t){return u(void 0,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(qn,"_").concat(e),[4,kn("".concat(qn,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){u(this,void 0,void 0,(function(){var n,r;return l(this,(function(i){switch(i.label){case 0:return[4,Un];case 1:return(n=i.sent())?(r=n.db,r.transaction(wn,"readwrite").objectStore(wn).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))};exports.LogL=void 0,(Fn=exports.LogL||(exports.LogL={}))[Fn.STATISTICS=-2]="STATISTICS",Fn[Fn.RECORD=-1]="RECORD",Fn[Fn.FATAL=0]="FATAL",Fn[Fn.ERROR=1]="ERROR",Fn[Fn.WARN=2]="WARN",Fn[Fn.INFO=3]="INFO",Fn[Fn.DEBUG=4]="DEBUG";var jn=function(e){return[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((function(t){return t===e}))},Qn=0,Wn=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS)}return e.prototype._stdout=function(e,t,n,r,i){if(!(e<=exports.LogL.FATAL)&&console&&!(e>this.outputLevel)){var o=["error","warn","info","debug"][e-1];null===console||void 0===console||console[o]("".concat(n,"[").concat(this._id,"][").concat(o.toUpperCase(),"]: ").concat(t," | ").concat(r," | ").concat(i))}},e.prototype.setOutputLevel=function(e){jn(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,r){var i=new Date;/^[\w-]+$/.test(t)?(this._stdout(e,t,i.toISOString(),n,r),e!==exports.LogL.DEBUG&&this.flush({time:+i,sessionId:Mn,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:r})):this._stdout(exports.LogL.ERROR,"L_LOG_TAG_INVALID_E",i.toISOString(),t,r)},e.prototype.createTraceId=function(){return"".concat(++Qn)},e.prototype.getSessionId=function(){return Mn},e}(),Jn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){!function(e){u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,Un];case 1:return(t=n.sent())?(Vn.push(e),Bn(t.db),[2]):[2]}}))}))}(e)},t}(Wn),Xn=function(){function e(e,t,n,r,i){this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=r,this.logger=i,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){var t,n,r;return l(this,(function(i){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=On.getLogUrlPolicyList(e,this.logger),n=t.policy,r=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,r.length>0&&this.realtimeReport(r[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return r=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||Ln,o=Math.max(r-5e3,i),s=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:t,itv:n}),s),[4,this.logDB.getLogs(i,o,t,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressLogs(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),g=je(e)?e:"https://".concat(e),g+="?version=".concat("5.8.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(u[u.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(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,r,i,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o}),s),[4,this.logDB.getLogs(e,t,exports.LogL.DEBUG,!1)]);case 1:return a=l.sent(),c=a.dbReady,u=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),s),h=je(r)?r:"https://".concat(r),h+="?version=".concat("5.8.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),c?u.length>0?[4,this.compressLogs(u)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,f=p.data,d=g?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(exports.LogTagId.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(exports.LogTagId.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),Zn=48,zn=64,$n=80,er=96,tr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",nr=tr.length,rr=function(e){for(var t={},n=0;n<e.length-1;n++){var r=e.charAt(n)+e.charAt(n+1);t.hasOwnProperty(r)?t[r].push(n):t[r]=[n]}for(var i=[],o=[],s=function(){if(o.length>0){var e=o.join("");if(o=[],e.length>26){var t=or(e.length),n=String.fromCharCode($n|t.length);i.push(n+t)}else{var r=String.fromCharCode(er|e.length);i.push(r)}i.push(e)}},a=0;a<e.length;){var c=ir(t,e,a);if(c.length<2)o.push(e.charAt(a++));else if(c.length<4)o.push(e.substr(a,c.length)),a+=c.length;else{var u=or(a-c.offset),l=or(c.length);if(u.length+l.length>=c.length)o.push(e.substr(a,c.length)),a+=c.length;else{s();var h=String.fromCharCode(zn|u.length<<2|l.length);i.push(h+u+l),a+=c.length}}}s();var d=or(e.length),p=String.fromCharCode(Zn|d.length);return i.push(p+d),i.join("")},ir=function(e,t,n){var r={length:0,offset:-1};if(t.length,n>=t.length-1)return r;var i=e[t.charAt(n)+t.charAt(n+1)];if(i[0]===n)return r;for(var o=t.length-n,s=0,a=i.length;s<a;s++){var c=i[s],u=n-c;if(!(u>238327)){var l=Math.min(o,u);if(l<=r.length)break;if(!(r.length>2&&t.charAt(c+r.length-1)!==t.charAt(n+r.length-1))){for(var h=2,d=h;d<l&&t.charAt(c+d)===t.charAt(n+d);d++)h++;h>=r.length&&(r.length=h,r.offset=c)}}}return r},or=function(e){var t=[],n=0;do{n=e%nr,t.push(tr.charAt(n)),e=(e-n)/nr}while(e>0);return t.join("")},sr=function(e){var t="RCDeviceId",n=r(e),i="",o=n.get(t);return o?i=o:(i=ht(),n.set(t,i)),i},ar=function(e){if("browser"!==e.tag)return{type:e.tag,version:"UnKonw"};var t,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,t=s[1]||s[2];break}}return{type:n||"UnKonw",version:t||"UnKonw"}},cr=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,c=e.content,u=n<0?c||"":JSON.stringify({content:c,traceId:i,from:r});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},ur=function(e){function t(t,n,r,i){var o=this,s=sr(n),a=ar(n),c="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=e.call(this,t,s,c,Kn(),r)||this).runtime=n,o.clientReportLevel=i,jn(o.clientReportLevel)||(o.clientReportLevel=void 0),o}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Yn(t.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressLogs=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:rr(e.map(cr).join(""))}]}))}))},t.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.logger.getSessionId(),u(void 0,void 0,void 0,(function(){var e,r,i;return l(this,(function(o){switch(o.label){case 0:return[4,kn("".concat(qn,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,r,i,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,e.prototype.report.call(this,t,n,r,i,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r)]}))}))},t}(Xn),lr=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(e,t,n){return void 0===t&&(t=Date.now()-lr),void 0===n&&(n=Date.now()),u(this,void 0,void 0,(function(){var r,i;return l(this,(function(o){switch(o.label){case 0:return t=t<0?Date.now()+t:t,(n=n<=0?Date.now():n)-t>lr&&(t=n-lr),(r=new Jn(e,"RC-IM","IM")).debug(exports.LogTagId.T,"get logs: startTime ".concat(t," endTime ").concat(n)),xn(e,r,{tag:"browser"}),[4,Kn().getLogs(t,n,exports.LogL.DEBUG,!1)];case 1:return i=o.sent().logs,r.debug(exports.LogTagId.T,"get logs ".concat(i.length)),function(e,t){var n=t.map((function(e){var t=e.sessionId,n=e.time,r=e.type,i=e.level,o=e.tag,s=e.traceId,a=e.loggerId,c=e.content;return"".concat(t,",").concat(n,",").concat(r,",").concat(i,",").concat(o,",").concat(s,",").concat(a,',"').concat(c,'"\n')})),r=new Blob(n,{type:"text/csv"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download="".concat(e,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}("".concat(e,"-").concat(t,"-").concat(n),i),[2]}}))}))}}}}var hr,dr,pr,gr,fr,_r,Er,Tr=function(){function e(e){this._context=e}return e.prototype.__getContext=function(){return this._context},e.prototype.createCodec=function(e,t){return this._context.createCodec(e,t)},e.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._context.refetchNaviInfo()]}))}))},e.prototype.getNaviInfo=function(){return this._context.getNaviInfoFromCache()},e.prototype.getCoreVersion=function(){return"5.8.4"},e.prototype.getAPIVersion=function(){return"5.8.4"},e.prototype.getAppkey=function(){return this._context.appkey},e.prototype.getCurrentId=function(){return this._context.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.sendMessage=function(e,t,n){return this._context.sendMessage(e,t,n)},e.prototype.registerMessageType=function(e,t,n,r){void 0===r&&(r=[]),this._context.registerMessageType(e,t,n,r)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getOSInfo=function(){return this._context.getOSInfo()},e.prototype.getProcessInfo=function(){return this._context.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._context.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._context.setCallInfo(e,t,n)},e.prototype.createLogger=function(e,t){return this._context.createLogger(e,t)},e}(),Cr="pgMsgP",vr="chatMsg",Ir="pcMsgP",yr="pbMsgP",mr={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Rr="delMsg",Sr="joinChrm",Or="joinChrmR",Nr="exitChrm",Mr="setKV",Lr="delKV",Ur="setKVS",Ar="delKVS",wr="qryRelationR",Pr="delRelation",br="setSeAtt",xr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Dr="reqCall",Vr="pullKvMsg",Gr="qryPMsg",Br="qryGMsg",kr="qryCHMsg",Fr="qryCMsg",Hr="qrySMsg",Kr=((hr={})["ppMsgP"]=G.PRIVATE,hr[Cr]=G.GROUP,hr[vr]=G.CHATROOM,hr[Ir]=G.CUSTOMER_SERVICE,hr[yr]=G.SYSTEM,hr),qr=((dr={})[G.PRIVATE]=Gr,dr[G.GROUP]=Br,dr[G.CHATROOM]=kr,dr[G.CUSTOMER_SERVICE]=Fr,dr[G.SYSTEM]=Hr,dr),Yr=((pr={})[G.PRIVATE]=xr.PRIVATE,pr[G.GROUP]=xr.GROUP,pr[G.ULTRA_GROUP]=xr.ULTRA_GROUP,pr[G.CUSTOMER_SERVICE]=xr.CUSTOMER_SERVICE,pr[G.SYSTEM]=xr.SYSTEM,pr),jr="1",Qr="0",Wr=1,Jr=2,Xr=3;!function(e){e[e.AT_MOST_ONCE=0]="AT_MOST_ONCE",e[e.AT_LEAST_ONCE=1]="AT_LEAST_ONCE",e[e.EXACTLY_ONCE=2]="EXACTLY_ONCE",e[e.DEFAULT=3]="DEFAULT"}(gr||(gr={})),function(e){e[e.SYMMETRIC=0]="SYMMETRIC",e[e.CONNECT=1]="CONNECT",e[e.CONN_ACK=2]="CONN_ACK",e[e.PUBLISH=3]="PUBLISH",e[e.PUB_ACK=4]="PUB_ACK",e[e.QUERY=5]="QUERY",e[e.QUERY_ACK=6]="QUERY_ACK",e[e.QUERY_CONFIRM=7]="QUERY_CONFIRM",e[e.SUBSCRIBE=8]="SUBSCRIBE",e[e.SUB_ACK=9]="SUB_ACK",e[e.UNSUBSCRIBE=10]="UNSUBSCRIBE",e[e.UNSUB_ACK=11]="UNSUB_ACK",e[e.PING_REQ=12]="PING_REQ",e[e.PING_RESP=13]="PING_RESP",e[e.DISCONNECT=14]="DISCONNECT",e[e.RESERVER2=15]="RESERVER2"}(fr||(fr={})),function(e){e.PUB="pub",e.QUERY="qry"}(_r||(_r={})),function(e){e[e.V4=4]="V4",e[e.V3=3]="V3"}(Er||(Er={}));var Zr,zr=function(){function e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=gr.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=gr.AT_LEAST_ONCE,this._dup=!1,this.syncMsg=!1,e&&e>0&&1===arguments.length?(this._retain=(1&e)>0,this.qos=(6&e)>>1,this._dup=(8&e)>0,this.type=e>>4&15,this.syncMsg=8==(8&e)):(this.type=e,this._retain=t,this.qos=n,this._dup=r)}return e.prototype.encode=function(){var e=this.type<<4;return e|=this._retain?1:0,e|=this.qos<<1,e|=this._dup?8:0},e}(),$r=function(){function e(){}return e.writeUTF=function(e,t){for(var n=this._getBackAndByteSize(e),r=n.back,i=n.byteSize,o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return t?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},e._getBackAndByteSize=function(e){var t=[],n=0;if(Ge(e))for(var r=0,i=e.length;r<i;r++){var o=e.charCodeAt(r);o>=0&&o<=127?(n+=1,t.push(o)):o>=128&&o<=2047?(n+=2,t.push(192|31&o>>6),t.push(128|63&o)):o>=2048&&o<=65535&&(n+=3,t.push(224|15&o>>12),t.push(128|63&o>>6),t.push(128|63&o))}return{byteSize:n,back:t}},e.readUTF=function(e){for(var t,n,r=[],i=-1,o=e,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++i])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?r.push(a):(t=(a-=65536)>>10|55296,n=a%1024|56320,r.push(t,n)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},e}(),ei=function(){function e(e){this._position=0,this._poolLen=0,this._pool=e,this._poolLen=e.length}return e.prototype.check=function(){return this._position>=this._pool.length},e.prototype.read2Byte=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<2;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readInt=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<4;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r.toString()}return parseInt(t,16)},e.prototype.readLong=function(){var e=this;if(e.check())return-1;for(var t="",n=0;n<8;n++){var r=e._pool[e._position++].toString(16);1===r.length&&(r="0".concat(r)),t+=r}return parseInt(t,16)},e.prototype.readByte=function(){if(this.check())return-1;var e=this._pool[this._position++];return e>255&&(e&=255),e},e.prototype.readUTF=function(){if(this.check())return"";var e=this.readByte()<<8|this.readByte(),t=this._position;this._position+=e;var n=this._pool.subarray(t,this._position);return $r.readUTF(n)},e.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},e}(),ti=function(){function e(){this._pool=[],this._position=0,this._writen=0}return e.prototype.write=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")?this._pool=this._pool.concat(e):e>=0&&(e>255&&(e&=255),this._pool.push(e),this._writen++),e},e.prototype.writeArr=function(e){return this._pool=this._pool.concat(e),e},e.prototype.writeUTF=function(e){var t=$r.writeUTF(e);this._pool=this._pool.concat(t),this._writen+=t.length},e.prototype.getBytesArray=function(){return this._pool},e}(),ni=function(e,t){return e&&t?"".concat(t,"_").concat(e):e||Date.now()},ri=function(){function e(e){this.header=e,this.messageId=0,this.timestamp=0,this.syncMsg=!1,this.identifier=""}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ni(e,t)},e.prototype.read=function(e,t,n,r){this.readMessage(e,t,n,r)},e.prototype.readMessage=function(e,t,n,r){return{stream:t,length:n}},e}(),ii=function(){function e(e){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new zr(e,!1,gr.AT_MOST_ONCE,!1)}return e.prototype.getIdentifier=function(){var e=this.messageId,t=this.identifier;return ni(e,t)},e.prototype.write=function(e){var t=this.getHeaderFlag();e.write(t),this.writeMessage(e)},e.prototype.setHeaderQos=function(e){this._header.qos=e},e.prototype.getHeaderFlag=function(){return this._header.encode()},e.prototype.getLengthSize=function(){return this.lengthSize},e.prototype.getBufferData=function(){var e=new ti;this.write(e);var t=e.getBytesArray();return new Int8Array(t)},e}(),oi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=null,t.userId=null,t.timestamp=0,t}return a(t,e),t.prototype.readMessage=function(e,n,r,i){if(n.readByte(),this.status=+n.readByte(),r<=t.MESSAGE_LENGTH)return{stream:n,length:r};if(i===Er.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();e.debug(exports.LogTagId.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:r}},t.MESSAGE_LENGTH=2,t}(ri),si=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){return t.readByte(),this.status=+t.readByte(),{stream:t,length:n}},t.MESSAGE_LENGTH=2,t}(ri),ai=function(e){function t(){return e.call(this,fr.PING_REQ)||this}return a(t,e),t.prototype.writeMessage=function(e){},t}(ii),ci=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t}(ri),ui=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.messageId=0,t}return a(t,e),t.prototype.readMessage=function(e,t,n){var r=256*t.readByte()+t.readByte();return this.messageId=parseInt(r.toString(),10),{stream:t,length:n}},t}(ri),li=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.writeMessage=function(e){var t=this.messageId,n=255&t,r=(65280&t)>>8;e.write(r),e.write(n)},t}(ii),hi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.topic="",t.targetId="",t.syncMsg=!1,t.identifier=_r.PUB,t}return a(t,e),t.prototype.readMessage=function(t,n,r){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),e.prototype.readMessage.call(this,t,n,r),this.data=n.readAll(),{stream:n,length:r}},t}(ui),di=function(e){function t(t,n,r){var i=e.call(this,fr.PUBLISH)||this;return i.syncMsg=!1,i.identifier=_r.PUB,i.topic=t,i.data=Ge(n)?$r.writeUTF(n):n,i.targetId=r,i}return a(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(li),pi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.date=0,t.millisecond=0,t.messageUId="",t.timestamp=0,t.identifier=_r.PUB,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),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:r}},t}(ui),gi=function(e){function t(t){var n=e.call(this,fr.PUB_ACK)||this;return n.status=0,n.date=0,n.millisecond=0,n.messageUId="",n.timestamp=0,n.messageId=t,n}return a(t,e),t.prototype.writeMessage=function(t){e.prototype.writeMessage.call(this,t)},t}(li),fi=function(e){function t(t,n,r){var i=e.call(this,fr.QUERY)||this;return i.identifier=_r.QUERY,i.topic=t,i.data=Ge(n)?$r.writeUTF(n):n,i.targetId=r,i}return a(t,e),t.prototype.writeMessage=function(t){t.writeUTF(this.topic),t.writeUTF(this.targetId),e.prototype.writeMessage.call(this,t),t.write(this.data)},t}(li),_i=function(e){function t(t){var n=e.call(this,fr.QUERY_CONFIRM)||this;return n.messageId=t,n}return a(t,e),t}(li),Ei=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.status=0,t.identifier=_r.QUERY,t.topic="",t.targetId="",t}return a(t,e),t.prototype.readMessage=function(t,n,r){return e.prototype.readMessage.call(this,t,n,r),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:r}},t}(ui),Ti=function(e,t,n){var r=new Uint8Array(t),i=new ei(r),o=i.readByte(),s=function(e,t){var n,r=e.type;switch(r){case fr.CONN_ACK:n=new oi(e);break;case fr.PUBLISH:(n=new hi(e)).syncMsg=e.syncMsg;break;case fr.PUB_ACK:n=new pi(e);break;case fr.QUERY_ACK:n=new Ei(e);break;case fr.SUB_ACK:case fr.UNSUB_ACK:case fr.PING_RESP:n=new ci(e);break;case fr.DISCONNECT:n=new si(e);break;default:n=new ri(e),t.error(exports.LogTagId.O,"No support for deserializing ".concat(r," messages"))}return n}(new zr(o),e);return s.read(e,i,r.length-1,n),s};!function(e){e[e.ppMsgP=1]="ppMsgP",e[e.ppMsgN=2]="ppMsgN",e[e.ppMsgS=3]="ppMsgS",e[e.pgMsgP=4]="pgMsgP",e[e.chatMsg=5]="chatMsg",e[e.pcMsgP=6]="pcMsgP",e[e.qryPMsg=7]="qryPMsg",e[e.qryGMsg=8]="qryGMsg",e[e.qryCHMsg=9]="qryCHMsg",e[e.qryCMsg=10]="qryCMsg",e[e.qrySMsg=11]="qrySMsg",e[e.recallMsg=12]="recallMsg",e[e.prMsgS=13]="prMsgS",e[e.pbMsgP=14]="pbMsgP",e[e.rrMsg=15]="rrMsg",e[e.rrList=16]="rrList",e[e.s_ntf=17]="s_ntf",e[e.s_msg=18]="s_msg",e[e.s_stat=19]="s_stat",e[e.s_cmd=20]="s_cmd",e[e.s_us=21]="s_us",e[e.pullUS=22]="pullUS",e[e.pgMsgS=23]="pgMsgS",e[e.chatMsgS=24]="chatMsgS",e[e.qrySessionsAtt=25]="qrySessionsAtt",e[e.pullMsg=26]="pullMsg",e[e.qrySessions=27]="qrySessions",e[e.delSessions=28]="delSessions",e[e.delMsg=29]="delMsg",e[e.updRRTime=30]="updRRTime",e[e.chrmPull=31]="chrmPull",e[e.joinChrm=32]="joinChrm",e[e.joinChrmR=33]="joinChrmR",e[e.exitChrm=34]="exitChrm",e[e.queryChrmI=35]="queryChrmI",e[e.setKV=36]="setKV",e[e.delKV=37]="delKV",e[e.pullKV=38]="pullKV",e[e.qryRelation=39]="qryRelation",e[e.delRelation=40]="delRelation",e[e.pullSeAtts=41]="pullSeAtts",e[e.setSeAtt=42]="setSeAtt",e[e.qnTkn=43]="qnTkn",e[e.qnUrl=44]="qnUrl",e[e.aliUrl=45]="aliUrl",e[e.s3Url=46]="s3Url",e[e.stcUrl=47]="stcUrl",e[e.minioUrl=48]="minioUrl",e[e.cleanPMsg=49]="cleanPMsg",e[e.cleanGMsg=50]="cleanGMsg",e[e.cleanCMsg=51]="cleanCMsg",e[e.cleanSMsg=52]="cleanSMsg",e[e.rtcPing=53]="rtcPing",e[e.rtc_ntf=54]="rtc_ntf",e[e.rtcSetOutData=55]="rtcSetOutData",e[e.rtcQryUserOutData=56]="rtcQryUserOutData",e[e.addSeTag=57]="addSeTag",e[e.delSeTag=58]="delSeTag",e[e.addTag=59]="addTag",e[e.delTag=60]="delTag",e[e.disTag=61]="disTag",e[e.reportsdk=62]="reportsdk",e[e.pullUgSes=63]="pullUgSes",e[e.pullUgMsg=64]="pullUgMsg",e[e.ugMsg=65]="ugMsg",e[e.qryUgMsg=66]="qryUgMsg",e[e.updUgRTime=67]="updUgRTime",e[e.upMsgEx=68]="upMsgEx",e[e.modifyMsg=69]="modifyMsg",e[e.qryMsgChange=70]="qryMsgChange",e[e.qryMsg=71]="qryMsg",e[e.operate=72]="operate",e[e.s_opNtf=73]="s_opNtf",e[e.ugUnpushQuery=74]="ugUnpushQuery",e[e.ugUnpushSet=75]="ugUnpushSet",e[e.setRtcRoomId=76]="setRtcRoomId",e[e.qryUgUal=77]="qryUgUal",e[e.s_pubCall=78]="s_pubCall"}(Zr||(Zr={}));var Ci=Zr,vi=function(){function e(e,t){this._runtime=e,this._appkey=t,this._users={}}return e.prototype._getMemData=function(e){return this._users[e]=this._users[e]||{inboxTime:0,outboxTime:0,broadcastSyncTime:0},this._users[e]},e.prototype.setInboxTime=function(e,t){var n=this._getMemData(t);if(!(n.inboxTime>e)){n.inboxTime=e;var r=U.INBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getInboxTime=function(e){var t=this._getMemData(e);if(0===t.inboxTime){var n=U.INBOX_TIME_KEY(this._appkey,e);t.inboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.inboxTime},e.prototype.setBroadcastSyncTime=function(e,t){var n=this._getMemData(t);if(!(n.broadcastSyncTime>=e||Ye(e))){n.broadcastSyncTime=e;var r=U.BROADCASTBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getBroadcastSyncTime=function(e){var t=this._getMemData(e);if(!t||0===t.broadcastSyncTime){var n=U.BROADCASTBOX_TIME_KEY(this._appkey,e);t.broadcastSyncTime=parseInt(this._runtime.localStorage.getItem(n),10)||1}return t.broadcastSyncTime},e.prototype.setOutboxTime=function(e,t){var n=this._getMemData(t);if(!(n.outboxTime>=e)){n.outboxTime=e;var r=U.OUTBOX_TIME_KEY(this._appkey,t);this._runtime.localStorage.setItem(r,e.toString())}},e.prototype.getOutboxTime=function(e){var t=this._getMemData(e);if(0===t.outboxTime){var n=U.OUTBOX_TIME_KEY(this._appkey,e);t.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return t.outboxTime},e}(),Ii={_caches:{},set:function(e,t){this._caches[e]=t},get:function(e){return this._caches[e]||0},clear:function(e){this._caches[e]=0}},yi=function(){function e(e,t,n){this.logger=e,this._kvCaches={},this._chatroomId=t,this._currentUserId=n}return e.prototype._add=function(e){var t=e.key;e.isDeleted=!1,this._kvCaches[t]=e},e.prototype._remove=function(e){var t=e.key,n=this._kvCaches[t];n&&(n.isDeleted=!0,this._kvCaches[t]=n)},e.prototype._setEntry=function(e,t){var n=e.key,r=e.type,i=e.isOverwrite,o=e.userId,s=this._getSetUserId(n),a=r===ne.DELETE,c=s===o,u=!this._isExisted(n),l=a?this._remove:this._add;(t||i||c||u)&&l.call(this,e)},e.prototype.getValue=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.value},e.prototype.getVersion=function(e){var t=this._kvCaches[e]||{};return t.isDeleted?null:t.version},e.prototype.getAllValue=function(){var e={};for(var t in this._kvCaches)this._kvCaches[t].isDeleted||(e[t]=this._kvCaches[t].value);return e},e.prototype._getSetUserId=function(e){return(this._kvCaches[e]||{}).userId},e.prototype._isExisted=function(e){var t=this._kvCaches[e]||{},n=t.value,r=t.isDeleted;return n&&!r},e.prototype.setEntries=function(e){var t=this,n=e.kvEntries,r=e.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(e){t._setEntry(e,r)}))},e.prototype.clear=function(){this._kvCaches={}},e}(),mi=function(){function e(e){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=e}return e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],t=e.chrmId,n=e.timestamp,(r=Ii.get(t))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(t,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===D.SUCCESS?(Ii.set(t,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.reset=function(e){Ii.clear(e);var t=this._storeCaches[e];null==t||t.clear()},e.prototype.pullEntry=function(e,t){this._pullQueue.push({chrmId:e,timestamp:t}),this._startPull()},e.prototype.setLocal=function(e,t,n){var r=this._storeCaches[e];Qe(r)||(r=new yi(this._engine.getInnerLogger(),e,n)),r.setEntries(t),this._storeCaches[e]=r},e.prototype.getValue=function(e,t){var n=this._storeCaches[e];return n?n.getValue(t):null},e.prototype.getVersion=function(e,t){var n=this._storeCaches[e];return n?n.getVersion(t):null},e.prototype.getAll=function(e){var t=this._storeCaches[e],n={};return t&&(n=t.getAllValue()),n},e}(),Ri=function(){function e(e){this._canJoinMulipleChrm=e,this._joinedChrmsInfo={}}return e.prototype.set=function(e,t){void 0===t&&(t=10),this._canJoinMulipleChrm||(this._joinedChrmsInfo={}),this._joinedChrmsInfo[e]=t},e.prototype.get=function(){return JSON.parse(JSON.stringify(this._joinedChrmsInfo))},e.prototype.remove=function(e){delete this._joinedChrmsInfo[e]},e.prototype.clear=function(){this._joinedChrmsInfo={}},e}(),Si="converStatusChanged",Oi=function(){function e(e,t,n){this._eventEmitter=new Ze,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(t,"-").concat(n),this._oldStorage=r(e.runtime),this._storage=new o(e.runtime,U.CONVER_STATE_PULL_TIME_KEY(t,n)),this._appkey=t,this._currentUserId=n,this._engine=e,this.adaptOldStatus()}return e.prototype.adaptOldStatus=function(){try{if(this._storage.get(this._storagePullTimeKey)||0)return;var e=this._oldStorage.get(this._storagePullTimeKey)||0;if(!e)return;this._storage.set(this._storagePullTimeKey,e),this._oldStorage.remove(this._storagePullTimeKey)}catch(e){this._engine.getInnerLogger().error(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(e.message))}},e.prototype._set=function(e){var t=this;if(!Ye(e)&&Array.isArray(e)){var n=this._storage.get(this._storagePullTimeKey)||0,r=e.length;e.forEach((function(e,i){var o=e.updatedTime||0;n=o>n?o:n,e.conversationType=e.type,t._eventEmitter.emit(Si,{statusItem:e,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,r;return l(this,(function(i){switch(i.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullConversationStatus(e)]);case 1:return t=i.sent(),n=t.code,r=t.data,n===D.SUCCESS?(this._isPulling=!1,this._set(r),this._startPull()):this._startPull(),[2]}}))}))},e.prototype.pull=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.watch=function(e){this._eventEmitter.on(Si,(function(t){e(t)}))},e.prototype.setConversationUpdatedTime=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;return e&&e>t?(this._storage.set(this._storagePullTimeKey,e),e):t},e.prototype.getConversationUpdatedTime=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),Ni={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}},Mi={};for(var Li in Ni){var Ui=Ni[Li].keyName;Mi[Ui]=Li}var Ai,wi=function(){function e(e,t,n,r){this._appkey=t,this._currentUserId=n,this.logger=r,this.storage=new o(e,U.OLD_CONVER_STATE_KEY(t,n)),this._localStore=new o(e,U.CONVER_STATE_KEY(t,n))}return e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e.prototype._getConOptionByKey=function(e){var t=(e=e||"").split("_");if(t.length>=2){var n=t.shift(),r=t.shift(),i=t.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:G.PRIVATE,targetId:"",channelId:""}},e.prototype._updateMentionedUserList=function(e,t,n){var r=this,i=e.conversationType,o=e.messageType,s=e.isMentioned,a=e.senderUserId;s&&i===G.GROUP&&((n.userIdList||[]).forEach((function(e){e===r._currentUserId&&t.indexOf(a)<0&&t.push(a)})),n.type===W.ALL&&t.indexOf(a)<0&&t.push(a));if(o===H.RECALL&&i===G.GROUP){var c=t.indexOf(a);c>=0&&t.splice(c,1)}return t},e.prototype.updateMentionedData=function(e){var t=e.conversationType,n=e.targetId,r=e.content,i=e.channelId,o=r.mentionedInfo;if(o){var s=this._getStoreKey(t,n,i),a=this._localStore.get(s)||{},c=Mi.mentionedInfo,u=Mi.hasMentioned,l=a[c]||{},h=l.userIdList||[];o={userIdList:h=this._updateMentionedUserList(e,h,o),type:(null==o?void 0:o.type)||l.type},0!==h.length?(a[c]=o,a[u]=!0):(delete a[c],delete a[u]),Qe(a)?this._localStore.set(s,a):this._localStore.remove(s)}},e.prototype._setLocal=function(e,t){if("tags"===e)for(var n in t)t[n].isTop||delete t[n].isTop;return t},e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=Mi[s],c=n[s];if(!Ye(a)&&!Ye(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s)c===Ni[a].defaultVal||"tags"===s&&!Qe(c)?delete o[a]:o[a]=this._setLocal(s,c),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var u=Object.keys(o);1===u.length&&u.includes("st")&&delete o.st,Qe(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Ni){var a=Ni[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||Bt(u)}return o},e.prototype.getValue=function(e){var t=this._localStore.getValues()||{},n=[];for(var r in t){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=t[r];for(var a in s)if(Ni[a]){var c=Ni[a],u=c.keyName,l=c.defaultVal;o[u]=s[a]||Bt(l)}o=e?e(o):o,n.push(o)}return n},e.prototype.getValueForTag=function(){var e=this._localStore.getValues()||{},t={};for(var n in e){var r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=e[n];for(var u in a){var l=Ni[u],h=l.keyName,d=l.defaultVal;s[h]=a[u]||Bt(d)}for(var p in s.tags){Ye(t[p])&&(t[p]=[]);var g=c(c({},s),{conversationType:i,targetId:o});delete g.tags,t[p].push(g)}}return t},e.prototype.adaptOldStore=function(){try{var e=this.storage.getValues();if(0===Object.keys(e).length)return;for(var t in e){var n="_".concat(t);this._localStore.set(n,e[t])}this.storage.clear()}catch(e){this.logger.error(exports.LogTagId.O,"adaptOldStore error: ".concat(e.message))}},e.prototype.remove=function(e,t,n){var r=this._getStoreKey(e,t,n);this._localStore.remove(r)},e}(),Pi=[G.PRIVATE,G.GROUP,G.SYSTEM,G.PUBLIC_SERVICE,G.APP_PUBLIC_SERVICE],bi={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},xi=1e3,Di=function(){function e(e,t,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new Ze,this._draftMap={},this._recallMsgTimeMap={},this._appkey=t,this._loginUserId=n,this._store=new wi(e.runtime,t,n,e.getInnerLogger()),this._statusManager=new Oi(e,t,n),this._statusManager.watch((function(e){var t=e.statusItem,n=e.isLastPull;o.addStatus(t,n)})),this._eventEmitter.on(bi.CHANGED,(function(e){r(e)})),this._eventEmitter.on(bi.CON_TAG_STATUS_CHANGED,(function(){i()}));var s=this._store.getValue();s.length>xi&&(s=s.sort((function(e,t){var n=e.lastMessageSentTime,r=void 0===n?0:n,i=t.lastMessageSentTime;return(void 0===i?0:i)-r})),s.splice(xi,s.length).forEach((function(e){o._store.remove(e.conversationType,e.targetId,e.channelId)})))}return e.prototype._calcMsg=function(e,t,n,r){var i=!this._recallMsgTimeMap[e]||this._recallMsgTimeMap[e]&&!this._recallMsgTimeMap[e].find((function(e){return e===r.sentTime})),o=t>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:i}},e.prototype._calcUnreadCount=function(e,t){var n=e.content,r=e.messageType,i=e.sentTime,o=e.isCounted,s=e.messageDirection,a=e.senderUserId,c=s===b.SEND&&a===this._loginUserId,u=r===H.RECALL,l=Ke(n),h=!1,d={},p=t.lastUnreadTime,g=t.lastReadTime,f=t.unreadMessageCount;if(p>i||c)return{hasChanged:h,localConversation:t,updateItems:d};if(o&&(t.unreadMessageCount=f+1,t.lastUnreadTime=i,h=!0),u&&l){var _="".concat(e.conversationType,"_").concat(e.channelId,"_").concat(e.targetId),E=this._calcMsg(_,p,g,n),T=E.isNotRead,C=E.isNotRepeadRecallSendTime;T&&f&&C&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),t.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:t.unreadMessageCount||0,time:i}),{hasChanged:h,localConversation:t,updateItems:d}},e.prototype._calcMentionedInfo=function(e,t){var n=e.content,r=e.messageDirection,i=e.isMentioned,o=e.sentTime,s=r===b.SEND,a=Ke(n),c=!1,u={};return!s&&i&&a&&n.mentionedInfo&&(t.hasMentioned=!0,c=!0,u.hasMentioned={val:!0,time:o},u.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:c,localConversation:t,updateItems:u}},e.prototype._calcMentionedCount=function(e,t){var n=e.content,r=e.messageDirection,i=!1;if(e.isMentioned&&r===b.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===W.ALL||(a||[]).includes(this._loginUserId)){i=!0;var c=t.unreadMentionedCount||0;t.unreadMentionedCount=c+1}if((a||[]).includes(this._loginUserId)){i=!0;c=t.unreadMentionedMeCount||0;t.unreadMentionedCount=c+1}}return{hasChanged:i,localConversation:t}},e.prototype._setUpdatedConversation=function(e){if(Ke(e)){var t=e.conversationType,n=e.targetId,r=e.channelId,i="".concat(t,"_").concat(n),o=this._store.get(t,n,r)||{};this._updatedConversations[i]=Object.assign(o,e)}},e.prototype._setConTagStatusChanged=function(e,t,n,r){var i=(this._store.get(e,t,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||!!i[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},e.prototype.addStatus=function(e,t){var n=e.conversationType,r=e.targetId,i=e.updatedTime,o=e.notificationStatus,s=e.notificationLevel,a=e.isTop,c=e.tags,u=e.channelId,l={},h={};if(n!==G.ULTRA_GROUP){Ye(o)||(h.notificationStatus={time:i,val:o}),Ye(s)||(h.notificationLevel={time:i,val:s}),Ye(a)||(h.isTop={time:i,val:a}),Ye(c)||(h.tags={time:i,val:c},null==c||c.forEach((function(e){l[e.tagId]={isTop:e.isTop}}))),this._setConTagStatusChanged(n,r,l,u);var d=this._store.get(n,r,u).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:h,channelId:u}),t&&this._notifyConversationChanged()}},e.prototype._notifyConversationChanged=function(){var e=[];for(var t in this._updatedConversations)e.push(this._updatedConversations[t]);0!==e.length&&(this._eventEmitter.emit(bi.CHANGED,e),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(bi.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},e.prototype.setConversationCacheByMessage=function(e,t){var n=this,r=e.conversationType,i=e.isPersited,o=e.targetId,s=e.channelId,a=e.sentTime;if(Pi.indexOf(r)>=0){var u=!1,l=this._store.get(r,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(t){var r=t.call(n,e,l),i=r.hasChanged,o=r.localConversation,s=r.updateItems;u=u||i,h=c(c({},h),s),l=Bt(o)})),this._store.set(r,o,l,s),this._store.updateMentionedData(e),i){var d=this._store.get(r,o,s);d.updatedItems=c({latestMessage:{time:e.sentTime,val:e}},h),d.latestMessage=e;var p=Object.assign(d,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(p)}(u||i)&&this._notifyConversationChanged()}},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e.prototype.getAllUnreadCount=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(e){var r=e.unreadMessageCount,o=e.notificationStatus,s=e.notificationLevel,a=e.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&o!==q.OPEN)&&(t.length>0?t.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){var r=this._store.getValue(),i=0;return r.forEach((function(r){var o=r.unreadMessageCount,s=r.notificationLevel,a=void 0===s?0:s,c=r.conversationType,u=r.unreadMentionedCount;e.includes(c)&&(0===t.length||t.includes(a))&&(i+=(n?u:o)||0)})),i},e.prototype.getUnreadCountByTag=function(e,t){var n=this._store.getValueForTag()[e]||[],r=0;return n.forEach((function(e){var n=e.unreadMessageCount,i=e.notificationStatus,o=e.notificationLevel;(t||1!==i||-1===o||0===o)&&(n=n||0,r+=Number(n))})),r},e.prototype.getUnreadCount=function(e,t,n){return this._store.get(e,t,n).unreadMessageCount||0},e.prototype.clearUnreadCount=function(e,t,n,r){void 0===r&&(r=!0);var i=this._store.get(e,t,n);i.lastReadTime=i.lastUnreadTime,this._recallMsgTimeMap["".concat(e,"_").concat(n,"_").concat(t)]=[];var o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(e,t,i,n),r&&0!==Object.keys(a).length){var c=Object.assign(i,{conversationType:e,targetId:t,channelId:n,updatedItems:a});this._setUpdatedConversation(c),this._notifyConversationChanged()}},e.prototype.clearAllUnreadCount=function(){var e=this;this._store.getValue().forEach((function(t){t.unreadMessageCount&&(t.unreadMessageCount=0,t.lastReadTime=t.lastUnreadTime,e._recallMsgTimeMap={},e._store.set(t.conversationType,t.targetId,t,t.channelId))}))},e.prototype.startPullConversationStatus=function(e){this._statusManager.pull(e)},e.prototype.setDraft=function(e,t,n,r){var i="".concat(e,"_").concat(t,"_").concat(r);this._draftMap[i]=n},e.prototype.getDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);return this._draftMap[r]},e.prototype.clearDraft=function(e,t,n){var r="".concat(e,"_").concat(t,"_").concat(n);delete this._draftMap[r]},e.prototype.addTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r),o=i.tags;o=Object.assign(o,n);var s=i.lastMessageSentTime||(new Date).getTime();this._store.set(e,t,{tags:o,lastMessageSentTime:s},r)},e.prototype.deleteTagStatus=function(e,t,n,r){void 0===r&&(r="");var i=this._store.get(e,t,r).tags;n.forEach((function(e){delete i[e]})),this._store.set(e,t,{tags:i},r)},e.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},e.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(e){return e.notificationStatus===q.OPEN||e.notificationLevel&&e.notificationLevel>0})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,notificationLevel:e.notificationLevel||0,notificationStatus:e.notificationStatus||2}}))},e.prototype.getTopConversationList=function(e,t){return(this._store.getValue()||{}).filter((function(n){return e.includes(n.conversationType)&&(Ye(t)||t===n.channelId)&&n.isTop})).map((function(e){return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e.prototype.adaptOldStore=function(){this._store.adaptOldStore()},e.prototype.getUnreadMentionedCount=function(e,t,n){return void 0===n&&(n=""),this.get(e,t,n).unreadMentionedCount||0},e.prototype.getAllUnreadMentionedCount=function(){var e=this._store.getValue(),t=0;return e.forEach((function(e){var n=e.unreadMentionedCount;n=n||0,t+=Number(n)})),t},e.prototype.getAllConversationState=function(){return this._store.getValue().filter((function(e){return e.unreadMessageCount||e.unreadMentionedCount})).map((function(e){return{conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,unreadCount:e.unreadMessageCount||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e.prototype.getUnreadConversationList=function(e){return(this._store.getValue()||{}).filter((function(t){return e.includes(t.conversationType)&&t.unreadMessageCount&&t.unreadMessageCount>0})).map((function(e){return{channelId:e.channelId,conversationType:e.conversationType,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount||0,latestMessage:null,hasMentioned:e.hasMentioned||!1,mentionedInfo:e.mentionedInfo,notificationStatus:e.notificationStatus||0,notificationLevel:e.notificationLevel,isTop:e.isTop||!1,lastUnreadTime:e.lastUnreadTime||0,unreadMentionedCount:e.unreadMentionedCount||0}}))},e.prototype.setConversationUpdatedTime=function(e){return this._statusManager.setConversationUpdatedTime(e)},e.prototype.getConversationUpdatedTime=function(){return this._statusManager.getConversationUpdatedTime()},e}(),Vi=function(){function e(e,t,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey=U.TAG_STATE_KEY(t,n),this._storagePullTimeKey=U.USER_SETTING_TIME_KEY(t,n),this._storage=r(e.runtime),this._engine=e,this._tagWatcherFunc=i}return e.prototype._updateTag=function(e){var t=e.tags,n={};t.forEach((function(e){n[e.tagId]={tagName:e.tagName,createdTime:e.createdTime}})),this._storage.set(this._storageTagKey,n),this._tagWatcherFunc()},e.prototype.addTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){var t,r=(null===(t=n[e.tagId])||void 0===t?void 0:t.createdTime)||e.createdTime||0;n[e.tagId]={tagName:e.tagName,createdTime:r}})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.deleteTag=function(e,t){var n=this._storage.get(this._storageTagKey)||{};e.forEach((function(e){delete n[e]})),this._storage.set(this._storageTagKey,n),this._storage.set(this._storagePullTimeKey,t)},e.prototype.getTagsInfo=function(){return this._storage.get(this._storageTagKey)||{}},e.prototype.getTags=function(){var e=this._storage.get(this._storageTagKey)||{},t=[];for(var n in e)t.push({tagId:n,tagName:e[n].tagName,createdTime:e[n].createdTime,conversationCount:0});return t.sort((function(e,t){return(e.createdTime||0)-(t.createdTime||0)}))},e.prototype.getTagById=function(e){var t=this._storage.get(this._storageTagKey)||{};return t[e]?{tagId:e,tagName:t[e].tagName,createdTime:t[e].createdTime,conversationCount:0}:null},e.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isPulling||0===this._pullQueue.length?[2]:(this._isPulling=!0,e=this._pullQueue.splice(0,1)[0],[4,this._engine.pullUserSettings(e)]);case 1:return t=c.sent(),n=t.code,r=t.data,n!==D.SUCCESS||Ye(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,Ye(a)||this._updateTag(a),this._storage.set(this._storagePullTimeKey,s),this._isPulling=!1,this._startPull()),[2]}}))}))},e.prototype.pullUserSettings=function(e){var t=this._storage.get(this._storagePullTimeKey)||0;(e>t||0===e)&&(this._pullQueue.push(t),this._startPull())},e.prototype.getVersion=function(){return this._storage.get(this._storagePullTimeKey)||0},e}(),Gi=function(e){return e.replace(/@.+$/,"@")},Bi=function(){function e(e,t,n,r,i){void 0===i&&(i=!0),this.appkey=e,this.logger=t,this.statisticLog=n,this.staticConfigManager=r,this.isRequestProfile=i,this.crtRequest=null}return e.prototype.request=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,r,i),[4,this.crtRequest]);case 1:return o=c.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},e.prototype.sendRequest=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d,p,g,f,_,E,C;return l(this,(function(l){switch(l.label){case 0:return o=Gi(e),!t&&(s=this.getNaviCache(o))&&(a=s.timestamp,c=s.naviInfo,n||Date.now()-a<T)?(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),r),u={bid:Lt(),ptc:exports.ProtocalType.NAVI,cod:D.SUCCESS,net:null==i?void 0:i.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:exports.NaviCacheType.LOCAL,v:exports.StatisticsVersion.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(exports.StatisticsTag.IM_NAVI,JSON.stringify(u),r),[2,{code:D.SUCCESS,data:c}]):(h=On.getNaviUrlList(e),this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:e,uris:h}),r),[4,this.requestHandler(h,e,r,i)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===D.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(_,e,r,i)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==D.SUCCESS?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,p,r),[2,{code:p}]):(C=g,this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:C}),r),this.setNaviCache(o,C),[2,{code:p,data:C}])}}))}))},e.prototype.requestHandler=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:i=0,o=e.length,l.label=1;case 1:return i<o?(s=i===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,c=Date.now(),[4,a.call(this,e[i],this.appkey,t,n,s)]):[3,4];case 2:if(u=l.sent(),h=u.code,d=u.data,p={bid:Lt(),ptc:exports.ProtocalType.NAVI,cod:h,net:null==r?void 0:r.type,dur:Date.now()-c,spr:0,pr:(null==d?void 0:d.type)||0,hos:e[i],cache:exports.NaviCacheType.REQUEST,v:exports.StatisticsVersion.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(exports.StatisticsTag.IM_NAVI,JSON.stringify(p),n),[D.SUCCESS,D.RC_CONN_TOKEN_INCORRECT,D.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return i+=1,[3,1];case 4:return[2,{code:D.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return D.RC_CONN_TOKEN_INCORRECT;case 416:return D.RC_LICENSE_EXPIRED;default:return D.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(Gi(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Gi(e),c(c({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,r=e.token,i=e.platform,o=e.protocol;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(r),"&version=").concat("5.8.4","&platfrom=").concat(i);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:t,timeout:v}},e.prototype.useV2Navi=function(){return!0},e}(),ki={},Fi=function(e){function t(t,n,r,i,o){var s=e.call(this,t,n,r,o,i.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol))||this;return s.runtime=i,s}return a(t,e),t.prototype.httpRequest=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return o="".concat(e,"/navi.js?appId=").concat(t,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(M,"&r=").concat(Date.now()),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(o),r),[4,this.runtime.httpReq({url:o,timeout:v,dataType:"text"})];case 1:if(200!==(s=u.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(s.status),r),!this.runtime.useNavi&&i?(c={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:On.getMiniCmpUrlList().join(",")},[2,{code:D.SUCCESS,data:c}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(c=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",this.runtime.useNavi||(c.server="",c.backupServer=On.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:D.SUCCESS,data:c}]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,s.data,r)}return[2,{code:D.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.httpRequestV2=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return i=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:this.runtime.tag,protocol:(/^https/.test(e)?exports.EConnectProtocol.WSS:exports.EConnectProtocol.WS).toString()}),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(i.url),r),[4,this.runtime.httpReq(i)];case 1:if(200!==(o=u.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(o.status),r),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(i.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,c=On.getMiniCmpUrlList(),a.serverAddr=c.map((function(e,t){return{addr:e,protocol:/^https/.test(i.url)?exports.EConnectProtocol.WSS:exports.EConnectProtocol.WS,weight:c.length-t}}))),[2,{code:D.SUCCESS,data:a}]}catch(e){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,o.data,r)}return[2,{code:D.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.getNaviCache=function(e){if(ki[e])return ki[e];var t,n=U.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var i=r.getItem(n);t=i?JSON.parse(i):[]}catch(e){t=[]}if(0===t.length)return null;var o=t.find((function(t){return t.token===e}))||null;return ki[e]=o,o},t.prototype.setNaviCache=function(e,t){var n,r=U.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var o=i.getItem(r);n=o?JSON.parse(o):[]}catch(e){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(t){return s-t.timestamp<T&&e!==t.token})));var a={timestamp:s,naviInfo:t,token:e};n.push(a),i.setItem(r,JSON.stringify(n)),ki[e]=a},t}(Bi),Hi=function(){function e(e,t){this._runtime=e,this._appkey=t,this._sendMessageMap={},this._userId=""}return e.prototype.init=function(e){this._userId=e;var t=U.SEND_MSG_KEY(this._appkey,e);this._sendMessageMap=this._getLocalInfo(t)},e.prototype._getLocalInfo=function(e){var t=this._runtime.localStorage.getItem(e);try{return t?JSON.parse(t):{}}catch(e){return{}}},e.prototype.setMessage=function(e,t){this._sendMessageMap[e]=t;var n=U.SEND_MSG_KEY(this._appkey,this._userId),r=this._getLocalInfo(n);r[e]=t,this._runtime.localStorage.setItem(n,JSON.stringify(r))},e.prototype.getSendMessageMap=function(){return this._sendMessageMap},e.prototype.removeByUID=function(e){delete this._sendMessageMap[e]},e.prototype.removeByTimestamp=function(e){var t=U.SEND_MSG_KEY(this._appkey,this._userId),n=this._getLocalInfo(t);Object.keys(n).forEach((function(t){n[t]<e&&delete n[t]})),this._runtime.localStorage.setItem(t,JSON.stringify(n))},e}();(Ai={})[G.PRIVATE]=Ci.qryPMsg,Ai[G.GROUP]=Ci.qryGMsg,Ai[G.CHATROOM]=Ci.qryCHMsg,Ai[G.CUSTOMER_SERVICE]=Ci.qryCMsg,Ai[G.SYSTEM]=Ci.qrySMsg;var Ki=[Ci[Ci.recallMsg],Ci[Ci.ppMsgS],Ci[Ci.pgMsgS],Ci[Ci.ppMsgP],Ci[Ci.pgMsgP],Ci[Ci.chatMsg],Ci[Ci.pcMsgP],Ci[Ci.prMsgS],Ci[Ci.updUgRTime],Ci[Ci.pbMsgP]],qi=function(){function e(e,t,n){this._localStore=new o(e,U.ULTRA_GROUP_STATE_KEY(t,n))}return e.prototype.set=function(e,t,n,r){var i=this._getStoreKey(e,t,r),o=this._localStore.get(i)||{};for(var s in n){var a=ji[s],c=n[s];if(!Ye(a)&&!Ye(c))c===Yi[a].defaultVal?delete o[a]:o[a]=c}Qe(o)?this._localStore.set(i,o):this._localStore.remove(i)},e.prototype.get=function(e,t,n){void 0===n&&(n="");var r=this._getStoreKey(e,t,n),i=this._localStore.get(r)||{},o={};for(var s in Yi){var a=Yi[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||Bt(u)}return o},e.prototype._getStoreKey=function(e,t,n){return"".concat(n,"_").concat(e,"_").concat(t)},e}(),Yi={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},ji={};for(var Qi in Yi){var Wi=Yi[Qi].keyName;ji[Wi]=Qi}var Ji,Xi=function(){function e(e,t,n){this._store=new qi(e.runtime,t,n)}return e.prototype.addUltraGroupStatus=function(e){var t=e.conversationType,n=e.targetId,r=e.notificationStatus,i=e.notificationLevel,o=e.channelId;t===G.ULTRA_GROUP&&this._store.set(t,n,{notificationStatus:r,notificationLevel:i},o)},e.prototype.get=function(e,t,n){return void 0===n&&(n=""),this._store.get(e,t,n)},e}(),Zi="UpStreamMessage",zi="PushExtra",$i="DownStreamMessage",eo="DownStreamMessages",to="SessionsAttQryInput",no="SessionsAttOutput",ro="SyncRequestMsg",io="ChrmPullMsg",oo="NotifyMsg",so="HistoryMsgInput",ao="HistoryMsgOuput",co="RelationQryInput",uo="RelationsOutput",lo="UnreadMsgInfo",ho="DeleteSessionsInput",po="SessionInfo",go="DeleteSessionsOutput",fo="RelationsInput",_o="DeleteMsgInput",Eo="CleanHisMsgInput",To="SessionMsgReadInput",Co="ChrmInput",vo="ChrmOutput",Io="QueryChatRoomInfoInput",yo="QueryChatRoomInfoOutput",mo="GetQNupTokenInput",Ro="GetQNupTokenOutput",So="GetQNdownloadUrlInput",Oo="GetDownloadUrlInput",No="GetQNdownloadUrlOutput",Mo="GetDownloadUrlOutput",Lo="ChrmKVEntity",Uo="SetChrmKV",Ao="SetChrmKVS",wo="DeleteChrmKVS",Po="ChrmKVOutput",bo="ChrmKVSOutput",xo="ChrmKVSVersionEntity",Do="ChrmKVSOutputEntity",Vo="QueryChrmKV",Go="SetUserSettingInput",Bo="SetUserSettingOutput",ko="PullUserSettingInput",Fo="PullUserSettingOutput",Ho="UserSettingNotification",Ko="SessionReq",qo="SessionStates",Yo="SessionState",jo="SessionStateItem",Qo="SessionStateModifyReq",Wo="SessionStateModifyResp",Jo="GroupUnpushQuery",Xo="GroupUnpushSet",Zo="QryRemindListReq",zo="QryRemindListResp",$o="GroupUnpushResult",es="GrpReadReceiptMsg",ts="GrpReadReceiptQryReq",ns="GrpReadReceiptQryResp",rs="GrpMsgReadUser",is="SessionTagAddInput",os="SessionTagItem",ss="SessionTagDelInput",as="SessionDisTagReq",cs="ReportSDKInput",us="ReportSDKOutput",ls="UltraGrpPullSes",hs="UltraGrpPullMsg",ds="MsgChangeReq",ps="QueryMsgChange",gs="MsgChange",fs="MsgChangeList",_s="MsgQuery",Es="MessageQueryInfo",Ts="MsgQueryAck",Cs="OperateStatus",vs="OperateStatusNotify",Is="OperateInfo",ys="OperateSummary",ms="SetRtcRoomIdInput",Rs="SetRtcRoomIdOutput",Ss="CallInfoUpStream",Os="CallInfoDownStream",Ns="KvInput",Ms="KvOutput";(Ji={})[Zi]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],Ji[eo]=["list","syncTime","finished","broadcastSyncTime"],Ji[$i]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],Ji[zi]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],Ji[to]=["nothing"],Ji[no]=["inboxTime","sendboxTime","totalUnreadCount"],Ji[ro]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],Ji[io]=["syncTime","count"],Ji[oo]=["type","time","chrmId"],Ji[so]=["targetId","time","count","order","busChannel"],Ji[ao]=["list","syncTime","hasMsg"],Ji[co]=["type","count","startTime","order"],Ji[uo]=["info","isFinished"],Ji[lo]=["msgId","msgTime","remindType","className"],Ji[ho]=["sessions"],Ji[po]=["type","channelId","busChannel"],Ji[go]=["nothing"],Ji[fo]=["type","msg","count","busChannel","startTime","endTime"],Ji[_o]=["type","conversationId","msgs","busChannel"],Ji[Eo]=["targetId","dataTime","conversationType","busChannel"],Ji[To]=["type","msgTime","channelId","busChannel"],Ji[Co]=["nothing"],Ji[vo]=["nothing","sessionId","joinTime"],Ji[Io]=["count","order"],Ji[yo]=["userTotalNums","userInfos"],Ji[mo]=["type","key","httpMethod","queryString","url"],Ji[So]=["type","key","fileName"],Ji[Oo]=["type","key","fileName"],Ji[Ro]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],Ji[No]=["downloadUrl"],Ji[Mo]=["downloadUrl"],Ji[Lo]=["key","value","status","timestamp","uid","version"],Ji[Uo]=["entry","bNotify","notification","type"],Ji[Ao]=["entry","bNotify","notification","type"],Ji[wo]=["entry","bNotify","notification","type"],Ji[Po]=["entries","bFullUpdate","syncTime"],Ji[bo]=["timestamp","errorKeys","keysVersion"],Ji[xo]=["version","key"],Ji[Do]=["key","errorCode"],Ji[Vo]=["timestamp"],Ji[Go]=["version","value"],Ji[Bo]=["version","reserve"],Ji[ko]=["version","reserve"],Ji[Fo]=["items","version"],Ji.UserSettingItem=["targetId","type","key","value","version","status","tags"],Ji[Ko]=["time"],Ji[qo]=["version","state"],Ji[Yo]=["type","channelId","time","stateItem","busChannel"],Ji[jo]=["sessionStateType","value","tags"],Ji[Qo]=["version","state"],Ji[Wo]=["version"],Ji[Xo]=["busChannel","unpushLevel"],Ji[Zo]=["groupId","busChannel","msgTime","size"],Ji[Jo]=["busChannel"],Ji[$o]=["groupId","busChannel","unpushLevel"],Ji[es]=["msgId","busChannel"],Ji[ts]=["msgId","busChannel"],Ji[ns]=["totalMemberNum","list"],Ji[rs]=["readTime","userId"],Ji[is]=["version","tags"],Ji[os]=["tagId","name","createdTime","isTop"],Ji[ss]=["version","tags"],Ji[as]=["tagId"],Ji[Ho]=["version","reserve"],Ji[cs]=["sdkInfo"],Ji[us]=["nothing"],Ji[ls]=["syncTime","isEraseMsgContent"],Ji[hs]=["syncTime"],Ji[ds]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],Ji[ps]=["syncTime"],Ji[fs]=["list","syncTime","hasNext"],Ji[gs]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],Ji[_s]=["targetId","type","query"],Ji[Es]=["msgTime","msgUID","busChannel"],Ji[Ts]=["list"],Ji[Cs]=["targetId","type","opType","busChannel"],Ji[vs]=["type","notifyType","info","summary"],Ji[Is]=["targetId","busChannel","userId","opType","optime"],Ji[ys]=["targetId","busChannel","count","opType"],Ji[ms]=["rtcRoomId"],Ji[Rs]=["nothing"];var Ls,Us,As,ws,Ps="\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(oo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(ro," {\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(Zi," {\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(zi," {\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(eo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat($i," {\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(w.IMAGE,";\n audio = ").concat(w.AUDIO,";\n video = ").concat(w.VIDEO,";\n file = ").concat(w.FILE,";\n sight = ").concat(w.SIGHT,";\n html = ").concat(w.COMBINE_HTML,";\n }\n message ").concat(mo," {\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(So," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Oo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Ro," {\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(No," {\n required string downloadUrl = 1;\n }\n message ").concat(Mo," {\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(Co," {\n required int32 nothing = 1;\n }\n message ").concat(vo," {\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(io," {\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(co,"\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(fo,"\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(uo,"\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(lo," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(lo," //未读消息摘要信息\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(Zo," // 新增 查询未读@列表入参\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(zo," //查询未读@列表出参\n {\n repeated ").concat(lo," 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(Eo,"\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(Io,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(yo,"\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(so,"\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(ao,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(to,"{\n required int32 nothing = 1;\n }\n message ").concat(no,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(To,"\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(ho,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(po,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(go,"\n {\n optional int32 nothing=1;\n }\n message ").concat(_o,"\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(Uo," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Ao," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(wo," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Po," {\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(bo," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Do,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Vo," {\n required int64 timestamp = 1;\n }\n message ").concat(Go," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(Bo," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(ko," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(Fo," {\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(Ko," {\n required int64 time = 1;\n }\n message ").concat(qo," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Yo," {\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(jo," {\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(Qo," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Jo," {\n optional string busChannel = 1;\n }\n message ").concat(Xo,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat($o," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat(Wo," {\n required int64 version=1;\n }\n message ").concat(es," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(ts," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(ns," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(rs," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(is," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(os," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(ss," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(as," {\n repeated string tagId=1;\n }\n message ").concat(Ho," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(cs,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(us,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(ls,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(hs,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(ds,"\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(ps," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(fs," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(gs," //变更详情\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(_s," //请求\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(Ts," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Cs," //客户端发送\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(vs," //服务端发送\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(Is," {\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(ys," {\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(ms,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Rs,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(Ss,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(Os,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(Ns,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(Ms,"\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"),bs=function(e,t,n,r,i,o){var s=i?Object.keys(i).map((function(t){return e.encode(bt.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0,a=o?Object.keys(o).map((function(t){return e.encode(bt.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(bt.RtcInput,{roomType:t,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},xs=function(e,t){var n=e.decode(bt.RtcUserListOutput,t),r=n.users,i=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,c=n.offlineKickTime,u={};return xt(r,(function(e){var t=e.userId,n=e.userData,r={};xt(n,(function(e){var t=e.key,n=e.value;r[t]=n})),u[t]=r})),{users:u,token:i,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:c}};!function(e){e[e.ACCEPTED=0]="ACCEPTED",e[e.UNACCEPTABLE_PROTOCOL_VERSION=1]="UNACCEPTABLE_PROTOCOL_VERSION",e[e.IDENTIFIER_REJECTED=2]="IDENTIFIER_REJECTED",e[e.SERVER_UNAVAILABLE=3]="SERVER_UNAVAILABLE",e[e.TOKEN_INCORRECT=4]="TOKEN_INCORRECT",e[e.NOT_AUTHORIZED=5]="NOT_AUTHORIZED",e[e.REDIRECT=6]="REDIRECT",e[e.PACKAGE_ERROR=7]="PACKAGE_ERROR",e[e.APP_BLOCK_OR_DELETE=8]="APP_BLOCK_OR_DELETE",e[e.BLOCK=9]="BLOCK",e[e.TOKEN_EXPIRE=10]="TOKEN_EXPIRE",e[e.DEVICE_ERROR=11]="DEVICE_ERROR",e[e.HOSTNAME_ERROR=12]="HOSTNAME_ERROR",e[e.HASOHTERSAMECLIENTONLINE=13]="HASOHTERSAMECLIENTONLINE",e[e.OUT_OF_LIMIT=14]="OUT_OF_LIMIT",e[e.IN_OTHER_CLUSTER=15]="IN_OTHER_CLUSTER",e[e.APP_AUTH_NOT_PASS=16]="APP_AUTH_NOT_PASS",e[e.OTP_USED=17]="OTP_USED",e[e.PLATFORM_ERROR=18]="PLATFORM_ERROR",e[e.ACCOUNT_CANCELLATION=19]="ACCOUNT_CANCELLATION",e[e.LICENSE_EXPIRED=20]="LICENSE_EXPIRED"}(Ls||(Ls={})),function(e){e[e.OTHER_DEVICE_LOGIN=1]="OTHER_DEVICE_LOGIN",e[e.BLOCK=2]="BLOCK",e[e.BLOCK_NEW=5]="BLOCK_NEW",e[e.REDIRECT_NEW=6]="REDIRECT_NEW",e[e.TOKEN_EXPIRED=7]="TOKEN_EXPIRED",e[e.ILLEGAL_PROTOCOL_VERSION=8]="ILLEGAL_PROTOCOL_VERSION",e[e.ACCOUNT_CANCELLATION=9]="ACCOUNT_CANCELLATION"}(Us||(Us={}));var Ds,Vs=((As={})[Us.OTHER_DEVICE_LOGIN]=D.RC_DISCONN_KICK,As[Us.BLOCK]=D.RC_DISCONN_EXCEPTION,As[Us.BLOCK_NEW]=D.RC_DISCONN_EXCEPTION,As[Us.REDIRECT_NEW]=D.RC_CONN_REDIRECTED,As[Us.TOKEN_EXPIRED]=D.RC_CONN_TOKEN_EXPIRED,As[Us.ILLEGAL_PROTOCOL_VERSION]=D.RC_CONN_PROTO_VERSION_ERROR,As[Us.ACCOUNT_CANCELLATION]=D.RC_ACCOUNT_CANCELLATION,As),Gs=((ws={})[Ls.ACCEPTED]=D.SUCCESS,ws[Ls.UNACCEPTABLE_PROTOCOL_VERSION]=D.RC_CONN_PROTO_VERSION_ERROR,ws[Ls.IDENTIFIER_REJECTED]=D.RC_CONN_IDENTIFIER_REJECTED,ws[Ls.SERVER_UNAVAILABLE]=D.RC_CONN_SERVER_UNAVAILABLE,ws[Ls.TOKEN_INCORRECT]=D.RC_CONN_TOKEN_INCORRECT,ws[Ls.NOT_AUTHORIZED]=D.RC_CONN_NOT_AUTHRORIZED,ws[Ls.REDIRECT]=D.RC_CONN_REDIRECTED,ws[Ls.PACKAGE_ERROR]=D.RC_CONN_PACKAGE_NAME_INVALID,ws[Ls.APP_BLOCK_OR_DELETE]=D.RC_CONN_APP_BLOCKED_OR_DELETED,ws[Ls.BLOCK]=D.RC_CONN_USER_BLOCKED,ws[Ls.TOKEN_EXPIRE]=D.RC_CONN_TOKEN_EXPIRED,ws[Ls.DEVICE_ERROR]=D.RC_CONN_DEVICE_ERROR,ws[Ls.HOSTNAME_ERROR]=D.RC_CONN_HOSTNAME_ERROR,ws[Ls.HASOHTERSAMECLIENTONLINE]=D.RC_DISCONN_SAME_CLIENT_ON_LINE,ws[Ls.OUT_OF_LIMIT]=D.RC_LISCENSE_COUNT_OUT_OF_LIMIT,ws[Ls.IN_OTHER_CLUSTER]=D.RC_CONN_WRONG_CLUSTER,ws[Ls.APP_AUTH_NOT_PASS]=D.RC_APP_AUTH_NOT_PASS,ws[Ls.OTP_USED]=D.RC_OTP_USED,ws[Ls.PLATFORM_ERROR]=D.RC_PLATFORM_ERROR,ws[Ls.ACCOUNT_CANCELLATION]=D.RC_ACCOUNT_CANCELLATION,ws[Ls.LICENSE_EXPIRED]=D.RC_LICENSE_EXPIRED,ws),Bs=function(e){return e===D.RC_CONN_REDIRECTED};exports.RCConnectionStatus=void 0,(Ds=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[Ds.CONNECTED=0]="CONNECTED",Ds[Ds.CONNECTING=1]="CONNECTING",Ds[Ds.DISCONNECTED=2]="DISCONNECTED",Ds[Ds.SUSPENDED=3]="SUSPENDED";var ks,Fs=function(){function e(e,t,n,r,i){this.appkey=e,this.navi=t,this.logger=n,this.statisticLog=r,this.listener=i,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:exports.NetworkType.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=exports.RCConnectionStatus.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus=e,this._connectDurSwitch&&e!==exports.RCConnectionStatus.CONNECTED&&e!==exports.RCConnectionStatus.CONNECTING){var n={bid:Lt(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(exports.StatisticsTag.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),Bs(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:e.type,on:this._network.type};this.statisticLog.__statistics(exports.StatisticsTag.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED?[2,{code:D.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=lt(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:exports.ConnectReason.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(i),r),[4,this.try2Connect(e,t,!1,r)]);case 1:return o=c.sent(),s=o.code,a=o.data,s!==D.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2,{code:s,data:a}])}}))}))},e.prototype.try2Connect=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,r),[4,this._crtConnectionTask]);case 1:return i=a.sent(),o=i.code,s=i.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},e.prototype.createConnectionTask=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return i={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,r,i)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==D.SUCCESS?[2,{code:s}]:1===(c=a).type?[2,{code:D.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),r),[4,this.connectWithToken(e.replace(/@.+$/,"@"),c,t,r)]);case 2:return u=l.sent(),h=u.code,d=u.data,Bs(h)?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"redirect code: ".concat(h),r),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,r)]):[D.RC_TCP_RESET,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(exports.LogTagId.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),r),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,h),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[2,this.createConnectionTask(e,t,!1,r)]):h!==D.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"code: ".concat(h),r),[2,{code:h}]):(this.logger.info(exports.LogTagId.L_CONNECT_R,"userId: ".concat(d),r),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case D.TIMEOUT:return void(this.reason=exports.ConnectReason.TIMEOUT);case D.RC_CONN_REDIRECTED:return void(this.reason=exports.ConnectReason.REDIRECTED);default:this.reason=exports.ConnectReason.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),r=function(){return u(i,void 0,void 0,(function(){var i,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED?[2]:(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(i)),[4,this.try2Connect(this.token,!0,e,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===D.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2]):[D.SERVER_UNAVAILABLE,D.TIMEOUT,D.RC_SOCKET_DISCONNECTED,D.RC_SOCKET_NOT_CREATED,D.RC_CONN_ACK_TIMEOUT,D.RC_TCP_RESET,D.RC_NAVI_REQ_FAILED,D.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTING||(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,o),this.reconnectTimer=setTimeout(r,5e3)),[2]):(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,o),[2])}}))}))},r(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return Bs(e)?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===D.RC_UDP_DISCONNECTED?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return u(this,void 0,void 0,(function(){var e,t,n=this;return l(this,(function(r){switch(r.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?(this._failedCount=0,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=r.sent())===D.SUCCESS?(this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,D.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,D.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,D.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype.getCmpList=function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return h([],this.cmpWeightCache,!0);var n=e.server,r=e.backupServer,i=e.serverAddr,o=e.protocol,s=e.openTLS;if(i)return this.cmpWeightCache=h([],i,!0),h([],i,!0);var a=[],c=[];return n&&c.push(n),null==r||r.split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,r){var i;i=t?1===s?exports.EConnectProtocol.TLS:exports.EConnectProtocol.RMTP:"http"===o?exports.EConnectProtocol.WS:exports.EConnectProtocol.WSS,a.push({addr:e,protocol:i,weight:n.length-r,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var r=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===exports.EConnectProtocol.QUIC:t.addr===e}));if(r)if(t){var i=Math.max.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));r.weight!==i&&(r.weight=i+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(e){return e.weight})));r.weight!==o&&(r.weight=o-1)}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e}(),Hs=function(){function e(t){this.logger=t,this._codec=e.createPBCodec()}return e.createPBCodec=function(){var e=Cn(Ps);return e.getModule=function(t){var n=new e[t];return n.getArrayData=function(){var e=n.toArrayBuffer();return e=Fe(e)?[].slice.call(new Int8Array(e)):e},n},e},e.prototype.decodeByPBName=function(e,t,n){var r,i=this,o=e,s=((r={})[eo]=i._formatSyncMessages,r[$i]=i._formatReceivedMessage,r[Zi]=i._formatSentMessage,r[ao]=i._formatHistoryMessages,r[uo]=i._formatConversationList,r[yo]=i._formatChatRoomInfos,r[Po]=i._formatChatRoomKVList,r[Fo]=i._formatUserSetting,r[qo]=i._formatConversationStatus,r[ns]=i._formatGrpReadReceiptQryResp,r[Bo]=i._formatSetUserSettingOutput,r[Ho]=i._formatUserSettingNotification,r[fs]=i._formatUltraMsgChangeList,r[vs]=i._formatUltraOperateStatusNotifyList,r[Ts]=i._formatUltraMsgList,r[zo]=i._formatUltraGroupUnreadMentionedList,r[vo]=i._formatChrmKVVersion,r[Ms]=i._formatCallKVInfo,r[Os]=i._fromatCallInfoDownStream,r)[t];try{o=e.length>0&&i._codec[t].decode(e),Ke(o)&&(o=function(e){for(var t in e)Ke(e[t])&&(e[t]=yt(e[t]));return e}(o)),qe(s)&&(o=s.call(this,o,n))}catch(e){this.logger.error(exports.LogTagId.L_PB_DECODE_E,t)}return o},e.prototype._readBytes=function(e){var t=e.offset,n=e.buffer,r=e.limit;if(t)try{var i=Fe(n)?new Uint8Array(n):n;return $r.readUTF(i.subarray(t,r))}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return e},e.prototype._formatBytes=function(e){if(!e)return e;var t=this._readBytes(e);try{t=t?JSON.parse(t):t}catch(e){this.logger.error(exports.LogTagId.O,null==e?void 0:e.stack)}return t||e},e.prototype._formatSyncMessages=function(e,t){t=t||{};var n=this,r=e.list,i=e.syncTime,o=e.finished;return(Ye(o)||null===o)&&(e.finished=!0),e.syncTime=yt(i),e.list=Dt(r,(function(e){return n._formatReceivedMessage(e,t)})),e},e.prototype._getUtfContent=function(e){if(e.user){var t=e.user,n=t.portrait,r=t.portraitUri,i=n||r;i&&(e.user.portrait=e.user.portraitUri=i)}return e},e.prototype._setExpansion=function(e){var t;return e&&(t=function(e){var t={},n=JSON.parse(e);return xt(n,(function(e,n){t[n]=e.v})),t}(e)),t},e.prototype._setPushConfig=function(e,t){var n=e.pushContent,r=e.pushExt,i=e.configFlag,o={};return r&&(o=St(t,r.pushConfigs,r.pushId)),c(c({},o),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:"",disablePushTitle:!!i&&Boolean(4&i),forceShowDetailContent:!!i&&Boolean(8&i),templateId:null==r?void 0:r.templateId})},e.prototype._formatReceivedMessage=function(e,t){if(!e)return e;var r=this,i=t||{},o=i.currentUserId,s=i.connectedTime,a=e.content,c=e.fromUserId,u=e.type,l=e.groupId,h=e.status,d=e.dataTime,p=e.extraContent,g=e.configFlag,f=e.extStatus,_=e.clientUniqueId,E=e.busChannel,T=e.msgId,C=e.classname,v=e.direction||b.RECEIVE,I=function(e){var t=n.READ;return{isPersited:!!(16&e),isCounted:!!(32&e),isMentioned:!!(64&e),disableNotification:!!(512&e),receivedStatus:t=2&e?n.RETRIEVED:t,canIncludeExpansion:!!(1024&e)}}(h),y=I.isPersited,m=I.isCounted,R=I.isMentioned,S=I.disableNotification,O=I.receivedStatus,N=I.canIncludeExpansion,M=!!(2&(f||0)),L=!!(4&(f||0)),U=!!(8&(f||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,A=[G.GROUP,G.CHATROOM,G.RTC_ROOM,G.ULTRA_GROUP].indexOf(u)>-1?l:c,w=c,P=b.RECEIVE;v===b.SEND&&(w=o,P=b.SEND);var x=yt(d),D=x<s,V=u===G.CHATROOM,B=r._setExpansion(p),k=r._formatBytes(a);k=r._getUtfContent(k);var F=r._setPushConfig(e,this.logger);V&&c===o&&(P=b.SEND);var H={conversationType:u,targetId:A,senderUserId:w,messageType:C,messageUId:T,isPersited:y,isCounted:m,isMentioned:R,sentTime:x,messageDirection:P,receivedTime:qt.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:N,content:k,expansion:B,configFlag:g,pushConfig:F,channelId:E||"",isInterrupt:M,isModifyMessage:L,messageId:yt(_)||0,sentStatus:exports.SentStatus.SENT};return u!==G.ULTRA_GROUP?(H.isOffLineMessage=D,H):(H.channelType=U,H)},e.prototype._formatSentMessage=function(e,t){var n=this,r=e.content,i=e.classname,o=e.sessionId,s=e.msgId,a=e.extraContent,u=e.pushExt,l=e.pushContent,h=e.configFlag,d=e.extStatus,p=e.clientUniqueId,g=e.systemId,f=t.signal,_=t.currentUserId,E=f.date,T=f.topic,C=f.targetId,v=!!(2&(d||0)),I=function(e){return{isPersited:!!(1&e),isCounted:!!(2&e),disableNotification:!!(32&e),canIncludeExpansion:!!(64&e)}}(o),y=I.isPersited,m=I.isCounted,R=I.disableNotification,S=I.canIncludeExpansion,O=Kr[T]||G.PRIVATE,N=Gt(mr,T),M=n._formatBytes(r),L=g||C;i===H.RECALL&&(O=M.conversationType||O,L=M.targetId||C);var U=n._setExpansion(a),A=n._setPushConfig(e,this.logger),w=c(c({},A),{pushTitle:null==u?void 0:u.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==u?void 0:u.templateId});return{conversationType:O,targetId:L,messageType:i,messageUId:s,isPersited:y,isCounted:m,isStatusMessage:N,senderUserId:_,content:n._formatBytes(r),sentTime:1e3*E,receivedTime:qt.getTime(),messageDirection:b.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:S,expansion:U,pushConfig:w,channelId:e.busChannel||"",isInterrupt:v,messageId:yt(p)||0}},e.prototype._formatHistoryMessages=function(e,t){var n=this,r=t.conversation||{},i=e.list,o=e.hasMsg,s=r.targetId,a=yt(e.syncTime),c=[];return xt(i,(function(e){var i=n._formatReceivedMessage(e,t);r.conversationType===G.ULTRA_GROUP?i.targetId=e.groupId||r.targetId:i.targetId=s,c.push(i)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},e.prototype._formatUltraMsgChangeList=function(e){var t=e.list,n=e.syncTime,r=e.hasNext;return{syncTime:n,list:t&&t.map((function(e){var t=e.targetId,n=e.type,r=e.time,i=e.changeType,o=e.msgUID,s=e.msgTime,a=e.busChannel,c=e.isAdmin,u=e.isDel,l=e.operatorId,h=e.subChangeType,d=e.userGroupIds,p=e.busChannelType,g=e.remindType;return{targetId:t,conversationType:n,changeType:i,messageUId:o,changeTime:yt(r),sendTime:yt(s),channelId:a||"",isAdmin:c,isDel:u,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:r}},e.prototype._formatUltraOperateStatusNotifyList=function(e){var t=e.type,n=e.notifyType,r=e.info,i=e.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(r)&&r.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.userId,i=e.opType,s=e.optime,a=yt(s);o.push({targetId:t,channelId:n,userId:r,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((function(e){var t=e.targetId,n=e.busChannel,r=e.count,i=e.opType;s.push({targetId:t,channelId:n,count:r,operationType:i})})),{conversationType:t,info:o,summary:s,hasInfo:c,hasSummary:a}},e.prototype._formatUltraMsgList=function(e,t){var n=this,r=e.list;return{list:r&&r.map((function(e){return n._formatReceivedMessage(e,t)}))}},e.prototype._formatUltraGroupUnreadMentionedList=function(e){var t=e.msgInfo;return(void 0===t?[]:t).map((function(e){return{messageUId:e.msgId,senTtime:yt(e.msgTime),mentionedType:e.remindType,messageType:e.className||""}}))},e.prototype._getUltraGroupConversationInfo=function(e,t){var n=t.versionTime,r=t.unreadCount,i=t.remindCount,o=t.busChannelType,s=t.msgInfo,a=t.remindMeCount;return e.versionTime=yt(n)||0,e.unreadMessageCount=this._getUnreadCount(yt(r)||0),e.unreadMentionedCount=this._getUnreadCount(yt(i)||0),e.unreadMentionedMeCount=this._getUnreadCount(yt(a)||0),e.channelType=o||exports.UltraGroupChannelType.PUBLIC,e.lastReadTime=0,s&&(e.firstUnreadMessage={sentTime:yt(s.msgTime)},e.lastReadTime=yt(s.msgTime)-1),e},e.prototype._getUnreadCount=function(e){return e>999?999:e},e.prototype._formatConversationList=function(e,t){var n=this,r=this,i=e.info,o=t.afterDecode,s={list:(i=Dt(i,(function(e){var i=e.msg,s=e.userId,a=e.type,c=e.unreadCount,u=e.busChannel,l=null;i&&((l=r._formatReceivedMessage(i,t)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:yt(c)||0,latestMessage:l||{},channelId:u||""};return a===G.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,e)),(null==o?void 0:o(h))||h})))||[]};return((null==t?void 0:t.conversationType)||G.NONE)===G.ULTRA_GROUP&&(s.isFinished=e.isFinished),s},e.prototype._formatSetUserSettingOutput=function(e){return e},e.prototype._formatChatRoomInfos=function(e){var t=e.userTotalNums,n=e.userInfos;return{userCount:t,userInfos:Dt(n,(function(e){var t=e.id,n=e.time;return{id:t,time:yt(n)}}))}},e.prototype._formatChatRoomKVList=function(e){var t=e.entries,n=e.bFullUpdate,r=e.syncTime;return t=Dt(t=t||[],(function(e){var t=e.key,n=e.value,r=e.status,i=e.timestamp,o=e.uid,s=e.version,a=function(e){return{isAutoDelete:!!(1&e),isOverwrite:!!(2&e),type:4&e?ne.DELETE:ne.UPDATE}}(r);return{key:t,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:yt(i),version:yt(s)}})),{kvEntries:t,isFullUpdate:n,syncTime:r}},e.prototype._formatUserSetting=function(e){var t=this,n=e.items,r=e.version,i={};return xt(n||[],(function(e){var n=e.key,r=e.version,o=e.value;e.version=yt(r),e.value=t._readBytes(o),"Tag"===n&&e.tags.forEach((function(e){e.createdTime=yt(e.createdTime),e.tagName=e.name})),i[n]=e})),{settings:i,version:r}},e.prototype._formatConversationStatus=function(e){var t=e.state,n=[];return xt(t,(function(e){var t=e.type,r=e.channelId,i=e.time,o=e.stateItem,s=e.busChannel,a=q.CLOSE,c=j.NOT_SET,u=!1,l=[];xt(o,(function(e){var t=e.sessionStateType,n=e.value,r=e.tags;switch(t){case Wr:a=n===jr?q.OPEN:q.CLOSE,c=Number(n)||j.NOT_SET;break;case Jr:u=n===jr;break;case Xr:l=r}})),n.push({conversationType:t,type:t,targetId:r,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:yt(i),tags:l,channelId:s||""})})),n},e.prototype._formatGrpReadReceiptQryResp=function(e){var t=e.totalMemberNum,n=e.list;return n.forEach((function(e){e.readTime=yt(e.readTime)})),{totalMemberCount:t,list:n}},e.prototype._formatUserSettingNotification=function(e){return e},e.prototype._formatChrmKVVersion=function(e){var t=e.joinTime,n=e.createTime,r=e.memberCount,i=e.chatroomBanState;return{joinTime:t,createTime:n||0,memberCount:r||0,isAllChatroomBanned:!!(1&i),isCurrentUserBanned:!!(2&i),isCurrentChatroomBanned:!!(4&i),isCurrentChatroomInWhitelist:!!(1&e.whiteListState)}},e.prototype._formatRTCJoinedUserInfo=function(e){return(e.info||[]).map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:yt(e.joinTime)}}))},e.prototype._formatCallKVInfo=function(e){return e},e.prototype._fromatCallInfoDownStream=function(e){return e},e.prototype.encodeServerConfParams=function(){var e=this._codec.getModule(to);return e.setNothing(1),e.getArrayData()},e.prototype._updateMentionedInfo=function(e,t,n){var r,i,o;return{userIdList:(null===(r=e.mentionedInfo)||void 0===r?void 0:r.userIdList)||t,type:(null===(i=e.mentionedInfo)||void 0===i?void 0:i.type)||n||W.ALL,mentionedContent:(null===(o=e.mentionedInfo)||void 0===o?void 0:o.mentionedContent)||""}},e.prototype._calculateFlag=function(e){var t=e.isFilerWhiteBlacklist,n=e.isVoipPush,r=e.pushConfig||{},i=0;return i|=n?1:0,i|=t?2:0,i|=r.disablePushTitle?4:0,i|=r.forceShowDetailContent?8:0},e.prototype._getPushExtraModule=function(e){var t=e.pushTitle,n=e.iOSConfig,r=e.androidConfig,i=e.templateId,o=void 0===i?"":i,s=this._codec.getModule(zi);if(t&&s.setTitle(t),n||r){var a=Rt(n,r);s.setPushConfigs(a)}return(null==r?void 0:r.notificationId)&&s.setPushId(null==r?void 0:r.notificationId),s.setTemplateId(o),s},e.prototype._getUpMsgModule=function(e,t){var n=t.messageType,r=t.isMentioned,i=t.mentionedType,o=t.content,s=t.directionalUserIdList,a=t.canIncludeExpansion,c=t.expansion,u=t.pushConfig,l=t.channelId,h=t.pushData,d=void 0===h?"":h,p=t.mentionedUserIdList,g=void 0===p?[]:p,f=t.pushContent,_=void 0===f?"":f,E=t.messageId,T=void 0===E?0:E,C=e.conversationType,v=e.targetId,I=this._codec.getModule(Zi),y=function(e){var t=e.isStatusMessage,n=e.isPersited,r=e.isCounted;t&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),e.isMentioned&&(i|=4),e.disableNotification&&(i|=32),e.canIncludeExpansion&&(i|=64),i}(t),m=u||{},R=m.pushContent,S=void 0===R?_:R,O=m.pushData,N=void 0===O?d:O;I.setSessionId(y),r&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,i)),S&&I.setPushText(S),N&&I.setAppData(N),s&&I.setUserId(s);var M=this._calculateFlag(t);if(I.setConfigFlag(M),I.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),I.setContent(JSON.stringify(o)),a&&c){var L={};xt(c,(function(e,t){L[t]={v:e}})),I.setExtraContent(JSON.stringify(L))}if(u){var U=this._getPushExtraModule(u);I.setPushExt(U)}return I.setClientUniqueId(T),Ye(l)||I.setBusChannel(l),C===G.SYSTEM&&I.setSystemId(v),I},e.prototype.encodeUpMsg=function(e,t){return this._getUpMsgModule(e,t).getArrayData()},e.prototype.encodeSyncMsg=function(e){var t=e.sendboxTime,n=e.inboxTime,r=e.broadcastSyncTime,i=this._codec.getModule(ro);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(t),i.setSyncTime(n),i.setBroadcastSyncTime(r),i.getArrayData()},e.prototype.encodeChrmSyncMsg=function(e,t){e=e||0,t=t||0;var n=this._codec.getModule(io);return n.setCount(t),n.setSyncTime(e),n.getArrayData()},e.prototype.encodeGetHistoryMsg=function(e,t){var n=t.count,r=t.order,i=t.timestamp,o=t.channelId,s=this._codec.getModule(so);return s.setTargetId(e),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},e.prototype.encodeSuperSyncMsg=function(e){var t=this._codec.getModule(hs);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeGetConversationList=function(e){var t=(e=e||{}).count,n=e.startTime,r=this._codec.getModule(co);return r.setType(1),r.setCount(t),r.setStartTime(n),r.getArrayData()},e.prototype.encodeOldConversationList=function(e){var t=(e=e||{}).count,n=e.type,r=e.startTime,i=e.order;t=t||0,r=r||0,i=i||0;var o=this._codec.getModule(co);return o.setType(n),o.setCount(t),o.setStartTime(r),o.setOrder(i),o.getArrayData()},e.prototype.encodeRemoveOldConversationList=function(e){var t=(e=e||{}).conversationType,n=e.channelId,r=this._codec.getModule(fo);return r.setType(t),n&&r.setBusChannel([n]),r.getArrayData()},e.prototype.encodeRemoveConversationList=function(e){var t=this,n=this._codec.getModule(ho),r=[];return xt(e,(function(e){var n=e.conversationType,i=e.targetId,o=t._codec.getModule(po);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},e.prototype.encodeDeleteMessages=function(e,t,n,r){var i=this._codec.getModule(_o),o=[];return xt(n,(function(e){o.push({msgId:e.messageUId,msgDataTime:e.sentTime,direct:e.messageDirection})})),i.setType(e),i.setConversationId(t),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},e.prototype.encodeClearMessages=function(e,t,n,r){var i=this._codec.getModule(Eo);return t=t||(new Date).getTime(),i.setDataTime(t),i.setTargetId(e),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()},e.prototype.encodeClearUnreadCount=function(e,t){var n=e.conversationType,r=e.targetId,i=e.channelId,o=t.timestamp,s=this._codec.getModule(To);return o=o||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(o),s.setBusChannel(i),s.getArrayData()},e.prototype.encodeExpandUltraMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.keys,c={mid:o,put:e.expansion,del:a,clear:e.removeAll?1:0},u=this._codec.getModule(ds);return u.setFromUserId(t),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},e.prototype.encodemodifyMessage=function(e,t){var n=e.targetId,r=e.conversationType,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.content,c=this._codec.getModule(ds);return c.setFromUserId(t),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},e.prototype.encodeQueryMsgChange=function(e){var t=this._codec.getModule(ps);return t.setSyncTime(e),t.getArrayData()},e.prototype.encodeMsgQuery=function(e){var t=e.targetId,n=e.conversationType,r=e.messages,i=this._codec.getModule(_s),o=r.map((function(e){return{msgTime:e.sendTime,msgUID:e.messageUId,busChannel:e.channelId}}));return i.setTargetId(t),i.setType(n),i.setQuery(o),i.getArrayData()},e.prototype.encodeUnreadMentionedMsgQuery=function(e){var t=e.targetId,n=e.channelId,r=e.sentTime,i=e.count,o=this._codec.getModule(Zo);return o.setGroupId(t),o.setBusChannel(n),o.setMsgTime(r),o.setSize(i),o.getArrayData()},e.prototype.encodeOperateStatus=function(e,t,n,r){var i=this._codec.getModule(Cs);return i.setTargetId(e),i.setType(t),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},e.prototype.encodeJoinOrQuitChatRoom=function(){var e=this._codec.getModule(Co);return e.setNothing(1),e.getArrayData()},e.prototype.encodeGetChatRoomInfo=function(e,t){var n=this._codec.getModule(Io);return n.setCount(e),n.setOrder(t),n.getArrayData()},e.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(e,t){var n=this._codec.getModule(Xo);return n.setUnpushLevel(e),n.setBusChannel(t),n.getArrayData()},e.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(e){var t=this._codec.getModule(Jo);return t.setBusChannel(e),t.getArrayData()},e.prototype.encodeGetFileToken=function(e,t,n,r,i){var o=this._codec.getModule(mo);return o.setType(e),o.setKey(t),o.setHttpMethod(n),o.setQueryString(r),o.setUrl(i),o.getArrayData()},e.prototype.encodeGetFileUrl=function(e,t,n,r){var i=this._codec.getModule(e);return i.setType(t),i.setKey(n),r&&i.setFileName(r),i.getArrayData()},e.prototype.encodeModifyChatRoomKV=function(e,t,n){var r=this._codec.getModule(Uo),i=t.key,o=t.value,s=t.notificationExtra,a=t.isSendNotification,c=t.type,u=t.timestamp,l=c||ne.UPDATE,h=Yt(t,l),d={key:i,value:o||"",uid:n,version:u};if(Ye(h)||(d.status=h),r.setEntry(d),a){var p={conversationType:G.CHATROOM,targetId:e},g={key:i,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:H.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r.setNotification(f),r.setBNotify(!0),r.setType(G.CHATROOM)}return r.getArrayData()},e.prototype.encodeModifyChatRoomKVS=function(e,t,n){var r=this._codec.getModule(Ao),i=t.entries,o=t.type||ne.UPDATE,s=Yt(t,o),a=[];return i.forEach((function(e){var t={key:e.key,value:e.value||"",uid:n,version:e.timestamp};Ye(s)||(t.status=s),a.push(t)})),r.setEntry(a),r.getArrayData()},e.prototype.encodePullChatRoomKV=function(e){var t=this._codec.getModule(Vo);return t.setTimestamp(e),t.getArrayData()},e.prototype.encodePullUserSetting=function(e){var t=this._codec.getModule(ko);return t.setVersion(e),t.getArrayData()},e.prototype.encodeGetConversationStatus=function(e){var t=this._codec.getModule(Ko);return t.setTime(e),t.getArrayData()},e.prototype.encodeSetConversationStatus=function(e,t){var n=this,r=this._codec.getModule(Qo),i=qt.getTime(),o=[];return xt(e,(function(e){var t=n._codec.getModule(Yo),r=e.conversationType,s=e.targetId,a=e.notificationStatus,c=e.isTop,u=e.channelId,l=e.notificationLevel,h=[];t.setType(r),t.setChannelId(s),t.setTime(i),t.setBusChannel(u);var d=a===q.OPEN,p={};Ye(a)||(p[Wr]=d),Ye(l)||(p[Wr]=l),Ye(c)||(p[Jr]=c),xt(p,(function(e,t){if(!Ye(e)){var r=n._codec.getModule(jo);e=e?jr:Qr,Ye(l)||Number(t)!==Wr||(e=String(l)),r.setSessionStateType(Number(t)),r.setValue(e),h.push(r)}})),t.setStateItem(h),o.push(t)})),r.setVersion(t||i),r.setState(o),r.getArrayData()},e.prototype.encodeReadReceipt=function(e,t){var n=this._codec.getModule(es);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeCreateTag=function(e,t){var n=this,r=this._codec.getModule(is),i=[];return e.forEach((function(e){var t=n._codec.getModule(os);t.setTagId(e.tagId),t.setName(e.tagName),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeMessageReader=function(e,t){var n=this._codec.getModule(es);return n.setMsgId(e),t&&n.setChannelId(t),n.getArrayData()},e.prototype.encodeRemoveTag=function(e,t){var n=this,r=this._codec.getModule(ss),i=[];return e.forEach((function(e){var t=n._codec.getModule(os);t.setTagId(e),i.push(t)})),r.setTags(i),r.setVersion(t),r.getArrayData()},e.prototype.encodeDisConversationTag=function(e){var t=this._codec.getModule(as);return t.setTagId(e),t.getArrayData()},e.prototype.encodeUpdateConversationTag=function(e,t){var n=this,r=this._codec.getModule(Qo),i=[];return t.forEach((function(t){var r=n._codec.getModule(Yo),o=n._codec.getModule(jo),s=[];e.forEach((function(e){var t=n._codec.getModule(os);t.setTagId(e.tagId),Ye(e.isTop)||t.setIsTop(e.isTop),s.push(t)})),o.setSessionStateType(Xr),o.setValue(JSON.stringify(s)),o.setTags(s),r.setType(t.conversationType),r.setChannelId(t.targetId),r.setTime(Date.now()),r.setStateItem([o]),i.push(r)})),r.setState(i),r.setVersion(qt.getTime()),r.getArrayData()},e.prototype.encodeReportSDKInfo=function(e){var t=this._codec.getModule(cs);return t.setSdkInfo(e),t.getArrayData()},e.prototype.encodeUltraGroup=function(e,t){var n=this._codec.getModule(ls);return n.setSyncTime(e),n.setIsEraseMsgContent(t),n.getArrayData()},e.prototype.encodebindRTCRoomForChatroom=function(e){var t=this._codec.getModule(ms);return t.setRtcRoomId(e.rtcRoomId),t.getArrayData()},e.prototype.encodeSetCallInfo=function(e,t){var n=this._codec.getModule(Ss);return n.setKey(e),n.setDataContent(t),n.getArrayData()},e.prototype.encodePullKVMsg=function(e){var t=this._codec.getModule(Ns);return t.setSyncTime(e),t.getArrayData()},e}(),Ks=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t,n,r,i,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 Hs(a.logger),a}return a(t,e),t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.getLocalConnectedTime=function(){return this._localConnectedTime},t.prototype.getCrtServerTime=function(){return Date.now()-this._localConnectedTime+this._connectedTime},t.prototype.connectWithToken=function(e,t,n,r){return u(this,void 0,void 0,(function(){var n,i,o,s,a,c,u,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=t.openAnti,i=t.type,o=this.getCmpList(t),0===(s=o.filter((function(e,t){return o.findIndex((function(t){return t.addr===e.addr}))===t})).sort((function(e,t){return e.weight>t.weight?-1:1}))).length)return this.logger.error(exports.LogTagId.L_NAVI_CONF_E,"no service available",r),[2,{code:D.SERVER_UNAVAILABLE}];a=1===n?Er.V4:Er.V3,c=function(t){var n,o,c,h,d,p,g,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return n=s[t],o=n.protocol,c=n.addr,h=n.weight,d=function(e,t,n,r,i,o,s){var a=ar(i),c=a.type,u=a.version,l="browser"===i.tag?"|".concat(c,"|").concat(u):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(e,"://").concat(t,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(M,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":i.tag+encodeURIComponent(l)).concat(i.connectPlatform?"&platform=".concat(i.connectPlatform):"").concat(h)}(o===exports.EConnectProtocol.WS?"ws":"wss",c,u.appkey,e,u.runtime,"",a),p=Date.now(),[4,u.connectWebSocket(d,a,r)];case 1:return g=l.sent(),f=g.code,_=g.data,E=u.cmpWeightCache.findIndex((function(e){return e.addr===c})),T={bid:Lt(),ptc:exports.ProtocalType.WS,cod:f,net:u.getNetwork().type,dur:Date.now()-p,spr:0,pr:i||0,hos:c,idx:E,rct:u.retryCount?exports.ConnectType.RECONNECT:exports.ConnectType.CONNECT,cid:"".concat(u.uuid,"_").concat(u.retryCount),v:exports.StatisticsVersion.CURRENT,rsn:u.reason,count:u.retryCount,weight:h},u.statisticLog.__statistics(exports.StatisticsTag.IM_WEBSOCKET,JSON.stringify(T),r),f===D.RC_SOCKET_DISCONNECTED||f===D.TIMEOUT?[2,"continue"]:f!==D.SUCCESS?[2,{value:{code:f}}]:(u._localConnectedTime=Math.floor((Date.now()+p)/2),u._socket=_.socket,u.updateCmpWeight(s[t].addr,!0),u.curCmpUrl=s[t].addr,[2,{value:{code:f,data:_.userId}}])}}))},u=this,h=0,p.label=1;case 1:return h<s.length?[5,c(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:D.SERVER_UNAVAILABLE}]}}))}))},t.prototype.connectWebSocket=function(e,t,n){return u(this,void 0,void 0,(function(){var r=this;return l(this,(function(i){return this.logger.info(exports.LogTagId.T,"connect start: ".concat(e),n),[2,new Promise((function(i){var o=r.runtime.createWebSocket(e);r._socketIndex=o.id;var s=setTimeout((function(){r.logger.info(exports.LogTagId.T,"connect timeout: ".concat(e),n),i({code:D.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),r.logger.info(exports.LogTagId.T,"socket open",n)})),o.onMessage((function(e){if(r._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(e)){var s,a=Ti(r.logger,e,t);if(a instanceof oi){var c=a.status;if(c!==Ls.ACCEPTED)return r.logger.info(exports.LogTagId.T,"connect failed: ".concat(c),n),void i({code:(s=c,Gs[s])});r.logger.info(exports.LogTagId.T,"connect success",n);var u=a.timestamp,l=a.userId,h=a.messageId;return r._connectedTime=u,r._idCount=h,void i({code:D.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof si){var d=a.status;return r.logger.info(exports.LogTagId.T,"recv disconnect signal -> status: ".concat(d)),void r.onRecvDisconnect(d,o)}r._onReceiveSignal(a)}}else r.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:r._socketIndex,curSocketId:o.id}))})),o.onClose((function(){r.logger.info(exports.LogTagId.T,"socket close",n);var e=D.RC_SOCKET_DISCONNECTED;i({code:e}),r.onSocketEnd(o,e)})),o.onError((function(e){r.logger.info(exports.LogTagId.T,"socket error",n);var t=D.RC_SOCKET_DISCONNECTED;i({code:t}),r.onSocketEnd(o,t)}))}))]}))}))},t.prototype._qosNeedAck=function(e,t){e.header&&e.header.qos!==gr.AT_MOST_ONCE&&(e instanceof hi&&!e.syncMsg&&(this.logger.debug(exports.LogTagId.O,"send pubAck -> ".concat(t," ").concat(e.topic)),this.sendOnly(new gi(t))),e instanceof Ei&&(this.logger.debug(exports.LogTagId.O,"send queryCon -> ".concat(t," ").concat(e.topic)),this.sendOnly(new _i(t))))},t.prototype._publishReader=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o=this;return l(this,(function(s){switch(s.label){case 0:return n=e.syncMsg,r=e.topic,this.logger.debug(exports.LogTagId.O,"recv PublishReader -> messageId: ".concat(t," ").concat(r)),r===en?[2]:!n||function(e){return[Ci.ppMsgS,Ci.pgMsgS,Ci.chatMsgS].map((function(e){return Ci[e]})).indexOf(e)>=0}(r)?(this.wsListener.signal(e),[2]):[4,new Promise((function(e){o._syncMessageIds[t]=e}))];case 1:return i=s.sent(),delete this._syncMessageIds[t],this.wsListener.signal(e,i),[2]}}))}))},t.prototype._onReceiveSignal=function(e){return u(this,void 0,void 0,(function(){var t,n,r;return l(this,(function(i){switch(i.label){case 0:return t=e.messageId,e instanceof ci&&this._pingResolve?(this._pingResolve(D.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(e,t),t>0&&(e instanceof pi||e instanceof Ei)&&(this.logger.debug(exports.LogTagId.O,"recv ack -> messageId: ".concat(t," ").concat(e.topic)),(n=this._messageIds[t])&&(n(e),delete this._messageIds[t]),(r=this._syncMessageIds[t])&&(delete this._syncMessageIds[t],r(e))),e instanceof hi?[4,this._publishReader(e,t)]:[3,2]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.onRecvDisconnect=function(e,t){this._socket&&this._socket===t&&(this._socket=null,this.clearResolves(),this.onDisconnectByServer(function(e){return Vs[e]}(e)))},t.prototype.onSocketEnd=function(e,t){this._socket&&this._socket===e&&(this._socket=null,this.clearResolves(),this.onDisconenctUnusual(t),this._pingResolve&&(this._pingResolve(t),this._pingResolve=void 0))},t.prototype.clearResolves=function(){for(var e in this._messageIds){var t=this._messageIds[e];delete this._messageIds[e],t(D.RC_SOCKET_DISCONNECTED)}},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t._pingResolve=n,setTimeout((function(){return n(D.TIMEOUT)}),e),t.sendOnly(new ai)}))},t.prototype.sendOnly=function(e){this._socket&&((e instanceof di||e instanceof fi)&&(e.messageId=this._generateMessageId()),this._socket.send(e.getBufferData().buffer))},t.prototype.send=function(e,t,n,r){return void 0===r&&(r=3e4),u(this,void 0,void 0,(function(){var i,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return this._socket?(i=this._generateMessageId(),e.messageId=i,this._socket.send(e.getBufferData().buffer),[4,new Promise((function(e){c._messageIds[i]=e,setTimeout((function(){c._messageIds[i]&&delete c._messageIds[i],e()}),r)}))]):[2,{code:D.RC_NET_CHANNEL_INVALID}];case 1:return(o=u.sent())?o instanceof Ei||o instanceof pi?(s=t&&o.data&&[D.SUCCESS,D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(o.status)>=0,a=s?this.codec.decodeByPBName(o.data,t,n):o,0!==o.status?(this.logger.warn(exports.LogTagId.O,"send failed -> message: ".concat(i,", respPBName: ").concat(t,", status: ").concat(o.status)),[2,{code:o.status,data:t&&o.data?a:null}]):[2,{code:D.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(exports.LogTagId.O,"send timeout -> message: ".concat(i,", respPBName: ").concat(t,", timeout: ").concat(r)),[2,{code:D.TIMEOUT}])}}))}))},t.prototype.close=function(e){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},t}(Fs);exports.StatisticL=void 0,(ks=exports.StatisticL||(exports.StatisticL={}))[ks.STATISTICS=-2]="STATISTICS",ks[ks.RECORD=-1]="RECORD";var qs=null,Ys="RC_CONF",js="RC_STATISTICS",Qs=null,Ws=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,qs];case 1:return(t=n.sent())?[4,new Promise((function(n){var r=t.db.transaction(js,"readwrite").objectStore(js),i=IDBKeyRange.lowerBound(Date.now()-e),o=r.getAllKeys(i);o.onsuccess=function(){var e=o.result,t=e.length;if(t>0){var i=r.delete(IDBKeyRange.bound(e[0],e[t-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),Qs=setTimeout((function(){return Ws(e)}),6e5),[2]}}))}))},Js=function(e,t,n){void 0===n&&(n=168),qs||("undefined"!=typeof window&&window&&window.indexedDB?qs=new Promise((function(r){var i=window.indexedDB;i.databases&&i.databases().then((function(e){e.some((function(e){return"RC_ENGINE_DB"===e.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(e),s=i.open(o,2);s.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,e.target.error),r(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(e){t.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(e){t.error(exports.LogTagId.L_LOGDB_ERROR_E,e.target.error)},o.onabort=function(e){t.info(exports.LogTagId.L_LOGDB_ABORT_S,e.target.error)},Ws(3600*Math.max(24,Math.min(168,n))*1e3),r({appkey:e,db:o})):r(null)},s.onupgradeneeded=function(e){var t=e.target.result;t.objectStoreNames.contains(js)&&t.deleteObjectStore(js);var n=t.createObjectStore(js,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=t.createObjectStore(Ys,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):t.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},Xs=function(){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return qs?(Qs&&(clearTimeout(Qs),Qs=null),[4,qs]):[2];case 1:return(e=t.sent())&&e.db.close(),qs=null,[2]}}))}))};function Zs(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,qs];case 1:return(t=n.sent())?[2,new Promise((function(n){var r=t.db.transaction(Ys,"readonly").objectStore(Ys).get(e);r.onsuccess=function(e){var t;n({value:null===(t=r.result)||void 0===t?void 0:t.value,success:!0})},r.onerror=function(e){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var zs="REPORT_SESSION",$s=function(e,t){return u(void 0,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(zs,"_").concat(e),[4,Zs("".concat(zs,"_").concat(e))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(t===(null==o?void 0:o.sessionId)||function(e,t){u(this,void 0,void 0,(function(){var n,r;return l(this,(function(i){switch(i.label){case 0:return[4,qs];case 1:return(n=i.sent())?(r=n.db,r.transaction(Ys,"readwrite").objectStore(Ys).put({key:e,value:t}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:t}),[2]):[2]}}))}))},ea=function(){return qs},ta=function(e){var t=e.sessionId,n=e.level,r=e.loggerId,i=e.traceId,o=e.time,s=e.tag,a=e.type,c=e.content,u=n<0?c||"":JSON.stringify({content:c,traceId:i,from:r});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(t,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},na=ht(),ra=Date.now(),ia=0,oa=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.__statistics=this._writer.bind(this,exports.StatisticL.STATISTICS)}return e.prototype._writer=function(e,t,n,r){var i=new Date;/^[\w-]+$/.test(t)&&this.flush({time:+i,sessionId:na,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:r})},e.prototype.createTraceId=function(){return"".concat(na,"-").concat(++ia)},e.prototype.getSessionId=function(){return na},e}(),sa=function(){function e(e,t,n,r,i,o){void 0===o&&(o=i),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.statisticDB=r,this.logger=i,this.reportClass=o,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){var t,n,r;return l(this,(function(i){return this.started?[2]:(this.userId=e.userId,e.logSwitch?(t=On.getLogUrlPolicyList(e,this.logger),n=t.policy,r=t.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,r.length>0&&this.realtimeReport(r[0].addr,n.level,n.itv),[2]):[2])}))}))},e.prototype.realtimeReport=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return r=Date.now(),i=this.statisticDB.getTimestamp4RealtimeLog()||ra,o=Math.max(r-5e3,i),s=this.reportClass.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:t}),s),[4,this.statisticDB.getStatistics(i,o,t,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressStatistics(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),g=je(e)?e:"https://".concat(e),g+="?version=".concat("5.8.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(u[u.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(e,t,n)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,r,i,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o}),s),[4,this.statisticDB.getStatistics(e,t,exports.StatisticL.STATISTICS,!1)]);case 1:return a=l.sent(),c=a.dbReady,u=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),s),h=je(r)?r:"https://".concat(r),h+="?version=".concat("5.8.4","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),c?u.length>0?[4,this.compressStatistics(u)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,f=p.data,d=g?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(exports.LogTagId.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(exports.LogTagId.L_REPORT_FULL_LOG_R,JSON.stringify({status:_}),s),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}(),aa="RC_STATISTICS",ca=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.flush=function(e){da(e)},t}(oa),ua=!1,la=[],ha=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return ua||0===la.length?[2]:(ua=!0,t=la.splice(0),[4,new Promise((function(n){var r=e.transaction(aa,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(aa);t.forEach((function(e){try{i.add(e)}catch(t){null===console||void 0===console||console.error("write log failed ->",e)}}))}))]);case 1:return n.sent(),ua=!1,setTimeout((function(){return ha(e)})),[2]}}))}))},da=function(e){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ea()];case 1:return(t=n.sent())?(la.push(e),ha(t.db),[2]):[2]}}))}))},pa=0,ga=function(){return{setTimestamp4RealtimeLog:function(e){pa=e},getTimestamp4RealtimeLog:function(){return pa},getStatistics:function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return[4,ea()];case 1:return(n=r.sent())?[2,new Promise((function(r){var i=n.db.transaction(aa,"readonly").objectStore(aa),o=[],s=IDBKeyRange.bound(e,t),a=i.index("time").openCursor(s);a.onsuccess=function(e){var t=e.target.result;if(t){var n=t.value;o.push(n),t.continue()}else r({dbReady:!0,logs:o})},a.onerror=function(e){r({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},fa=function(e){function t(t,n,r,i){var o=this,s=sr(n),a=ar(n),c="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=e.call(this,t,s,c,ga(),r,i)||this).runtime=n,o}return a(t,e),t.prototype.send=function(e){return this.runtime.httpReq(e)},t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,$s(t.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,e.prototype.checkStart.call(this,t)]}}))}))},t.prototype.compressStatistics=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{success:!0,data:rr(e.map(ta).join(""))}]}))}))},t.prototype.isReporter=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,(t=this.userId,n=this.reportClass.getSessionId(),u(void 0,void 0,void 0,(function(){var e,r,i;return l(this,(function(o){switch(o.label){case 0:return[4,Zs("".concat(zs,"_").concat(t))];case 1:return e=o.sent(),r=e.success,i=e.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,e.sent()]}var t,n}))}))},t.prototype.report=function(t,n,r,i,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){switch(a.label){case 0:return[4,this.isReporter()];case 1:return a.sent()?[2,e.prototype.report.call(this,t,n,r,i,o,s)]:[2]}}))}))},t.prototype.realtimeReport=function(t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,e.prototype.realtimeReport.call(this,t,n,r)]}))}))},t}(sa),_a=function(e){function t(t,n,r,i){void 0===i&&(i=exports.AreaCode.BJ);var o=e.call(this,t,n,i)||this;return o.appkey=t,o.logger=n,o.runtime=r,o.areaCode=i,o._storageKey="",o._storageKey=U.STATIC_CONFIG_KEY(t),o}return a(t,e),t.prototype.getCache=function(){return this.runtime.localStorage.getItem(this._storageKey)},t.prototype.setCache=function(e){this.runtime.localStorage.setItem(this._storageKey,e)},t.prototype.clearCache=function(){this.runtime.localStorage.removeItem(this._storageKey)},t.prototype.sendRequest=function(e){return u(this,void 0,void 0,(function(){var t,n,r;return l(this,(function(i){switch(i.label){case 0:return[4,this.runtime.httpReq({url:e})];case 1:return t=i.sent(),n=t.status,r=t.data,[2,{code:n,data:r}]}}))}))},t.prototype.decryptData=function(e){return u(this,void 0,void 0,(function(){var t,n;return l(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,Ut(e,m,R)];case 1:return t=r.sent(),[2,JSON.parse(t)];case 2:return n=r.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},t}(Nn),Ea=function(e,t,r,i,o,s,a){return{conversationType:e,targetId:t,senderUserId:s,messageDirection:b.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:o,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt,messageId:a||0,sentStatus:exports.SentStatus.SENT}},Ta=function(e){return e.sort((function(e,t){var n,r,i=(null===(n=e.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=t.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i})),e},Ca=function(e){function t(t,n,r,i){var o=e.call(this,t,n,r,i,new Jn(i.appkey,"RC-E","IM"),new ca(i.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=i.appkey,a=i.logOutputLevel,c=i.logExpireTime,u=i.navigators,l=i.areaCode,h=i.logServerUrl,d=i.miniCMPProxy;return o.logger.setOutputLevel(a),xn(s,o.logger,t,c),o.reporter=new ur(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new Fi(s,o.logger,o.statisticLog,t,new _a(s,o.logger,t,l)),Js(s,o.logger,c),o.reporterStatistic=new fa(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new vi(t,s),o._sendMessageStore=new Hi(t,s),o._chrmEntryHandler=new mi(o),o._connMgr=new Ks(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}),On.init({areaCode:l,navigators:u,logServerUrl:h,miniCMPProxy:d}),o}return a(t,e),t.prototype.onConnected=function(){var e=this.navi.getNaviInfoFromCache(this._connMgr.getToken()),t=this._connMgr.getCurrentUserId();this.currentUserId=t,this._pullOfflineFinished=!1,this._joinedChrmManager||(this._joinedChrmManager=new Ri(e.joinMChrm)),this._conversationManager||(this._conversationManager=new Di(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new Xi(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Vi(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===e.ugMsg&&this._notificationOnline(),this.reporter.checkStart(e),this.reporterStatistic.checkStart(e)},t.prototype.onDisconnected=function(e){this._resetMemoryState(),this._watcher.onDisconnected(e)},t.prototype.createLogger=function(e,t){return new Jn(this._appkey,e,t)},t.prototype.refetchNaviInfo=function(){return this.navi.request(this._connMgr.getToken(),!0,!0,this.logger.createTraceId())},t.prototype.getNaviInfoFromCache=function(){return this.navi.getNaviInfoFromCache(this._connMgr.getToken())},t.prototype.getConnectedTime=function(){return this._connMgr.getConnectedTime()},t.prototype.getConnectionStatus=function(){return this._connMgr.getConnectionStatus()},t.prototype.connect=function(e,t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return this._openCallPlus=n,[2,this._connMgr.connect(e,t,n,r)]}))}))},t.prototype._signalHandler=function(e,t){var n=e.syncMsg,r=e.topic;if(n)this._receiveSyncMsg(e,t);else{var i=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,r,i);var o=Ci[r];if(o)switch(o){case Ci.s_ntf:this._pullMsg(e);break;case Ci.s_msg:this._receiveMsg(e);break;case Ci.s_cmd:this._receiveStateNotify(e);break;case Ci.s_us:this._receiveSettingNotify(e);break;case Ci.rtc_ntf:this._receiveRtcKv(e.data);break;case Ci.s_opNtf:this._pullOperateStatusNotify(e);break;case Ci.s_pubCall:this._pubCallInfo(e)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,r,i)}},t.prototype._receiveStateNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,oo),n=t.time,r=t.type,i=t.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(i,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(i),this._watcher.chatroom({chatroomDestroyed:e.targetId});break;case 6:this._ultraGroupTimeQue.push(n),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp);break;case 7:this._pullUltraChangeMessageQue.push(n),this._pullUltraChangeMessageList(this._lastPullingUltraChangeMessageTime)}},t.prototype._receiveSettingNotify=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Ho).version;this._userSettingManager.pullUserSettings(t)},t.prototype._receiveMessageExpansion=function(e){var t=e.content,n=t.put,r=t.del,i=t.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})},t.prototype._clearUltraGroupUnreadCount=function(e,t){var n=this._connMgr.codec.decodeByPBName(e.data,To),r=n.channelId,i=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(i,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(Kt([s]))),t&&(this._ultraMsgMap[t.messageUId]=t.timestamp)},t.prototype._receiveSyncMsg=function(e,t){if(Ki.includes(e.topic))if(e.topic!==Ci[Ci.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(e.data,Zi,{currentUserId:this.currentUserId,signal:e});((n=this._handleMsgProperties(n)).conversationType!==G.CHATROOM||this._chrmsQueue[n.targetId])&&(this._pullingMsg?this._pullQueue.push((null==t?void 0:t.timestamp)||n.sentTime):(t&&(n.sentTime=t.timestamp,n.messageUId=t.messageUId,this._sendMessageStore.setMessage(t.messageUId,t.timestamp)),this.logger.info(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==H.EXPANSION_NOTIFY?((n.messageType===H.SYNC_READ_STATUS||n.messageType===H.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(e,t)},t.prototype._batchMessage=function(e){for(var t=this,n=[],r=[],i=e.length-1;i>=0;i-=1){var o=e[i];o.messageType!==H.LOG_COMMAND||"rongcloudsystem"!==o.senderUserId?n.unshift(o):r.unshift(o)}this._watcher.batchMessage(n),0!==r.length&&r.forEach((function(e){var n=e.content,r=n.startTime,i=n.endTime,o=n.platform,s=n.logId,a=n.uri;t.reporter.report(parseInt(r,10),parseInt(i,10),o,a,s,e.messageUId)}))},t.prototype._pubCallInfo=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,Os),n=t.key,r=t.dataContent,i=t.maxTime;this._latestPullKVMsgTimestamp=i,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:r}]}))},t.prototype._pullMsg=function(e){var t=this._connMgr.codec.decodeByPBName(e.data,oo),n=t.type,r=t.chrmId,i=t.time;if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(i)),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),this._syncMsg()},t.prototype._startSyncInterval=function(){var e=this;this._stopSyncInterval();this._intervalTimer=setInterval((function(){Date.now()-e._latestSyncTimestamp>=18e4&&e._syncMsg()}),3e4),this._latestSyncTimestamp=Date.now(),this._syncMsg()},t.prototype._stopSyncInterval=function(){-1!==this._intervalTimer&&(clearInterval(this._intervalTimer),this._intervalTimer=-1)},t.prototype._syncCallPullKVMsg=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),t=new fi(Vr,e,this.currentUserId),[4,this._connMgr.send(t,Ms)]):[2];case 1:return n=o.sent(),r=n.code,i=n.data,r===D.SUCCESS&&i?(this._latestPullKVMsgTimestamp=i.maxTime,this._watcher.callInfo(JSON.stringify({list:i.info})),[2]):[2]}}))}))},Object.defineProperty(t.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),t.prototype._messageProcessor=function(e){var t=this,n=0,r=[],i=[];return e.forEach((function(e){if((r.push(e.messageUId),e.messageDirection===b.SEND)&&(n=Math.max(e.sentTime,n),t._sendMessageStore.getSendMessageMap()[e.messageUId]))return void t._sendMessageStore.removeByUID(e.messageUId);if(e.messageType!==H.DELIVERED&&e.messageType!==H.DELIVERED_MSG)if(e.messageType!==H.EXPANSION_NOTIFY){if(e.messageType!==H.SYNC_READ_STATUS||e.senderUserId===t.currentUserId){(e.messageType===H.SYNC_READ_STATUS||e.messageType===H.READ_RECEIPT&&e.senderUserId===t.currentUserId)&&t._conversationManager.clearUnreadCount(e.conversationType,e.targetId,e.channelId);var o=t._handleMsgProperties(e);t._conversationManager.setConversationCacheByMessage(o,!0),i.push(o)}}else t._receiveMessageExpansion(e)})),{newOutboxTime:n,messageUIds:r,messages:i}},t.prototype._syncMsg=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,c,u,h,d,p,g,f,_,E,T,C,v;return l(this,(function(l){switch(l.label){case 0:return this._pullingMsg?[2]:this._isConnected?(this._pullingMsg=!0,e=this._letterbox.getOutboxTime(this.currentUserId),t=this._letterbox.getInboxTime(this.currentUserId),n=this._letterbox.getBroadcastSyncTime(this.currentUserId),r=this._connMgr.codec.encodeSyncMsg({sendboxTime:e,inboxTime:t,broadcastSyncTime:n}),i=new fi(Ci[Ci.pullMsg],r,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:e,inboxTime:t,broadcastSyncTime:n}),o),[4,this._connMgr.send(i,eo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==D.SUCCESS||!c||Ye(c.finished)||Ye(c.list)||Ye(c.syncTime)?(this.logger.warn(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,d=c.syncTime,p=c.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:u.map((function(e){return{messageUId:e.messageUId,messageId:e.messageId,sentTime:e.sentTime}}))}),o),f=this._messageProcessor(u),_=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(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,C=this._pullQueue.filter((function(e){return e>d})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,C),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:C}),o),h?(this._pullQueue.length>0&&(this._pullQueue.length=0,this._syncMsg()),[2]):(this._syncMsg(),[2]))}}))}))},t.prototype._receiveMsg=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,$i,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(t=this._handleMsgProperties(t),this.logger.info(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:t.messageUId,messgeId:t.messageId,sentTime:t.sentTime})),t.messageType!==H.DELIVERED&&t.messageType!==H.DELIVERED_MSG){if(t.conversationType!==G.RTC_ROOM){if(this._pullingMsg)return;if(this._pullQueue.length>0)return void this._syncMsg()}t.senderUserId===this.currentUserId&&this._sendMessageStore.setMessage(t.messageUId,t.sentTime),t.isStatusMessage||t.senderUserId===this.currentUserId||this._letterbox.setInboxTime(t.sentTime,this.currentUserId),t.messageType!==H.EXPANSION_NOTIFY?t.messageType===H.SYNC_READ_STATUS&&t.senderUserId!==this.currentUserId||(this._conversationManager.setConversationCacheByMessage(t,!0),this._batchMessage([t])):this._receiveMessageExpansion(t)}}},t.prototype._handleMsgProperties=function(e,t){void 0===t&&(t=!1);var n,r=e.messageType,i=e.isStatusMessage,o=e.isCounted,s=void 0!==o&&o,a=e.isPersited,u=void 0!==a&&a,l=r in S,h=r in this._customMessageType;if(n=l?c(c({},S[r]),{isStatusMessage:O.includes(r)}):h?this._customMessageType[r]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(e,n),t&&!Ye(i)&&(e.isStatusMessage=i),!t){var d=e.content.user;if(d){var p=d.portrait,g=d.portraitUri,f=p||g;f&&(d.portrait=d.portraitUri=f)}}return e},t.prototype._fixDownstreamData=function(e,t,n){return e&&2===t.list.length&&(t.hasMore=!0,0===n?t.list.shift():t.list.pop()),t},t.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){var c;return void 0===o&&(o=""),u(this,void 0,void 0,(function(){var s,u,h,d,p,g,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return u=(s=this).currentUserId,h=s._connMgr,d=qr[e]||Gr,p=1===r&&0===n,h?(g=h.codec.encodeGetHistoryMsg(t,{timestamp:n,count:p?2:r,order:i,channelId:o}),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:o,timestamp:n,count:r,order:i}),a),[4,h.send(new fi(d,g,u),ao,{currentUserId:u,connectedTime:h.getConnectedTime(),conversation:{targetId:t}})]):[3,2];case 1:return f=l.sent(),(_=f.code)===D.SUCCESS&&g?(E=f.data,E=this._fixDownstreamData(p,E,i),T=[],null===(c=E.list)||void 0===c||c.forEach((function(e){e&&T.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:T.join(",")}),a),[2,{code:_,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:D.RC_NET_CHANNEL_INVALID}]}}))}))},t.prototype.getMessages=function(e,t,n,r,i,o,s){return this.getHistoryMessage(e,t,n,r,i,o,s)},t.prototype.reportSDKInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this.logger.createTraceId(),o=JSON.stringify(e),this.logger.debug(exports.LogTagId.L_VER_REPORT_T,o,i),s=r.codec.encodeReportSDKInfo(o),a=new fi(Ci[Ci.reportsdk],s,n),[4,r.send(a)]):[2];case 1:return(c=u.sent().code)!==D.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,c,i),[2]}}))}))},t.prototype.deleteRemoteMessage=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeDeleteMessages(e,t,n,r),c=new fi(Rr,a,o),[4,s.send(c)]):[2,D.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),[2,u.code]}}))}))},t.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeClearMessages(t,n,r,e),c=Yr[e],u=new fi(c,a,o),[4,s.send(u)]):[2,D.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},t.prototype.getConversationList=function(e,t,n,r,i){return void 0===e&&(e=300),u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,t=t||G.PRIVATE,a=s.codec.encodeOldConversationList({count:e,type:t,startTime:n,order:r}),c=new fi(wr,a,o),[4,s.send(c,uo,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(e){var t=e.conversationType,n=e.targetId,r=e.channelId,i=p._conversationManager.get(t,n,r);return Object.assign(e,i),e}})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==D.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},t.prototype.removeConversation=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeRemoveOldConversationList({conversationType:e,channelId:n,targetId:t}),o=new fi(Pr,i,t),[4,r.send(o)]):[2,D.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},t.prototype.getConversation=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return e!==G.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(t)])?[3,3]:[2,{code:D.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(e,t,n))?[4,this.getHistoryMessage(e,t,0,1,0)]:[2,{code:D.CONVER_GET_ERROR}];case 2:if(o=u.sent(),s=o.code,a=o.data,s!==D.SUCCESS)return[2,{code:D.CONVER_GET_ERROR}];c=(null==a?void 0:a.list[0])||null,r={conversationType:e,targetId:t,channelId:n,unreadMessageCount:i.unreadMessageCount||0,latestMessage:c,notificationStatus:i.notificationStatus||q.CLOSE,notificationLevel:i.notificationLevel||j.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},u.label=3;case 3:return[2,{code:D.SUCCESS,data:r}]}}))}))},t.prototype.getAllConversationUnreadCount=function(e,t,n){var r=this._conversationManager.getAllUnreadCount(e,t,n);return Promise.resolve({code:D.SUCCESS,data:r})},t.prototype.getTotalUnreadCountByLevels=function(e,t,n){void 0===n&&(n=!1);var r=0;if(e.includes(G.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];(0===t.length||t.includes(o.notificationLevel))&&(r+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(e,t,n),Promise.resolve({code:D.SUCCESS,data:r})},t.prototype.getConversationUnreadCount=function(e,t,n){var r,i;return e===G.ULTRA_GROUP?(i=(null===(r=this._ultraGroupMap["".concat(n,"_").concat(t)])||void 0===r?void 0:r.unreadMessageCount)||0,i=this._getUnreadCount(i)):i=this._conversationManager.getUnreadCount(e,t,n),Promise.resolve({code:D.SUCCESS,data:i})},t.prototype.clearConversationUnreadCount=function(e,t,n){return this._conversationManager.clearUnreadCount(e,t,n,!1),Promise.resolve(D.SUCCESS)},t.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(D.SUCCESS)},t.prototype.getFirstUnreadMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.saveConversationMessageDraft=function(e,t,n,r){return this._conversationManager.setDraft(e,t,n,r),Promise.resolve(D.SUCCESS)},t.prototype.getConversationMessageDraft=function(e,t,n){var r=this._conversationManager.getDraft(e,t,n);return Promise.resolve({code:D.SUCCESS,data:r})},t.prototype.clearConversationMessageDraft=function(e,t,n){return this._conversationManager.clearDraft(e,t,n),Promise.resolve(D.SUCCESS)},t.prototype.pullConversationStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this)._connMgr,r=t.currentUserId,i=n.codec.encodeGetConversationStatus(e),o=new fi(Ci[Ci.pullSeAtts],i,r),[4,n.send(o,qo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:e,userId:r})),a!==D.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(e){var t=e.conversationType,n=e.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),t===G.ULTRA_GROUP?h._setUltraConversationStatus(e):u.push(e)})),[2,{code:a,data:u}])}}))}))},t.prototype._setUltraConversationStatus=function(e){var t=e.targetId,n=e.notificationStatus,r=e.notificationLevel,i=e.channelId,o=e.isTop,s=this._ultraGroupMap["".concat(i,"_").concat(t)];return s&&void 0!==r&&(s.notificationLevel=r,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==n&&(s.notificationStatus=n,this._ultraGroupManager.addUltraGroupStatus(s)),s&&void 0!==o&&(s.isTop=o),s},t.prototype.batchSetConversationStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,u,h,d,p,g,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(t=this).currentUserId,r=t._connMgr,i=this._conversationManager.getConversationUpdatedTime(),o=r.codec.encodeSetConversationStatus(e,i),s=new fi(br,o,n),[4,r.send(s,Wo)]):[2,D.RC_NET_UNAVAILABLE];case 1:return a=l.sent(),u=a.code,h=a.data,u!==D.SUCCESS?[2,u]:(d=h,this._conversationManager.setConversationUpdatedTime(d.version),p=[],e.forEach((function(e){if(e.conversationType!==G.ULTRA_GROUP)f._conversationManager.addStatus(c(c({},e),{updatedTime:d.version}),!0);else{var t=f._setUltraConversationStatus(e);t&&p.push(t)}})),p.length>0&&(g=Kt(p),g=Ta(g),this._watcher.conversation(g)),[2,u])}}))}))},t.prototype.setConversationNotificationLevel=function(e,t,n,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this.batchSetConversationStatus([{conversationType:e,targetId:t,notificationLevel:n,channelId:r}])]}))}))},t.prototype._joinChrm=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p,g,f,_,E,T,C,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeJoinOrQuitChatRoom(),a=new fi(s=n?Or:Sr,o,e),this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,topic:s}),r),[4,i.send(a,vo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,d=u===D.SUCCESS?"info":"warn",this.logger[d](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:u,timestamp:(new Date).getTime()}),r),u===D.SUCCESS?(g=(p=h).joinTime,f=p.createTime,_=p.memberCount,E=p.isAllChatroomBanned,T=p.isCurrentUserBanned,C=p.isCurrentChatroomBanned,v=p.isCurrentChatroomInWhitelist,this._chrmsQueue[e]||(this._chrmsQueue[e]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(e,t,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(e,0),this._joinedChrmManager.set(e,t),this._startSyncIntervalForChrmPull(),[2,{code:u,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:C,isCurrentChatroomInWhitelist:v}}]):[2,{code:u}]}}))}))},t.prototype._rejoinChrm=function(){return u(this,void 0,void 0,(function(){var e,t,n,r,i,o,s,a,u,h;return l(this,(function(l){switch(l.label){case 0:for(n in e=this._joinedChrmManager.get(),t=[],e)t.push(n);r=0,l.label=1;case 1:return r<t.length?(i=t[r],this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:i,count:e[i]||10,topic:Or})),o=this.logger.createTraceId(),[4,this._joinChrm(i,e[i]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,u=s.data,h=a===D.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===D.SUCCESS)return this._watcher.chatroom({rejoinedRoom:c({chatroomId:i,count:e[i]},u)}),[2];a===D.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(i),delete this._chrmsQueue[i]),this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:a}}),l.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},t.prototype._pullChrmMsg=function(e,t,n){return void 0===t&&(t=10),void 0===n&&(n=0),u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._chrmsQueue[e],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,t),a=new fi(Ci[Ci.chrmPull],s,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:e,timestamp:o})),[4,this._connMgr.send(a,eo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return c=l.sent(),u=c.code,h=c.data,r.pulling=!1,u===D.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,r.timestamp=n?Math.max(p,n):p,r.queue=r.queue.filter((function(e){return e>p})),f=[],_=[],d.forEach((function(e){e.sentTime<o||(f.push(e.messageUId),_.push(e))})),this._batchMessage(_),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:f.join(",")})),(!g||r.queue.length>0)&&this._pullChrmMsg(e),[2]):(this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:""})),[2])}}))}))},t.prototype.joinChatroom=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._joinChrm(e,t,!1,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.joinExistChatroom=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._joinChrm(e,t,!0,n)]}))}))},t.prototype.quitChatroom=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr,n=t.codec.encodeJoinOrQuitChatRoom(),r=new fi(Nr,n,e),[4,t.send(r)]):[2,D.RC_NET_UNAVAILABLE];case 1:return i=s.sent(),(o=i.code)===D.SUCCESS&&(delete this._chrmsQueue[e],this._chrmEntryHandler.reset(e),this._joinedChrmManager.remove(e)),[2,o]}}))}))},t.prototype.getChatroomInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeGetChatRoomInfo(t,n),o=new fi(Ci[Ci.queryChrmI],i,e),[4,r.send(o,yo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==D.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},t.prototype.getChatroomHistoryMessages=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeGetHistoryMsg(e,{timestamp:t,count:n,order:r}),s=new fi(kr,o,e),[4,i.send(s,ao,{conversation:{targetId:e}})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,c!==D.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},t.prototype._modifyChatroomKV=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=this._chrmEntryHandler.getVersion(e,t.key),t.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(e,t,i),a=t.type===ne.UPDATE?Mr:Lr,c=new fi(a,s,e),[4,r.send(c,vo)]):[2,D.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),(h=u.code)===D.SUCCESS?(this._chrmEntryHandler.setLocal(e,{kvEntries:[t],syncTime:this.getServerTime()},i),[2,h]):[2,h]}}))}))},t.prototype._chatroomKVStoreNotAllSuccess=function(e,t){var n=t.data,r=e;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(e){var t=r.findIndex((function(t){return e.key===t.key}));-1!==t&&r.splice(t,1)})),r},t.prototype._modifyChatroomKVS=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,t.entries.forEach((function(t){var n=_._chrmEntryHandler.getVersion(e,t.key);t.version=null==n?_.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(e,t,i),s=t.type===ne.UPDATE?Ur:Ar,a=new fi(s,o,e),[4,r.send(a,bo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,-1!==[D.SUCCESS,D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=c({},t)).entries,t.entries.forEach((function(e){p.push(c(c({},e),g))})),h===D.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=u.data,d=f.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,u)),this._chrmEntryHandler.setLocal(e,{kvEntries:p,syncTime:(new Date).getTime()},i)),[2,{code:h,data:d}]}}))}))},t.prototype.setChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.setChatroomEntries=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.UPDATE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.UPDATE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.removeChatroomEntries=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.DELETE,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKVS(e,t)]}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.type=ne.DELETE,t.isOverwrite=!0,t.userId=t.userId||this.currentUserId,[2,this._modifyChatroomKV(e,t)]}))}))},t.prototype.getChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(e,t))?[2,{code:D.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,i=r.codec.encodePullChatRoomKV(0),o=new fi(Ci[Ci.pullKV],i,e),[4,r.send(o,Po)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(e){return e.key===t})),void 0!==c)?[2,{code:D.SUCCESS,data:null==c?void 0:c.value}]:[2,{code:D.CHATROOM_KEY_NOT_EXIST}]}}))}))},t.prototype.getAllChatroomEntry=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return(t=this._chrmEntryHandler.getAll(e))&&Object.keys(t).length?[2,{code:D.SUCCESS,data:t}]:this._isConnected?(n=this._connMgr,t={},r=n.codec.encodePullChatRoomKV(0),i=new fi(Ci[Ci.pullKV],r,e),[4,n.send(i,Po)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return o=a.sent(),(s=o.data)&&s.kvEntries&&s.kvEntries.length&&s.kvEntries.forEach((function(e){e.key&&(t[e.key]=e.value||"")})),[2,{code:D.SUCCESS,data:t}]}}))}))},t.prototype.pullChatroomEntry=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=r.codec.encodePullChatRoomKV(t),s=new fi(Ci[Ci.pullKV],o,e),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:e,timestamp:t})),[4,r.send(s,Po)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,h=c===D.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_PULL_CHATROOM_KV_R,JSON.stringify({code:c,timestamp:t})),c===D.SUCCESS&&u?(d=u.kvEntries,p=[],d.length>0&&(d.forEach((function(t){var n=t.key,r=t.value,i=t.type,o=t.timestamp,s=t.userId;g._chrmEntryHandler.getValue(e,n)===r&&s===g.getCurrentUserId()||p.push({key:n,value:r,type:i,timestamp:o,chatroomId:e})})),this._chrmEntryHandler.setLocal(e,u,i),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},t.prototype._startSyncIntervalForChrmPull=function(){var e=this;this._stopSyncIntervalForChrmPull(),this._intervalTimerForChrmPull=setInterval((function(){var t=Object.keys(e._chrmsQueue);0!==t.length&&e._isConnected?t.forEach((function(t){e._pullChrmMsg(t),e.getNaviInfoFromCache().kvStorage&&e._chrmEntryHandler.pullEntry(t,0)})):e._stopSyncIntervalForChrmPull()}),y)},t.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},t.prototype.sendMessage=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=function(e,t){var n=e.messageType;if("RC:SRSMsg"===n&&Object.assign(e,{directionalUserIdList:[t]}),n===H.READ_RECEIPT_RESPONSE&&e.content.receiptMessageDic)for(var r in e.directionalUserIdList=[],e.content.receiptMessageDic)e.directionalUserIdList.push(r);return e}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![G.PRIVATE,G.GROUP].includes(e)&&n.isStatusMessage,s=o?function(e){var t;return(t={},t[G.PRIVATE]=Ci.ppMsgS,t[G.GROUP]=Ci.pgMsgS,t)[e]}(e):function(e){var t;return(t={},t[G.PRIVATE]=Ci.ppMsgP,t[G.GROUP]=Ci.pgMsgP,t[G.CHATROOM]=Ci.chatMsg,t[G.CUSTOMER_SERVICE]=Ci.pcMsgP,t[G.RTC_ROOM]=Ci.prMsgS,t[G.SYSTEM]=Ci.pbMsgP,t)[e]}(e)||Ci.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:Mt(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},n),(h=new di(Ci[s],u,e===G.SYSTEM?this.currentUserId:t)).setHeaderQos(gr.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(h),[2,{code:D.SUCCESS,data:Ea(e,t,c({},n),"",0,this.currentUserId,a)}]):(d=this._connMgr.getCrtServerTime(),p=Ea(e,t,c({},n),"",d,this.currentUserId,a),null==r||r(a),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:e,targetId:t,channelId:n.channelId}),i),[4,this._connMgr.send(h)])):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return g=l.sent(),f=g.code,_=g.data,f!==D.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:p.messageUId,messageId:p.messageId}),i),p.sentStatus=exports.SentStatus.FAILED,[2,{code:f,data:p}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:null==_?void 0:_.messageUId,messageId:null==_?void 0:_.messageId}),i),E=_,this._sendMessageStore.setMessage(E.messageUId,E.timestamp),p.sentTime=E.timestamp,p.messageUId=E.messageUId,this._conversationManager.setConversationCacheByMessage(p,!0),[2,{code:D.SUCCESS,data:p}])}}))}))},t.prototype.recallMsg=function(e,t,n,r,i){var o;return u(this,void 0,void 0,(function(){var s,a,u,h,d,p,g,f,_,E,T,C,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=i.user,a=i.extra,u=i.isDelete,h={conversationType:e,targetId:t,messageUId:n,sentTime:r,channelId:i.channelId||"",isDelete:u||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},p=Ci[Ci.recallMsg],g=this._connMgr.codec.encodeUpMsg({conversationType:e,targetId:t},d),(f=new di(p,g,this.currentUserId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,T=_.data,e===G.ULTRA_GROUP&&this.logger.debug(exports.LogTagId.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:e,targetId:t,channelId:i.channelId})),E!==D.SUCCESS?[2,{code:E}]:(C=T,e===G.ULTRA_GROUP?(this._ultraMsgMap[C.messageUId]=C.timestamp,this._updateUltraGroupWhenRecallMsg(t,i.channelId||"",n),[2,{code:D.SUCCESS}]):(this._sendMessageStore.setMessage(C.messageUId,C.timestamp),v=Ea(e,t,c(c({},d),{isPersited:!0}),C.messageUId,C.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:D.SUCCESS,data:v}]))}}))}))},t.prototype.sendReadReceiptMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i;return l(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(t,n),i=new fi(Ci[Ci.rrMsg],r,e),[2,this._connMgr.send(i)]):[2,{code:D.RC_NET_UNAVAILABLE}]}))}))},t.prototype.getMessageReader=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i;return l(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(t,n),i=new fi(Ci[Ci.rrList],r,e),[2,this._connMgr.send(i,ns)]):[2,{code:D.RC_NET_UNAVAILABLE}]}))}))},t.prototype.pullUserSettings=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullUserSetting(e),n=new fi(Ci[Ci.pullUS],t,this.currentUserId),[4,this._connMgr.send(n,Fo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===D.SUCCESS&&this._naviChangeHandler(o),[2,{code:i,data:o}]}}))}))},t.prototype._naviChangeHandler=function(e){var t;if(e){var n=e.settings,r=null===(t=null==n?void 0:n.VoipInfo)||void 0===t?void 0:t.value;if(r){var i=this._connMgr.getToken();this.navi.updateVoipCallInfo(i,r);var o=this.navi.getNaviInfoFromCache(i);this._watcher.onNaviDataChange(c({},o))}}else this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:e}))},t.prototype.getFileToken=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=r&&"uploads"!==r?t||"":mt(e,t),s=this._connMgr.codec.encodeGetFileToken(e,o,n||"",r||"",i||""),a=new fi(Ci[Ci.qnTkn],s,this.currentUserId),[4,this._connMgr.send(a,Ro)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,d=c(c({},d),{fileName:o,downloadAuthInfo:d.downloadAuthInfo?JSON.parse(d.downloadAuthInfo):null}),h===D.SUCCESS?[2,{code:h,data:d}]:[2,{code:h}]}}))}))},t.prototype.getFileUrl=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i="",o="",s="",t===X.QINIU?(o=So,s=No):(o=Oo,s=Mo),i=t===X.QINIU?Ci[Ci.qnUrl]:t===X.AWS?Ci[Ci.s3Url]:t===X.STC?Ci[Ci.stcUrl]:t===X.MINIO?Ci[Ci.minioUrl]:Ci[Ci.aliUrl],a=this._connMgr.codec.encodeGetFileUrl(o,e,n,r),c=new fi(i,a,this.currentUserId),[4,this._connMgr.send(c,s)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,p=d,h===D.SUCCESS?[2,{code:h,data:p}]:[2,{code:h}]}}))}))},t.prototype.disconnect=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.reporter.stop(),this.reporterStatistic.stop(),[4,this._connMgr.disconnect()];case 1:return e.sent(),this._resetMemoryState(),[2]}}))}))},t.prototype._resetMemoryState=function(){-1!==this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=-1),this._pullQueue.length=0,this._stopSyncInterval(),this.resetUltraGroupData(),this._joinedChrmManager&&(this._joinedChrmManager.clear(),delete this._joinedChrmManager),this._conversationManager&&delete this._conversationManager,this._ultraGroupManager&&delete this._ultraGroupManager,this._userSettingManager&&delete this._userSettingManager,this._chrmsQueue={}},t.prototype.resetUltraGroupData=function(){this._stopUltraSyncInterval(),this._lastSyncUltraMsgTimeStamp=0,this._lastSyncUltraMsgLocalTimeStamp=0,this._isUltraPulling=!1,this._ultraGroupTimeQue=[],this._isUltraGroupListExist=!1,this._ultraGroupMap={}},t.prototype.registerMessageType=function(e,t,n,r,i){this._customMessageType[e]={isPersited:t,isCounted:n,isStatusMessage:i}},t.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},t.prototype.getCurrentUserId=function(){return this.currentUserId},t.prototype.createTag=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new fi(Ci[Ci.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Bo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==D.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([c(c({},e),{createdTime:a})],a),[2,{code:D.SUCCESS}])}}))}))},t.prototype.removeTag=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([e],t),r=new fi(Ci[Ci.delSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Bo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==D.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([e],a),[2,{code:D.SUCCESS}])}}))}))},t.prototype.updateTag=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(t=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeCreateTag([e],t),r=new fi(Ci[Ci.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,Bo)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==D.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([e],a),[2,{code:D.SUCCESS}])}}))}))},t.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){var e,t;return l(this,(function(n){return e=this._userSettingManager.getTags(),t=this._conversationManager.getConversationListForTag(),e.forEach((function(e){e.conversationCount=t[e.tagId]?t[e.tagId].length:0})),[2,{code:D.SUCCESS,data:e}]}))}))},t.prototype.addTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s=this;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?this._userSettingManager.getTagById(e)?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new fi(Ci[Ci.addTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:D.TAG_NOT_EXIST}]:[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(i=a.sent().code)!==D.SUCCESS?[2,{code:i}]:((o={})[e]={},t.forEach((function(e){s._conversationManager.addTagStatus(e.conversationType,e.targetId,o,e.channelId)})),[2,{code:D.SUCCESS}])}}))}))},t.prototype.removeTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:e}],t),r=new fi(Ci[Ci.delTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(i=s.sent().code)!==D.SUCCESS?[2,{code:i}]:(t.forEach((function(t){o._conversationManager.deleteTagStatus(t.conversationType,t.targetId,[e],t.channelId)})),[2,{code:D.SUCCESS}])}}))}))},t.prototype.removeTagsForConversation=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=e.conversationType,r=e.targetId,i=e.channelId,o=t.map((function(e){return{tagId:e}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[e]),a=new fi(Ci[Ci.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(c=u.sent().code)!==D.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,r,t,i),[2,{code:D.SUCCESS}])}}))}))},t.prototype.getConversationListByTag=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(r=this).currentUserId,o=r._connMgr,s=o.codec.encodeOldConversationList({count:n,type:G.PRIVATE,startTime:t}),a=new fi(wr,s,i),[4,o.send(a,uo,{currentUserId:i,connectedTime:o.getConnectedTime()})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,u!==D.SUCCESS?[2,{code:u}]:(d=this._conversationHasTagFilter(e,null==h?void 0:h.list),[2,{code:u,data:d}])}}))}))},t.prototype._conversationHasTagFilter=function(e,t){var n=this,r=[],i=[];function o(e,t){return e.latestMessage&&t.latestMessage?e.latestMessage.sentTime-t.latestMessage.sentTime:0}return t.forEach((function(t){var o=t.conversationType,s=t.targetId,a=t.channelId,u=n._conversationManager.get(o,s,a),l=u.hasMentioned,h=u.mentionedInfo,d=u.lastUnreadTime,p=u.notificationStatus,g=u.isTop,f=u.tags,_=u.unreadMessageCount,E=f&&f[e];if(E){var T=c(c({},t),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:_});E.isTop?r.push(c(c({},T),{isTopInTag:!0})):i.push(c(c({},T),{isTopInTag:!1}))}})),r.sort(o),i.sort(o),h(h([],r,!0),i,!0)},t.prototype.getUnreadCountByTag=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(e,t),[2,{code:D.SUCCESS,data:n}]):[2,{code:D.RC_NET_UNAVAILABLE}]}))}))},t.prototype.setConversationStatusInTag=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=t.targetId,i=t.conversationType,o=t.channelId,s=n.isTop,a=[{tagId:e,isTop:s}],(c=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(c.tags,e)?(u=this._connMgr.codec.encodeUpdateConversationTag(a,[t]),h=new fi(Ci[Ci.addTag],u,this.currentUserId),[4,this._connMgr.send(h)]):[2,{code:D.NO_TAG_IN_CONVER}]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(d=l.sent().code)!==D.SUCCESS?[2,{code:d}]:((p={})[e]={},s&&(p[e].isTop=!0),this._conversationManager.addTagStatus(i,r,p,o),[2,{code:D.SUCCESS}])}}))}))},t.prototype.getTagsForConversation=function(e){var t;return u(this,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:D.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(e.conversationType,e.targetId,e.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(t=r[o])||void 0===t?void 0:t.tagName});return[2,{code:D.SUCCESS,data:i}]}))}))},t.prototype.getBlockConversationList=function(){var e=this._conversationManager.getBlockConversationList();return Promise.resolve({code:D.SUCCESS,data:e})},t.prototype.getTopConversationList=function(e,t){var n=this._conversationManager.getTopConversationList(e,t);return Promise.resolve({code:D.SUCCESS,data:n})},t.prototype.getUnreadConversationList=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){return t=this._conversationManager.getUnreadConversationList(e),[2,Promise.resolve({code:D.SUCCESS,data:t})]}))}))},t.prototype.getUnreadMentionedCount=function(e){var t,n;return n=e.conversationType===G.ULTRA_GROUP?(null===(t=this._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)])||void 0===t?void 0:t.unreadMentionedCount)||0:this._conversationManager.getUnreadMentionedCount(e.conversationType,e.targetId,e.channelId),n=this._getUnreadCount(n),Promise.resolve({code:D.SUCCESS,data:n})},t.prototype.getAllUnreadMentionedCount=function(){var e=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:D.SUCCESS,data:e})},t.prototype.getConversationNotificationLevel=function(e,t,n){if(!this._isUltraGroupListExist&&e===G.ULTRA_GROUP)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var r;if(!(r=e===G.ULTRA_GROUP?this._ultraGroupManager.get(G.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n)))return Promise.resolve({code:D.SUCCESS,data:j.NOT_SET});var i=r.notificationLevel;return Ye(r.notificationLevel)&&!Ye(r.notificationStatus)&&(i=q.OPEN===r.notificationStatus?1:0),Promise.resolve({code:D.SUCCESS,data:i})},t.prototype.getConversationNotificationStatus=function(e,t,n){var r;return(r=e===G.ULTRA_GROUP?this._ultraGroupManager.get(G.ULTRA_GROUP,t,n):this._conversationManager.get(e,t,n))?Promise.resolve({code:D.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:D.SUCCESS,data:q.CLOSE})},t.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this.getHistoryMessage(e,t,n,r,i,o)},t.prototype.getUltraGroupList=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o=this;return l(this,(function(s){return t=e.targetId,n=e.channelType,this._isUltraGroupListExist?(r=(r=Object.values(this._ultraGroupMap).filter((function(e){return!(e.targetId!==t&&t||e.channelType!==n&&Be(n))}))).map((function(e){var t=e.unreadMessageCount,n=e.unreadMentionedCount,r=e.unreadMentionedMeCount;return t=o._getUnreadCount(t),n=o._getUnreadCount(n),r=o._getUnreadCount(r),c(c({},e),{unreadMessageCount:t,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=Ta(r),i=Kt(r),[2,{code:D.SUCCESS,data:i}]):[2,{code:D.METHOD_NOT_AVAILABLE}]}))}))},t.prototype._getUnreadCount=function(e){return e>999?999:e},t.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){(e.notificationStatus===q.OPEN||e.notificationLevel>0)&&t.push({conversationType:G.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:D.SUCCESS,data:t})},t.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var e=Object.values(this._ultraGroupMap),t=[];return e.forEach((function(e){!0===e.isTop&&t.push({conversationType:G.ULTRA_GROUP,targetId:e.targetId,channelId:e.channelId})})),Promise.resolve({code:D.SUCCESS,data:t})},t.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){if(!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var n=0;for(var r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:D.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){var n=0;for(var r in this._ultraGroupMap){var i=this._ultraGroupMap[r];i.targetId!==e||t&&0!==t.length&&!t.includes(this._ultraGroupMap[r].notificationLevel)||(n+=i.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:D.SUCCESS,data:n})},t.prototype.getUltraGroupUnreadInfoList=function(e){var t=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(r){var i=t._ultraGroupMap[r];e.includes(i.targetId)&&n.push({type:i.conversationType,targetId:i.targetId,channelId:i.channelId,unreadMessageCount:t._getUnreadCount(i.unreadMessageCount),mentionedCount:t._getUnreadCount(i.unreadMentionedCount),mentionedMeCount:t._getUnreadCount(i.unreadMentionedMeCount),notificationLevel:i.notificationLevel})})),Promise.resolve({code:D.SUCCESS,data:n})},t.prototype.getAllUltraGroupUnreadCount=function(e){if(void 0===e&&(e=!1),!this._isUltraGroupListExist)return Promise.resolve({code:D.METHOD_NOT_AVAILABLE});var t=0;for(var n in this._ultraGroupMap)t+=e?this._ultraGroupMap[n].unreadMentionedCount||0:this._ultraGroupMap[n].unreadMessageCount||0;return t=this._getUnreadCount(t),Promise.resolve({code:D.SUCCESS,data:t})},t.prototype.clearUltraUnreadcount=function(e,t){return void 0===t&&(t=""),u(this,void 0,void 0,(function(){var n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:G.ULTRA_GROUP,targetId:e,channelId:t},{timestamp:n}),(i=new di(Ci[Ci.updUgRTime],r,this.currentUserId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(i)]):[2,D.RC_NET_UNAVAILABLE]:[2,Promise.resolve(D.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===D.SUCCESS&&((s=this._ultraGroupMap["".concat(t,"_").concat(e)])&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.lastReadTime=n),s.firstUnreadMessage&&(s.firstUnreadMessage=null)),[2,o]}}))}))},t.prototype._getUltraGroupList=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h,d,p,g,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(!1,t=this._connMgr.codec.encodeUltraGroup(e,false),n=new fi(Ci[Ci.pullUgSes],t,this.currentUserId),[4,this._connMgr.send(n,uo,{currentUserId:this.currentUserId,conversationType:G.ULTRA_GROUP})]):[2];case 1:return r=l.sent(),i=r.code,o=r.data,i===D.SUCCESS&&o?(a=o.list,c=o.isFinished,a.forEach((function(e){e.notificationStatus=q.CLOSE,e.notificationLevel=j.NOT_SET,e.isTop=!1,f._ultraGroupMap["".concat(e.channelId,"_").concat(e.targetId)]=e,f._ultraGroupManager.addUltraGroupStatus(e)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(i,", try again")),s=setTimeout((function(){f._getUltraGroupList(e),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==D.SUCCESS&&this.logger.warn(exports.LogTagId.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(p)),g=Object.values(this._ultraGroupMap),g=Ta(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Kt(g)),this._syncUltraMsg(this._lastSyncUltraMsgTimeStamp),l.label=4;case 4:return[2]}}))}))},t.prototype._startUltraSyncInterval=function(){var e=this,t=function(){e._ultraGroupTimer=setTimeout((function(){Date.now()-e._lastSyncUltraMsgLocalTimeStamp>=18e4&&e._syncUltraMsg(e._lastSyncUltraMsgTimeStamp),e._stopUltraSyncInterval(),t()}),3e4)};this._lastSyncUltraMsgLocalTimeStamp=Date.now(),t()},t.prototype._stopUltraSyncInterval=function(){-1!==this._ultraGroupTimer&&(clearTimeout(this._ultraGroupTimer),this._ultraGroupTimer=-1)},t.prototype._notificationOnline=function(){return u(this,void 0,void 0,(function(){var e,t,n,r=this;return l(this,(function(i){switch(i.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return e=i.sent(),t=e.code,n=e.data,t===D.SUCCESS&&n?(this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){r._notificationOnline()}),3e3),[2])}}))}))},t.prototype._fetchUltraMsg=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return t=this._connMgr.codec.encodeSuperSyncMsg(e),n=new fi(Ci[Ci.pullUgMsg],t,this.currentUserId),r=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:e}),r),[4,this._connMgr.send(n,eo,{currentUserId:this.currentUserId,conversation:{conversationType:G.ULTRA_GROUP}})];case 1:return i=l.sent(),o=i.code,s=i.data,o===D.SUCCESS&&s?(a=s.list,c=s.syncTime,u=a.map((function(e){return e.messageUId})).join(","),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:u,timestamp:e,syncTime:c}),r)):this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:e}),r),[2,{code:o,data:s}]}}))}))},t.prototype._getUltraGroup=function(e,t,n){var r,i,o,s=e.targetId,a=e.messageType,c=e.channelId,u=e.isCounted,l=e.channelType,h=e.sentTime,d=e.senderUserId,p=e.content,g=e.isMentioned,f=this._ultraGroupMap["".concat(c,"_").concat(s)],_=f||{conversationType:G.ULTRA_GROUP,targetId:s,channelId:c,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:q.CLOSE,notificationLevel:j.NOT_SET,isTop:!1};return u&&d!==this.currentUserId&&a!==H.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=t,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),g&&(null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.type)!==W.ALL&&(null===(o=null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=e,_.channelType=l,f||(this._ultraGroupMap["".concat(c,"_").concat(s)]=_),_},t.prototype._syncUltraMsg=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return!this._isConnected||this._isUltraPulling?[2]:(this._isUltraPulling=!0,[4,this._fetchUltraMsg(e)]);case 1:return t=l.sent(),n=t.code,r=t.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===D.SUCCESS&&r?(i=r.list,o=r.syncTime,s=r.finished,a={},c=[],i.forEach((function(e){var t,n,r,i=e.targetId,s=e.content,u=e.messageUId,l=e.channelId,d=e.isMentioned;if(h._ultraMsgMap[u])delete h._ultraMsgMap[u];else{var p=0;d&&((null===(t=null==s?void 0:s.mentionedInfo)||void 0===t?void 0:t.type)===W.ALL||(null===(r=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(e,p,o);a["".concat(l,"_").concat(i)]=g,h._ultraGroupManager.addUltraGroupStatus(g),c.push(e)}})),Object.keys(a).length>0&&(this.logger.debug(exports.LogTagId.O,"notice ultragroups"),u=Object.values(a),u=Ta(u),this._watcher.conversation(Kt(u))),this.logger.debug(exports.LogTagId.O,"notice ultragroup message"),this._batchMessage(c),this._ultraGroupTimeQue=this._ultraGroupTimeQue.filter((function(e){return e>o})),this._lastSyncUltraMsgTimeStamp=o,s?(this._ultraGroupTimeQue.length>0&&(this._ultraGroupTimeQue.length=0,this._syncUltraMsg(o)),[2]):(this._syncUltraMsg(o),[2])):[2]}}))}))},t.prototype.sendUltraMessage=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===t.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message"),t=this._handleMsgProperties(t,!0),i=t.messageId?t.messageId:Mt(),t.messageId=i,o=this._connMgr.codec.encodeUpMsg({conversationType:G.ULTRA_GROUP,targetId:e},t),(s=new di(Ci[Ci.ugMsg],o,e)).setHeaderQos(gr.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=Ea(G.ULTRA_GROUP,e,c({},t),"",a,this.currentUserId,i),n&&n(i),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:t.messageType,conversationType:G.ULTRA_GROUP,targetId:e,channelId:t.channelId}),r),[4,this._connMgr.send(s)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return h=l.sent(),d=h.code,p=h.data,d!==D.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:u.messageUId,messageId:u.messageId}),r),u.sentStatus=exports.SentStatus.FAILED,[2,{code:d,data:u}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId}),r),g=p,u.sentTime=g.timestamp,u.messageUId=g.messageUId,this._ultraMsgMap[g.messageUId]=g.timestamp,f=t.channelId||"",(_=this._ultraGroupMap["".concat(f,"_").concat(e)])?(_.latestMessage=u,Be(_.channelType)&&(u.channelType=_.channelType)):(_={conversationType:G.ULTRA_GROUP,targetId:e,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:q.CLOSE,notificationLevel:j.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(f,"_").concat(e)]=_,this._ultraGroupManager.addUltraGroupStatus(_)),this._watcher.conversation(Kt([_])),[2,{code:d,data:u}])}}))}))},t.prototype.sendUltraGroupTypingStatus=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=e.conversationType,r=e.channelId,i=e.targetId,o=this._connMgr.codec.encodeOperateStatus(i,n,r||"",t||0),(s=new di(Ci[Ci.operate],o,i)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(a=c.sent().code)!==D.SUCCESS?[2,{code:a,msg:D[a]}]:[2,{code:a}]}}))}))},t.prototype.getUltraGroupMessageListByMessageUId=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?e.messages&&e.messages.length<1||e.messages&&e.messages.length>20?[2,{code:D.MSG_LIMIT_ERROR}]:(t={},e.messages.forEach((function(e){t[e.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(e),(r=new fi(Ci[Ci.qryMsg],n,this.currentUserId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(r,Ts,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==D.SUCCESS?[2,{code:o,msg:D[o]}]:(a=(s||{}).list,Array.isArray(a)&&a.forEach((function(e){var n=e.messageUId;t[n]=e})),[2,{code:0,data:t}])}}))}))},t.prototype._pullOperateStatusNotify=function(e){if(this._isConnected){var t=this._connMgr.codec.decodeByPBName(e.data,vs),n=t.conversationType,r=t.info,i=t.summary;this.logger.debug(exports.LogTagId.O,"s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(t)}},t.prototype.expandUltraMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,r;return l(this,(function(i){switch(i.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodeExpandUltraMessage(e,this.currentUserId),(n=new fi(Ci[Ci.upMsgEx],t,e.targetId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return(r=i.sent().code)!==D.SUCCESS?[2,{code:r,msg:D[r]}]:[2,{code:r}]}}))}))},t.prototype.modifyMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodemodifyMessage(e,this.currentUserId),(n=new fi(Ci[Ci.modifyMsg],t,e.targetId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==D.SUCCESS?[2,{code:i,msg:D[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},t.prototype._pullUltraChangeMessageList=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?this._isPullingUltraChangeMessage?[2]:(this._isPullingUltraChangeMessage=!0,t=this._connMgr.codec.encodeQueryMsgChange(e),(n=new fi(Ci[Ci.qryMsgChange],t,this.currentUserId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(n,fs)]):[2];case 1:return r=l.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i===D.SUCCESS&&o?(s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),u=this._pullUltraChangeMessageQue.filter((function(e){return e>c})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,u),s?this._pullUltraChangeMessageList(c):this._lastPullingUltraChangeMessageTime=c,[2]):[2]}}))}))},t.prototype._handleUltraChangeList=function(e){var t={};e.forEach((function(e){var n=e.changeType;t[n]||(t[n]=[]),t[n].push(e)}));var n=exports.UltraMsgChangeType.CHANNEL_CHANGE,r=exports.UltraMsgChangeType.MSG_RECALL,i=exports.UltraMsgChangeType.MSG_EXPANSION,o=exports.UltraMsgChangeType.MSG_MODIFY,s=exports.UltraMsgChangeType.USER_GROUP_CHANGE;t[n]&&this._handleUltraChannelChange(t[n]),t[r]&&this._handleMsgRecall(t[r]),t[i]&&this._handleMsgUpdate(t[i]),t[o]&&this._handleMsgUpdate(t[o]),t[s]&&this._handleUserGroupStatus(t[s])},t.prototype._handleUltraChannelChange=function(e){var t=this,n=[],r=[],i=[];e.forEach((function(e){var o=e.subChangeType,s=e.targetId,a=e.channelId,c=e.sendTime,u=e.operatorId,l="".concat(a,"_").concat(s),h=t._ultraGroupMap[l];if(h){var d=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,p=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,g=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=exports.UltraMsgSubChangeType.CHANNEL_DELETE,_=exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=exports.UltraGroupChannelType.PUBLIC,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=exports.UltraGroupChannelType.PRIVATE,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete t._ultraGroupMap[l];break;case f:r.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:c}),delete t._ultraGroupMap[l];break;case _:i.push({targetId:s,channelId:a,userId:u,channelType:exports.UltraGroupChannelType.PRIVATE}),u===t.currentUserId&&delete t._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),i.length>0&&this._watcher.ultraGroupChannelUserKicked(i)},t.prototype._handleMsgRecall=function(e){var t=this,n=[];e.forEach((function(e){var r=e.targetId,i=e.channelId,o=e.messageUId,s=e.sendTime,a=e.conversationType,c=e.operatorId,u=e.mentionedType;t._updateUltraGroupWhenRecallMsg(r,i,o,s,u),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:o,senderUserId:c,channelId:i,content:{conversationType:a,targetId:r,messageUId:o,channelId:i},messageDirection:1,messageType:H.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)},t.prototype._handleMsgUpdate=function(e){var t={};for(var n in e.forEach((function(e){var n=e.targetId,r=e.conversationType,i=e.sendTime,o=e.messageUId,s=e.channelId,a="".concat(r,"_").concat(n);t[a]||(t[a]=[]),t[a].push({messageUId:o,channelId:s,sendTime:i})})),t){var r=n.split("_"),i=r.shift(),o=r.join("_");this._pullUltraMessageList(e[0].changeType,{targetId:o,conversationType:Number(i),messages:h([],t[n],!0)})}},t.prototype._pullUltraMessageList=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(t),(r=new fi(Ci[Ci.qryMsg],n,this.currentUserId)).setHeaderQos(gr.AT_LEAST_ONCE),[4,this._connMgr.send(r,Ts,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return i=l.sent(),o=i.code,s=i.data,o!==D.SUCCESS?[2,{code:o,msg:D[o]}]:(a=(s||{}).list,c=[],Array.isArray(a)&&a.forEach((function(e){var t=e.targetId,n=e.channelId,r=e.messageUId,i=u._ultraGroupMap["".concat(n,"_").concat(t)];i&&i.latestMessage.messageUId===r&&(i.latestMessage=e),c.push(e)})),e===exports.UltraMsgChangeType.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(c),e===exports.UltraMsgChangeType.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(c),[2])}}))}))},t.prototype._handleUserGroupStatus=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h,d;return l(this,(function(l){return t=exports.UserGroupChangeType.REMOVE_USER_GROUP,n=exports.UserGroupChangeType.JOIN_USER_GROUP,r=exports.UserGroupChangeType.EXIT_USER_GROUP,i=exports.UserGroupChangeType.CHANNEL_BIND_USER_GROUP,o=exports.UserGroupChangeType.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],c=[],u=[],h=[],e.forEach((function(e){var l=e.conversationType,d=e.targetId,p=e.userGroupIds,g=e.busChannelType,f=e.channelId;switch(e.subChangeType){case t:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:c.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:u.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),d={},s.length>0&&(d.userGroupDisband=s),a.length>0&&(d.userAdded=a),c.length>0&&(d.userRemoved=c),u.length>0&&(d.userGroupBindChannel=u),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},t.prototype.getUltraHistoryMsg=function(e,t,n){var r;return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr.codec.encodeGetHistoryMsg(e,t),o=new fi(Ci[Ci.qryUgMsg],i,this.currentUserId),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:G.ULTRA_GROUP,channelId:t.channelId,timestamp:null==t?void 0:t.timestamp,count:null==t?void 0:t.count}),n),[4,this._connMgr.send(o,ao,{currentUserId:this.currentUserId,conversation:{conversationType:G.ULTRA_GROUP,targetId:e}})]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,a===D.SUCCESS&&c?(u=[],null===(r=c.list)||void 0===r||r.forEach((function(e){e&&u.push(e.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:u.join(",")}),n),[2,{code:a,data:c}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},t.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(t,n),i=new fi(Ci[Ci.ugUnpushSet],r,e),[4,this._connMgr.send(i)]):[2,{code:D.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:D.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,D.SUCCESS,[2,{code:s}]}}))}))},t.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(t),i=new fi(Ci[Ci.ugUnpushQuery],r,e),[4,n.send(i,$o)]):[2,{code:D.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:D.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===D.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}]}}))}))},t.prototype._updateUltraGroupWhenRecallMsg=function(e,t,n,r,i){var o="".concat(t,"_").concat(e);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,c=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),r&&c<r&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(i===exports.UltraMentionedType.ALL||i===exports.UltraMentionedType.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,i===exports.UltraMentionedType.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Kt([s])))}},t.prototype.getAllConversationState=function(){return Promise.resolve({code:D.SUCCESS,data:this._conversationManager.getAllConversationState()})},t.prototype.getUltraGroupUnreadMentionedMessages=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(t=this._connMgr.codec.encodeUnreadMentionedMsgQuery(e),n=new fi(Ci[Ci.qryUgUal],t,this.currentUserId),[4,this._connMgr.send(n,zo)]):[2,Promise.resolve({code:D.METHOD_NOT_AVAILABLE})]:[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===D.SUCCESS&&o?[2,{code:i,data:o}]:[2,{code:i}]}}))}))},t.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(t=e.targetId,n=e.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(t)]||{},i=r.firstUnreadMessage||null,[2,{code:D.SUCCESS,data:i}]):[2,Promise.resolve({code:D.METHOD_NOT_AVAILABLE})]:[2,{code:D.RC_NET_UNAVAILABLE}]}))}))},t.prototype.bindRTCRoomForChatroom=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=e.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(e),r=new fi(Ci[Ci.setRtcRoomId],n,t),[4,this._connMgr.send(r)]):[2,D.RC_NET_UNAVAILABLE];case 1:return i=o.sent(),[2,i.code]}}))}))},t.prototype.rtcSignaling=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(i=r instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(r)):r,o=n?new fi(t,i,e):new di(t,i,e),[4,this._connMgr.send(o)]):[2,{code:D.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,[2,{code:a,buffer:null==c?void 0:c.data}]}}))}))},t.prototype.rtcPing=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=bs(this.rtcCodec,t,n),[4,this.rtcSignaling(e,Ci[Ci.rtcPing],!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o!==D.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(bt.RtcOutput,s)).version=yt(a.version),[2,{code:o,data:a}])}}))}))},t.prototype.getDeviceId=function(){return sr(this.runtime)},t.prototype.getOSInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:D.NOT_SUPPORT}]}))}))},t.prototype.getProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:D.NOT_SUPPORT}]}))}))},t.prototype.getMainProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{code:D.NOT_SUPPORT}]}))}))},t.prototype.destroy=function(){Dn(),Xs()},t.prototype.callExtra=function(e){return Promise.resolve({code:D.NOT_SUPPORT})},t.prototype.getConversationListWithAllChannel=function(){throw new Error("Method not implemented.")},t.prototype.getConversationListWithAllChannelByPage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getConversationsByPage=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){throw new Error("Method not implemented.")},t.prototype.clearConversations=function(){throw new Error("Method not implemented.")},t.prototype.setUserStatusListener=function(e,t){throw new Error("Method not implemented.")},t.prototype.setUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.subscribeUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.getUserStatus=function(e){throw new Error("Method not implemented.")},t.prototype.addToBlacklist=function(e){return Promise.resolve(D.NOT_SUPPORT)},t.prototype.removeFromBlacklist=function(e){return Promise.resolve(D.NOT_SUPPORT)},t.prototype.getBlacklist=function(){return Promise.resolve({code:D.NOT_SUPPORT})},t.prototype.getBlacklistStatus=function(e){return Promise.resolve({code:D.NOT_SUPPORT})},t.prototype.insertMessage=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.batchInsertMessage=function(e,t){throw new Error("Method not implemented.")},t.prototype.getMessageCount=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.deleteMessages=function(e){throw new Error("Method not implemented.")},t.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.clearMessages=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setMessageContent=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.setMessageSearchField=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchConversationByContent=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.searchConversationByContentWithAllChannel=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.searchMessageByContent=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessagesByUser=function(e,t,n,r,i,o){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){throw new Error("Method not implemented.")},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){throw new Error("Method not implemented.")},t.prototype.getUnreadMentionedMessages=function(e,t){throw new Error("Method not implemented.")},t.prototype.setMessageSentStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.updateMessageReceiptStatus=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.setMessageReceivedStatus=function(e,t){throw new Error("Method not implemented.")},t.prototype.clearData=function(){throw new Error("Method not implemented.")},t.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){throw new Error("Method not implemented.")},t.prototype.setCallInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return(r=this._connMgr)?(i=r.codec.encodeSetCallInfo(t,n),[4,r.send(new fi(Dr,i,e),Ss)]):[3,2];case 1:return o=c.sent(),s=o.code,a=o.data,s===D.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:D.RC_NET_CHANNEL_INVALID})]}}))}))},t.prototype.getGroupMessageDeliverList=function(e,t,n){throw new Error("Method not implemented.")},t.prototype.getPrivateMessageDeliverTime=function(e,t){throw new Error("Method not implemented.")},t.prototype.setCheckDuplicateMessage=function(e){throw new Error("Method not implemented.")},t.prototype.setProxy=function(e){return Promise.resolve({code:D.NOT_SUPPORT})},t.prototype.getProxy=function(){return Promise.resolve({code:D.NOT_SUPPORT})},t.prototype.testProxy=function(e,t){return Promise.resolve({status:D.NOT_SUPPORT})},t.prototype.setNetwork=function(e,t){this._connMgr.setNetwork(e,t)},t}(Tn),va=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t.prototype.joinRTCRoom=function(e,t,n,r,i,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return s=bs(this._context.rtcCodec,t,n,r,i,o),[4,this.rtcSignaling(e,Qt,!0,s)];case 1:return a=l.sent(),c=a.code,u=a.buffer,c===D.SUCCESS&&u&&(h=xs(this._context.rtcCodec,u)),[2,{code:c,data:h}]}}))}))},t.prototype.quitRTCRoom=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return t=this._context.rtcCodec.encode(bt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,Wt,!0,t)];case 1:return[2,n.sent().code]}}))}))},t.prototype.rtcPing=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._context.rtcPing(e,t,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.rtcPingResVersion=function(e,t,n){return this._context.rtcPing(e,t,n)},t.prototype.getRTCRoomInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Jt,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===D.SUCCESS&&i&&(o=this._context.rtcCodec.decode(bt.RtcRoomInfoOutput,i)),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfoList=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,Xt,!0,t)];case 1:return n=a.sent(),r=n.code,i=n.buffer,r===D.SUCCESS&&i&&(s=xs(this._context.rtcCodec,i),o={users:s.users}),[2,{code:r,data:o}]}}))}))},t.prototype.getRTCUserInfo=function(e){throw new Error("Method not implemented.")},t.prototype.setRTCUserInfo=function(e,t,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(bt.RtcValueInfo,{key:t,value:n}),[4,this.rtcSignaling(e,Zt,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.removeRTCUserInfo=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(bt.RtcKeyDeleteInput,{key:t}),[4,this.rtcSignaling(e,zt,!1,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.setRTCData=function(e,t,n,r,i,o){return u(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(bt.RtcSetDataInput,{interior:r,target:i,key:t,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(e,$t,!1,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCTotalRes=function(e,t,n,r,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:r,content:this._context.rtcCodec.encode(bt.RtcValueInfo,{key:t.name,value:t.content},!0),valueInfo:[this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"mcu_uris",value:i},!0)]},s=this._context.rtcCodec.encode(bt.RtcUserSetDataInput,o),[4,this.rtcSignaling(e,en,!0,s)];case 1:return[2,a.sent().code]}}))}))},t.prototype.setRTCCDNUris=function(e,t,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(bt.RtcUserSetDataInput,{objectName:t,valueInfo:this._context.rtcCodec.encode(bt.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(e,en,!0,r)];case 1:return[2,i.sent().code]}}))}))},t.prototype.getRTCData=function(e,t,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return i=this._context.rtcCodec.encode(bt.RtcDataInput,{interior:n,target:r,key:t}),[4,this.rtcSignaling(e,tn,!0,i)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===D.SUCCESS&&a?(c=this._context.rtcCodec.decode(bt.RtcQryOutput,a).outInfo,u={},c.forEach((function(e){u[e.key]=e.value})),[2,{code:s,data:u}]):[2,{code:s}]}}))}))},t.prototype.removeRTCData=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(bt.RtcDataInput,{interior:n,target:r,key:t,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(e,nn,!1,o)];case 1:return[2,s.sent().code]}}))}))},t.prototype.setRTCOutData=function(e,t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCOutData=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))},t.prototype.getRTCToken=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=bs(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,rn,!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o===D.SUCCESS&&s?(a=this._context.rtcCodec.decode(bt.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},t.prototype.setRTCState=function(e,t){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(bt.MCFollowInput,{state:t}),[4,this.rtcSignaling(e,on,!0,n)];case 1:return[2,r.sent().code]}}))}))},t.prototype.getRTCUserList=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(e,sn,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===D.SUCCESS&&i?(o=xs(this._context.rtcCodec,i),[2,{code:r,data:o}]):[2,{code:r}]}}))}))},t.prototype.joinLivingRoomAsAudience=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return r=bs(this._context.rtcCodec,t,n),[4,this.rtcSignaling(e,an,!0,r)];case 1:return i=l.sent(),o=i.code,s=i.buffer,o===D.SUCCESS&&s?(a=this._context.rtcCodec.decode(bt.RtcViewerJoinedOutput,s),c=a.rtcToken,u=a.entries,[2,{code:o,data:{token:c,kvEntries:u}}]):[2,{code:o}]}}))}))},t.prototype.quitLivingRoomAsAudience=function(e){return u(this,void 0,void 0,(function(){var t,n;return l(this,(function(r){switch(r.label){case 0:return t=this._context.rtcCodec.encode(bt.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(e,cn,!0,t)];case 1:return n=r.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},t.prototype.rtcIdentityChange=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=this._context.rtcCodec.encode(bt.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:t,needSysChatroom:!1}),[4,this.rtcSignaling(e,ln,!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o===D.SUCCESS&&s?(a=xs(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},t.prototype.requestRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteTimeout,o=e.inviteInfo,s=e.roomId,a=this._context.rtcCodec.encode(bt.RtcInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,timeoutTime:i,inviteInfo:o}),[4,this.rtcSignaling(s,hn,!0,a)];case 1:return c=u.sent().code,this._context.rtcKVManager.reset(),[2,c]}}))}))},t.prototype.cancelRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,n=e.invitedUserId,r=e.inviteSessionId,i=e.inviteInfo,o=e.roomId,s=this._context.rtcCodec.encode(bt.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:n,inviteSessionId:r,inviteInfo:i}),[4,this.rtcSignaling(o,dn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.responseRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return t=e.inviteUserId,n=e.inviteRoomId,r=e.inviteSessionId,i=e.content,o=e.key,s=e.value,a=e.agree,c=e.roomId,u=this._context.rtcCodec.encode(bt.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:n,inviteSessionId:r,content:i,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(c,pn,!0,u)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},t.prototype.endRoomPK=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.endRoomId,n=e.sessionId,r=e.content,i=e.keys,o=e.roomId,s=this._context.rtcCodec.encode(bt.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:n,inviteContent:r,inviteRoomKeys:i}),[4,this.rtcSignaling(o,gn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},t.prototype.registerRTCSignalListener=function(e){this._context.registerRTCSignalingListener(e)},t.prototype.rtcSignaling=function(e,t,n,r){return this._context.rtcSignaling(e,t,n,r)},t.prototype.getRTCJoinedUserInfo=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return t=this._context.rtcCodec.encode(bt.RtcQueryUserJoinedInput,{userId:e}),[4,this.rtcSignaling("",fn,!0,t)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===D.SUCCESS&&i?(o=this._context.rtcCodec.decode(bt.RtcQueryUserJoinedOutput,i).info||[],[2,{code:r,data:o.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:yt(e.joinTime)}}))}]):[2,{code:r}]}}))}))},t}(Tr);function Ia(e){return c({},e)}var ya=function(){function e(e,t){var n,r;this._runtime=e,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[H.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[H.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[H.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[H.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[H.INTERCEPT]=this._processInterceptMessage.bind(this),n[H.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[H.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[H.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((r={})[H.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),r[H.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),r[H.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),r),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=c({},t),this.appkey=this._options.appkey,this._options.typingExpireTime&&(this._options.typingExpireTime<2e3?this._typingExpireTime=2e3:this._options.typingExpireTime>6e3?this._typingExpireTime=6e3:this._typingExpireTime=this._options.typingExpireTime),this._options.navigators=this._options.navigators.map((function(e){return e.replace(/\/$/g,"")}));var i={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.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(_n,En),this._engine=kt()?new RCCppEngine(e,this.rtcCodec,i,this._options):new Ca(e,this.rtcCodec,i,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new jt(this._engine)}return e.init=function(t,n){if(this._context)return this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context;this._context=new e(t,n),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"a3bfcb8a1942a64de619c8a162a5855274fbee89",version:"5.8.4"}));var r=this._context._engine;return t.setNetworkStatusListener(r.setNetwork.bind(r)),this._context},e.destroy=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this._context?(this._context.logger.info(exports.LogTagId.L_DESTROY_O),[4,this._context._destroy()]):[2];case 1:return e.sent(),this._context=void 0,[2]}}))}))},e.prototype.createCodec=function(e,t){return new yn(e,t)},e.prototype.install=function(e,t){var n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:e.tag}),n),this._pluginInstanseMap[e.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[e.tag];var r="RCRTC"===e.tag?new va(this):new Tr(this),i=null;try{if(!e.verify(this._runtime))return null;i=e.setup(r,this._runtime,t)}catch(e){this.logger.error(exports.LogTagId.L_INSTALL_PLUGIN_R,null==e?void 0:e.stack,n)}return["RCRTC","RCCall"].includes(e.tag)&&e.version&&e.name&&(this._versionInfo[e.name]=e.version),i&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[e.tag]=i),i},e.prototype._onConnectionStatusChange=function(e,t){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,e,t),this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onconnectionstatechange)||void 0===r||r.call(n,e,t)}))},e.prototype._processChatrormMessage=function(e){var t;if("function"==typeof this._watcher.chatroomState)return this._watcher.chatroomState({userChange:{users:(t={},t[e.senderUserId]="RC:ChrmQuitNtf"===e.messageType?oe.QUIT:oe.JOIN,t),chatroomId:e.targetId}}),!0},e.prototype._processChrmMemChangeMessage=function(e){if("function"==typeof this._watcher.chatroomState){var t={};Array.isArray(e.content.userList)&&e.content.userList.forEach((function(e){t[e.userId]=e.status})),this._watcher.chatroomState({userChange:{users:t,chatroomId:e.targetId}})}return!0},e.prototype._processTypingStatusMessage=function(e){if(this._addTypingInfo(Ia(e)),this._watcher.typingState)return!0},e.prototype._processInterceptMessage=function(e){var t={conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId||"",blockType:e.content.interceptType,blockedMessageUId:e.content.msgUId,extra:e.content.extra};if(e.conversationType===G.ULTRA_GROUP){var n=e.content.sourceType;if(t.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&e.content.sourceContent)try{t.sourceContent=JSON.parse(e.content.sourceContent)}catch(e){this.logger.warn(exports.LogTagId.L_CALLBACK_E,JSON.stringify({source:"message.content.sourceContent",msg:e.message}))}}return this._MessageBlockedListener(t),!0},e.prototype._processChrmSyncMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyMultiLoginSync:{chatroomId:e.content.chatroomId,status:e.content.status,reason:e.content.reason,time:e.content.time,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBlockMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBlock:{chatroomId:e.content.chatroomId,operateType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processChrmMemBanMessage=function(e){return"function"==typeof this._watcher.chatroomState&&this._watcher.chatroomState({chatroomNotifyBan:{chatroomId:e.content.chatroomId,banType:e.content.operateType,durationTime:e.content.durationTime,operateTime:e.content.operateTime,userIdList:e.content.userList,extra:e.content.extra||null}}),!0},e.prototype._processReadReceiptMessage=function(e){"function"==typeof this._watcher.readReceiptReceived&&this._watcher.readReceiptReceived({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.content.lastMessageSendTime)},e.prototype._processReadReceiptRequestMessage=function(e){"function"==typeof this._watcher.messageReceiptRequest&&this._watcher.messageReceiptRequest({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.content.messageUId,e.senderUserId)},e.prototype._processReadReceiptResponseMessage=function(e){var t,n=null===(t=e.content)||void 0===t?void 0:t.receiptMessageDic,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId},e.senderUserId,n[r])},e.prototype._messageReceiver=function(e,t,n){var r,i,o,s,a=this;if(!(null===(i=(r=this._compatibleMessageProccessor)[e.messageType])||void 0===i?void 0:i.call(r,e))&&!this._pluginContextQueue.some((function(t){if(!t.onmessage)return!1;try{return t.onmessage(Ia(e))}catch(e){return a.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==e?void 0:e.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,Ia(e),t,n),!this._messageProccessor[e.messageType])return e;this._messageProccessor[e.messageType](e)}},e.prototype._batchMessageReceiver=function(e,t,n){var r=this,i=[];e.forEach((function(e){var o=r._messageReceiver(e,t,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,i.map((function(e){return e.messageUId})).join(",")),this._watcher.batchMessage(i))},e.prototype._chatroomInfoListener=function(e){var t,n;null===(n=(t=this._watcher).chatroomState)||void 0===n||n.call(t,e)},e.prototype._conversationInfoListener=function(e){var t,n;null===(n=(t=this._watcher).conversationState)||void 0===n||n.call(t,e)},e.prototype._expansionInfoListener=function(e){var t,n;null===(n=(t=this._watcher).expansion)||void 0===n||n.call(t,e)},e.prototype._tagListener=function(){var e,t;null===(t=(e=this._watcher).tag)||void 0===t||t.call(e)},e.prototype._conversationTagListener=function(){var e,t;null===(t=(e=this._watcher).conversationTagChanged)||void 0===t||t.call(e)},e.prototype._typingStatusListener=function(e){var t,n;null===(n=(t=this._watcher).typingState)||void 0===n||n.call(t,e)},e.prototype._pullFinishedListener=function(){var e,t;null===(t=(e=this._watcher).pullFinished)||void 0===t||t.call(e)},e.prototype._MessageBlockedListener=function(e){var t,n;null===(n=(t=this._watcher).messageBlocked)||void 0===n||n.call(t,e)},e.prototype._messageDeliveredListerer=function(e){var t,n;null===(n=(t=this._watcher).messageDelivered)||void 0===n||n.call(t,e)},e.prototype._groupMessageDeliveredStatusListerer=function(e){var t,n;null===(n=(t=this._watcher).groupMessageDeliveredStatus)||void 0===n||n.call(t,e)},e.prototype._callInfoListener=function(e){var t=this;this._pluginContextQueue.forEach((function(n){try{n.onCallInfo&&n.onCallInfo(e)}catch(e){t.logger.warn(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype._ultraGroupEnableListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupEnable)||void 0===n||n.call(t,e)},e.prototype._operateStatusListener=function(e){var t,n;null===(n=(t=this._watcher).operateStatus)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageExpansionUpdatedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageExpansionUpdated)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageModifiedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageModified)||void 0===n||n.call(t,e)},e.prototype._ultraGroupMessageRecalledListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupMessageRecalled)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelChangeTypeListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelChangeType)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelUserKickedListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelUserKicked)||void 0===n||n.call(t,e)},e.prototype._ultraGroupChannelDeleteListener=function(e){var t,n;null===(n=(t=this._watcher).ultraGroupChannelDelete)||void 0===n||n.call(t,e)},e.prototype._userGroupStatusListener=function(e){var t,n;null===(n=(t=this._watcher).userGroupStatus)||void 0===n||n.call(t,e)},e.prototype._rtcDataChange=function(e,t){this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onrtcdatachange)||void 0===r||r.call(n,e,t)}))},e.prototype._naviDataChange=function(e){this._pluginContextQueue.forEach((function(t){var n;null===(n=t.onnavidatachange)||void 0===n||n.call(t,e)}))},e.prototype.assignWatcher=function(e){var t=this;Object.keys(this._watcher).forEach((function(n){if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];t._watcher[n]=qe(r)||Ke(r)?r:void 0}}))},e.prototype._resetWatcher=function(){var e=this;Object.keys(this._watcher).forEach((function(t){e._watcher[t]=void 0}))},e.prototype._addTypingInfo=function(e){var t=e.senderUserId,n=e.conversationType,r=e.targetId,i=e.content,o=e.channelId,s=i.typingContentType,a=o||"",c="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(e){return e.userId===t}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:t,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),this._startCheckTypingInfo())},e.prototype._startCheckTypingInfo=function(){var e=this;-1===this._typingInternalTimer&&0!==Object.keys(this._typingInfo).length&&(this._typingInternalTimer=setInterval((function(){for(var t in e._typingInfo){var n=e._typingInfo[t].length;e._typingInfo[t]=e._typingInfo[t].filter((function(t){return Date.now()-t.timestamp<e._typingExpireTime})),e._typingInfo[t].length===n||e._typingChangedList.includes(t)||e._typingChangedList.push(t),0===e._typingInfo[t].length&&delete e._typingInfo[t]}e._notifyTypingChanged()}),500))},e.prototype._notifyTypingChanged=function(){var e=this;if(this._typingChangedList.length>0){var t=this._typingChangedList.map((function(t){return{conversationType:Number(t.split("#")[0]),targetId:t.split("#")[1],channelId:t.split("#")[2],list:e._typingInfo[t]||[]}}));this._typingStatusListener(t),this._typingChangedList=[]}0===Object.keys(this._typingInfo).length&&(clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1)},e.prototype.getConnectedTime=function(){return this._engine.getConnectedTime()},e.prototype.getServerTime=function(){return this._engine.getServerTime()},e.prototype.getDeviceId=function(){return this._engine.getDeviceId()},e.prototype.getCurrentUserId=function(){return this._engine.getCurrentUserId()},e.prototype.getConnectionStatus=function(){return this._engine.getConnectionStatus()},Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e.prototype.refetchNaviInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.refetchNaviInfo()]}))}))},e.prototype.connect=function(e,t,n){var r,i;return u(this,void 0,void 0,(function(){var o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._token=e,[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(e,t,s,n)];case 2:return a=l.sent(),c=a.code,u=a.data,c!==D.SUCCESS?[2,{code:c}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=$e.getInfo(),null===(i=(r=this._engine).reportSDKInfo)||void 0===i||i.call(r,h)),[2,{code:c,userId:u}])}}))}))},e.prototype.disconnect=function(e){return u(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return clearInterval(this._typingInternalTimer),this._typingInternalTimer=-1,this._typingInfo={},[4,this._engine.disconnect(e)];case 1:return n.sent(),this._pluginContextQueue.forEach((function(e){if(e.ondisconnect)try{e.ondisconnect()}catch(e){t.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),[2,Promise.resolve()]}}))}))},e.prototype.reconnect=function(e){return this.connect(this.token,!!e,this.logger.createTraceId())},e.prototype._getTokenWithoutNavi=function(){return this._token.replace(/@.+$/,"@")},e.prototype.getNaviInfoFromCache=function(){return this._engine.getNaviInfoFromCache()},e.prototype.registerMessageType=function(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),ke(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[e]=r),this._engine.registerMessageType(e,t,n,r,i)},e.prototype.registerRTCSignalingListener=function(e){this._engine.registerRTCSignalingListener(e)},e.prototype.checkSearchPropsMsg=function(e,t){var n=this._registerMessageSearchPropsMapping[e],r={};return n&&Ke(t)&&Object.keys(t).forEach((function(e){if(n.includes(e)){var i=t[e];Be(i)&&(i>-Math.pow(2,64)&&i<Math.pow(2,64)&&Number.isInteger(i)||(r[e]=i))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:D.SEARCH_PROPS_LIMIT_ERROR}:{code:D.SUCCESS}},e.prototype.sendMessage=function(e,t,n,r,i){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==D.SUCCESS)return Promise.resolve({code:s,msg:a});if(e===G.SYSTEM&&n.messageType!==H.SYNC_READ_STATUS)return Promise.resolve({code:D.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(e!==G.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(1===((null==c?void 0:c.grpRRVer)||0)&&n.messageType===H.READ_RECEIPT_RESPONSE)return Promise.resolve({code:D.READ_RECEIPT_ERROR})}var u=n.canIncludeExpansion,l=void 0!==u&&u,h=n.expansion;if(l){var d=Xe(h),p=d.isIllgalEx,g=d.isExKeyOrValLengthExceedLimit;if(d.isExceedLimit||g)return Promise.resolve({code:D.EXPANSION_LIMIT_EXCEET});if(p)return Promise.resolve({code:D.BIZ_ERROR_INVALID_PARAMETER})}var E,T,C=JSON.stringify(n.content);return E=C,void 0===T&&(T="utf-8"),("utf-16"===T?f(E):_(E))>I?Promise.resolve({code:D.RC_MSG_CONTENT_EXCEED_LIMIT}):e===G.ULTRA_GROUP?this._engine.sendUltraMessage(t,n,r,i):this._engine.sendMessage(e,t,n,r,i)},e.prototype.sendExpansionMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return t=e.channelId,n=e.conversationType,r=e.targetId,i=e.messageUId,o=e.keys,s=e.expansion,a=e.removeAll,e.canIncludeExpansion?(c=Xe(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:D.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:D.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:i},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,r,{content:d,messageType:H.EXPANSION_NOTIFY,channelId:t})])):[2,{code:D.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},e.prototype.sendReadReceiptMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:D.READ_RECEIPT_ERROR,msg:"The read receipt switch is not on, please call the sendMessage method!"}]:[2,this._engine.sendReadReceiptMessage(e,t,n)]}))}))},e.prototype.getMessageReader=function(e,t,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:D.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(e,t,n)]}))}))},e.prototype._destroy=function(){return u(this,void 0,void 0,(function(){var e=this;return l(this,(function(t){switch(t.label){case 0:return this._resetWatcher(),this._engine.destroy(),this._runtime.removeNetworkStatusListener(),[4,this.disconnect()];case 1:return t.sent(),this._pluginContextQueue.forEach((function(t){if(t.ondestroy)try{t.ondestroy()}catch(t){e.logger.error(exports.LogTagId.L_CALLBACK_E,null==t?void 0:t.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},e.prototype.getHistoryMessage=function(e,t,n,r,i,o,s,a){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),e===G.ULTRA_GROUP){var c={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(t,c,a)}return this._engine.getHistoryMessage(e,t,n,r,i,o,s||"",a)},e.prototype.getMessages=function(e,t,n,r,i,o,s){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),e===G.ULTRA_GROUP){var a={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(t,a,s)}return this._engine.getMessages(e,t,n,r,i,o,s)},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,r,i,o,s){return this._engine.getHistoryMessagesByObjectNames(e,t,n,r,i,o,s)},e.prototype.getConversationList=function(e,t,n,r,i){if(void 0===e&&(e=300),void 0===i&&(i=""),t===G.ULTRA_GROUP){var o=D.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:D[o]})}return this._engine.getConversationList(e,t,n,r,i)},e.prototype.getConversationsByPage=function(e,t,n,r){return this._engine.getConversationsByPage(e,t,n,r)},e.prototype.getConversation=function(e,t,n){return this._engine.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return void 0===n&&(n=""),e===G.ULTRA_GROUP?Promise.resolve(D.METHOD_NOT_SUPPORT):this._engine.removeConversation(e,t,n)},e.prototype.getUltraGroupList=function(e){return this._engine.getUltraGroupList(e)},e.prototype.getBlockUltraGroupList=function(){return this._engine.getBlockUltraGroupList()},e.prototype.getTopUltraGroupList=function(){return this._engine.getTopUltraGroupList()},e.prototype.clearUnreadCount=function(e,t,n){return void 0===n&&(n=""),e===G.ULTRA_GROUP?this._engine.clearUltraUnreadcount(t,n):this._engine.clearConversationUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(){return this._engine.clearAllUnreadCount()},e.prototype.getUnreadCount=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationUnreadCount(e,t,n)},e.prototype.getTotalUnreadCount=function(e,t,n){if(t&&t.includes(G.ULTRA_GROUP)){var r=D.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:D[r]})}return this._engine.getAllConversationUnreadCount(e,t&&t.length>0?t:[G.PRIVATE,G.GROUP,G.SYSTEM,G.PUBLIC_SERVICE],!!n)},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){return this._engine.getTotalUnreadCountByLevels(e,t,n)},e.prototype.getFirstUnreadMessage=function(e,t,n){return void 0===n&&(n=""),this._engine.getFirstUnreadMessage(e,t,n)},e.prototype.setConversationNotificationLevel=function(e,t,n,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationNotificationLevel(e,t,n,r)]}))}))},e.prototype.setConversationStatus=function(e,t,n,r,i){if(void 0===i&&(i=""),e===G.ULTRA_GROUP&&void 0!==n)return Promise.resolve(D.METHOD_NOT_SUPPORT);var o=[{conversationType:e,targetId:t,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},e.prototype.saveConversationMessageDraft=function(e,t,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(e,t,n,r)},e.prototype.getConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationMessageDraft(e,t,n)},e.prototype.clearConversationMessageDraft=function(e,t,n){return void 0===n&&(n=""),this._engine.clearConversationMessageDraft(e,t,n)},e.prototype.recallMessage=function(e,t,n,r,i){return this._engine.recallMsg(e,t,n,r,i)},e.prototype.deleteRemoteMessage=function(e,t,n,r){return void 0===r&&(r=""),e===G.ULTRA_GROUP?Promise.resolve(D.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(e,t,n,r)},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(e,t,n,r)},e.prototype.joinChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinChatroom(e,t,n)},e.prototype.joinExistChatroom=function(e,t,n){return void 0===t&&(t=10),this._engine.joinExistChatroom(e,t,n)},e.prototype.quitChatroom=function(e){return this._engine.quitChatroom(e)},e.prototype.getChatroomInfo=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=0),this._engine.getChatroomInfo(e,t,n)},e.prototype.setChatroomEntry=function(e,t){var n=t.key,r=t.value;return Ot(n)&&Nt(r)?this._engine.setChatroomEntry(e,t):Promise.resolve(D.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.setChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n],i=r.key,o=r.value;if(!Ot(i)||!Nt(o))return Promise.resolve({code:D.BIZ_ERROR_INVALID_PARAMETER})}var s=c(c({},t),{isOverwrite:t.isForce});return this._engine.setChatroomEntries(e,s)},e.prototype.forceSetChatroomEntry=function(e,t){var n=t.key,r=t.value;return Ot(n)&&Nt(r)?this._engine.forceSetChatroomEntry(e,t):Promise.resolve(D.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntry=function(e,t){var n=t.key;return Ot(n)?this._engine.removeChatroomEntry(e,t):Promise.resolve(D.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.removeChatroomEntries=function(e,t){for(var n=0;n<t.entries.length;n++){var r=t.entries[n].key;if(!Ot(r))return Promise.resolve({code:D.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(e,t)},e.prototype.forceRemoveChatroomEntry=function(e,t){var n=t.key;return Ot(n)?this._engine.forceRemoveChatroomEntry(e,t):Promise.resolve(D.BIZ_ERROR_INVALID_PARAMETER)},e.prototype.getChatroomEntry=function(e,t){return this._engine.getChatroomEntry(e,t)},e.prototype.getAllChatroomEntries=function(e){return this._engine.getAllChatroomEntry(e)},e.prototype.getChatroomHistoryMessages=function(e,t,n,r){return void 0===t&&(t=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(e,r,t,n)},e.prototype.getFileToken=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c,u,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)||"",c=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(e,t,n,r,i)];case 1:return u=l.sent(),h=u.code,d=u.data,h===D.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:c}))]:[2,Promise.reject(h)]}}))}))},e.prototype.getFileUrl=function(e,t,n,r,i){return void 0===i&&(i=X.QINIU),u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(e,i,t,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===D.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},e.prototype.createTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.createTag(e)]}))}))},e.prototype.removeTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeTag(e)]}))}))},e.prototype.updateTag=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.updateTag(e)]}))}))},e.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getTagList()]}))}))},e.prototype.addTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return t.length>1e3?[2,Promise.reject(D.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(e,t)]}))}))},e.prototype.removeTagForConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagForConversations(e,t)]}))}))},e.prototype.removeTagsForConversation=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.removeTagsForConversation(e,t)]}))}))},e.prototype.getConversationListByTag=function(e,t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getConversationListByTag(e,t,n,r)]}))}))},e.prototype.getUnreadCountByTag=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.getUnreadCountByTag(e,t)]}))}))},e.prototype.setConversationStatusInTag=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setConversationStatusInTag(e,t,n)]}))}))},e.prototype.getTagsForConversation=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getTagsForConversation(e)]}))}))},e.prototype.getBlockConversationList=function(){return this._engine.getBlockConversationList()},e.prototype.getTopConversationList=function(e,t){return e&&0!==e.length||(e=[G.PRIVATE,G.CHATROOM,G.GROUP,G.SYSTEM,G.APP_PUBLIC_SERVICE,G.PUBLIC_SERVICE]),this._engine.getTopConversationList(e,t)},e.prototype.getUnreadConversationList=function(e){return e&&0!==e.length||(e=[G.PRIVATE,G.CHATROOM,G.GROUP,G.SYSTEM,G.APP_PUBLIC_SERVICE,G.PUBLIC_SERVICE]),this._engine.getUnreadConversationList(e)},e.prototype.getUnreadMentionedCount=function(e){return this._engine.getUnreadMentionedCount(e)},e.prototype.getAllUnreadMentionedCount=function(){return this._engine.getAllUnreadMentionedCount()},e.prototype.sendUltraGroupTypingStatus=function(e){if(e.conversationType!==G.ULTRA_GROUP){var t=D.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:t,msg:D[t]})}return this._engine.sendUltraGroupTypingStatus(e)},e.prototype.getUltraGroupMessageListByMessageUId=function(e){return this._engine.getUltraGroupMessageListByMessageUId(e)},e.prototype.expandUltraMessage=function(e){return u(this,void 0,void 0,(function(){var t,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return t=e.conversationType,n=e.expansion,r=e.canIncludeExpansion,t!==G.ULTRA_GROUP?[2,{code:i=D.CONVERSATION_TYPE_NOT_SUPPORT,msg:D[i]}]:r?(o=Xe(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:D.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:D.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(e)]):[2,{code:D.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},e.prototype.modifyMessage=function(e){return u(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return e.conversationType!==G.ULTRA_GROUP?[2,{code:t=D.CONVERSATION_TYPE_NOT_SUPPORT,msg:D[t]}]:[4,this._engine.modifyMessage(e)];case 1:return[2,{code:n.sent().code}]}}))}))},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadMentionedCountByTargetId(e,t)},e.prototype.getUltraGroupUnreadCountByTargetId=function(e,t){return this._engine.getUltraGroupUnreadCountByTargetId(e,t)},e.prototype.getAllUltraGroupUnreadCount=function(e){return void 0===e&&(e=!1),this._engine.getAllUltraGroupUnreadCount(e)},e.prototype.getAllConversationState=function(){return this._engine.getAllConversationState()},e.prototype.getUltraGroupUnreadMentionedMessages=function(e){return this._engine.getUltraGroupUnreadMentionedMessages(e)},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(e){return this._engine.getUltraGroupFirstUnreadMessageTimestamp(e)},e.prototype.getUltraGroupUnreadInfoList=function(e){return this._engine.getUltraGroupUnreadInfoList(e)},e.prototype.callExtra=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return(t=this._engine).callExtra.apply(t,h([e],n,!1))},e.prototype.getOSInfo=function(){return this._engine.getOSInfo()},e.prototype.getProcessInfo=function(){return this._engine.getProcessInfo()},e.prototype.getMainProcessInfo=function(){return this._engine.getMainProcessInfo()},e.prototype.setCallInfo=function(e,t,n){return this._engine.setCallInfo(e,t,n)},e.prototype.getGroupMessageDeliverList=function(e,t,n){return void 0===n&&(n=""),this._engine.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){return void 0===t&&(t=""),this._engine.getPrivateMessageDeliverTime(e,t)},e.prototype.clearConversations=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.clearConversations(e,t)]}))}))},e.prototype.setUserStatusListener=function(e,t){var n=this;return this._engine.setUserStatusListener(e,(function(e){try{t(e)}catch(e){n.logger.error(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}}))},e.prototype.addToBlacklist=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.addToBlacklist(e)]}))}))},e.prototype.removeFromBlacklist=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.removeFromBlacklist(e)]}))}))},e.prototype.getBlacklist=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getBlacklist()]}))}))},e.prototype.getBlacklistStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklistStatus(e)]}))}))},e.prototype.insertMessage=function(e,t,n){return u(this,void 0,void 0,(function(){var r,i,o;return l(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),i=r.code,o=r.msg,i!==D.SUCCESS?[2,Promise.resolve({code:i,msg:o})]:[2,this._engine.insertMessage(e,t,n)]}))}))},e.prototype.batchInsertMessage=function(e,t){return this._engine.batchInsertMessage(e,t)},e.prototype.getMessageCount=function(e,t,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getMessageCount(e,t,n)]}))}))},e.prototype.deleteMessages=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.deleteMessages(e)]}))}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,r,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(e,t,n,r,i)]}))}))},e.prototype.clearMessages=function(e,t,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.clearMessages(e,t,n)]}))}))},e.prototype.getMessage=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getMessage(e)]}))}))},e.prototype.setMessageContent=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setMessageContent(e,t,n)]}))}))},e.prototype.setMessageSearchField=function(e,t,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setMessageSearchField(e,t,n)]}))}))},e.prototype.setMessageSentStatus=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageSentStatus(e,t)]}))}))},e.prototype.setMessageReceivedStatus=function(e,t){return u(this,void 0,void 0,(function(){return l(this,(function(n){return[2,this._engine.setMessageReceivedStatus(e,t)]}))}))},e.prototype.setMessageStatusToRead=function(e,t,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(e,t,n,r)]}))}))},e.prototype.setUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.setUserStatus(e)]}))}))},e.prototype.subscribeUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.subscribeUserStatus(e)]}))}))},e.prototype.getUserStatus=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getUserStatus(e)]}))}))},e.prototype.searchConversationByContent=function(e,t,n,r){return void 0===t&&(t=[]),void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContent(e,t,n,r)]}))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){return void 0===t&&(t=[]),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContentWithAllChannel(e,t,n)]}))}))},e.prototype.searchMessageByContent=function(e,t,n,r,i,o,s){return void 0===s&&(s=""),u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(e,t,n,r,i,o,s)]}))}))},e.prototype.searchMessagesByUser=function(e,t,n,r,i,o){return void 0===i&&(i=5),void 0===o&&(o=""),u(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(e,t,n,r,i,o)]}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,r,i){return u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(e,t,n,r,i)]}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,r,i,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,r,i,o,s)]}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){return void 0===n&&(n=""),this._engine.getUnreadMentionedMessages(e,t,n)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(e,t,n,r)},e.prototype.getUltraGroupDefaultNotificationLevel=function(e,t){return void 0===t&&(t=""),this._engine.getUltraGroupDefaultNotificationLevel(e,t)},e.prototype.setUltraGroupDefaultNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.setUltraGroupDefaultNotificationLevel(e,t,n)},e.prototype.getConversationNotificationLevel=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationLevel(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){return void 0===n&&(n=""),this._engine.getConversationNotificationStatus(e,t,n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,r,i,o){return this._engine.getRemoteHistoryMessages(e,t,n,r,i,o)},e.prototype.getConversationListWithAllChannel=function(){return this._engine.getConversationListWithAllChannel()},e.prototype.getConversationListWithAllChannelByPage=function(e,t){return this._engine.getConversationListWithAllChannelByPage(e,t)},e.prototype.clearData=function(){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.clearData()]}))}))},e.prototype.createLogger=function(e,t){return this._engine.createLogger(e,t)},e.prototype.setCheckDuplicateMessage=function(e){return this._engine.setCheckDuplicateMessage(e)},e.prototype.rtcSignaling=function(e,t,n,r){return this._engine.rtcSignaling(e,t,n,r)},e.prototype.rtcPing=function(e,t,n){return this._engine.rtcPing(e,t,n)},e.prototype.bindRTCRoomForChatroom=function(e){return this._engine.bindRTCRoomForChatroom(e)},e.prototype.setProxy=function(e){return this._engine.setProxy(e)},e.prototype.getProxy=function(){return this._engine.getProxy()},e.prototype.testProxy=function(e,t){return this._engine.testProxy(e,t)},e}(),ma=N;exports.AConnectionMgr=Fs,exports.AEngine=Tn,exports.APIContext=ya,exports.AppStorage=o,exports.BasicLogger=Wn,exports.BasicNavi=Bi,exports.BasicReporter=Xn,exports.BasicStaticConfigManager=Nn,exports.BasicStatistic=oa,exports.BasicStatisticReporter=sa,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType={"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"},exports.ChatroomEntryType=ne,exports.ChatroomSyncStatusReason=be,exports.ChatroomUserChangeType=oe,exports.ChrmMemBanType=_e,exports.ChrmMemOperateType=ge,exports.ChrmSyncStatus=de,exports.Codec=yn,exports.ConnectionStatus=k,exports.ConversationType=G,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DelayTimer=qt,exports.ErrorCode=D,exports.EventEmitter=Ze,exports.FORMATED_VERSION=M,exports.FileType=w,exports.HTTP_TIMEOUT=C,exports.IM_CHATROOM_PULL_INTERVAL_TIME=y,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.IndexDBLogger=Jn,exports.IndexDBReporter=ur,exports.IndexDBStatistic=ca,exports.IndexDBStatisticReporter=fa,exports.LOCAL_STORAGE_KEYS=U,exports.MAX_MESSAGE_CONTENT_BYTES=I,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MAX_UPLOAD_FILE_SIZE=5368709120,exports.MentionedType=W,exports.MessageBlockType=ae,exports.MessageDirection=b,exports.MessageType=H,exports.NAVI_CACHE_DURATION=T,exports.NAVI_REQ_TIMEOUT=v,exports.NotificationLevel=j,exports.NotificationStatus=q,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=le,exports.PluginContext=Tr,exports.RCAssertError=pt,exports.REAT_TIME_LOG_SIZE=20971520,exports.RTCPluginContext=va,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=S,exports.STATIC_CONFIG_CACHE_TIME=L,exports.STATIC_CONFIG_IV=R,exports.STATIC_CONFIG_KEY=m,exports.STATUS_MESSAGE=O,exports.UPLOAD_FILE_CHUNK_SIZE=10485760,exports.UploadMethod=X,exports.VERSION=N,exports.VersionManage=$e,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketNavi=Fi,exports.appendUrl=E,exports.assert=function(e,t,n,r){if(void 0===r&&(r=!1),!gt(e,t,n,r))throw new pt("'".concat(e,"' is invalid: ").concat(JSON.stringify(t)))},exports.clone=Kt,exports.cloneByJSON=Bt,exports.deInitLogDB=Dn,exports.decryptCBC=Ut,exports.fixUrlProtocol=At,exports.forEach=xt,exports.getBrowser=Ft,exports.getClientMessageId=Mt,exports.getMimeKey=function(e){var t="application/octet-stream";switch(e){case w.IMAGE:t="image/jpeg";break;case w.AUDIO:t="audio/amr";break;case w.VIDEO:t="video/3gpp";break;case w.SIGHT:t="video/mpeg4";break;case w.COMBINE_HTML:t="text/html"}return t},exports.getUUID=lt,exports.getUUID22=ht,exports.getUploadFileName=mt,exports.getbundleId=Lt,exports.httpRequest=function(e){var t=e.method||exports.HttpMethod.GET,n=e.timeout||C,r=e.headers,i=e.query,o=e.body,s=e.onProgress,a=E(e.url,i),c=wt(),u="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(t,a),r&&c.setRequestHeader)for(var l in r)c.setRequestHeader(l,r[l]);return u?function(e,t,n){return new Promise((function(r){0!==t&&(e.timeout=t),e.onload=function(){r({data:e.responseText,status:e.status||200})},e.onerror=function(){r({status:e.status})},e.ontimeout=function(){r({status:e.status})};var i="object"==typeof n?JSON.stringify(n):n;e.send(i)}))}(c,n,o):function(e,t,n,r){return new Promise((function(i){e.onreadystatechange=function(){4===e.readyState&&i({data:e.responseText,status:e.status,xhr:e})},e.onerror=function(){i({status:e.status})},r&&(e.upload.onprogress=function(e){return r(e)}),0!==t&&setTimeout((function(){e.abort(),i({status:e.status})}),t),e.send(n)}))}(c,n,o,s)},exports.indexOf=Vt,exports.initLogDB=xn,exports.initStatisticDB=Js,exports.isArray=ke,exports.isArrayBuffer=Fe,exports.isBoolean=function(e){return"boolean"==typeof e},exports.isConnnectAck=function(e){return Object.keys(Gs).some((function(t){return Gs[t]===e}))},exports.isDisconnectedByServer=function(e){return Object.keys(Vs).some((function(t){return Vs[t]===e}))},exports.isFunction=qe,exports.isHttpUrl=je,exports.isInObject=Gt,exports.isInclude=function(e,t){return-1!==Vt(e,t)},exports.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},exports.isNumber=Be,exports.isObject=Ke,exports.isString=Ge,exports.isTypeInConversationList=function(e){return[G.PRIVATE,G.GROUP,G.SYSTEM,G.PUBLIC_SERVICE,G.APP_PUBLIC_SERVICE].includes(e)},exports.isUndefined=Ye,exports.isValidChannelId=Je,exports.isValidChrmEntryKey=Ot,exports.isValidChrmEntryValue=Nt,exports.isValidConversationType=We,exports.isValidExpansion=Xe,exports.isValidFileType=function(e){return Be(e)&&Object.prototype.hasOwnProperty.call(w,e)},exports.isValidNotificationLevel=function(e){return Be(e)&&Object.prototype.hasOwnProperty.call(j,e)},exports.logger=ut,exports.map=Dt,exports.notEmptyArray=function(e){return ke(e)&&e.length>0},exports.notEmptyObject=Qe,exports.notEmptyString=He,exports.pushConfigsToJSON=Rt,exports.pushJSONToConfigs=St,exports.statisticTranscsv=ta,exports.todo=function(e){return new p(e)},exports.transcsv=cr,exports.unInitStatisticDB=Xs,exports.urlCenter=On,exports.usingCppEngine=kt,exports.validate=gt,exports.version=ma;
1
+ "use strict";var t;Object.defineProperty(exports,"__esModule",{value:!0}),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,r=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},i=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=r(t);var o=this._rootStorage.get(e)||{};this._cache=new i(((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 c=function(){return c=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},c.apply(this,arguments)};function u(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function l(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[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(c){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,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function h(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||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){for(var e=0,n=0,r=t.length;n<r;n++)e+=t.charCodeAt(n)<=65535?2:4;return e},_=function(t){for(var e,n=0,r=0,i=t.length;r<i;r++)n+=(e=t.charCodeAt(r))<127?1:e<=2047?2:e<=65535?3:4;return n},E=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},T=72e5,C=6e4,v=1e4,I=131072,y=18e4,m="cd4936151214ce45dc1d12673a59d94c",R="51ad078e5eb17a91",S={"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:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:RcNtf":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:Delivered":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},O=["RC:TypSts","RC:InterceptMsg","RC:RL"],N="5.8.5",L=N.replace(/-.+$/,""),M=18e5,U="rongcloudsystem",A={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)},CLOUD_CONTROL_KEY:function(t){return"cloud-control-".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 b,w=d;!function(t){t[t.SEND=1]="SEND",t[t.RECEIVE=2]="RECEIVE"}(b||(b={}));var P,x=b;!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.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",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"}(P||(P={}));var D,V=P;!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"}(D||(D={}));var G,B=D;!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"}(G||(G={}));var k,F=G;!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.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",t.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg"}(k||(k={}));var H,K=k;!function(t){t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE"}(H||(H={}));var q,Y=H;!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"}(q||(q={}));var j,W=q;!function(t){t[t.ALL=1]="ALL",t[t.SINGAL=2]="SINGAL"}(j||(j={}));var Q,J=j;!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"}(Q||(Q={}));var X,Z=Q;!function(t){t[t.UPDATE=1]="UPDATE",t[t.DELETE=2]="DELETE"}(X||(X={}));var z,$,tt,et,nt,rt=X;exports.LogLevel=void 0,(z=exports.LogLevel||(exports.LogLevel={}))[z.LOG=0]="LOG",z[z.DEBUG=0]="DEBUG",z[z.INFO=1]="INFO",z[z.WARN=2]="WARN",z[z.ERROR=3]="ERROR",z[z.FATAL=4]="FATAL",z[z.STATISTICS=6]="STATISTICS",z[z.NONE=1e3]="NONE",exports.LogSource=void 0,($=exports.LogSource||(exports.LogSource={})).IM="IM",$.RTC="RTC",exports.LogTagId=void 0,(tt=exports.LogTagId||(exports.LogTagId={})).L_IMSDK_VER_O="L-imsdk_ver-O",tt.A_INIT_O="A-init-O",tt.A_INIT_REPEAT_O="A_INIT_REPEAT_O",tt.L_INIT_O="L-init-O",tt.A_DESTROY_O="A_DESTROY_O",tt.L_DESTROY_O="L_DESTROY_O",tt.A_CONNECT_T="A-connect-T",tt.A_CONNECT_R="A-connect-R",tt.A_CONNECT_S="A-connect-S",tt.A_DISCONNECT_O="A-disconnect-O",tt.A_RECONNECT_T="A-reconnect-T",tt.A_RECONNECT_R="A_RECONNECT_R",tt.L_CONNECT_T="L-connect-T",tt.L_CONNECT_R="L-connect-R",tt.L_CONNECT_S="L-connect-S",tt.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",tt.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",tt.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",tt.A_MSG_LISTENER_E="A-MSG_LISTENER-E",tt.O="L-original-O",tt.T="L-TEST-O",tt.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",tt.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",tt.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",tt.A_SEND_MSG_T="A-send_msg-T",tt.A_SEND_MSG_R="A-send_msg-R",tt.L_SEND_MSG_T="L-send_msg-T",tt.L_SEND_MSG_R="L-send_msg-R",tt.L_PULL_MSG_T="L-pull_msg-T",tt.L_PULL_MSG_R="L-pull_msg-R",tt.L_PULL_MSG_O="L-pull_msg-O",tt.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",tt.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",tt.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",tt.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",tt.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",tt.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",tt.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",tt.L_RECV_S_MSG_O="L-recv_s_msg-O",tt.A_DELETE_MESSAGES_S="A-delete_messages-S",tt.P_DELETE_MSG_S="P-delete_msg-S",tt.L_PULL_CONVERSATION_S="L-pull_conversation-S",tt.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",tt.A_REGTYP_O="A-regtyp-O",tt.P_REGTYP_E="P-regtype-E",tt.L_GET_NAVI_T="L-get_navi-T",tt.L_GET_NAVI_R="L-get_navi-R",tt.L_REQUEST_T="L-request-T",tt.L_REQUEST_R="L-request-R",tt.L_PARSE_NAVI_E="L-parse_navi-E",tt.L_ENV_S="L-Env-S",tt.L_GET_INDEX_NAVI_S="L-get_index_navi-S",tt.A_JOIN_CHATROOM_T="A-join_chatroom-T",tt.A_JOIN_CHATROOM_R="A-join_chatroom-R",tt.L_JOIN_CHATROOM_T="L-join_chatroom-T",tt.L_JOIN_CHATROOM_R="L-join_chatroom-R",tt.A_QUIT_CHATROOM_T="A-quit_chatroom-T",tt.A_QUIT_CHATROOM_R="A-quit_chatroom-R",tt.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",tt.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",tt.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",tt.L_MEDIA_S="L-media-S",tt.L_MEDIA_UPLOAD_T="L-media_upload-T",tt.L_MEDIA_UPLOAD_R="L-media_upload-R",tt.G_UPLOAD_LOG_S="G-upload_log-S",tt.G_REPORT_LOG_S="G-report_log-S",tt.G_UPLOAD_LOG_E="G-upload_log-E",tt.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",tt.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",tt.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",tt.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",tt.A_GET_HISTORY_MSG_T="A-get_history_msg-T",tt.A_GET_HISTORY_MSG_R="A-get_history_msg-R",tt.L_GET_HISTORY_MSG_T="L-get_history_msg-T",tt.L_GET_HISTORY_MSG_R="L-get_history_msg-R",tt.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",tt.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",tt.A_CALLBACK_O="A-callback-O",tt.A_CALLBACK_E="A-callback-E",tt.L_CALLBACK_E="L-callback-E",tt.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",tt.L_PB_ENCODE_E="L-pb-encode-E",tt.L_PB_DECODE_E="L-pb-decode-E",tt.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",tt.L_REPORT_FULL_LOG_O="L-report_full_log-O",tt.L_REPORT_FULL_LOG_T="L-report_full_log-T",tt.L_REPORT_FULL_LOG_R="L-report_full_log-R",tt.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",tt.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",tt.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",tt.L_LOGDB_CLOSED_S="L-logDB_closed-S",tt.L_LOGDB_ERROR_E="L-logDB_error-S",tt.L_LOGDB_ABORT_S="L-logDB_abort-S",tt.L_REALTIME_LOG_R="L_REALTIME_LOG_R",tt.L_REALTIME_LOG_O="L_REALTIME_LOG_O",tt.L_REALTIME_LOG_T="L_REALTIME_LOG_T",tt.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",tt.L_RECV_RMTP_O="L_RECV_RMTP_O",tt.L_RECV_RMTP_E="L_RECV_RMTP_E",tt.L_RECV_S_NTF_O="L-recv_s_ntf_O",tt.L_VER_REPORT_T="L-VER_REPORT-T",tt.L_VER_REPORT_R="L-VER_REPORT-R",tt.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",tt.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",tt.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",tt.A_REMOVE_PROXY_O="A-remove_proxy-O",tt.A_SET_PROXY_O="A-set_proxy-O",tt.A_TEST_PROXY_O="A-test_proxy-O",tt.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",tt.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",tt.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",tt.L_GET_STATIC_CONF_T="L-get_static_conf-T",tt.L_GET_STATIC_CONF_R="L-get_static_conf-R",tt.L_GET_STATIC_CONF_E="L-get_static_conf-E",tt.L_CLOUD_DISABLED="L-cloud_disabled",tt.L_CLOUD_EXPIRE="L-cloud_expire",tt.L_CLOUD_OVERCLOCK="L-cloud_overclock",tt.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",tt.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",tt.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",tt.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",tt.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",tt.L_PARSE_JSON_MSGS_E="L-parse_json_messsages-E",tt.L_PARSE_JSON_E="L-parse_json-E",exports.StatisticsTag=void 0,(et=exports.StatisticsTag||(exports.StatisticsTag={})).IM_NAVI="IM-stats_navi-S",et.IM_WEBSOCKET="IM-stats_websocket-S",et.IM_CONNECTION_DURATION="IM-stats_con_dur-S",et.IM_CMP="IM-stats_cmp-S",et.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",et.IM_STATS_CS="IM-stats_cs-S",et.IM_NETWORK_CHANGE="IM-stats_network_change-S",et.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",et.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(nt||(nt={}));var it,ot,st=nt;!function(t){t[t.GLOBAL=1]="GLOBAL",t[t.CUSTOM=2]="CUSTOM",t[t.THIRD_PARTY=3]="THIRD_PARTY"}(it||(it={})),exports.MessageBlockSourceType=void 0,(ot=exports.MessageBlockSourceType||(exports.MessageBlockSourceType={}))[ot.MSG_ORIGINAL=0]="MSG_ORIGINAL",ot[ot.MSG_EXPANSION=1]="MSG_EXPANSION",ot[ot.MSG_MODIFY=2]="MSG_MODIFY";var at,ct=it;!function(t){t[t.typing=0]="typing"}(at||(at={}));var ut,lt,ht=at;exports.SentStatus=void 0,(ut=exports.SentStatus||(exports.SentStatus={}))[ut.SENDING=10]="SENDING",ut[ut.FAILED=20]="FAILED",ut[ut.SENT=30]="SENT",ut[ut.RECEIVED=40]="RECEIVED",ut[ut.READ=50]="READ",ut[ut.DESTROYED=60]="DESTROYED",function(t){t[t.QUIT=0]="QUIT",t[t.JOIN=1]="JOIN"}(lt||(lt={}));var dt,pt=lt;!function(t){t[t.Deblock=0]="Deblock",t[t.Blocked=1]="Blocked"}(dt||(dt={}));var gt,ft=dt;!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"}(gt||(gt={}));var _t,Et=gt;!function(t){t[t.LeaveOnMyOwn=0]="LeaveOnMyOwn",t[t.OtherDeviceLogin=1]="OtherDeviceLogin"}(_t||(_t={}));var Tt,Ct,vt,It,yt,mt,Rt,St,Ot,Nt,Lt,Mt,Ut,At,bt,wt,Pt,xt=_t;exports.EConnectProtocol=void 0,(Tt=exports.EConnectProtocol||(exports.EConnectProtocol={}))[Tt.RMTP=1]="RMTP",Tt[Tt.TLS=2]="TLS",Tt[Tt.RPP=3]="RPP",Tt[Tt.QUIC=4]="QUIC",Tt[Tt.WS=5]="WS",Tt[Tt.WSS=6]="WSS",Tt[Tt.HTTP=11]="HTTP",Tt[Tt.HTTPS=12]="HTTPS",exports.StoreKeys=void 0,(Ct=exports.StoreKeys||(exports.StoreKeys={})).NAVI="rc-navi",Ct.REALTIME_LOG_TIMESTAMP="rc-realtime-log-timestamp",exports.UltraGroupChannelType=void 0,(vt=exports.UltraGroupChannelType||(exports.UltraGroupChannelType={}))[vt.PUBLIC=0]="PUBLIC",vt[vt.PRIVATE=1]="PRIVATE",exports.UltraGroupChannelChangeType=void 0,(It=exports.UltraGroupChannelChangeType||(exports.UltraGroupChannelChangeType={}))[It.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",It[It.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",It[It.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UltraMsgChangeType=void 0,(yt=exports.UltraMsgChangeType||(exports.UltraMsgChangeType={}))[yt.MSG_EXPANSION=1]="MSG_EXPANSION",yt[yt.MSG_MODIFY=2]="MSG_MODIFY",yt[yt.MSG_RECALL=3]="MSG_RECALL",yt[yt.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",yt[yt.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE",exports.UltraMsgSubChangeType=void 0,(mt=exports.UltraMsgSubChangeType||(exports.UltraMsgSubChangeType={}))[mt.CHANNEL_DELETE=1]="CHANNEL_DELETE",mt[mt.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",mt[mt.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",mt[mt.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",mt[mt.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",mt[mt.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN",exports.UserGroupChangeType=void 0,(Rt=exports.UserGroupChangeType||(exports.UserGroupChangeType={}))[Rt.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",Rt[Rt.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",Rt[Rt.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",Rt[Rt.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",Rt[Rt.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP",exports.UltraMentionedType=void 0,(St=exports.UltraMentionedType||(exports.UltraMentionedType={}))[St.NOT_MENTIONED=0]="NOT_MENTIONED",St[St.ALL=1]="ALL",St[St.ME=2]="ME",exports.EnterpriseType=void 0,(Ot=exports.EnterpriseType||(exports.EnterpriseType={}))[Ot.PRIVATE=1]="PRIVATE",Ot[Ot.OPEN=0]="OPEN",exports.ProtocalType=void 0,(Nt=exports.ProtocalType||(exports.ProtocalType={}))[Nt.NAVI=1]="NAVI",Nt[Nt.TCP=2]="TCP",Nt[Nt.WS=3]="WS",exports.NaviCacheType=void 0,(Lt=exports.NaviCacheType||(exports.NaviCacheType={}))[Lt.REQUEST=0]="REQUEST",Lt[Lt.LOCAL=1]="LOCAL",exports.StatisticsVersion=void 0,(Mt=exports.StatisticsVersion||(exports.StatisticsVersion={}))[Mt.CURRENT=2]="CURRENT",exports.ConnectType=void 0,(Ut=exports.ConnectType||(exports.ConnectType={}))[Ut.CONNECT=0]="CONNECT",Ut[Ut.RECONNECT=1]="RECONNECT",exports.ConnectReason=void 0,(At=exports.ConnectReason||(exports.ConnectReason={}))[At.CONNECT=0]="CONNECT",At[At.RECONNECT=1]="RECONNECT",At[At.REDIRECTED=3]="REDIRECTED",At[At.TIMEOUT=4]="TIMEOUT",exports.RTCMode=void 0,(bt=exports.RTCMode||(exports.RTCMode={}))[bt.RTC=0]="RTC",bt[bt.LIVE=2]="LIVE",bt[bt.SIP=4]="SIP",bt[bt.CALL=5]="CALL",bt[bt.MEETING=6]="MEETING",bt[bt.CROSS_MUTI=7]="CROSS_MUTI",bt[bt.CROSS_LIVE=8]="CROSS_LIVE",exports.LiveType=void 0,(wt=exports.LiveType||(exports.LiveType={}))[wt.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",wt[wt.AUDIO=1]="AUDIO",exports.LiveRole=void 0,(Pt=exports.LiveRole||(exports.LiveRole={}))[Pt.ANCHOR=1]="ANCHOR",Pt[Pt.AUDIENCE=2]="AUDIENCE";var Dt,Vt,Gt;exports.RTCApiType=void 0,(Dt=exports.RTCApiType||(exports.RTCApiType={}))[Dt.ROOM=1]="ROOM",Dt[Dt.PERSON=2]="PERSON",exports.RTCIdentityChangeType=void 0,(Vt=exports.RTCIdentityChangeType||(exports.RTCIdentityChangeType={}))[Vt.AnchorToViewer=1]="AnchorToViewer",Vt[Vt.ViewerToAnchor=2]="ViewerToAnchor",exports.RTCJoinType=void 0,(Gt=exports.RTCJoinType||(exports.RTCJoinType={}))[Gt.KICK=0]="KICK",Gt[Gt.REFUSE=1]="REFUSE",Gt[Gt.COEXIST=2]="COEXIST";var Bt=function(t){return"string"==typeof t},kt=function(t){return"number"==typeof t&&!Number.isNaN(t)},Ft=function(t){return-1!==Object.prototype.toString.call(t).indexOf("Array")},Ht=function(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)},Kt=function(t){return Bt(t)&&t.length>0},qt=function(t){return"[object Object]"===Object.prototype.toString.call(t)},Yt=function(t){return"[object Function]"===Object.prototype.toString.call(t)},jt=function(t){return void 0===t||"[object Undefined]"===Object.prototype.toString.call(t)},Wt=function(t){return Bt(t)&&/https?:\/\//.test(t)},Qt=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1},Jt=function(t){return kt(t)&&Object.prototype.hasOwnProperty.call(B,t)},Xt=function(t){var e=!1;return Bt(t)&&!/_/g.test(t)&&t.length<=20&&(e=!0),e},Zt=function(t){var e=!1,n=!1,r=!1;if(qt(t)){var i=Object.keys(t).length;for(var o in e=i>20,t)if(n||(n=Bt(o)&&!/^[A-Za-z0-9_=+-]+$/.test(o)),!r){var s=t[o];r=o.length>32||s.length>4096}}return{isExceedLimit:e,isIllgalEx:n,isExKeyOrValLengthExceedLimit:r}},zt=function(){function t(){this._map={}}return t.prototype.on=function(t,e,n){var r=this._map[t]||(this._map[t]=[]);r.some((function(t){return t.listener===e&&t.target===n}))||r.push({listener:e,target:n})},t.prototype.once=function(t,e,n){var r=this._map[t]||(this._map[t]=[]);r.some((function(t){return t.listener===e&&t.target===n}))||r.push({listener:e,target:n,once:!0})},t.prototype.off=function(t,e,n){var r=this._map[t];r&&((r=r.filter((function(t){return t.listener!==e||t.target!==n}))).length?this._map[t]=r:delete this._map[t])},t.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=this._map[t];if(r)for(var i=r.length-1;i>=0;i-=1){var o=r[i],s=o.target,a=o.once,c=o.listener;a&&r.splice(i,1);try{c.call.apply(c,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}(),$t="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};$t.engine="5.8.5";var te=function(){function t(){}return t.add=function(t,e){$t[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 $t.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(t){return t.padStart(3,"0")})).join("")>=n},t.getInfo=function(){return $t},t}();function ee(){return!0}var ne=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)}))},re=function(){var t=ne();if(t="".concat(t.replace(/-/g,""),"a"),t=function(t){var e="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZa0".split(""),n=e.length+1,r=+t,i=[];do{var o=r%n;r=(r-o)/n,i.unshift(e[o])}while(r);return i.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},ie=function(t){var e="RCDeviceId",n=r(t),i="",o=n.get(e);return o?i=o:(i=re(),n.set(e,i)),i},oe=null;function se(t,e,n,r){void 0===n&&(n={});var i=["error","warn","info","debug"][3-t];if(oe&&t<exports.LogLevel.FATAL)try{var o=JSON.stringify(n);oe[i](e,o)}catch(t){console.error(t)}}var ae,ce,ue=se.bind(null,exports.LogLevel.DEBUG),le=se.bind(null,exports.LogLevel.INFO),he=se.bind(null,exports.LogLevel.WARN),de=se.bind(null,exports.LogLevel.ERROR),pe=se.bind(null,exports.LogLevel.FATAL),ge=Object.freeze({__proto__:null,init:function(t){oe=t},log:se,debug:ue,info:le,warn:he,error:de,fatal:pe});exports.AssertRules=void 0,(ce=exports.AssertRules||(exports.AssertRules={}))[ce.STRING=0]="STRING",ce[ce.ONLY_STRING=1]="ONLY_STRING",ce[ce.NUMBER=2]="NUMBER",ce[ce.BOOLEAN=3]="BOOLEAN",ce[ce.OBJECT=4]="OBJECT",ce[ce.ARRAY=5]="ARRAY",ce[ce.CALLBACK=6]="CALLBACK",ce[ce.CHANNEL_ID=7]="CHANNEL_ID",ce[ce.CONVERSATION=8]="CONVERSATION";var fe,_e=((ae={})[exports.AssertRules.STRING]=Kt,ae[exports.AssertRules.ONLY_STRING]=Bt,ae[exports.AssertRules.NUMBER]=kt,ae[exports.AssertRules.BOOLEAN]=function(t){return"boolean"==typeof t},ae[exports.AssertRules.OBJECT]=qt,ae[exports.AssertRules.ARRAY]=Ft,ae[exports.AssertRules.CALLBACK]=function(t){var e=!0;return qt(t)||(e=!1),(t=t||{}).onSuccess&&!Yt(t.onSuccess)&&(e=!1),t.onError&&!Yt(t.onError)&&(e=!1),e},ae[exports.AssertRules.CHANNEL_ID]=Xt,ae[exports.AssertRules.CONVERSATION]=function(t){var e=!0;return qt(t)||(e=!1),Bt(t.targetId)||(e=!1),Jt(t.conversationType)||(e=!1),jt(t.channelId)||Xt(t.channelId)||(e=!1),e},ae),Ee=function(t){function e(e){var n=t.call(this,e)||this;return n.name="RCAssertError",n}return a(e,t),e}(Error),Te=function(t,e,n,r){void 0===r&&(r=!1),n=_e[n]||n;var i=r?n(e):jt(e)||null==e||n(e);return i||null===console||void 0===console||console.error("'".concat(t,"' is invalid: ").concat(JSON.stringify(e))),i};!function(t){t.ALIYUN="aliyun",t.S3="s3",t.STC="stc",t.MINIO="minio",t.QINIU="qiniu",t.BAIDU="baidu",t.RCX="rcx"}(fe||(fe={}));var Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function ve(t){var e,n,r,i,o,s,a="",c=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");c<t.length;)e=Ce.indexOf(t.charAt(c++))<<2|(i=Ce.indexOf(t.charAt(c++)))>>4,n=(15&i)<<4|(o=Ce.indexOf(t.charAt(c++)))>>2,r=(3&o)<<6|(s=Ce.indexOf(t.charAt(c++))),a+=String.fromCharCode(e),64!==o&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(r));return a}function Ie(t){for(var e=null===window||void 0===window?void 0:window.atob(t),n=new Uint8Array(e.length),r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n.buffer}var ye,me=function(t){if(!qt(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)},Re=function(t,e){var n=Math.floor(1e3*Math.random()%1e4),r=ne(),i=function(t){t=t||"-";var e=new Date,n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate();return"".concat(n).concat(t).concat(r).concat(t).concat(i)}(),o=(new Date).getTime(),s="";if(e){var a=e.split(".");s=".".concat(a[a.length-1])}return"".concat(t,"__RC-").concat(i,"_").concat(n,"_").concat(o).concat(r).concat(s)},Se=function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=t.threadId,r=t.apnsCollapseId,i=t.category,o=t.richMediaUri,s=e.channelIdMi,a=e.channelIdHW,c=e.channelIdOPPO,u=e.typeVivo,l=e.googleConfig,h=e.miLargeIconUrl,d=e.importanceHW,p=e.categoryHW,g=e.imageUrlHW,f=e.categoryVivo,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=r||"",_.category=i||"",_.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 C=[{HW:{channelId:a||"",importance:d||"NORMAL",image:g||"",category:p||""}},{MI:{channelId:s||"",large_icon_uri:h||""}},{OPPO:{channelId:c||""}},{VIVO:{classification:u||"",category:f||""}},{APNS:_},{FCM:E}];return JSON.stringify(C)},Oe=function(t,e,n){var r={},i={notificationId:n||""};if(!e)return{iOSConfig:r,androidConfig:i};try{var o=JSON.parse(e);null==o||o.forEach((function(t){var e,n,o,s,a,c,u,l,h,d=Object.keys(t);if(0!==d.length){var p=d[0];switch(p){case"HW":return i.channelIdHW=null===(e=t[p])||void 0===e?void 0:e.channelId,i.importanceHW=null===(n=t[p])||void 0===n?void 0:n.importance,i.imageUrlHW=null===(o=t[p])||void 0===o?void 0:o.image,void(i.categoryHW=null===(s=t[p])||void 0===s?void 0:s.category);case"MI":return i.channelIdMi=null===(a=t[p])||void 0===a?void 0:a.channelId,void(i.miLargeIconUrl=null===(c=t[p])||void 0===c?void 0:c.large_icon_uri);case"OPPO":return void(i.channelIdOPPO=null===(u=t[p])||void 0===u?void 0:u.channelId);case"VIVO":return i.typeVivo=null===(l=t[p])||void 0===l?void 0:l.classification,void(i.categoryVivo=null===(h=t[p])||void 0===h?void 0:h.category);case"APNS":return r.threadId=t[p]["thread-id"],r.apnsCollapseId=t[p]["apns-collapse-id"],r.category=t[p].category,void(r.richMediaUri=t[p].richMediaUri);case"FCM":i.googleConfig={collapseKey:t[p].collapse_key||"",imageUrl:t[p].imageUrl||"",priority:t[p].priority||""}}}}))}catch(n){t.error(exports.LogTagId.O,"Wrong format for pushConfigs field! content: ".concat(e))}return{iOSConfig:r,androidConfig:i}},Ne=function(t){var e=/^[A-Za-z0-9_=+-]+$/.test(t),n=t.length;return e&&(n<=128&&n>=1)},Le=function(t){var e=t.length;return e<=4096&&e>=1},Me=(ye=0,function(){var t=((4294967295&Date.now())>>>0).toString(2),e=Math.floor(Math.random()*(Math.pow(2,20)-1)),n=t+ye.toString(2).padStart(11,"0")+e.toString(2).padStart(20,"0");return ye=2047&++ye,parseInt(n,2)}),Ue=function(){var t=te.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},Ae=function(t,e,n){return u(void 0,void 0,void 0,(function(){var r,i;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 r=o.sent(),[4,window.crypto.subtle.decrypt({name:"AES-CBC",iv:(new TextEncoder).encode(n)},r,Ie(t))];case 2:return i=o.sent(),[2,(new TextDecoder).decode(i)]}}))}))};function be(t,e){var n;if(!t)return"";var r="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)?r?t.replace(/^https?:\/\//i,"https://"):t:e!==exports.EConnectProtocol.HTTP||r?"https://".concat(t):"http://".concat(t)}var we,Pe,xe,De=function(t,e){if(!t)return"";var n=t.ossConfig,r=void 0===n?"":n,i="";try{var o=JSON.parse(r);if(o.length>0){var s=o.find((function(t){return t[fe.MINIO]}));s&&(i=s[fe.MINIO])}}catch(t){e.warn(exports.LogTagId.L_PARSE_JSON_E,JSON.stringify({ossConfig:r,error:t}))}return i};exports.HttpMethod=void 0,(we=exports.HttpMethod||(exports.HttpMethod={})).GET="GET",we.POST="POST",we.PUT="PUT",exports.NetworkType=void 0,(Pe=exports.NetworkType||(exports.NetworkType={})).WIFI="wifi",Pe.FOUR_G="4g",Pe.THREE_G="3g",Pe.TWO_G="2g",Pe.FIVE_G="2g",Pe.THREE_GENT="3gnet",Pe.UNKONWN="unknown",exports.TagChangeType=void 0,(xe=exports.TagChangeType||(exports.TagChangeType={}))[xe.add=1]="add",xe[xe.update=2]="update",xe[xe.delete=3]="delete";var Ve=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")};var Ge,Be,ke=function(t,e,n){var r=null==n?void 0:n.isReverse;qt(t)&&function(){for(var n in t)e(t[n],n,t)}(),(Ft(t)||Bt(t))&&function(){if(r)for(var n=t.length-1;n>=0;n--)e(t[n],n);else for(var i=0,o=t.length;i<o;i++)e(t[i],i)}()},Fe=function(t,e){return ke(t,(function(n,r){t[r]=e(n,r)})),t},He=function(t,e){if(t.indexOf)return t.indexOf(e);var n=-1;return ke(t,(function(t,r){e===t&&(n=r)})),n},Ke=function(t,e){var n=[];return ke(t,(function(t){n.push(t)})),-1!==He(n,e)},qe=function(t){return JSON.parse(JSON.stringify(t))},Ye=function(){return"undefined"!=typeof RCCppEngine},je=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},We=function(t){var e;if("object"==typeof t&&null!==t)if(Array.isArray(t))for(var n in e=[],t)e.push(We(t[n]));else for(var n in e={},t)e[n]=We(t[n]);else e=t;return e},Qe=function(t){var e;try{e=We(t)}catch(n){e=JSON.parse(JSON.stringify(t))}return e},Je={_delayTime:0,setTime:function(t){var e=(new Date).getTime();Je._delayTime=e-t},getTime:function(){var t=Je._delayTime;return(new Date).getTime()-t}},Xe=function(t,e){var n=0;return t.isAutoDelete&&(n|=1),t.isOverwrite&&(n|=2),2===e&&(n|=4),n},Ze=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._pullTime=0,this._engine=t}return t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,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,(r=this._pullTime)>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullRTCRoomEntry(e,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,o===V.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}(),ze="rtcRJoin_data",$e="rtcRExit",tn="rtcRInfo",en="rtcUData",nn="rtcUPut",rn="rtcUDel",on="rtcSetData",sn="userSetData",an="rtcQryData",cn="rtcDelData",un="rtcToken",ln="rtcUserState",hn="rtcUList",dn="viewerJoinR",pn="viewerExitR",gn="rtcPullKv",fn="rtcIdentityChange",_n="rtcInvite",En="rtcCancelInvite",Tn="rtcInviteAnswer",Cn="rtcEndInvite",vn="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"}(Be||(Be={}));var In=((Ge={})[Be.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas"],Ge[Be.RtcUserListOutput]=["users","token","sessionId","roomInfo"],Ge[Be.SetUserStatusInput]=["status"],Ge[Be.RtcSetDataInput]=["interior","target","key","value","objectName","content"],Ge[Be.RtcUserSetDataInput]=["valueInfo","objectName","content"],Ge[Be.RtcDataInput]=["interior","target","key","objectName","content"],Ge[Be.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],Ge[Be.MCFollowInput]=["state"],Ge[Be.RtcTokenOutput]=["rtcToken"],Ge[Be.RtcQryOutput]=["outInfo"],Ge[Be.RtcQryUserOutDataInput]=["userId"],Ge[Be.RtcUserOutDataOutput]=["user"],Ge[Be.RtcQueryListInput]=["order"],Ge[Be.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],Ge[Be.RtcValueInfo]=["key","value"],Ge[Be.RtcKeyDeleteInput]=["key"],Ge[Be.RtcNotifyMsg]=["type","time","roomId"],Ge[Be.RtcPullKV]=["timestamp","roomId"],Ge[Be.RtcKVOutput]=["entries","bFullUpdate","syncTime"],Ge[Be.RtcQueryUserJoinedInput]=["userId"],Ge[Be.RtcQueryUserJoinedOutput]=["info"],Ge[Be.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],Ge[Be.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],Ge[Be.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],Ge[Be.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],Ge),yn="\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(Be.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(Be.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(Be.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(Be.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(Be.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(Be.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(Be.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(Be.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(Be.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(Be.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(Be.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n }\n message ").concat(Be.RtcQryOutput,"{\n repeated ").concat(Be.RtcValueInfo," outInfo=1;\n }\n message ").concat(Be.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(Be.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(Be.RtcUserSetDataInput," {\n repeated ").concat(Be.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(Be.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(Be.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(Be.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(Be.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(Be.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(Be.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(Be.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(Be.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(Be.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(Be.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(Be.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(Be.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n }\n message ").concat(Be.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(Be.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(Be.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(Be.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"),mn=function(){function t(t,e,n,r,i,o){this.runtime=t,this.rtcCodec=e,this._watcher=n,this._options=r,this.logger=i,this.statisticLog=o,this._appkey=this._options.appkey,this._rtcKVManager=new Ze(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 u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(u){switch(u.label){case 0:return e=this.rtcCodec.encode(Be.RtcPullKV,{timestamp:0,roomId:t}),[4,this.rtcSignaling(t,gn,!0,e)];case 1:return n=u.sent(),r=n.code,i=n.buffer,r!==V.SUCCESS?[2,{code:r}]:(o=this.rtcCodec.decode(Be.RtcKVOutput,i),s=o.entries,a=o.syncTime,s=(s||[]).map((function(t){return c(c({},t),{timestamp:me(t.timestamp)})})),this._watcher.onRTCDataChange(s,t),[2,{code:r,data:{kvEntries:s,syncTime:me(a)}}])}}))}))},t.prototype._receiveRtcKv=function(t){if(this._rtcSignalingListener)this._rtcSignalingListener(t);else{var e=this.rtcCodec.decode(Be.RtcNotifyMsg,t),n=e.time,r=e.type,i=e.roomId;1===r&&this._rtcKVManager.pullEntry(i,me(n))}},t.prototype.destroy=function(){},t}();function Rn(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,r,o;return e?(o=(t>>>=0)>=0&&t<256)&&(r=c[t])?r:(n=i(t,(0|t)<0?-1:0,!0),o&&(c[t]=n),n):(o=(t|=0)>=-128&&t<128)&&(r=a[t])?r:(n=i(t,t<0?-1:0,!1),o&&(a[t]=n),n)}function r(t,e){if(isNaN(t)||!isFinite(t))return e?f:g;if(e){if(t<0)return f;if(t>=h)return v}else{if(-d>=t)return I;if(t+1>=d)return C}return t<0?r(-t,e).neg():i(0|t%l,0|t/l,e)}function i(e,n,r){return new t(e,n,r)}function o(t,e,n){var i,s,a,c,l,h,d;if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return g;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||n>36)throw RangeError("radix");if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return o(t.substring(1),e,n).neg();for(s=r(u(n,8)),a=g,c=0;c<t.length;c+=8)l=Math.min(8,t.length-c),h=parseInt(t.substring(c,c+l),n),l<8?(d=r(u(n,l)),a=a.mul(d).add(r(h))):a=(a=a.mul(s)).add(r(h));return a.unsigned=e,a}function s(e){return e instanceof t?e:"number"==typeof e?r(e):"string"==typeof e?o(e):i(e.low,e.high,e.unsigned)}var a,c,u,l,h,d,p,g,f,_,E,T,C,v,I,y;return t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),t.isLong=e,a={},c={},t.fromInt=n,t.fromNumber=r,t.fromBits=i,u=Math.pow,t.fromString=o,t.fromValue=s,65536,1<<24,d=(h=(l=4294967296)*l)/2,p=n(16777216),g=n(0),t.ZERO=g,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,C=i(-1,2147483647,!1),t.MAX_VALUE=C,v=i(-1,-1,!0),t.MAX_UNSIGNED_VALUE=v,I=i(0,-2147483648,!1),t.MIN_VALUE=I,(y=t.prototype).toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},y.toString=function(t){var e,n,i,o,s,a,c,l;if((t=t||10)<2||t>36)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())return this.eq(I)?(e=r(t),i=(n=this.div(e)).mul(e).sub(this),n.toString(t)+i.toInt().toString(t)):"-"+this.neg().toString(t);for(o=r(u(t,6),this.unsigned),s=this,a="";;){if(c=s.div(o),l=(s.sub(c.mul(o)).toInt()>>>0).toString(t),(s=c).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){var t,e;if(this.isNegative())return this.eq(I)?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},y.isZero=function(){return 0===this.high&&0===this.low},y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return 1==(1&this.low)},y.isEven=function(){return 0==(1&this.low)},y.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)},y.eq=y.equals,y.notEquals=function(t){return!this.eq(t)},y.neq=y.notEquals,y.lessThan=function(t){return this.comp(t)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(t){return this.comp(t)<=0},y.lte=y.lessThanOrEqual,y.greaterThan=function(t){return this.comp(t)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(t){return this.comp(t)>=0},y.gte=y.greaterThanOrEqual,y.compare=function(t){if(e(t)||(t=s(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?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},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(I)?I:this.not().add(_)},y.neg=y.negate,y.add=function(t){var n,r,o,a,c,u,l,h,d,p,g;return e(t)||(t=s(t)),n=this.high>>>16,r=65535&this.high,o=this.low>>>16,a=65535&this.low,c=t.high>>>16,u=65535&t.high,l=t.low>>>16,h=0,d=0,p=0,g=0,p+=(g+=a+(65535&t.low))>>>16,d+=(p+=o+l)>>>16,h+=(d+=r+u)>>>16,h+=n+c,i((p&=65535)<<16|(g&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},y.subtract=function(t){return e(t)||(t=s(t)),this.add(t.neg())},y.sub=y.subtract,y.multiply=function(t){var n,o,a,c,u,l,h,d,f,_,E,T;return this.isZero()?g:(e(t)||(t=s(t)),t.isZero()?g:this.eq(I)?t.isOdd()?I:g:t.eq(I)?this.isOdd()?I:g:this.isNegative()?t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg():t.isNegative()?this.mul(t.neg()).neg():this.lt(p)&&t.lt(p)?r(this.toNumber()*t.toNumber(),this.unsigned):(n=this.high>>>16,o=65535&this.high,a=this.low>>>16,c=65535&this.low,u=t.high>>>16,l=65535&t.high,h=t.low>>>16,f=0,_=0,E=0,T=0,E+=(T+=c*(d=65535&t.low))>>>16,_+=(E+=a*d)>>>16,E&=65535,_+=(E+=c*h)>>>16,f+=(_+=o*d)>>>16,_&=65535,f+=(_+=a*h)>>>16,_&=65535,f+=(_+=c*l)>>>16,f+=n*d+o*h+a*l+c*u,i((E&=65535)<<16|(T&=65535),(f&=65535)<<16|(_&=65535),this.unsigned)))},y.mul=y.multiply,y.divide=function(t){var n,i,o,a,c,l,h;if(e(t)||(t=s(t)),t.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?f:g;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(I))return t.eq(_)||t.eq(T)?I:t.eq(I)?_:(n=this.shr(1).div(t).shl(1)).eq(g)?t.isNegative()?_:T:(i=this.sub(t.mul(n)),o=n.add(i.div(t)));if(t.eq(I))return this.unsigned?f:g;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=g}for(i=this;i.gte(t);){for(n=Math.max(1,Math.floor(i.toNumber()/t.toNumber())),c=(a=Math.ceil(Math.log(n)/Math.LN2))<=48?1:u(2,a-48),h=(l=r(n)).mul(t);h.isNegative()||h.gt(i);)h=(l=r(n-=c,this.unsigned)).mul(t);l.isZero()&&(l=_),o=o.add(l),i=i.sub(h)}return o},y.div=y.divide,y.modulo=function(t){return e(t)||(t=s(t)),this.sub(this.div(t).mul(t))},y.mod=y.modulo,y.not=function(){return i(~this.low,~this.high,this.unsigned)},y.and=function(t){return e(t)||(t=s(t)),i(this.low&t.low,this.high&t.high,this.unsigned)},y.or=function(t){return e(t)||(t=s(t)),i(this.low|t.low,this.high|t.high,this.unsigned)},y.xor=function(t){return e(t)||(t=s(t)),i(this.low^t.low,this.high^t.high,this.unsigned)},y.shiftLeft=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?i(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):i(0,this.low<<t-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(t){return e(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?i(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):i(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(t){var n;return e(t)&&(t=t.toInt()),0===(t&=63)?this:(n=this.high,t<32?i(this.low>>>t|n<<32-t,n>>>t,this.unsigned):i(32===t?n:n>>>t-32,0,this.unsigned))},y.shru=y.shiftRightUnsigned,y.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},y.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},y.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]},y.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 r(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,o=p&(1<<-l)-1,p>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)}function i(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?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*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=g,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=g,s/=256,u-=8);t[n+p-g]|=128*f}var o,s,a,c,u,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,r){var i,o,s,a,c,u;for(("boolean"==typeof e||"string"!=typeof e)&&(r=n,n=e,e=void 0),i=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&&(i+=o);if(0===i)return new l(0,n,r);for(u=new l(i,n,r),s=0;a>s;)(o=(c=t[s++]).limit-c.offset)<=0||(u.view.set(c.view.subarray(c.offset,c.limit),u.offset),u.offset+=o);return u.limit=u.offset,u.offset=0,u},l.isByteBuffer=function(t){return!0===(t&&t.__isByteBuffer__)},l.type=function(){return ArrayBuffer},l.wrap=function(t,e,n,r){var i,s;if("string"!=typeof e&&(r=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(i=o.clone.call(t)).markedOffset=-1,i;if(t instanceof Uint8Array)i=new l(0,n,r),t.length>0&&(i.buffer=t.buffer,i.offset=t.byteOffset,i.limit=t.byteOffset+t.byteLength,i.view=new Uint8Array(t.buffer));else if(t instanceof ArrayBuffer)i=new l(0,n,r),t.byteLength>0&&(i.buffer=t,i.offset=0,i.limit=t.byteLength,i.view=t.byteLength>0?new Uint8Array(t):null);else{if("[object Array]"!==Object.prototype.toString.call(t))throw TypeError("Illegal buffer");for((i=new l(t.length,n,r)).limit=t.length,s=0;s<t.length;++s)i.view[s]=t[s]}return i},o.writeBitSet=function(t,e){var n,r,i,o,s,a,c=void 0===e;if(c&&(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(r=e,o=(i=t.length)>>3,s=0,e+=this.writeVarint32(i,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(i>s){for(a=0,n=0;i>s;)n|=(1&!!t[s++])<<a++;this.writeByte(n,e++)}return c?(this.offset=e,this):e-r},o.readBitSet=function(t){var e,n,r,i,o,s,a,c=void 0===t;for(c&&(t=this.offset),i=(r=(n=this.readVarint32(t)).value)>>3,o=0,s=[],t+=n.length;i--;)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(r>o)for(a=0,e=this.readByte(t++);r>o;)s[o++]=!!(1&e>>a++);return c&&(this.offset=t),s},o.readBytes=function(t,e){var n,r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+"+t+") <= "+this.buffer.byteLength)}return n=this.slice(e,e+t),r&&(this.offset+=t),n},o.writeBytes=o.append,o.writeInt8=function(t,e){var n,r=void 0===e;if(r&&(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,r&&(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,r=void 0===e;if(r&&(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,r&&(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,r=void 0===e;if(r&&(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),r&&(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,r=void 0===e;if(r&&(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),r&&(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,r=void 0===e;if(r&&(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),r&&(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,r=void 0===e;if(r&&(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),r&&(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 r,i,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)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=e.low,o=e.high,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,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&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeLong=o.writeInt64,o.readInt64=function(e){var n,r,i,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,r=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,r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=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),i=new t(n,r,!1),o&&(this.offset+=8),i},o.readLong=o.readInt64,o.writeUint64=function(e,n){var r,i,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)>(r=this.buffer.byteLength)&&this.resize((r*=2)>n?r:n),n-=8,i=e.low,o=e.high,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,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&i>>>24,this.view[n+1]=255&i>>>16,this.view[n+2]=255&i>>>8,this.view[n+3]=255&i),s&&(this.offset+=8),this},o.writeUInt64=o.writeUint64,o.readUint64=function(e){var n,r,i,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,r=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,r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=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),i=new t(n,r,!0),o&&(this.offset+=8),i},o.readUInt64=o.readUint64),o.writeFloat32=function(t,e){var n,r=void 0===e;if(r&&(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,i(this.view,t,e,this.littleEndian,23,4),r&&(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=r(this.view,t,this.littleEndian,23,4),n&&(this.offset+=4),e},o.readFloat=o.readFloat32,o.writeFloat64=function(t,e){var n,r=void 0===e;if(r&&(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,i(this.view,t,e,this.littleEndian,52,8),r&&(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=r(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,r,i,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+=r=l.calculateVarint32(t))>(i=this.buffer.byteLength)&&this.resize((i*=2)>e?i:e),e-=r,t>>>=0;t>=128;)n=128|127&t,this.view[e++]=n,t>>>=7;return this.view[e++]=t,o?(this.offset=e,this):r},o.writeVarint32ZigZag=function(t,e){return this.writeVarint32(l.zigZagEncode32(t),e)},o.readVarint32=function(t){var e,n,r,i,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,r=0;do{if(!this.noAssert&&t>this.limit)throw(i=Error("Truncated")).truncated=!0,i;e=this.view[t++],n<5&&(r|=(127&e)<<7*n),++n}while(0!=(128&e));return r|=0,o?(this.offset=t,r):{value:r,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,r=e.shiftRightUnsigned(28).toInt()>>>0,i=e.shiftRightUnsigned(56).toInt()>>>0;return 0==i?0==r?n<16384?n<128?1:2:1<<21>n?3:4:r<16384?r<128?5:6:1<<21>r?7:8:i<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 r,i,o,s,a,c=void 0===n;if(c&&(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()),r=l.calculateVarint64(e),i=e.toInt()>>>0,o=e.shiftRightUnsigned(28).toInt()>>>0,s=e.shiftRightUnsigned(56).toInt()>>>0,(n+=r)>(a=this.buffer.byteLength)&&this.resize((a*=2)>n?a:n),n-=r,r){case 10:this.view[n+9]=1&s>>>7;case 9:this.view[n+8]=9!==r?128|s:127&s;case 8:this.view[n+7]=8!==r?128|o>>>21:127&o>>>21;case 7:this.view[n+6]=7!==r?128|o>>>14:127&o>>>14;case 6:this.view[n+5]=6!==r?128|o>>>7:127&o>>>7;case 5:this.view[n+4]=5!==r?128|o:127&o;case 4:this.view[n+3]=4!==r?128|i>>>21:127&i>>>21;case 3:this.view[n+2]=3!==r?128|i>>>14:127&i>>>14;case 2:this.view[n+1]=2!==r?128|i>>>7:127&i>>>7;case 1:this.view[n]=1!==r?128|i:127&i}return c?(this.offset+=r,this):r},o.writeVarint64ZigZag=function(t,e){return this.writeVarint64(l.zigZagEncode64(t),e)},o.readVarint64=function(e){var n,r,i,o,s,a,c=void 0===e;if(c&&(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,r=0,i=0,o=0,s=0,r=127&(s=this.view[e++]),128&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)&&(i=127&(s=this.view[e++]),(128&s||this.noAssert&&void 0===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)&&(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(r|i<<28,i>>>4|o<<24,!1),c?(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 r,i,o,s=void 0===n;if(s&&(n=this.offset),i=t.length,!this.noAssert){if("string"!=typeof t)throw TypeError("Illegal str: Not a string");for(r=0;i>r;++r)if(0===t.charCodeAt(r))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 i=u.calculateUTF16asUTF8(e(t))[1],n+=i+1,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=i+1,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),this.view[n++]=0,s?(this.offset=n,this):i},o.readCString=function(t){var e,r,i,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,i=-1,u.decodeUTF8toUTF16(function(){if(0===i)return null;if(t>=this.limit)throw RangeError("Illegal range: Truncated data, "+t+" < "+this.limit);return 0===(i=this.view[t++])?null:i}.bind(this),r=n(),!0),o?(this.offset=t,r()):{string:r(),length:t-e}},o.writeIString=function(t,n){var r,i,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(i=n,r=u.calculateUTF16asUTF8(e(t),this.noAssert)[1],n+=4+r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=4+r,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):(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),n+=4,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==i+4+r)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+4+r));return s?(this.offset=n,this):n-i},o.readIString=function(t){var e,n,r,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+4) <= "+this.buffer.byteLength)}return e=t,n=this.readUint32(t),r=this.readUTF8String(n,l.METRICS_BYTES,t+=4),t+=r.length,i?(this.offset=t,r.string):{string:r.string,length:t-e}},l.METRICS_CHARS="c",l.METRICS_BYTES="b",o.writeUTF8String=function(t,n){var r,i,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 i=n,r=u.calculateUTF16asUTF8(e(t))[1],n+=r,o=this.buffer.byteLength,n>o&&this.resize((o*=2)>n?o:n),n-=r,u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),s?(this.offset=n,this):n-i},o.writeString=o.writeUTF8String,l.calculateUTF8Chars=function(t){return u.calculateUTF16asUTF8(e(t))[0]},l.calculateUTF8Bytes=function(t){return u.calculateUTF16asUTF8(e(t))[1]},l.calculateString=l.calculateUTF8Bytes,o.readUTF8String=function(t,e,r){var i,o,s,a,c;if("number"==typeof e&&(r=e,e=void 0),(i=void 0===r)&&(r=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 r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}if(s=0,a=r,e===l.METRICS_CHARS){if(o=n(),u.decodeUTF8(function(){return t>s&&r<this.limit?this.view[r++]:null}.bind(this),(function(t){++s,u.UTF8toUTF16(t,o)})),s!==t)throw RangeError("Illegal range: Truncated data, "+s+" == "+t);return i?(this.offset=r,o()):{string:o(),length:r-a}}if(e===l.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+t>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+"+t+") <= "+this.buffer.byteLength)}if(c=r+t,u.decodeUTF8toUTF16(function(){return c>r?this.view[r++]:null}.bind(this),o=n(),this.noAssert),r!==c)throw RangeError("Illegal range: Truncated data, "+r+" == "+c);return i?(this.offset=r,o()):{string:o(),length:r-a}}throw TypeError("Unsupported metrics: "+e)},o.readString=o.readUTF8String,o.writeVString=function(t,n){var r,i,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,r=u.calculateUTF16asUTF8(e(t),this.noAssert)[1],i=l.calculateVarint32(r),n+=i+r,s=this.buffer.byteLength,n>s&&this.resize((s*=2)>n?s:n),n-=i+r,n+=this.writeVarint32(r,n),u.encodeUTF16toUTF8(e(t),function(t){this.view[n++]=t}.bind(this)),n!==o+r+i)throw RangeError("Illegal range: Truncated data, "+n+" == "+(n+r+i));return a?(this.offset=n,this):n-o},o.readVString=function(t){var e,n,r,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}return e=t,n=this.readVarint32(t),r=this.readUTF8String(n.value,l.METRICS_BYTES,t+=n.length),t+=r.length,i?(this.offset=t,r.string):{string:r.string,length:t-e}},o.append=function(t,e,n){var r,i,o;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=void 0),(r=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)),(i=t.limit-t.offset)<=0||((n+=i)>(o=this.buffer.byteLength)&&this.resize((o*=2)>n?o:n),n-=i,this.view.set(t.view.subarray(t.offset,t.limit),n),t.offset+=i,r&&(this.offset+=i)),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,r,i;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):(r=new ArrayBuffer(n),(i=new Uint8Array(r)).set(this.view.subarray(t,e)),this.buffer=r,this.view=i,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,r=new l(n,this.littleEndian,this.noAssert);return r.offset=0,r.limit=n,r.markedOffset>=0&&(r.markedOffset-=t),this.copyTo(r,0,t,e),r},o.copyTo=function(t,e,n,r){var i,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=(i=void 0===n)?this.offset:0|n,r=void 0===r?this.limit:0|r,e<0||e>t.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+e+" <= "+t.buffer.byteLength);if(n<0||r>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+n+" <= "+this.buffer.byteLength);return 0===(s=r-n)?t:(t.ensureCapacity(e+s),t.view.set(this.view.subarray(n,r),e),i&&(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 r=void 0===e;if(r&&(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 r&&(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 r,i,o,s,a;if(("number"==typeof e||"string"!=typeof e)&&(n=e,e=void 0),(r=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)),(i=t.limit-t.offset)<=0||((o=i-n)>0?(s=new ArrayBuffer(this.buffer.byteLength+o),(a=new Uint8Array(s)).set(this.view.subarray(n,this.buffer.byteLength),i),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-i),t.offset=t.limit,r&&(this.offset-=i)),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,r=this.limit;if(!this.noAssert){if("number"!=typeof n||n%1!=0)throw TypeError("Illegal offset: Not an integer");if(n>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,n<0||n>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+n+" <= "+r+" <= "+this.buffer.byteLength)}return t||0!==n||r!==this.buffer.byteLength?n===r?s:(e=new ArrayBuffer(r-n),new Uint8Array(e).set(new Uint8Array(this.buffer).subarray(n,r),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)}},c=function(){var t,e,n={},r=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],i=[];for(t=0,e=r.length;e>t;++t)i[r[t]]=t;return n.encode=function(t,e){for(var n,i;null!==(n=t());)e(r[63&n>>2]),i=(3&n)<<4,null!==(n=t())?(e(r[63&((i|=15&n>>4)|15&n>>4)]),i=(15&n)<<2,null!==(n=t())?(e(r[63&(i|3&n>>6)]),e(r[63&n])):(e(r[63&i]),e(61))):(e(r[63&i]),e(61),e(61))},n.decode=function(t,e){function n(t){throw Error("Illegal character code: "+t)}for(var r,o,s;null!==(r=t());)if(void 0===(o=i[r])&&n(r),null!==(r=t())&&(void 0===(s=i[r])&&n(r),e(o<<2>>>0|(48&s)>>4),null!==(r=t()))){if(void 0===(o=i[r])){if(61===r)break;n(r)}if(e((15&s)<<4>>>0|(60&o)>>2),null!==(r=t())){if(void 0===(s=i[r])){if(61===r)break;n(r)}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 r;return c.encode(function(){return e>t?this.view[t++]:null}.bind(this),r=n()),r()},l.fromBase64=function(t,n){if("string"!=typeof t)throw TypeError("str");var r=new l(t.length/4*3,n),i=0;return c.decode(e(t),(function(t){r.view[i++]=t})),r.limit=i,r},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=[],r=[];e>t;)n.push(this.view[t++]),n.length>=1024&&(r.push(String.fromCharCode.apply(String,n)),n=[]);return r.join("")+String.fromCharCode.apply(String,n)},l.fromBinary=function(t,e){if("string"!=typeof t)throw TypeError("str");for(var n,r=0,i=t.length,o=new l(i,e);i>r;){if((n=t.charCodeAt(r))>255)throw RangeError("illegal char code: "+n);o.view[r++]=n}return o.limit=i,o},o.toDebug=function(t){for(var e,n=-1,r=this.buffer.byteLength,i="",o="",s="";r>n;){if(-1!==n&&(i+=(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!==r){for(;i.length<51;)i+=" ";s+=i+o+"\n",i=o=""}i+=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!==r?" ":""}if(t&&" "!==i){for(;i.length<51;)i+=" ";s+=i+o+"\n"}return t?s:i},l.fromDebug=function(t,e,n){for(var r,i,o=t.length,s=new l(0|(o+1)/3,e,n),a=0,c=0,u=!1,h=!1,d=!1,p=!1,g=!1;o>a;){switch(r=t.charAt(a++)){case"!":if(!n){if(h||d||p){g=!0;break}h=d=p=!0}s.offset=s.markedOffset=s.limit=c,u=!1;break;case"|":if(!n){if(h||p){g=!0;break}h=p=!0}s.offset=s.limit=c,u=!1;break;case"[":if(!n){if(h||d){g=!0;break}h=d=!0}s.offset=s.markedOffset=c,u=!1;break;case"<":if(!n){if(h){g=!0;break}h=!0}s.offset=c,u=!1;break;case"]":if(!n){if(p||d){g=!0;break}p=d=!0}s.limit=s.markedOffset=c,u=!1;break;case">":if(!n){if(p){g=!0;break}p=!0}s.limit=c,u=!1;break;case"'":if(!n){if(d){g=!0;break}d=!0}s.markedOffset=c,u=!1;break;case" ":u=!1;break;default:if(!n&&u){g=!0;break}if(i=parseInt(r+t.charAt(a++),16),!n&&(isNaN(i)||i<0||i>255))throw TypeError("Illegal str: Not a debug encoded string");s.view[c++]=i,u=!0}if(g)throw TypeError("Illegal str: Invalid symbol at "+a)}if(!n){if(!h||!p)throw TypeError("Illegal str: Missing offset or limit");if(c<s.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+c+" < "+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,r=new Array(e-t);e>t;)(n=this.view[t++])<16?r.push("0",n.toString(16)):r.push(n.toString(16));return r.join("")},l.fromHex=function(t,e,n){var r,i,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(i=t.length,o=new l(0|i/2,e),s=0,a=0;i>s;s+=2){if(r=parseInt(t.substring(s,s+2),16),!n&&(!isFinite(r)||r<0||r>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[a++]=r}return o.limit=a,o},u=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,r,i,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===(r=t())&&s([n,r]),e((31&n)<<6|63&r);else if(224==(240&n))(null===(r=t())||null===(i=t()))&&s([n,r,i]),e((15&n)<<12|(63&r)<<6|63&i);else{if(240!=(248&n))throw RangeError("Illegal starting byte: "+n);(null===(r=t())||null===(i=t())||null===(o=t()))&&s([n,r,i,o]),e((7&n)<<18|(63&r)<<12|(63&i)<<6|63&o)}},UTF16toUTF8:function(t,e){for(var n,r=null;null!==(n=null!==r?r:t());)n>=55296&&n<=57343&&null!==(r=t())&&r>=56320&&r<=57343?(e(1024*(n-55296)+r-56320+65536),r=null):e(n);null!==r&&e(r)},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,r=0;return t.UTF16toUTF8(e,(function(t){++n,r+=t<128?1:t<2048?2:t<65536?3:4})),[n,r]}};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 r;try{u.decodeUTF8toUTF16(function(){return e>t?this.view[t++]:null}.bind(this),r=n())}catch(n){if(t!==e)throw RangeError("Illegal range: Truncated data, "+t+" != "+e)}return r()},l.fromUTF8=function(t,n,r){if(!r&&"string"!=typeof t)throw TypeError("Illegal str: Not a string");var i=new l(u.calculateUTF16asUTF8(e(t),!0)[1],n,r),o=0;return u.encodeUTF16toUTF8(e(t),(function(t){i.view[o++]=t})),i.limit=o,i},l}(e),r=function(e,n){var r,i,o={};return o.ByteBuffer=e,o.c=e,r=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 r=t.XHR();if(r.open("GET",e,!!n),r.setRequestHeader("Accept","text/plain"),"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/plain"),!n)return r.send(null),200==r.status||0==r.status&&"string"==typeof r.responseText?r.responseText:null;if(r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0==r.status&&"string"==typeof r.responseText?n(r.responseText):n(null))},4==r.readyState)return;r.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 r=-1,i=1;if("-"==t.charAt(0)&&(i=-1,t=t.substring(1)),e.NUMBER_DEC.test(t))r=parseInt(t);else if(e.NUMBER_HEX.test(t))r=parseInt(t.substring(2),16);else{if(!e.NUMBER_OCT.test(t))throw Error("illegal id value: "+(i<0?"-":"")+t);r=parseInt(t.substring(1),8)}if(r=0|i*r,!n&&r<0)throw Error("illegal id value: "+(i<0?"-":"")+t);return r}function r(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 i(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={},c=function(t){this.source=t+"",this.index=0,this.line=1,this.stack=[],this._stringOpen=null},u=c.prototype;return u._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]},u.next=function(){var t,n,r,i,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(r=this.source.charAt(this.index));)if("\n"===r&&++this.line,++this.index===this.source.length)return null;if("/"===this.source.charAt(this.index))if(++this.index,"/"===this.source.charAt(this.index)){for(;"\n"!==this.source.charAt(++this.index);)if(this.index==this.source.length)return null;++this.index,++this.line,t=!0}else{if("*"!==(r=this.source.charAt(this.index)))return"/";do{if("\n"===r&&++this.line,++this.index===this.source.length)return null;n=r,r=this.source.charAt(this.index)}while("*"!==n||"/"!==r);++this.index,t=!0}}while(t);if(this.index===this.source.length)return null;if(i=this.index,e.DELIM.lastIndex=0,!e.DELIM.test(this.source.charAt(i++)))for(;i<this.source.length&&!e.DELIM.test(this.source.charAt(i));)++i;return('"'===(o=this.source.substring(this.index,this.index=i))||"'"===o)&&(this._stringOpen=o),o},u.peek=function(){if(0===this.stack.length){var t=this.next();if(null===t)return null;this.stack.push(t)}return this.stack[0]},u.skip=function(t){var e=this.next();if(e!==t)throw Error("illegal '"+e+"', '"+t+"' expected")},u.omit=function(t){return this.peek()===t&&(this.next(),!0)},u.toString=function(){return"Tokenizer ("+this.index+"/"+this.source.length+" at line "+this.line+")"},a.Tokenizer=c,o=function(t){this.tn=new c(t),this.proto3=!1},(s=o.prototype).parse=function(){var t,n={name:"[ROOT]",package:null,messages:[],enums:[],imports:[],options:{},services:[]},r=!0;try{for(;t=this.tn.next();)switch(t){case"package":if(!r||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(!r)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(!r)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),r=!1;break;case"enum":this._parseEnum(n),r=!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 r(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 r,i=this.tn.next(),o=!1;if("("===i&&(o=!0,i=this.tn.next()),!e.TYPEREF.test(i))throw Error("illegal option name: "+i);r=i,o&&(this.tn.skip(")"),r="("+r+")",i=this.tn.peek(),e.FQTYPEREF.test(i)&&(r+=i,this.tn.next())),this.tn.skip("="),this._parseOptionValue(t,r),n||this.tn.skip(";")},s._parseOptionValue=function(t,n){var r=this.tn.peek();if("{"!==r)i(t.options,n,this._readValue(!0));else for(this.tn.skip("{");"}"!==(r=this.tn.next());){if(!e.NAME.test(r))throw Error("illegal option name: "+n+"."+r);this.tn.omit(":")?i(t.options,n+"."+r,this._readValue(!0)):this._parseOptionValue(t,n+"."+r)}},s._parseService=function(t){var n,r=this.tn.next();if(!e.NAME.test(r))throw Error("illegal service name at line "+this.tn.line+": "+r);for(n={name:r,rpc:{},options:{}},this.tn.skip("{");"}"!==(r=this.tn.next());)if("option"===r)this._parseOption(n);else{if("rpc"!==r)throw Error("illegal service token: "+r);this._parseServiceRPC(n)}this.tn.omit(";"),t.services.push(n)},s._parseServiceRPC=function(t){var n,r,i="rpc",o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal rpc service method name: "+o);if(n=o,r={request:null,response:null,request_stream:!1,response_stream:!1,options:{}},this.tn.skip("("),"stream"===(o=this.tn.next()).toLowerCase()&&(r.request_stream=!0,o=this.tn.next()),!e.TYPEREF.test(o))throw Error("illegal rpc service request type: "+o);if(r.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()&&(r.response_stream=!0,o=this.tn.next()),r.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(r)}this.tn.omit(";")}else this.tn.skip(";");void 0===t[i]&&(t[i]={}),t[i][n]=r},s._parseMessage=function(t,r){var i=!!r,o=this.tn.next(),s={name:"",fields:[],enums:[],messages:[],options:{},services:[],oneofs:{}};if(!e.NAME.test(o))throw Error("illegal "+(i?"group":"message")+" name: "+o);for(s.name=o,i&&(this.tn.skip("="),r.id=n(this.tn.next()),s.isGroup=!0),"["===(o=this.tn.peek())&&r&&this._parseFieldOptions(r),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,r,i){var o,s,a;if(!e.RULE.test(r))throw Error("illegal message field rule: "+r);if(o={rule:r,type:"",name:"",options:{},id:0},"map"===r){if(i)throw Error("illegal type: "+i);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"===(i=void 0!==i?i: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(i)&&!e.TYPEREF.test(i))throw Error("illegal message field type: "+i);if(o.type=i,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,r,i,o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal oneof name: "+o);for(r=o,i=[],this.tn.skip("{");"}"!==(o=this.tn.next());)(n=this._parseMessageField(t,"optional",o)).oneof=r,i.push(n.id);this.tn.omit(";"),t.oneofs[r]=i},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 r,i={name:"",values:[],options:{}},o=this.tn.next();if(!e.NAME.test(o))throw Error("illegal name: "+o);for(i.name=o,this.tn.skip("{");"}"!==(o=this.tn.next());)if("option"===o)this._parseOption(i);else{if(!e.NAME.test(o))throw Error("illegal name: "+o);this.tn.skip("="),r={name:o,id:n(this.tn.next(),!0)},"["===(o=this.tn.peek())&&this._parseFieldOptions({options:{}}),this.tn.skip(";"),i.values.push(r)}this.tn.omit(";"),t.enums.push(i)},s._parseExtensionRanges=function(){var e,n,i,o=[];do{for(n=[];;){switch(e=this.tn.next()){case"min":i=t.ID_MIN;break;case"max":i=t.ID_MAX;break;default:i=r(e)}if(n.push(i),2===n.length)break;if("to"!==this.tn.peek()){n.push(i);break}this.tn.next()}o.push(n)}while(this.tn.omit(","));return this.tn.skip(";"),o},s._parseExtend=function(t){var n,r=this.tn.next();if(!e.TYPEREF.test(r))throw Error("illegal extend reference: "+r);for(n={ref:r,fields:[]},this.tn.skip("{");"}"!==(r=this.tn.next());)if(e.RULE.test(r))this._parseMessageField(n,r);else{if(!e.TYPEREF.test(r))throw Error("illegal extend token: "+r);if(!this.proto3)throw Error("illegal field rule: "+r);this._parseMessageField(n,"optional",r)}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 i(e,n){var r=n.readVarint32(),o=7&r,s=r>>>3;switch(o){case t.WIRE_TYPES.VARINT:do{r=n.readUint8()}while(128==(128&r));break;case t.WIRE_TYPES.BITS64:n.offset+=8;break;case t.WIRE_TYPES.LDELIM:r=n.readVarint32(),n.offset+=r;break;case t.WIRE_TYPES.STARTGROUP:i(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,c,u,l,h,d,p,g,f,_,E,T,C,v,I={},y=function(t,e,n){this.builder=t,this.parent=e,this.name=n,this.className},m=y.prototype;return m.fqn=function(){for(var t=this.name,e=this;null!=(e=e.parent);)t=e.name+"."+t;return t},m.toString=function(t){return(t?this.className+" ":"")+this.fqn()},m.build=function(){throw Error(this.toString(!0)+" cannot be built directly")},I.T=y,o=function(t,e,n,r,i){y.call(this,t,e,n),this.className="Namespace",this.children=[],this.options=r||{},this.syntax=i||"proto2"},(s=o.prototype=Object.create(y.prototype)).getChildren=function(t){var e,n,r;if(null==(t=t||null))return this.children.slice();for(e=[],n=0,r=this.children.length;r>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 u.Field&&e.name!==e.originalName&&null===this.getChild(e.originalName))e.name=e.originalName;else{if(!(t instanceof u.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,r="number"==typeof t?"id":"name";for(e=0,n=this.children.length;n>e;++e)if(this.children[e][r]===t)return this.children[e];return null},s.resolve=function(t,e){var n,r="string"==typeof t?t.split("."):t,i=this,o=0;if(""===r[o]){for(;null!==i.parent;)i=i.parent;o++}do{do{if(!(i instanceof I.Namespace)){i=null;break}if(!((n=i.getChild(r[o]))&&n instanceof I.T&&(!e||n instanceof I.Namespace))){i=null;break}i=n,o++}while(o<r.length);if(null!=i)break;if(null!==this.parent)return this.parent.resolve(t,e)}while(null!=i);return i},s.qn=function(t){var e,n,r=[],i=t;do{r.unshift(i.name),i=i.parent}while(null!==i);for(e=1;e<=r.length;e++)if(n=r.slice(r.length-e),t===this.resolve(n,t instanceof I.Namespace))return n.join(".");return t.fqn()},s.build=function(){var t,e,n,r={},i=this.children;for(e=0,n=i.length;n>e;++e)(t=i[e])instanceof o&&(r[t.name]=t.build());return Object.defineProperty&&Object.defineProperty(r,"$options",{value:this.buildOpt()}),r},s.buildOpt=function(){var t,e,n,r,i={},o=Object.keys(this.options);for(t=0,e=o.length;e>t;++t)n=o[t],r=this.options[o[t]],i[n]=r;return i},s.getOption=function(t){return void 0===t?this.options:void 0!==this.options[t]?this.options[t]:null},I.Namespace=o,a=function(e,n,r,i){if(this.type=e,this.resolvedType=n,this.isMapKey=r,this.syntax=i,r&&t.MAP_KEY_TYPES.indexOf(e)<0)throw Error("Invalid map key type: "+e.name)},c=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 r(0):e.defaultValue},c.verifyValue=function(r){var i,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 r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r>4294967295?0|r:r;case t.TYPES.uint32:case t.TYPES.fixed32:return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),r<0?r>>>0:r;case t.TYPES.int64:case t.TYPES.sint64:case t.TYPES.sfixed64:if(t.Long)try{return n(r,!1)}catch(t){a(typeof r,t.message)}else a(typeof r,"requires Long.js");case t.TYPES.uint64:case t.TYPES.fixed64:if(t.Long)try{return n(r,!0)}catch(t){a(typeof r,t.message)}else a(typeof r,"requires Long.js");case t.TYPES.bool:return"boolean"!=typeof r&&a(typeof r,"not a boolean"),r;case t.TYPES.float:case t.TYPES.double:return"number"!=typeof r&&a(typeof r,"not a number"),r;case t.TYPES.string:return"string"==typeof r||r&&r instanceof String||a(typeof r,"not a string"),""+r;case t.TYPES.bytes:return e.isByteBuffer(r)?r:e.wrap(r);case t.TYPES.enum:for(i=this.resolvedType.getChildren(t.Reflect.Enum.Value),s=0;s<i.length;s++){if(i[s].name==r)return i[s].id;if(i[s].id==r)return i[s].id}if("proto3"===this.syntax)return("number"!=typeof r||r==r&&r%1!=0)&&a(typeof r,"not an integer"),(r>4294967295||r<0)&&a(typeof r,"not in range for uint32"),r;a(r,"not a valid enum value");case t.TYPES.group:case t.TYPES.message:if(r&&"object"==typeof r||a(typeof r,"object expected"),r instanceof this.resolvedType.clazz)return r;if(r instanceof t.Builder.Message){for(s in o={},r)r.hasOwnProperty(s)&&(o[s]=r[s]);r=o}return new this.resolvedType.clazz(r)}throw Error("[INTERNAL] Illegal value for "+this.toString(!0)+": "+r+" (undefined type "+this.type+")")},c.calculateLength=function(e,n){if(null===n)return 0;var i;switch(this.type){case t.TYPES.int32:return n<0?r.calculateVarint64(n):r.calculateVarint32(n);case t.TYPES.uint32:return r.calculateVarint32(n);case t.TYPES.sint32:return r.calculateVarint32(r.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 r.calculateVarint64(n);case t.TYPES.sint64:return r.calculateVarint64(r.zigZagEncode64(n));case t.TYPES.fixed64:case t.TYPES.sfixed64:return 8;case t.TYPES.bool:return 1;case t.TYPES.enum:return r.calculateVarint32(n);case t.TYPES.double:return 8;case t.TYPES.string:return i=r.calculateUTF8Bytes(n),r.calculateVarint32(i)+i;case t.TYPES.bytes:if(n.remaining()<0)throw Error("Illegal value for "+this.toString(!0)+": "+n.remaining()+" bytes remaining");return r.calculateVarint32(n.remaining())+n.remaining();case t.TYPES.message:return i=this.resolvedType.calculate(n),r.calculateVarint32(i)+i;case t.TYPES.group:return(i=this.resolvedType.calculate(n))+r.calculateVarint32(e<<3|t.WIRE_TYPES.ENDGROUP)}throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")},c.encodeValue=function(e,n,i){var o,s;if(null===n)return i;switch(this.type){case t.TYPES.int32:n<0?i.writeVarint64(n):i.writeVarint32(n);break;case t.TYPES.uint32:i.writeVarint32(n);break;case t.TYPES.sint32:i.writeVarint32ZigZag(n);break;case t.TYPES.fixed32:i.writeUint32(n);break;case t.TYPES.sfixed32:i.writeInt32(n);break;case t.TYPES.int64:case t.TYPES.uint64:i.writeVarint64(n);break;case t.TYPES.sint64:i.writeVarint64ZigZag(n);break;case t.TYPES.fixed64:i.writeUint64(n);break;case t.TYPES.sfixed64:i.writeInt64(n);break;case t.TYPES.bool:"string"==typeof n?i.writeVarint32("false"===n.toLowerCase()?0:!!n):i.writeVarint32(n?1:0);break;case t.TYPES.enum:i.writeVarint32(n);break;case t.TYPES.float:i.writeFloat32(n);break;case t.TYPES.double:i.writeFloat64(n);break;case t.TYPES.string:i.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,i.writeVarint32(n.remaining()),i.append(n),n.offset=o;break;case t.TYPES.message:s=(new r).LE(),this.resolvedType.encode(n,s),i.writeVarint32(s.offset),i.append(s.flip());break;case t.TYPES.group:this.resolvedType.encode(n,i),i.writeVarint32(e<<3|t.WIRE_TYPES.ENDGROUP);break;default:throw Error("[INTERNAL] Illegal value to encode in "+this.toString(!0)+": "+n+" (unknown type)")}return i},c.decode=function(e,n,r){if(n!=this.type.wireType)throw Error("Unexpected wire type for element");var i,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(i=e.clone()).limit=i.offset+o,e.offset+=o,i;case t.TYPES.message:return o=e.readVarint32(),this.resolvedType.decode(e,o);case t.TYPES.group:return this.resolvedType.decode(e,-1,r)}throw Error("[INTERNAL] Illegal decode type")},c.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 r.fromBinary(e)}},c.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()},I.Element=a,u=function(t,e,n,r,i,s){o.call(this,t,e,n,r,s),this.className="Message",this.extensions=void 0,this.clazz=null,this.isGroup=!!i,this._fields=null,this._fieldsById=null,this._fieldsByName=null},(l=u.prototype=Object.create(o.prototype)).build=function(n){var i,o,s,a;if(this.clazz&&!n)return this.clazz;for(i=function(t,n){function i(e,n,o,s){var a,c,u,l,h,d,p;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(r.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 c=[],e.forEach((function(t,e){c[e]=i(t,n,o,s)})),c;if(c={},e instanceof t.Map){for(l=(u=e.entries()).next();!l.done;l=u.next())c[e.keyElem.valueToString(l.value[0])]=i(l.value[1],n,o,e.valueElem.resolvedType);return c}for(p in h=e.$type,d=void 0,e)e.hasOwnProperty(p)&&(c[p]=h&&(d=h.getChild(p))?i(e[p],n,o,d.resolvedType):i(e[p],n,o));return c}var o,s,a=n.getChildren(t.Reflect.Message.Field),c=n.getChildren(t.Reflect.Message.OneOf),u=function(e){var i,o,s,l;for(t.Builder.Message.call(this),i=0,o=c.length;o>i;++i)this[c[i].name]=null;for(i=0,o=a.length;o>i;++i)this[(s=a[i]).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 u)||Array.isArray(e)||e instanceof t.Map||r.isByteBuffer(e)||e instanceof ArrayBuffer||t.Long&&e instanceof t.Long)for(i=0,o=arguments.length;o>i;++i)void 0!==(l=arguments[i])&&this.$set(a[i].name,l);else this.$set(e)},l=u.prototype=Object.create(t.Builder.Message.prototype);for(l.add=function(e,r,i){var o=n._fieldsByName[e];if(!i){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");r=o.verifyValue(r,!0)}return null===this[e]&&(this[e]=[]),this[e].push(r),this},l.$add=l.add,l.set=function(e,r,i){var o,s,a;if(e&&"object"==typeof e){for(o in i=r,e)e.hasOwnProperty(o)&&void 0!==(r=e[o])&&this.$set(o,r,i);return this}if(s=n._fieldsByName[e],i)this[e]=r;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]=r=s.verifyValue(r)}return s&&s.oneof&&(a=this[s.oneof.name],null!==r?(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,r){if(r)return this[e];var i=n._fieldsByName[e];if(!(i&&i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: undefined");if(!(i instanceof t.Reflect.Message.Field))throw Error(this+"#"+e+" is not a field: "+i.toString(!0));return this[i.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,r,i,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})),r=function(e,n){return this[t.name]=n?e:t.verifyValue(e),this},i=function(){return this[t.name]},null===n.getChild("set"+o)&&(l["set"+o]=r),null===n.getChild("set_"+e)&&(l["set_"+e]=r),null===n.getChild("get"+o)&&(l["get"+o]=i),null===n.getChild("get_"+e)&&(l["get_"+e]=i)}(s);return l.encode=function(t,r){var i,o;"boolean"==typeof t&&(r=t,t=void 0),i=!1,t||(t=new e,i=!0),o=t.littleEndian;try{return n.encode(this,t.LE(),r),(i?t.flip():t).LE(o)}catch(e){throw t.LE(o),e}},u.encode=function(t,e,n){return new u(t).encode(e,n)},l.calculate=function(){return n.calculate(this)},l.encodeDelimited=function(t){var e,i=!1;return t||(t=new r,i=!0),e=(new r).LE(),n.encode(this,e).flip(),t.writeVarint32(e.remaining()),t.append(e),i?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 i(this,!!t,!!e,this.$type)},l.encodeJSON=function(){return JSON.stringify(i(this,!0,!0,this.$type))},u.decode=function(t,e){var i,o;"string"==typeof t&&(t=r.wrap(t,e||"base64")),i=(t=r.isByteBuffer(t)?t:r.wrap(t)).littleEndian;try{return o=n.decode(t.LE()),t.LE(i),o}catch(e){throw t.LE(i),e}},u.decodeDelimited=function(t,e){var i,o,s;if("string"==typeof t&&(t=r.wrap(t,e||"base64")),(t=r.isByteBuffer(t)?t:r.wrap(t)).remaining()<1)return null;if(i=t.offset,o=t.readVarint32(),t.remaining()<o)return t.offset=i,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}},u.decode64=function(t){return u.decode(t,"base64")},u.decodeHex=function(t){return u.decode(t,"hex")},u.decodeJSON=function(t){return new u(JSON.parse(t))},l.toString=function(){return n.toString()},Object.defineProperty&&(Object.defineProperty(u,"$options",{value:n.buildOpt()}),Object.defineProperty(l,"$options",{value:u.$options}),Object.defineProperty(u,"$type",{value:n}),Object.defineProperty(l,"$type",{value:n})),u}(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 u||o instanceof T){if(i.hasOwnProperty(o.name))throw Error("Illegal reflect child of "+this.toString(!0)+": "+o.toString(!0)+" cannot override static property '"+o.name+"'");i[o.name]=o.build()}else if(o instanceof u.Field)o.build(),this._fields.push(o),this._fieldsById[o.id]=o,this._fieldsByName[o.name]=o;else if(!(o instanceof u.OneOf||o instanceof E))throw Error("Illegal reflect child of "+this.toString(!0)+": "+this.children[s].toString(!0));return this.clazz=i},l.encode=function(t,e,n){var r,i,o,s,a,c=null;for(o=0,s=this._fields.length;s>o;++o)i=t[(r=this._fields[o]).name],r.required&&null===i?null===c&&(c=r):r.encode(n?i:r.verifyValue(i),e,t);if(null!==c)throw(a=Error("Missing at least one required field for "+this.toString(!0)+": "+c)).encoded=e,a;return e},l.calculate=function(t){for(var e,n,r=0,i=0,o=this._fields.length;o>i;++i){if(n=t[(e=this._fields[i]).name],e.required&&null===n)throw Error("Missing at least one required field for "+this.toString(!0)+": "+e);r+=e.calculate(n,t)}return r},l.decode=function(e,n,r){var o,s,a,c,u,l,h,d,p,g,f,_;for(n="number"==typeof n?n:-1,u=e.offset,l=new this.clazz;e.offset<u+n||-1===n&&e.remaining()>0;){if(a=(o=e.readVarint32())>>>3,(s=7&o)===t.WIRE_TYPES.ENDGROUP){if(a!==r)throw Error("Illegal group end indicator for "+this.toString(!0)+": "+a+" ("+(r?r+" expected":"not a group")+")");break}if(c=this._fieldsById[a])c.repeated&&!c.options.packed?l[c.name].push(c.decode(s,e)):c.map?(d=c.decode(s,e),l[c.name].set(d[0],d[1])):(l[c.name]=c.decode(s,e),c.oneof&&(null!==(p=l[c.oneof.name])&&p!==c.name&&(l[p]=null),l[c.oneof.name]=c.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(;i(a,e););break;default:throw Error("Illegal wire type for unknown field "+a+" in "+this.toString(!0)+"#decode: "+s)}}for(g=0,f=this._fields.length;f>g;++g)if(null===l[(c=this._fields[g]).name])if("proto3"===this.syntax)l[c.name]=c.defaultValue;else{if(c.required)throw(_=Error("Missing at least one required field for "+this.toString(!0)+": "+c.name)).decoded=l,_;t.populateDefaults&&null!==c.defaultValue&&(l[c.name]=c.defaultValue)}return l},I.Message=u,h=function(e,n,r,i,o,s,a,c,l,h){y.call(this,e,n,s),this.className="Message.Field",this.required="required"===r,this.repeated="repeated"===r,this.map="map"===r,this.keyType=i||null,this.type=o,this.resolvedType=null,this.id=a,this.options=c||{},this.defaultValue=null,this.oneof=l||null,this.syntax=h||"proto2",this.originalName=this.name,this.element=null,this.keyElement=null,!this.builder.options.convertFieldsToCamelCase||this instanceof u.ExtensionField||(this.name=t.Util.toCamelCase(this.name))},(d=h.prototype=Object.create(y.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 r,i,o;if(n=n||!1,r=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&&r(typeof e,"required"),"proto3"===this.syntax&&this.type!==t.TYPES.message&&r(typeof e,"proto3 field without field presence cannot be null"),null;if(this.repeated&&!n){for(Array.isArray(e)||(e=[e]),o=[],i=0;i<e.length;i++)o.push(this.element.verifyValue(e[i]));return o}return this.map&&!n?e instanceof t.Map?e:(e instanceof Object||r(typeof e,"expected ProtoBuf.Map or raw object for map field"),new t.Map(this,e)):(!this.repeated&&Array.isArray(e)&&r(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,i){var o,s,a,c,u;if(null===this.type||"object"!=typeof this.type)throw Error("[INTERNAL] Unresolved type in "+this.toString(!0)+": "+this.type);if(null===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,(c=r.calculateVarint32(a))>1&&(u=n.slice(s,n.offset),s+=c-1,n.offset=s,n.append(u)),n.writeVarint32(a,s-c)}else for(o=0;o<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,i){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,i)+r.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,i,n),n.writeVarint32(16|this.type.wireType),this.element.encodeValue(2,e,n)}),this):this.hasWirePresence(e,i)&&(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 i,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;i=0;try{if(this.repeated)if(this.options.packed&&t.PACKABLE_WIRE_TYPES.indexOf(this.type.wireType)>=0){for(i+=r.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),s=0,o=0;o<e.length;o++)s+=this.element.calculateLength(this.id,e[o]);i+=r.calculateVarint32(s),i+=s}else for(o=0;o<e.length;o++)i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e[o]);else this.map?e.forEach((function(e,n){var o=r.calculateVarint32(8|this.keyType.wireType)+this.keyElement.calculateLength(1,n)+r.calculateVarint32(16|this.type.wireType)+this.element.calculateLength(2,e);i+=r.calculateVarint32(this.id<<3|t.WIRE_TYPES.LDELIM),i+=r.calculateVarint32(o),i+=o}),this):this.hasWirePresence(e,n)&&(i+=r.calculateVarint32(this.id<<3|this.type.wireType),i+=this.element.calculateLength(this.id,e))}catch(t){throw Error("Illegal value for "+this.toString(!0)+": "+e+" ("+t+")")}return i},d.decode=function(e,n,r){var i,o,s,c,u,l,h;if(!(!this.map&&e==this.type.wireType||!r&&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&&!r){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(c=a.defaultFieldValue(this.keyType),i=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((u=n.clone()).limit=u.offset+o,n.offset+=o;u.remaining()>0;)if(e=7&(l=u.readVarint32()),1===(h=l>>>3))c=this.keyElement.decode(u,e,h);else{if(2!==h)throw Error("Unexpected tag in map field key/value submessage");i=this.element.decode(u,e,h)}return[c,i]}return this.element.decode(n,e,this.id)},I.Message.Field=h,p=function(t,e,n,r,i,o,s){h.call(this,t,e,n,null,r,i,o,s),this.extension},p.prototype=Object.create(h.prototype),I.Message.ExtensionField=p,g=function(t,e,n){y.call(this,t,e,n),this.fields=[]},I.Message.OneOf=g,f=function(t,e,n,r,i){o.call(this,t,e,n,r,i),this.className="Enum",this.object=null},f.getName=function(t,e){var n,r,i=Object.keys(t);for(r=0;r<i.length;++r)if(t[n=i[r]]===e)return n;return null},(f.prototype=Object.create(o.prototype)).build=function(e){var n,r,i,o;if(this.object&&!e)return this.object;for(n=new t.Builder.Enum,i=0,o=(r=this.getChildren(f.Value)).length;o>i;++i)n[r[i].name]=r[i].id;return Object.defineProperty&&Object.defineProperty(n,"$options",{value:this.buildOpt(),enumerable:!1}),this.object=n},I.Enum=f,_=function(t,e,n,r){y.call(this,t,e,n),this.className="Enum.Value",this.id=r},_.prototype=Object.create(y.prototype),I.Enum.Value=_,E=function(t,e,n,r){y.call(this,t,e,n),this.field=r},E.prototype=Object.create(y.prototype),I.Extension=E,T=function(t,e,n,r){o.call(this,t,e,n,r),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,i=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=i.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,i){try{try{n=t.resolvedRequestType.clazz.decode(r.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,r){if(!n){try{r=t.resolvedResponseType.clazz.decode(r)}catch(t){}return r&&r instanceof t.resolvedResponseType.clazz?void i(null,r):void i(Error("Illegal response type received in service method "+e.name+"#"+t.name))}i(n)}))}catch(t){setTimeout(i.bind(this,t),0)}},i[t.name]=function(e,n,r){new i(e)[t.name](n,r)},Object.defineProperty&&(Object.defineProperty(i[t.name],"$options",{value:t.buildOpt()}),Object.defineProperty(o[t.name],"$options",{value:i[t.name].$options}))}(s[n]);return Object.defineProperty&&(Object.defineProperty(i,"$options",{value:e.buildOpt()}),Object.defineProperty(o,"$options",{value:i.$options}),Object.defineProperty(i,"$type",{value:e}),Object.defineProperty(o,"$type",{value:e})),i}(t,this)},I.Service=T,C=function(t,e,n,r){y.call(this,t,e,n),this.className="Service.Method",this.options=r||{}},(C.prototype=Object.create(y.prototype)).buildOpt=s.buildOpt,I.Service.Method=C,v=function(t,e,n,r,i,o,s,a){C.call(this,t,e,n,a),this.className="Service.RPCMethod",this.requestName=r,this.responseName=i,this.requestStream=o,this.responseStream=s,this.resolvedRequestType=null,this.resolvedResponseType=null},v.prototype=Object.create(C.prototype),I.Service.RPCMethod=v,I}(o),o.Builder=function(t,e,n){function r(t){t.messages&&t.messages.forEach((function(e){e.syntax=t.syntax,r(e)})),t.enums&&t.enums.forEach((function(e){e.syntax=t.syntax}))}var i=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=i.prototype;return i.isMessage=function(t){return"string"==typeof t.name&&(void 0===t.values&&void 0===t.rpc)},i.isMessageField=function(t){return"string"==typeof t.rule&&"string"==typeof t.name&&"string"==typeof t.type&&void 0!==t.id},i.isEnum=function(t){return"string"==typeof t.name&&!(void 0===t.values||!Array.isArray(t.values)||0===t.values.length)},i.isService=function(t){return!("string"!=typeof t.name||"object"!=typeof t.rpc||!t.rpc)},i.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 r,o,s,a,c;if(!e)return this;if(Array.isArray(e)){if(0===e.length)return this;e=e.slice()}else e=[e];for(r=[e];r.length>0;){if(e=r.pop(),!Array.isArray(e))throw Error("not a valid namespace: "+JSON.stringify(e));for(;e.length>0;){if(o=e.shift(),i.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),c=[],o.enums&&o.enums.forEach((function(t){c.push(t)})),o.messages&&o.messages.forEach((function(t){c.push(t)})),o.services&&o.services.forEach((function(t){c.push(t)})),o.extensions&&(s.extensions="number"==typeof o.extensions[0]?[o.extensions]:o.extensions),this.ptr.addChild(s),c.length>0){r.push(e),e=c,c=null,this.ptr=s,s=null;continue}c=null}else if(i.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(i.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(!i.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 r,i,o,a;if(null!==s.getChild(0|e.id))throw Error("duplicate extended field id in "+s.name+": "+e.id);if(s.extensions&&(r=!1,s.extensions.forEach((function(t){e.id>=t[0]&&e.id<=t[1]&&(r=!0)})),!r))throw Error("illegal extended field id in "+s.name+": "+e.id+" (not within valid ranges)");i=e.name,this.options.convertFieldsToCamelCase&&(i=t.Util.toCamelCase(i)),o=new n.Message.ExtensionField(this,s,e.rule,e.type,this.ptr.fqn()+"."+i,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 i,o,s,a,c,u,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(i=n.root,t.Util.IS_NODE,(i.indexOf("\\")>=0||n.file.indexOf("\\")>=0)&&(d="\\"),o=i+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,c=0;c<e.imports.length;c++)if("string"==typeof e.imports[c]){if(!s)throw Error("cannot determine import root");if("google/protobuf/descriptor.proto"===(u=e.imports[c]))continue;if(u=s+d+u,!0===this.files[u])continue;if(/\.proto$/i.test(u)&&!t.DotProto&&(u=u.replace(/\.proto$/,".json")),null===(l=t.Util.fetch(u)))throw Error("failed to import '"+u+"' in '"+n+"': file not found");/\.json$/i.test(u)?this.import(JSON.parse(l+""),u):this.import(t.DotProto.Parser.parse(l),u)}else n?/\.(\w+)$/.test(n)?this.import(e.imports[c],n.replace(/^(.+)\.(\w+)$/,(function(t,e,n){return e+"_import"+c+"."+n}))):this.import(e.imports[c],n+"_import"+c):this.import(e.imports[c]);a&&(this.importRoot=null)}return e.package&&this.define(e.package),e.syntax&&r(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 r;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(!(r=(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=r,r instanceof n.Enum){if(this.ptr.type=t.TYPES.enum,"proto3"===this.ptr.syntax&&"proto3"!==r.syntax)throw Error("proto3 message cannot reference proto2 enum")}else{if(!(r instanceof n.Message))throw Error("illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.type);this.ptr.type=r.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(!((r=this.ptr.parent.resolve(this.ptr.requestName,!0))&&r instanceof t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.requestName);if(this.ptr.resolvedRequestType=r,!((r=this.ptr.parent.resolve(this.ptr.responseName,!0))&&r instanceof t.Reflect.Message))throw Error("Illegal type reference in "+this.ptr.toString(!0)+": "+this.ptr.responseName);this.ptr.resolvedResponseType=r}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,r;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,r=0;r<e.length;r++){if(!n[e[r]]){n=null;break}n=n[e[r]]}return n},o.lookup=function(t,e){return t?this.ns.resolve(t,e):this.ns},o.toString=function(){return"Builder"},i.Message=function(){},i.Enum=function(){},i.Service=function(){},i}(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 r=function(t,n){var r,i,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(r=Object.keys(n),i=0;i<r.length;i++)o=this.keyElem.valueFromString(r[i]),s=this.valueElem.verifyValue(n[r[i]]),this.map[this.keyElem.valueToString(o)]={key:o,value:s}},i=r.prototype;return i.clear=function(){this.map={}},i.delete=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t)),n=e in this.map;return delete this.map[e],n},i.entries=function(){var t,e,r=[],i=Object.keys(this.map);for(e=0;e<i.length;e++)r.push([(t=this.map[i[e]]).key,t.value]);return n(r)},i.keys=function(){var t,e=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)e.push(this.map[r[t]].key);return n(e)},i.values=function(){var t,e=[],r=Object.keys(this.map);for(t=0;t<r.length;t++)e.push(this.map[r[t]].value);return n(e)},i.forEach=function(t,e){var n,r,i=Object.keys(this.map);for(r=0;r<i.length;r++)t.call(e,(n=this.map[i[r]]).value,n.key,this)},i.set=function(t,e){var n=this.keyElem.verifyValue(t),r=this.valueElem.verifyValue(e);return this.map[this.keyElem.valueToString(n)]={key:n,value:r},this},i.get=function(t){var e=this.keyElem.valueToString(this.keyElem.verifyValue(t));return e in this.map?this.map[e].value:void 0},i.has=function(t){return this.keyElem.valueToString(this.keyElem.verifyValue(t))in this.map},r}(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(r){if(null!==r)try{e(null,o.loadProto(r,n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===r?null:o.loadProto(r,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(r){if(null!==r)try{e(null,o.loadJson(JSON.parse(r),n,t))}catch(t){e(t)}else e(Error("Failed to fetch file"))}));var r=o.Util.fetch("object"==typeof t?t.root+"/"+t.file:t);return null===r?null:o.loadJson(JSON.parse(r),n,t)},i=t,o.loadProto(i,void 0,"").build("Modules").probuf}(n,e);return r}var Sn,On,Nn=function(){function t(t,e,n){this.pbmaps=t,this.logger=n,this.pbModules=Rn(e)}return t.prototype.getModule=function(t){return new this.pbModules[t]},t.prototype.encode=function(t,e,n){var r=new this.pbModules[t];if(e)try{this.pbmaps[t].forEach((function(t){var n=e[t];void 0!==n&&r["set".concat(function(t,e,n){if(void 0===e||void 0===n)return t.toUpperCase();var r=t.slice(e,n);return t.replace(r,(function(t){return t.toUpperCase()}))}(t,0,1))](n)}))}catch(e){var i="pbname: ".concat(t,", stack: ").concat(e.stack);this.logger?this.logger.error(exports.LogTagId.L_PB_ENCODE_E,i):null===console||void 0===console||console.error(exports.LogTagId.L_PB_ENCODE_E,i)}return n?r:r.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(!qt(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 r in t)t[r]=this.fixInt64Values(t[r]);return t},t}();exports.AreaCode=void 0,(On=exports.AreaCode||(exports.AreaCode={}))[On.BJ=1]="BJ",On[On.SG=2]="SG",On[On.NA=3]="NA",On[On.SG_A=4]="SG_A";var Ln=((Sn={})[exports.AreaCode.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},Sn[exports.AreaCode.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},Sn[exports.AreaCode.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},Sn[exports.AreaCode.SG_A]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:exports.EConnectProtocol.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},Sn);function Mn(t){return t>=exports.AreaCode.BJ&&t<=3?t:exports.AreaCode.BJ}function Un(t){return void 0===t&&(t=exports.AreaCode.BJ),Ln[Mn(t)].cloudControllerUrlBase64}exports.EConnectProtocol.HTTPS;var An=function(){function t(){this.initOption={}}return t.prototype.init=function(t){this.initOption=t},t.prototype.getNaviUrlList=function(t){var e,n=this.initOption||{},r=n.areaCode,i=n.navigators,o=(e=r,void 0===e&&(e=exports.AreaCode.BJ),Ln[Mn(e)].naviUrlBase64).map((function(t){return ve(t)})),s=t.split("@")[1],a=s?s.split(";"):[],c=i&&i.length>0?h(h([],a,!0),i,!0):h(h([],a,!0),o,!0);return c.filter((function(t,e){return c.indexOf(t)===e})).map((function(t){return be(t)}))},t.prototype.getLogUrlPolicyList=function(t,e){var n,r=t||{},i=r.log,o=r.logPolicy,s=this.initOption||{},a=s.areaCode,u=s.logServerUrl,l=(n=a,void 0===n&&(n=exports.AreaCode.BJ),Ln[Mn(n)].logUrlBase64).map((function(t){return c(c({},t),{addr:ve(t.addr)})})),d=[],p={level:1,itv:6,times:5};if(i)d.push.apply(d,i.addrs),Object.assign(p,i.policy);else if(o)try{var g=JSON.parse(o);d.push({addr:g.url,protocol:exports.EConnectProtocol.HTTPS,weight:1}),p.level=g.level,p.itv=g.itv,p.times=g.times}catch(n){e.warn(exports.LogTagId.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:t.logPolicy}))}var f=u?h([{addr:u,protocol:exports.EConnectProtocol.HTTPS,weight:101}],d,!0):h(h([],d,!0),l,!0);return{policy:p,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 c(c({},t),{addr:be(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=exports.AreaCode.BJ),Ln[Mn(e)].miniCmpBase64).map((function(t){return ve(t)})),r=(this.initOption||{}).miniCMPProxy;return r&&r.length>0?r: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=exports.AreaCode.BJ),Ln[Mn(e)].staticConfigUrlBase64).map((function(t){return ve(t)}))},t.prototype.getCloudControllerUrl=function(t){var e,n=null!=t?t:null===(e=this.initOption)||void 0===e?void 0:e.areaCode;return n?Un(n).map((function(t){return ve(t)})):Un().map((function(t){return ve(t)}))},t}(),bn=new An,wn=function(){function t(t,e,n){void 0===n&&(n=exports.AreaCode.BJ),this.appkey=t,this.logger=e,this.areaCode=n,this.staticUrls=[]}return t.prototype.getStaticConfig=function(){var t;return u(this,void 0,void 0,(function(){var e,n,r,i,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)<M?[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 be(t.addr,t.protocol)}))||[]}];case 3:return[3,5];case 4:return r=s.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==r?void 0:r.stack})),[3,5];case 5:this.clearCache(),s.label=6;case 6:return[4,this._requestHandle()];case 7:return(i=s.sent())?[4,this.decryptData(i)]:[2];case 8:return(null==(o=s.sent())?void 0:o.areaCode)!==this.areaCode?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:i})),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 be(t.addr,t.protocol)})))||[]}])}}))}))},t.prototype._requestHandle=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:t=(t=h(h([],this.staticUrls,!0),bn.getStaticConfigUrl(),!0).map((function(t){return be(t)}))).filter((function(e,n){return t.indexOf(e)===n})),e=0,n=t,c.label=1;case 1:return e<n.length?(r=n[e],this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_T,JSON.stringify({url:r})),i=Date.now(),[4,this.sendRequest("".concat(r,"/").concat(this.appkey))]):[3,4];case 2:if(o=c.sent(),s=o.code,a=o.data,200===s)return this.logger.info(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-i})),[2,a];this.logger.warn(exports.LogTagId.L_GET_STATIC_CONF_R,JSON.stringify({url:r,code:s,duration:Date.now()-i})),c.label=3;case 3:return e++,[3,1];case 4:return[2]}}))}))},t.prototype.setAreaCode=function(t){this.areaCode=t},t}(),Pn=re(),xn=Date.now(),Dn=null,Vn="RC_LOGS",Gn="RC_CONF",Bn=null,kn=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Dn];case 1:return(e=n.sent())?[4,new Promise((function(n){var r=e.db.transaction(Vn,"readwrite").objectStore(Vn),i=IDBKeyRange.lowerBound(Date.now()-t),o=r.getAllKeys(i);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var i=r.delete(IDBKeyRange.bound(t[0],t[e-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),Bn=setTimeout((function(){return kn(t)}),6e5),[2]}}))}))},Fn=function(t,e,n,r){void 0===r&&(r=168),Dn||("undefined"!=typeof window&&window&&window.indexedDB&&"IE"!==je(n).type?Dn=new Promise((function(n){var i=window.indexedDB;i.databases&&i.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_LOGS_".concat(t),s=i.open(o,1);s.onerror=function(t){e.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,t.target.error),n(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(t){e.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(exports.LogTagId.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(exports.LogTagId.L_LOGDB_ABORT_S,t.target.error)},kn(3600*Math.max(24,Math.min(168,r))*1e3),n({appkey:t,db:o})):n(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(Vn)&&e.deleteObjectStore(Vn);var n=e.createObjectStore(Vn,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(Gn,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},Hn=function(){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return Dn?(Bn&&(clearTimeout(Bn),Bn=null),[4,Dn]):[2];case 1:return(t=e.sent())&&t.db.close(),Dn=null,[2]}}))}))},Kn=[],qn=!1,Yn=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return qn||0===Kn.length?[2]:(qn=!0,e=Kn.splice(0),[4,new Promise((function(n){var r=t.transaction(Vn,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(Vn);e.forEach((function(t){try{i.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),qn=!1,setTimeout((function(){return Yn(t)})),[2]}}))}))};function jn(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Dn];case 1:return(e=n.sent())?[2,new Promise((function(n){var r=e.db.transaction(Gn,"readonly").objectStore(Gn).get(t);r.onsuccess=function(t){var e;n({value:null===(e=r.result)||void 0===e?void 0:e.value,success:!0})},r.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var Wn,Qn=0,Jn=function(){return{setTimestamp4RealtimeLog:function(t){Qn=t},getTimestamp4RealtimeLog:function(){return Qn},getLogs:function(t,e,n,r){return u(this,void 0,void 0,(function(){var i;return l(this,(function(o){switch(o.label){case 0:return[4,Dn];case 1:return(i=o.sent())?[2,new Promise((function(o){var s=i.db.transaction(Vn,"readonly").objectStore(Vn),a=[],c=IDBKeyRange.bound(t,e),u=s.index("time").openCursor(c);u.onsuccess=function(t){var e=t.target.result;if(e){var i=e.value;i.level<=n&&(r?i.sessionId===Pn:i.level>=0)&&a.push(i),e.continue()}else o({dbReady:!0,logs:a})},u.onerror=function(t){o({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Xn="REPORT_SESSION",Zn=function(t,e){return u(void 0,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(Xn,"_").concat(t),[4,jn("".concat(Xn,"_").concat(t))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(e===(null==o?void 0:o.sessionId)||function(t,e){u(this,void 0,void 0,(function(){var n,r;return l(this,(function(i){switch(i.label){case 0:return[4,Dn];case 1:return(n=i.sent())?(r=n.db,r.transaction(Gn,"readwrite").objectStore(Gn).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))};exports.LogL=void 0,(Wn=exports.LogL||(exports.LogL={}))[Wn.STATISTICS=-2]="STATISTICS",Wn[Wn.RECORD=-1]="RECORD",Wn[Wn.FATAL=0]="FATAL",Wn[Wn.ERROR=1]="ERROR",Wn[Wn.WARN=2]="WARN",Wn[Wn.INFO=3]="INFO",Wn[Wn.DEBUG=4]="DEBUG";var zn=function(t){return[exports.LogL.DEBUG,exports.LogL.INFO,exports.LogL.WARN,exports.LogL.ERROR].some((function(e){return e===t}))},$n=0,tr=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.outputLevel=exports.LogL.WARN,this.debug=this._log.bind(this,exports.LogL.DEBUG),this.info=this._log.bind(this,exports.LogL.INFO),this.warn=this._log.bind(this,exports.LogL.WARN),this.error=this._log.bind(this,exports.LogL.ERROR),this.__statistics=this._log.bind(this,exports.LogL.STATISTICS)}return t.prototype._stdout=function(t,e,n,r,i){if(!(t<=exports.LogL.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(r," | ").concat(i))}},t.prototype.setOutputLevel=function(t){zn(t)&&(this.outputLevel=t)},t.prototype._log=function(t,e,n,r){var i=new Date;/^[\w-]+$/.test(e)?(this._stdout(t,e,i.toISOString(),n,r),t!==exports.LogL.DEBUG&&this.flush({time:+i,sessionId:Pn,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:r})):this._stdout(exports.LogL.ERROR,"L_LOG_TAG_INVALID_E",i.toISOString(),e,r)},t.prototype.createTraceId=function(){return"".concat(++$n)},t.prototype.getSessionId=function(){return Pn},t}(),er=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){!function(t){u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Dn];case 1:return(e=n.sent())?(Kn.push(t),Yn(e.db),[2]):[2]}}))}))}(t)},e}(tr),nr=function(){function t(t,e,n,r,i){this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.logDB=r,this.logger=i,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return t.prototype.checkStart=function(t){return u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=bn.getLogUrlPolicyList(t,this.logger),n=e.policy,r=e.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,r.length>0&&this.realtimeReport(r[0].addr,n.level,n.itv),[2]):[2])}))}))},t.prototype.realtimeReport=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return r=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||xn,o=Math.max(r-5e3,i),s=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:e,itv:n}),s),[4,this.logDB.getLogs(i,o,e,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressLogs(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),g=Wt(t)?t:"https://".concat(t),g+="?version=".concat("5.8.5","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.logDB.setTimestamp4RealtimeLog(u[u.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,r,i,o,s){return void 0===s&&(s=!1),u(this,void 0,void 0,(function(){var a,c,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(a=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:i,messageUId:o,isCloudControl:s}),a),[4,this.logDB.getLogs(t,e,exports.LogL.DEBUG,!1)]);case 1:return c=l.sent(),u=c.dbReady,h=c.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:h.length}),a),d=Wt(r)?r:"https://".concat(r),d+="?version=".concat("5.8.5","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u?h.length>0?[4,this.compressLogs(h)]:[3,3]:[3,5];case 2:return g=l.sent(),f=g.success,_=g.data,p=f?_:"compress failed",[3,4];case 3:p="no data",l.label=4;case 4:return[3,6];case 5:p="no database",l.label=6;case 6:return this.logger.debug(exports.LogTagId.L_REPORT_FULL_LOG_O,"compress done",a),s&&(d+="&source=cloud"),[4,this.send({url:d,body:p,method:"POST"})];case 7:return E=l.sent().status,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_R,JSON.stringify({status:E}),a),[2]}}))}))},t.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},t}(),rr=48,ir=64,or=80,sr=96,ar="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",cr=ar.length,ur=function(t){for(var e={},n=0;n<t.length-1;n++){var r=t.charAt(n)+t.charAt(n+1);e.hasOwnProperty(r)?e[r].push(n):e[r]=[n]}for(var i=[],o=[],s=function(){if(o.length>0){var t=o.join("");if(o=[],t.length>26){var e=hr(t.length),n=String.fromCharCode(or|e.length);i.push(n+e)}else{var r=String.fromCharCode(sr|t.length);i.push(r)}i.push(t)}},a=0;a<t.length;){var c=lr(e,t,a);if(c.length<2)o.push(t.charAt(a++));else if(c.length<4)o.push(t.substr(a,c.length)),a+=c.length;else{var u=hr(a-c.offset),l=hr(c.length);if(u.length+l.length>=c.length)o.push(t.substr(a,c.length)),a+=c.length;else{s();var h=String.fromCharCode(ir|u.length<<2|l.length);i.push(h+u+l),a+=c.length}}}s();var d=hr(t.length),p=String.fromCharCode(rr|d.length);return i.push(p+d),i.join("")},lr=function(t,e,n){var r={length:0,offset:-1};if(e.length,n>=e.length-1)return r;var i=t[e.charAt(n)+e.charAt(n+1)];if(i[0]===n)return r;for(var o=e.length-n,s=0,a=i.length;s<a;s++){var c=i[s],u=n-c;if(!(u>238327)){var l=Math.min(o,u);if(l<=r.length)break;if(!(r.length>2&&e.charAt(c+r.length-1)!==e.charAt(n+r.length-1))){for(var h=2,d=h;d<l&&e.charAt(c+d)===e.charAt(n+d);d++)h++;h>=r.length&&(r.length=h,r.offset=c)}}}return r},hr=function(t){var e=[],n=0;do{n=t%cr,e.push(ar.charAt(n)),t=(t-n)/cr}while(t>0);return e.join("")},dr=function(t){if("browser"!==t.tag)return{type:t.tag,version:"UnKonw"};var e,n,r=navigator.userAgent,i={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 i)if(i.hasOwnProperty(o)){var s=r.match(i[o]);if(s){n=o,e=s[1]||s[2];break}}return{type:n||"UnKonw",version:e||"UnKonw"}},pr=function(t){var e=t.sessionId,n=t.level,r=t.loggerId,i=t.traceId,o=t.time,s=t.tag,a=t.type,c=t.content,u=n<0?c||"":JSON.stringify({content:c,traceId:i,from:r});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},gr=function(t){function e(e,n,r,i){var o=this,s=ie(n),a=dr(n),c="".concat(a.type,"|").concat(a.version,"|").concat(r.getSessionId());return(o=t.call(this,e,s,c,Jn(),r)||this).runtime=n,o.clientReportLevel=i,zn(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 u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,Zn(e.userId,this.logger.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressLogs=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:ur(t.map(pr).join(""))}]}))}))},e.prototype.isReporter=function(){return u(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(),u(void 0,void 0,void 0,(function(){var t,r,i;return l(this,(function(o){switch(o.label){case 0:return[4,jn("".concat(Xn,"_").concat(e))];case 1:return t=o.sent(),r=t.success,i=t.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,r,i,o,s,a){return void 0===a&&(a=!1),u(this,void 0,void 0,(function(){var c;return l(this,(function(u){switch(u.label){case 0:return[4,this.isReporter()];case 1:return c=u.sent(),this.userId&&!c?[2]:[2,t.prototype.report.call(this,e,n,r,i,o,s,a)]}}))}))},e.prototype.realtimeReport=function(e,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,t.prototype.realtimeReport.call(this,e,n,r)]}))}))},e}(nr),fr=144e5;if("undefined"!=typeof window){window.__rongcloud_devtools__={logger:{get:function(t,e,n){return void 0===e&&(e=Date.now()-fr),void 0===n&&(n=Date.now()),u(this,void 0,void 0,(function(){var r,i;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>fr&&(e=n-fr),(r=new er(t,"RC-IM","IM")).debug(exports.LogTagId.T,"get logs: startTime ".concat(e," endTime ").concat(n)),Fn(t,r,{tag:"browser"}),[4,Jn().getLogs(e,n,exports.LogL.DEBUG,!1)];case 1:return i=o.sent().logs,r.debug(exports.LogTagId.T,"get logs ".concat(i.length)),function(t,e){var n=e.map((function(t){var e=t.sessionId,n=t.time,r=t.type,i=t.level,o=t.tag,s=t.traceId,a=t.loggerId,c=t.content;return"".concat(e,",").concat(n,",").concat(r,",").concat(i,",").concat(o,",").concat(s,",").concat(a,',"').concat(c,'"\n')})),r=new Blob(n,{type:"text/csv"}),i=URL.createObjectURL(r),o=document.createElement("a");o.href=i,o.download="".concat(t,".csv"),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}("".concat(t,"-").concat(e,"-").concat(n),i),[2]}}))}))}}}}var _r,Er,Tr,Cr,vr,Ir,yr,mr=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 u(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.5"},t.prototype.getAPIVersion=function(){return"5.8.5"},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,r){void 0===r&&(r=[]),this._context.registerMessageType(t,e,n,r)},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}(),Rr="pgMsgP",Sr="chatMsg",Or="pcMsgP",Nr="pbMsgP",Lr={PRIVATE:"ppMsgS",GROUP:"pgMsgS",CHATROOM:"chatMsgS"},Mr="delMsg",Ur="joinChrm",Ar="joinChrmR",br="exitChrm",wr="setKV",Pr="delKV",xr="setKVS",Dr="delKVS",Vr="qryRelationR",Gr="delRelation",Br="setSeAtt",kr={PRIVATE:"cleanPMsg",GROUP:"cleanGMsg",ULTRA_GROUP:"cleanGMsg",CUSTOMER_SERVICE:"cleanCMsg",SYSTEM:"cleanSMsg"},Fr="reqCall",Hr="pullKvMsg",Kr="qryPMsg",qr="qryGMsg",Yr="qryCHMsg",jr="qryCMsg",Wr="qrySMsg",Qr=((_r={})["ppMsgP"]=B.PRIVATE,_r[Rr]=B.GROUP,_r[Sr]=B.CHATROOM,_r[Or]=B.CUSTOMER_SERVICE,_r[Nr]=B.SYSTEM,_r),Jr=((Er={})[B.PRIVATE]=Kr,Er[B.GROUP]=qr,Er[B.CHATROOM]=Yr,Er[B.CUSTOMER_SERVICE]=jr,Er[B.SYSTEM]=Wr,Er),Xr=((Tr={})[B.PRIVATE]=kr.PRIVATE,Tr[B.GROUP]=kr.GROUP,Tr[B.ULTRA_GROUP]=kr.ULTRA_GROUP,Tr[B.CUSTOMER_SERVICE]=kr.CUSTOMER_SERVICE,Tr[B.SYSTEM]=kr.SYSTEM,Tr),Zr="1",zr="0",$r=1,ti=2,ei=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"}(Cr||(Cr={})),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"}(vr||(vr={})),function(t){t.PUB="pub",t.QUERY="qry"}(Ir||(Ir={})),function(t){t[t.V4=4]="V4",t[t.V3=3]="V3"}(yr||(yr={}));var ni,ri=function(){function t(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=Cr.AT_LEAST_ONCE),void 0===r&&(r=!1),this._retain=!1,this.qos=Cr.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=r)}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}(),ii=function(){function t(){}return t.writeUTF=function(t,e){for(var n=this._getBackAndByteSize(t),r=n.back,i=n.byteSize,o=0,s=r.length;o<s;o++)r[o]>255&&(r[o]&=255);return e?r:i<=255?[0,i].concat(r):[i>>8,255&i].concat(r)},t._getBackAndByteSize=function(t){var e=[],n=0;if(Bt(t))for(var r=0,i=t.length;r<i;r++){var o=t.charCodeAt(r);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,r=[],i=-1,o=t,s="";++i<o.length;){var a=Number(o[i]);if(a===(127&a)||(240==(240&a)?a=(a=(a=(a^=240)<<6|128^o[++i])<<6|128^o[++i])<<6|128^o[++i]:224==(224&a)?a=(a=(a^=224)<<6|128^o[++i])<<6|128^o[++i]:192==(192&a)&&(a=(a^=192)<<6|128^o[++i])),!Number.isFinite(a)||a<0||a>1114111||Math.floor(a)!==a)throw RangeError("Invalid code point: ".concat(a));a<=65535?r.push(a):(e=(a-=65536)>>10|55296,n=a%1024|56320,r.push(e,n)),(i+1===o.length||r.length>16384)&&(s+=String.fromCharCode.apply(null,r),r.length=0)}return s},t}(),oi=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 r=t._pool[t._position++].toString(16);1===r.length&&(r="0".concat(r)),e+=r.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 r=t._pool[t._position++].toString(16);1===r.length&&(r="0".concat(r)),e+=r.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 r=t._pool[t._position++].toString(16);1===r.length&&(r="0".concat(r)),e+=r}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 ii.readUTF(n)},t.prototype.readAll=function(){return this._pool.subarray(this._position,this._poolLen)},t}(),si=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=ii.writeUTF(t);this._pool=this._pool.concat(e),this._writen+=e.length},t.prototype.getBytesArray=function(){return this._pool},t}(),ai=function(t,e){return t&&e?"".concat(e,"_").concat(t):t||Date.now()},ci=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 ai(t,e)},t.prototype.read=function(t,e,n,r){this.readMessage(t,e,n,r)},t.prototype.readMessage=function(t,e,n,r){return{stream:e,length:n}},t}(),ui=function(){function t(t){this.lengthSize=0,this.messageId=0,this.topic="",this.targetId="",this.identifier="",this._header=new ri(t,!1,Cr.AT_MOST_ONCE,!1)}return t.prototype.getIdentifier=function(){var t=this.messageId,e=this.identifier;return ai(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 si;this.write(t);var e=t.getBytesArray();return new Int8Array(e)},t}(),li=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,r,i){if(n.readByte(),this.status=+n.readByte(),r<=e.MESSAGE_LENGTH)return{stream:n,length:r};if(i===yr.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(exports.LogTagId.O,"server sessionId -> ".concat(s)),this.timestamp=n.readLong()}return{stream:n,length:r}},e.MESSAGE_LENGTH=2,e}(ci),hi=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}(ci),di=function(t){function e(){return t.call(this,vr.PING_REQ)||this}return a(e,t),e.prototype.writeMessage=function(t){},e}(ui),pi=function(t){function e(e){return t.call(this,e)||this}return a(e,t),e}(ci),gi=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 r=256*e.readByte()+e.readByte();return this.messageId=parseInt(r.toString(),10),{stream:e,length:n}},e}(ci),fi=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,r=(65280&e)>>8;t.write(r),t.write(n)},e}(ui),_i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.topic="",e.targetId="",e.syncMsg=!1,e.identifier=Ir.PUB,e}return a(e,t),e.prototype.readMessage=function(e,n,r){return this.date=n.readInt(),this.topic=n.readUTF(),this.targetId=n.readUTF(),t.prototype.readMessage.call(this,e,n,r),this.data=n.readAll(),{stream:n,length:r}},e}(gi),Ei=function(t){function e(e,n,r){var i=t.call(this,vr.PUBLISH)||this;return i.syncMsg=!1,i.identifier=Ir.PUB,i.topic=e,i.data=Bt(n)?ii.writeUTF(n):n,i.targetId=r,i}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}(fi),Ti=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=Ir.PUB,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,r){return t.prototype.readMessage.call(this,e,n,r),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:r}},e}(gi),Ci=function(t){function e(e){var n=t.call(this,vr.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}(fi),vi=function(t){function e(e,n,r){var i=t.call(this,vr.QUERY)||this;return i.identifier=Ir.QUERY,i.topic=e,i.data=Bt(n)?ii.writeUTF(n):n,i.targetId=r,i}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}(fi),Ii=function(t){function e(e){var n=t.call(this,vr.QUERY_CONFIRM)||this;return n.messageId=e,n}return a(e,t),e}(fi),yi=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.status=0,e.identifier=Ir.QUERY,e.topic="",e.targetId="",e}return a(e,t),e.prototype.readMessage=function(e,n,r){return t.prototype.readMessage.call(this,e,n,r),this.date=n.readInt(),this.status=256*n.readByte()+n.readByte(),this.data=n.readAll(),{stream:n,length:r}},e}(gi),mi=function(t,e,n){var r=new Uint8Array(e),i=new oi(r),o=i.readByte(),s=function(t,e){var n,r=t.type;switch(r){case vr.CONN_ACK:n=new li(t);break;case vr.PUBLISH:(n=new _i(t)).syncMsg=t.syncMsg;break;case vr.PUB_ACK:n=new Ti(t);break;case vr.QUERY_ACK:n=new yi(t);break;case vr.SUB_ACK:case vr.UNSUB_ACK:case vr.PING_RESP:n=new pi(t);break;case vr.DISCONNECT:n=new hi(t);break;default:n=new ci(t),e.error(exports.LogTagId.O,"No support for deserializing ".concat(r," messages"))}return n}(new ri(o),t);return s.read(t,i,r.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"}(ni||(ni={}));var Ri=ni,Si=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 r=A.INBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(r,t.toString())}},t.prototype.getInboxTime=function(t){var e=this._getMemData(t);if(0===e.inboxTime){var n=A.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||jt(t))){n.broadcastSyncTime=t;var r=A.BROADCASTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(r,t.toString())}},t.prototype.getBroadcastSyncTime=function(t){var e=this._getMemData(t);if(!e||0===e.broadcastSyncTime){var n=A.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 r=A.OUTBOX_TIME_KEY(this._appkey,e);this._runtime.localStorage.setItem(r,t.toString())}},t.prototype.getOutboxTime=function(t){var e=this._getMemData(t);if(0===e.outboxTime){var n=A.OUTBOX_TIME_KEY(this._appkey,t);e.outboxTime=parseInt(this._runtime.localStorage.getItem(n),10)||0}return e.outboxTime},t}(),Oi={_caches:{},set:function(t,e){this._caches[t]=e},get:function(t){return this._caches[t]||0},clear:function(t){this._caches[t]=0}},Ni=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,r=t.type,i=t.isOverwrite,o=t.userId,s=this._getSetUserId(n),a=r===rt.DELETE,c=s===o,u=!this._isExisted(n),l=a?this._remove:this._add;(e||i||c||u)&&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,r=e.isDeleted;return n&&!r},t.prototype.setEntries=function(t){var e=this,n=t.kvEntries,r=t.isFullUpdate;n=n||[],(r=r||!1)&&this.clear(),n.forEach((function(t){e._setEntry(t,r)}))},t.prototype.clear=function(){this._kvCaches={}},t}(),Li=function(){function t(t){this._pullQueue=[],this._isPulling=!1,this._storeCaches={},this._engine=t}return t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,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,(r=Oi.get(e))>n?(this._isPulling=!1,this._startPull(),[2]):[4,this._engine.pullChatroomEntry(e,r)]);case 1:return i=a.sent(),o=i.code,s=i.data,this._isPulling=!1,o===V.SUCCESS?(Oi.set(e,s.syncTime||0),this._startPull()):this._startPull(),[2]}}))}))},t.prototype.reset=function(t){Oi.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 r=this._storeCaches[t];Qt(r)||(r=new Ni(this._engine.getInnerLogger(),t,n)),r.setEntries(e),this._storeCaches[t]=r},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}(),Mi=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}(),Ui="converStatusChanged",Ai=function(){function t(t,e,n){this._eventEmitter=new zt,this._pullQueue=[],this._isPulling=!1,this._storagePullTimeKey="con-s-".concat(e,"-").concat(n),this._oldStorage=r(t.runtime),this._storage=new o(t.runtime,A.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(exports.LogTagId.A_CALLBACK_E,"adaptOldStatus error: ".concat(t.message))}},t.prototype._set=function(t){var e=this;if(!jt(t)&&Array.isArray(t)){var n=this._storage.get(this._storagePullTimeKey)||0,r=t.length;t.forEach((function(t,i){var o=t.updatedTime||0;n=o>n?o:n,t.conversationType=t.type,e._eventEmitter.emit(Ui,{statusItem:t,isLastPull:i===r-1})})),this._storage.set(this._storagePullTimeKey,n)}},t.prototype._startPull=function(){return u(this,void 0,void 0,(function(){var t,e,n,r;return l(this,(function(i){switch(i.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=i.sent(),n=e.code,r=e.data,n===V.SUCCESS?(this._isPulling=!1,this._set(r),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(Ui,(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}(),bi={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}},wi={};for(var Pi in bi){var xi=bi[Pi].keyName;wi[xi]=Pi}var Di,Vi=function(){function t(t,e,n,r){this._appkey=e,this._currentUserId=n,this.logger=r,this.storage=new o(t,A.OLD_CONVER_STATE_KEY(e,n)),this._localStore=new o(t,A.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(),r=e.shift(),i=e.join("_");return{conversationType:Number(r),targetId:i,channelId:n}}return{conversationType:B.PRIVATE,targetId:"",channelId:""}},t.prototype._updateMentionedUserList=function(t,e,n){var r=this,i=t.conversationType,o=t.messageType,s=t.isMentioned,a=t.senderUserId;s&&i===B.GROUP&&((n.userIdList||[]).forEach((function(t){t===r._currentUserId&&e.indexOf(a)<0&&e.push(a)})),n.type===J.ALL&&e.indexOf(a)<0&&e.push(a));if(o===K.RECALL&&i===B.GROUP){var c=e.indexOf(a);c>=0&&e.splice(c,1)}return e},t.prototype.updateMentionedData=function(t){var e=t.conversationType,n=t.targetId,r=t.content,i=t.channelId,o=t.senderUserId,s=r.mentionedInfo;if(s&&o!==this._currentUserId){var a=this._getStoreKey(e,n,i),c=this._localStore.get(a)||{},u=wi.mentionedInfo,l=wi.hasMentioned,h=c[u]||{},d=h.userIdList||[];s={userIdList:d=this._updateMentionedUserList(t,d,s),type:(null==s?void 0:s.type)||h.type},0!==d.length?(c[u]=s,c[l]=!0):(delete c[u],delete c[l]),Qt(c)?this._localStore.set(a,c):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,r){var i=this._getStoreKey(t,e,r),o=this._localStore.get(i)||{};for(var s in n){var a=wi[s],c=n[s];if(!jt(a)&&!jt(c)&&"hasMentioned"!==s&&"MentionedInfo"!==s)c===bi[a].defaultVal||"tags"===s&&!Qt(c)?delete o[a]:o[a]=this._setLocal(s,c),o.c||(delete o.t,delete o.hm,delete o.m,delete o.mc)}var u=Object.keys(o);1===u.length&&u.includes("st")&&delete o.st,Qt(o)?this._localStore.set(i,o):this._localStore.remove(i)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var r=this._getStoreKey(t,e,n),i=this._localStore.get(r)||{},o={};for(var s in bi){var a=bi[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||qe(u)}return o},t.prototype.getValue=function(t){var e=this._localStore.getValues()||{},n=[];for(var r in e){var i=this._getConOptionByKey(r),o={conversationType:i.conversationType,targetId:i.targetId,channelId:i.channelId},s=e[r];for(var a in s)if(bi[a]){var c=bi[a],u=c.keyName,l=c.defaultVal;o[u]=s[a]||qe(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 r=this._getConOptionByKey(n),i=r.conversationType,o=r.targetId,s={},a=t[n];for(var u in a){var l=bi[u],h=l.keyName,d=l.defaultVal;s[h]=a[u]||qe(d)}for(var p in s.tags){jt(e[p])&&(e[p]=[]);var g=c(c({},s),{conversationType:i,targetId:o});delete g.tags,e[p].push(g)}}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(exports.LogTagId.O,"adaptOldStore error: ".concat(t.message))}},t.prototype.remove=function(t,e,n){var r=this._getStoreKey(t,e,n);this._localStore.remove(r)},t}(),Gi=[B.PRIVATE,B.GROUP,B.SYSTEM,B.PUBLIC_SERVICE,B.APP_PUBLIC_SERVICE],Bi={CHANGED:"conversationChanged",CON_TAG_STATUS_CHANGED:"conTagStatusChanged"},ki=1e3,Fi=function(){function t(t,e,n,r,i){var o=this;this._updatedConversations={},this._conTagStatusChanged=!1,this._eventEmitter=new zt,this._draftMap={},this._recallMsgTimeMap={},this._appkey=e,this._loginUserId=n,this._store=new Vi(t.runtime,e,n,t.getInnerLogger()),this._statusManager=new Ai(t,e,n),this._statusManager.watch((function(t){var e=t.statusItem,n=t.isLastPull;o.addStatus(e,n)})),this._eventEmitter.on(Bi.CHANGED,(function(t){r(t)})),this._eventEmitter.on(Bi.CON_TAG_STATUS_CHANGED,(function(){i()}));var s=this._store.getValue();s.length>ki&&(s=s.sort((function(t,e){var n=t.lastMessageSentTime,r=void 0===n?0:n,i=e.lastMessageSentTime;return(void 0===i?0:i)-r})),s.splice(ki,s.length).forEach((function(t){o._store.remove(t.conversationType,t.targetId,t.channelId)})))}return t.prototype._calcMsg=function(t,e,n,r){var i=!this._recallMsgTimeMap[t]||this._recallMsgTimeMap[t]&&!this._recallMsgTimeMap[t].find((function(t){return t===r.sentTime})),o=e>=r.sentTime;return n&&(o=n<r.sentTime),{isNotRead:o,isNotRepeadRecallSendTime:i}},t.prototype._calcUnreadCount=function(t,e){var n=t.content,r=t.messageType,i=t.sentTime,o=t.isCounted,s=t.messageDirection,a=t.senderUserId,c=s===x.SEND&&a===this._loginUserId,u=r===K.RECALL,l=qt(n),h=!1,d={},p=e.lastUnreadTime,g=e.lastReadTime,f=e.unreadMessageCount;if(p>i||c)return{hasChanged:h,localConversation:e,updateItems:d};if(o&&(e.unreadMessageCount=f+1,e.lastUnreadTime=i,h=!0),u&&l){var _="".concat(t.conversationType,"_").concat(t.channelId,"_").concat(t.targetId),E=this._calcMsg(_,p,g,n),T=E.isNotRead,C=E.isNotRepeadRecallSendTime;T&&f&&C&&(this._recallMsgTimeMap[_]||(this._recallMsgTimeMap[_]=[]),this._recallMsgTimeMap[_].push(n.sentTime),e.unreadMessageCount=f-1,h=!0)}return h&&(d.unreadMessageCount={val:e.unreadMessageCount||0,time:i}),{hasChanged:h,localConversation:e,updateItems:d}},t.prototype._calcMentionedInfo=function(t,e){var n=t.content,r=t.messageDirection,i=t.isMentioned,o=t.sentTime,s=r===x.SEND,a=qt(n),c=!1,u={};return!s&&i&&a&&n.mentionedInfo&&(e.hasMentioned=!0,c=!0,u.hasMentioned={val:!0,time:o},u.mentionedInfo={val:n.mentionedInfo,time:o}),{hasChanged:c,localConversation:e,updateItems:u}},t.prototype._calcMentionedCount=function(t,e){var n=t.content,r=t.messageDirection,i=!1;if(t.isMentioned&&r===x.RECEIVE&&(null==n?void 0:n.mentionedInfo)){var o=n.mentionedInfo,s=o.type,a=o.userIdList;if(s===J.ALL||(a||[]).includes(this._loginUserId)){i=!0;var c=e.unreadMentionedCount||0;e.unreadMentionedCount=c+1}if((a||[]).includes(this._loginUserId)){i=!0;c=e.unreadMentionedMeCount||0;e.unreadMentionedCount=c+1}}return{hasChanged:i,localConversation:e}},t.prototype._setUpdatedConversation=function(t){if(qt(t)){var e=t.conversationType,n=t.targetId,r=t.channelId,i="".concat(e,"_").concat(n),o=this._store.get(e,n,r)||{};this._updatedConversations[i]=Object.assign(o,t)}},t.prototype._setConTagStatusChanged=function(t,e,n,r){var i=(this._store.get(t,e,r)||{}).tags||{};if(Object.keys(i).length===Object.keys(n).length){for(var o in i)if(!n[o]||!!i[o].isTop!=!!n[o].isTop)return void(this._conTagStatusChanged=!0)}else this._conTagStatusChanged=!0},t.prototype.addStatus=function(t,e){var n=t.conversationType,r=t.targetId,i=t.updatedTime,o=t.notificationStatus,s=t.notificationLevel,a=t.isTop,c=t.tags,u=t.channelId,l={},h={};if(n!==B.ULTRA_GROUP){jt(o)||(h.notificationStatus={time:i,val:o}),jt(s)||(h.notificationLevel={time:i,val:s}),jt(a)||(h.isTop={time:i,val:a}),jt(c)||(h.tags={time:i,val:c},null==c||c.forEach((function(t){l[t.tagId]={isTop:t.isTop}}))),this._setConTagStatusChanged(n,r,l,u);var d=this._store.get(n,r,u).lastMessageSentTime||(new Date).getTime();this._store.set(n,r,{notificationStatus:o,notificationLevel:s,isTop:a,tags:l,lastMessageSentTime:d},u),this._setUpdatedConversation({conversationType:n,targetId:r,updatedItems:h,channelId:u}),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(Bi.CHANGED,t),this._updatedConversations={},this._conTagStatusChanged&&(this._eventEmitter.emit(Bi.CON_TAG_STATUS_CHANGED),this._conTagStatusChanged=!1))},t.prototype.setConversationCacheByMessage=function(t,e){var n=this,r=t.conversationType,i=t.isPersited,o=t.targetId,s=t.channelId,a=t.sentTime;if(Gi.indexOf(r)>=0){var u=!1,l=this._store.get(r,o,s),h={};if(l.lastMessageSentTime=a,[this._calcUnreadCount,this._calcMentionedInfo,this._calcMentionedCount].forEach((function(e){var r=e.call(n,t,l),i=r.hasChanged,o=r.localConversation,s=r.updateItems;u=u||i,h=c(c({},h),s),l=qe(o)})),this._store.set(r,o,l,s),this._store.updateMentionedData(t),i){var d=this._store.get(r,o,s);d.updatedItems=c({latestMessage:{time:t.sentTime,val:t}},h),d.latestMessage=t;var p=Object.assign(d,{conversationType:r,targetId:o,channelId:s});this._setUpdatedConversation(p)}(u||i)&&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 r=this._store.getValue(),i=0;return r.forEach((function(t){var r=t.unreadMessageCount,o=t.notificationStatus,s=t.notificationLevel,a=t.conversationType;r=r||0,(n||void 0!==s&&s<=0||void 0===s&&o!==Y.OPEN)&&(e.length>0?e.includes(Number(a))&&(i+=Number(r)):i+=Number(r))})),i},t.prototype.getTotalUnreadCountByLevels=function(t,e,n){var r=this._store.getValue(),i=0;return r.forEach((function(r){var o=r.unreadMessageCount,s=r.notificationLevel,a=void 0===s?0:s,c=r.conversationType,u=r.unreadMentionedCount;t.includes(c)&&(0===e.length||e.includes(a))&&(i+=(n?u:o)||0)})),i},t.prototype.getUnreadCountByTag=function(t,e){var n=this._store.getValueForTag()[t]||[],r=0;return n.forEach((function(t){var n=t.unreadMessageCount,i=t.notificationStatus,o=t.notificationLevel;(e||1!==i||-1===o||0===o)&&(n=n||0,r+=Number(n))})),r},t.prototype.getUnreadCount=function(t,e,n){return this._store.get(t,e,n).unreadMessageCount||0},t.prototype.clearUnreadCount=function(t,e,n,r){void 0===r&&(r=!0);var i=this._store.get(t,e,n);i.lastReadTime=i.lastUnreadTime,this._recallMsgTimeMap["".concat(t,"_").concat(n,"_").concat(e)]=[];var o=i.unreadMessageCount,s=i.hasMentioned,a={};if(o&&(i.unreadMessageCount=0,a.unreadMessageCount={val:0,time:Date.now()}),s&&(i.hasMentioned=!1,i.unreadMentionedCount=0,i.mentionedInfo=void 0,a.hasMentioned={val:!1,time:Date.now()},a.mentionedInfo={val:void 0,time:Date.now()}),this._store.set(t,e,i,n),r&&0!==Object.keys(a).length){var c=Object.assign(i,{conversationType:t,targetId:e,channelId:n,updatedItems:a});this._setUpdatedConversation(c),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,r){var i="".concat(t,"_").concat(e,"_").concat(r);this._draftMap[i]=n},t.prototype.getDraft=function(t,e,n){var r="".concat(t,"_").concat(e,"_").concat(n);return this._draftMap[r]},t.prototype.clearDraft=function(t,e,n){var r="".concat(t,"_").concat(e,"_").concat(n);delete this._draftMap[r]},t.prototype.addTagStatus=function(t,e,n,r){void 0===r&&(r="");var i=this._store.get(t,e,r),o=i.tags;o=Object.assign(o,n);var s=i.lastMessageSentTime||(new Date).getTime();this._store.set(t,e,{tags:o,lastMessageSentTime:s},r)},t.prototype.deleteTagStatus=function(t,e,n,r){void 0===r&&(r="");var i=this._store.get(t,e,r).tags;n.forEach((function(t){delete i[t]})),this._store.set(t,e,{tags:i},r)},t.prototype.getConversationListForTag=function(){return this._store.getValueForTag()},t.prototype.getBlockConversationList=function(){return this._store.getValue().filter((function(t){return t.notificationStatus===Y.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)&&(jt(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}(),Hi=function(){function t(t,e,n,i){this._pullQueue=[],this._isPulling=!1,this._storageTagKey=A.TAG_STATE_KEY(e,n),this._storagePullTimeKey=A.USER_SETTING_TIME_KEY(e,n),this._storage=r(t.runtime),this._engine=t,this._tagWatcherFunc=i}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,r=(null===(e=n[t.tagId])||void 0===e?void 0:e.createdTime)||t.createdTime||0;n[t.tagId]={tagName:t.tagName,createdTime:r}})),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 u(this,void 0,void 0,(function(){var t,e,n,r,i,o,s,a;return l(this,(function(c){switch(c.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=c.sent(),n=e.code,r=e.data,n!==V.SUCCESS||jt(r)?(this._isPulling=!1,this._startPull()):(o=(i=r).settings,s=i.version,a=o.Tag,jt(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}(),Ki=function(t){return t.replace(/@.+$/,"@")},qi=function(){function t(t,e,n,r,i){void 0===i&&(i=!0),this.appkey=t,this.logger=e,this.statisticLog=n,this.staticConfigManager=r,this.isRequestProfile=i,this.crtRequest=null}return t.prototype.request=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(t,e,n,r,i),[4,this.crtRequest]);case 1:return o=c.sent(),s=o.code,a=o.data,this.crtRequest=null,[2,{code:s,data:a}]}}))}))},t.prototype.sendRequest=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c,u,h,d,p,g,f,_,E,C;return l(this,(function(l){switch(l.label){case 0:return o=Ki(t),!e&&(s=this.getNaviCache(o))&&(a=s.timestamp,c=s.naviInfo,n||Date.now()-a<T)?(this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),r),u={bid:Ue(),ptc:exports.ProtocalType.NAVI,cod:V.SUCCESS,net:null==i?void 0:i.type,dur:0,spr:0,pr:c.type||0,hos:"",cache:exports.NaviCacheType.LOCAL,v:exports.StatisticsVersion.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(exports.StatisticsTag.IM_NAVI,JSON.stringify(u),r),[2,{code:V.SUCCESS,data:c}]):(h=bn.getNaviUrlList(t),this.logger.info(exports.LogTagId.L_GET_NAVI_T,JSON.stringify({token:t,uris:h}),r),[4,this.requestHandler(h,t,r,i)]);case 1:return d=l.sent(),p=d.code,g=d.data,p===V.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,r,i)]):[3,4];case 3:E=l.sent(),p=E.code,g=E.data,l.label=4;case 4:return p!==V.SUCCESS?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,p,r),[2,{code:p}]):(C=g).code&&200!==C.code?(this.logger.warn(exports.LogTagId.L_GET_NAVI_R,C.code,r),[2,{code:this.transHttpCode(C.code)}]):(this.logger.info(exports.LogTagId.L_GET_NAVI_R,JSON.stringify({naviInfo:C}),r),this.setNaviCache(o,C),[2,{code:p,data:C}])}}))}))},t.prototype.requestHandler=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:i=0,o=t.length,l.label=1;case 1:return i<o?(s=i===t.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,c=Date.now(),[4,a.call(this,t[i],this.appkey,e,n,s)]):[3,4];case 2:if(u=l.sent(),h=u.code,d=u.data,p={bid:Ue(),ptc:exports.ProtocalType.NAVI,cod:h,net:null==r?void 0:r.type,dur:Date.now()-c,spr:0,pr:(null==d?void 0:d.type)||0,hos:t[i],cache:exports.NaviCacheType.REQUEST,v:exports.StatisticsVersion.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(exports.StatisticsTag.IM_NAVI,JSON.stringify(p),n),[V.SUCCESS,V.RC_CONN_TOKEN_INCORRECT,V.RC_LICENSE_EXPIRED].includes(h))return[2,{code:h,data:d}];l.label=3;case 3:return i+=1,[3,1];case 4:return[2,{code:V.RC_NAVI_REQ_FAILED}]}}))}))},t.prototype.transHttpCode=function(t){switch(t){case 401:case 403:return V.RC_CONN_TOKEN_INCORRECT;case 416:return V.RC_LICENSE_EXPIRED;default:return V.RC_NAVI_REQ_FAILED}},t.prototype.getNaviInfoFromCache=function(t){var e=this.getNaviCache(Ki(t));return e?e.naviInfo:null},t.prototype.updateVoipCallInfo=function(t,e){var n=this.getNaviInfoFromCache(t);n&&this.setNaviCache(Ki(t),c(c({},n),{voipCallInfo:e}))},t.prototype.getNaviV2RequestOption=function(t){var e,n=t.uri,r=t.token,i=t.platform,o=t.protocol;e="".concat(n,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(r),"&version=").concat("5.8.5","&platfrom=").concat(i);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:v}},t.prototype.useV2Navi=function(){return!0},t}(),Yi={},ji=function(t){function e(e,n,r,i,o,s){void 0===s&&(s="default");var a=t.call(this,e,n,r,o,i.useNavi&&"https:"===(null===window||void 0===window?void 0:window.location.protocol))||this;return a.runtime=i,a.environment=s,a}return a(e,t),e.prototype.httpRequest=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return o="".concat(t,"/navi.js?appId=").concat(e,"&token=").concat(encodeURIComponent(n),"&callBack=x&v=").concat(L,"&r=").concat(Date.now(),"&env=").concat(this.environment),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(o),r),[4,this.runtime.httpReq({url:o,timeout:v,dataType:"text"})];case 1:if(200!==(s=u.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(s.status),r),!this.runtime.useNavi&&i?(c={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:bn.getMiniCmpUrlList().join(",")},[2,{code:V.SUCCESS,data:c}]):[2,{code:this.transHttpCode(s.status)}];try{return 0===(a=s.data.match(/{[\d\D]+}/)[0]).indexOf('{\\"code\\":')&&(a=JSON.parse('"'.concat(a,'"'))),(c=JSON.parse(a)).protocol=/^https/.test(o)?"https":"http",c.code&&200!==c.code?[2,{code:this.transHttpCode(c.code)}]:(this.runtime.useNavi||(c.server="",c.backupServer=bn.getMiniCmpUrlList().join(","),c.logSwitch=0),[2,{code:V.SUCCESS,data:c}])}catch(t){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,s.data,r)}return[2,{code:V.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.httpRequestV2=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return i=this.getNaviV2RequestOption({appkey:e,token:n,uri:t,platform:this.runtime.tag,protocol:(/^https/.test(t)?exports.EConnectProtocol.WSS:exports.EConnectProtocol.WS).toString()}),this.logger.debug(exports.LogTagId.L_REQUEST_T,"req navi => ".concat(i.url),r),[4,this.runtime.httpReq(i)];case 1:if(200!==(o=u.sent()).status)return this.logger.debug(exports.LogTagId.L_REQUEST_R,"request navi failed: ".concat(o.status),r),[2,{code:this.transHttpCode(o.status)}];try{return s=o.data,(a="object"!=typeof s?JSON.parse(s):s).protocol=/^https/.test(i.url)?"https":"http",this.runtime.useNavi||(a.logSwitch=0,c=bn.getMiniCmpUrlList(),a.serverAddr=c.map((function(t,e){return{addr:t,protocol:/^https/.test(i.url)?exports.EConnectProtocol.WSS:exports.EConnectProtocol.WS,weight:c.length-e}}))),[2,{code:V.SUCCESS,data:a}]}catch(t){this.logger.error(exports.LogTagId.L_PARSE_NAVI_E,o.data,r)}return[2,{code:V.RC_NAVI_REQ_FAILED}]}}))}))},e.prototype.getNaviCache=function(t){if(Yi[t])return Yi[t];var e,n=A.NAVI_KEY(this.appkey),r=this.runtime.localStorage;try{var i=r.getItem(n);e=i?JSON.parse(i):[]}catch(t){e=[]}if(0===e.length)return null;var o=e.find((function(e){return e.token===t}))||null;return Yi[t]=o,o},e.prototype.setNaviCache=function(t,e){var n,r=A.NAVI_KEY(this.appkey),i=this.runtime.localStorage;try{var o=i.getItem(r);n=o?JSON.parse(o):[]}catch(t){n=[]}var s=Date.now();n.length>0&&(n=n.filter((function(e){return s-e.timestamp<T&&t!==e.token})));var a={timestamp:s,naviInfo:e,token:t};n.push(a),i.setItem(r,JSON.stringify(n)),Yi[t]=a},e}(qi),Wi=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=A.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=A.SEND_MSG_KEY(this._appkey,this._userId),r=this._getLocalInfo(n);r[t]=e,this._runtime.localStorage.setItem(n,JSON.stringify(r))},t.prototype.getSendMessageMap=function(){return this._sendMessageMap},t.prototype.removeByUID=function(t){delete this._sendMessageMap[t]},t.prototype.removeByTimestamp=function(t){var e=A.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}();(Di={})[B.PRIVATE]=Ri.qryPMsg,Di[B.GROUP]=Ri.qryGMsg,Di[B.CHATROOM]=Ri.qryCHMsg,Di[B.CUSTOMER_SERVICE]=Ri.qryCMsg,Di[B.SYSTEM]=Ri.qrySMsg;var Qi=[Ri[Ri.recallMsg],Ri[Ri.ppMsgS],Ri[Ri.pgMsgS],Ri[Ri.ppMsgP],Ri[Ri.pgMsgP],Ri[Ri.chatMsg],Ri[Ri.pcMsgP],Ri[Ri.prMsgS],Ri[Ri.updUgRTime],Ri[Ri.pbMsgP]],Ji=function(){function t(t,e,n){this._localStore=new o(t,A.ULTRA_GROUP_STATE_KEY(e,n))}return t.prototype.set=function(t,e,n,r){var i=this._getStoreKey(t,e,r),o=this._localStore.get(i)||{};for(var s in n){var a=Zi[s],c=n[s];if(!jt(a)&&!jt(c))c===Xi[a].defaultVal?delete o[a]:o[a]=c}Qt(o)?this._localStore.set(i,o):this._localStore.remove(i)},t.prototype.get=function(t,e,n){void 0===n&&(n="");var r=this._getStoreKey(t,e,n),i=this._localStore.get(r)||{},o={};for(var s in Xi){var a=Xi[s],c=a.keyName,u=a.defaultVal;o[c]=i[s]||qe(u)}return o},t.prototype._getStoreKey=function(t,e,n){return"".concat(n,"_").concat(t,"_").concat(e)},t}(),Xi={nc:{keyName:"notificationStatus",defaultVal:2},nl:{keyName:"notificationLevel",defaultVal:0}},Zi={};for(var zi in Xi){var $i=Xi[zi].keyName;Zi[$i]=zi}var to,eo=function(){function t(t,e,n){this._store=new Ji(t.runtime,e,n)}return t.prototype.addUltraGroupStatus=function(t){var e=t.conversationType,n=t.targetId,r=t.notificationStatus,i=t.notificationLevel,o=t.channelId;e===B.ULTRA_GROUP&&this._store.set(e,n,{notificationStatus:r,notificationLevel:i},o)},t.prototype.get=function(t,e,n){return void 0===n&&(n=""),this._store.get(t,e,n)},t}(),no="UpStreamMessage",ro="PushExtra",io="DownStreamMessage",oo="DownStreamMessages",so="SessionsAttQryInput",ao="SessionsAttOutput",co="SyncRequestMsg",uo="ChrmPullMsg",lo="NotifyMsg",ho="HistoryMsgInput",po="HistoryMsgOuput",go="RelationQryInput",fo="RelationsOutput",_o="UnreadMsgInfo",Eo="DeleteSessionsInput",To="SessionInfo",Co="DeleteSessionsOutput",vo="RelationsInput",Io="DeleteMsgInput",yo="CleanHisMsgInput",mo="SessionMsgReadInput",Ro="ChrmInput",So="ChrmOutput",Oo="QueryChatRoomInfoInput",No="QueryChatRoomInfoOutput",Lo="GetQNupTokenInput",Mo="GetQNupTokenOutput",Uo="GetQNdownloadUrlInput",Ao="GetDownloadUrlInput",bo="GetQNdownloadUrlOutput",wo="GetDownloadUrlOutput",Po="ChrmKVEntity",xo="SetChrmKV",Do="SetChrmKVS",Vo="DeleteChrmKVS",Go="ChrmKVOutput",Bo="ChrmKVSOutput",ko="ChrmKVSVersionEntity",Fo="ChrmKVSOutputEntity",Ho="QueryChrmKV",Ko="SetUserSettingInput",qo="SetUserSettingOutput",Yo="PullUserSettingInput",jo="PullUserSettingOutput",Wo="UserSettingNotification",Qo="SessionReq",Jo="SessionStates",Xo="SessionState",Zo="SessionStateItem",zo="SessionStateModifyReq",$o="SessionStateModifyResp",ts="GroupUnpushQuery",es="GroupUnpushSet",ns="QryRemindListReq",rs="QryRemindListResp",is="GroupUnpushResult",os="GrpReadReceiptMsg",ss="GrpReadReceiptQryReq",as="GrpReadReceiptQryResp",cs="GrpMsgReadUser",us="SessionTagAddInput",ls="SessionTagItem",hs="SessionTagDelInput",ds="SessionDisTagReq",ps="ReportSDKInput",gs="ReportSDKOutput",fs="UltraGrpPullSes",_s="UltraGrpPullMsg",Es="MsgChangeReq",Ts="QueryMsgChange",Cs="MsgChange",vs="MsgChangeList",Is="MsgQuery",ys="MessageQueryInfo",ms="MsgQueryAck",Rs="OperateStatus",Ss="OperateStatusNotify",Os="OperateInfo",Ns="OperateSummary",Ls="SetRtcRoomIdInput",Ms="SetRtcRoomIdOutput",Us="CallInfoUpStream",As="CallInfoDownStream",bs="KvInput",ws="KvOutput";(to={})[no]=["sessionId","classname","content","pushText","userId","configFlag","clientUniqueId","appData","extraContent","pushExt","busChannel"],to[oo]=["list","syncTime","finished","broadcastSyncTime"],to[io]=["fromUserId","type","groupId","classname","content","dataTime","status","msgId","extraContent","pushContent","configFlag","pushExt","busChannel","extStatus","toUserId","groupUnpush"],to[ro]=["title","templateIdNoUse","pushId","pushConfigs","templateId"],to[so]=["nothing"],to[ao]=["inboxTime","sendboxTime","totalUnreadCount"],to[co]=["syncTime","ispolling","isweb","isPullSend","isKeeping","sendBoxSyncTime","broadcastSyncTime"],to[uo]=["syncTime","count"],to[lo]=["type","time","chrmId"],to[ho]=["targetId","time","count","order","busChannel"],to[po]=["list","syncTime","hasMsg"],to[go]=["type","count","startTime","order"],to[fo]=["info","isFinished"],to[_o]=["msgId","msgTime","remindType","className"],to[Eo]=["sessions"],to[To]=["type","channelId","busChannel"],to[Co]=["nothing"],to[vo]=["type","msg","count","busChannel","startTime","endTime"],to[Io]=["type","conversationId","msgs","busChannel"],to[yo]=["targetId","dataTime","conversationType","busChannel"],to[mo]=["type","msgTime","channelId","busChannel"],to[Ro]=["nothing"],to[So]=["nothing","sessionId","joinTime"],to[Oo]=["count","order"],to[No]=["userTotalNums","userInfos"],to[Lo]=["type","key","httpMethod","queryString","url","ext"],to[Uo]=["type","key","fileName"],to[Ao]=["type","key","fileName","ext"],to[Mo]=["deadline","token","bosToken","bosDate","path","osskeyId","ossPolicy","ossSign","ossBucketName"],to[bo]=["downloadUrl"],to[wo]=["downloadUrl"],to[Po]=["key","value","status","timestamp","uid","version"],to[xo]=["entry","bNotify","notification","type"],to[Do]=["entry","bNotify","notification","type"],to[Vo]=["entry","bNotify","notification","type"],to[Go]=["entries","bFullUpdate","syncTime"],to[Bo]=["timestamp","errorKeys","keysVersion"],to[ko]=["version","key"],to[Fo]=["key","errorCode"],to[Ho]=["timestamp"],to[Ko]=["version","value"],to[qo]=["version","reserve"],to[Yo]=["version","reserve"],to[jo]=["items","version"],to.UserSettingItem=["targetId","type","key","value","version","status","tags"],to[Qo]=["time"],to[Jo]=["version","state"],to[Xo]=["type","channelId","time","stateItem","busChannel"],to[Zo]=["sessionStateType","value","tags"],to[zo]=["version","state"],to[$o]=["version"],to[es]=["busChannel","unpushLevel"],to[ns]=["groupId","busChannel","msgTime","size"],to[ts]=["busChannel"],to[is]=["groupId","busChannel","unpushLevel"],to[os]=["msgId","busChannel"],to[ss]=["msgId","busChannel"],to[as]=["totalMemberNum","list"],to[cs]=["readTime","userId"],to[us]=["version","tags"],to[ls]=["tagId","name","createdTime","isTop"],to[hs]=["version","tags"],to[ds]=["tagId"],to[Wo]=["version","reserve"],to[ps]=["sdkInfo"],to[gs]=["nothing"],to[fs]=["syncTime","isEraseMsgContent"],to[_s]=["syncTime"],to[Es]=["fromUserId","targetId","type","busChannel","msgUID","msgTime","content"],to[Ts]=["syncTime"],to[vs]=["list","syncTime","hasNext"],to[Cs]=["targetId","type","time","changeType","msgUID","msgTime","busChannel","isAdmin","isDel","operatorId","subChangeType","busChannelType","isRemindMe","userGroupIds","remindType"],to[Is]=["targetId","type","query"],to[ys]=["msgTime","msgUID","busChannel"],to[ms]=["list"],to[Rs]=["targetId","type","opType","busChannel"],to[Ss]=["type","notifyType","info","summary"],to[Os]=["targetId","busChannel","userId","opType","optime"],to[Ns]=["targetId","busChannel","count","opType"],to[Ls]=["rtcRoomId"],to[Ms]=["nothing"];var Ps,xs,Ds,Vs,Gs="\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(lo," {\n required int32 type = 1;\n optional int64 time = 2;\n optional string chrmId=3;\n }\n message ").concat(co," {\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(no," {\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(ro," {\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(oo," {\n repeated DownStreamMessage list = 1;\n required int64 syncTime = 2;\n optional bool finished = 3;\n optional int64 broadcastSyncTime = 4;\n }\n message ").concat(io," {\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(w.IMAGE,";\n audio = ").concat(w.AUDIO,";\n video = ").concat(w.VIDEO,";\n file = ").concat(w.FILE,";\n sight = ").concat(w.SIGHT,";\n html = ").concat(w.COMBINE_HTML,";\n }\n message ").concat(Lo," {\n required FileType type = 1;\n optional string key = 2;\n optional string httpMethod = 3;\n optional string queryString = 4;\n optional string url = 5; // url, sdk 设置下载地址\n optional string ext = 6; // 扩展字段,SDK 与 服务自定义字段,格式 json\n }\n message ").concat(Uo," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n }\n message ").concat(Ao," {\n required FileType type = 1;\n required string key = 2;\n optional string fileName = 3;\n optional string ext = 4; // 扩展字段,SDK 与 服务自定义字段,格式 json\n }\n message ").concat(Mo," {\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(bo," {\n required string downloadUrl = 1;\n }\n message ").concat(wo," {\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(Ro," {\n required int32 nothing = 1;\n }\n message ").concat(So," {\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(uo," {\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(go,"\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(vo,"\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(fo,"\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(_o," msgInfo = 10; // 新增 首条未读消息信息,可为空\n optional int32 remindMeCount = 11; //@ 我的未读数\n }\n message ").concat(_o," //未读消息摘要信息\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(ns," // 新增 查询未读@列表入参\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(rs," //查询未读@列表出参\n {\n repeated ").concat(_o," 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(yo,"\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(Oo,"\n {\n required int32 count= 1;\n optional int32 order= 2;\n }\n\n message ").concat(No,"\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(ho,"\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(po,"\n {\n repeated DownStreamMessage list=1;\n required int64 syncTime=2;\n required int32 hasMsg=3;\n }\n message ").concat(so,"{\n required int32 nothing = 1;\n }\n message ").concat(ao,"{\n required int64 inboxTime = 1;\n required int64 sendboxTime = 2;\n required int64 totalUnreadCount = 3;\n }\n message ").concat(mo,"\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(Eo,"\n {\n repeated SessionInfo sessions = 1;\n }\n message ").concat(To,"\n {\n required ChannelType type = 1;\n required string channelId = 2;\n optional string busChannel = 3;//所属会话业务标识\n }\n message ").concat(Co,"\n {\n optional int32 nothing=1;\n }\n message ").concat(Io,"\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(xo," {\n required ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Do," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Vo," {\n repeated ChrmKVEntity entry = 1;\n optional bool bNotify = 2;\n optional UpStreamMessage notification = 3;\n optional ChannelType type = 4;\n }\n message ").concat(Go," {\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(Bo," {\n repeated ChrmKVSOutputEntity errorKeys = 1;\n repeated ChrmKVSVersionEntity keysVersion = 2;\n }\n message ").concat(Fo,"\n {\n optional string key = 1;\n optional int32 errorCode = 2;\n }\n message ").concat(Ho," {\n required int64 timestamp = 1;\n }\n message ").concat(Ko," {\n required int64 version=1;\n required string value=2;\n }\n message ").concat(qo," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(Yo," {\n required int64 version=1;\n optional bool reserve=2;\n }\n message ").concat(jo," {\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(Qo," {\n required int64 time = 1;\n }\n message ").concat(Jo," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(Xo," {\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(Zo," {\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(zo," {\n required int64 version=1;\n repeated SessionState state= 2;\n }\n message ").concat(ts," {\n optional string busChannel = 1;\n }\n message ").concat(es,"{\n optional string busChannel = 1;\n required int32 unpushLevel = 2;\n }\n message ").concat(is," {\n required string groupId = 1;\n optional string busChannel = 2;\n required int32 unpushLevel = 3;\n }\n message ").concat($o," {\n required int64 version=1;\n }\n message ").concat(os," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(ss," {\n repeated string msgId=1; //已读消息ID\n optional string channelId = 2; // 该消息所属会话的业务标识\n }\n message ").concat(as," {\n required int32 totalMemberNum = 1;//群内总人数\n repeated GrpMsgReadUser list = 2;//已读用户列表(list复类型)\n }\n message ").concat(cs," {\n required int64 readTime = 1;//已读时间\n required string userId = 2;//已读用户id\n }\n message ").concat(us," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ls," {\n required string tagId=1;\n optional string name=2;\n optional int64 createdTime=3;\n optional bool isTop=4;\n }\n message ").concat(hs," {\n required int64 version=1;\n repeated SessionTagItem tags=2;\n }\n message ").concat(ds," {\n repeated string tagId=1;\n }\n message ").concat(Wo," {\n required int64 version=1;\n required bool reserve=2;\n }\n message ").concat(ps,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n message ').concat(gs,"\n {\n optional int32 nothing=1; //占位\n }\n message ").concat(fs,"\n {\n required int64 syncTime = 1;//同步时间戳\n optional bool isEraseMsgContent = 2;//拉取会话时,是否屏蔽掉消息内容\n }\n message ").concat(_s,"\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(Es,"\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(Ts," //查询入参\n {\n required int64 syncTime = 1;//同步时间戳\n }\n message ").concat(vs," //应答结果\n {\n repeated MsgChange list = 1; //变更\n required int64 syncTime = 2; //同步时间(用于下次同步入参)\n optional bool hasNext = 3 ;\n }\n message ").concat(Cs," //变更详情\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(Is," //请求\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(ms," //应答\n {\n repeated DownStreamMessage list = 1;//消息\n }\n message ").concat(Rs," //客户端发送\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(Ss," //服务端发送\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(Os," {\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(Ns," {\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(Ls,"\n {\n required string rtcRoomId= 1; //rtc房间ID;\n }\n message ").concat(Ms,"\n {\n required int32 nothing = 1; //用于占位\n }\n message ").concat(Us,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n }\n message ").concat(As,"\n {\n required string key= 1; //业务方法关健字(如:ringCall)\n required string dataContent=2; //业务数据json字符串\n required int64 maxTime=3;//时间戳,这个下行直发的时候带上\n }\n message ").concat(bs,"\n {\n required int64 syncTime = 1; //同步时间戳\n }\n message ").concat(ws,"\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"),Bs=function(t,e,n,r,i,o){var s=i?Object.keys(i).map((function(e){return t.encode(Be.RtcValueInfo,{key:e,value:i[e]},!0)})):void 0,a=o?Object.keys(o).map((function(e){return t.encode(Be.RtcValueInfo,{key:e,value:o[e]},!0)})):void 0;return t.encode(Be.RtcInput,{roomType:e,broadcastType:n,joinType:r,innerDatas:s,outerDatas:a})},ks=function(t,e){var n=t.decode(Be.RtcUserListOutput,e),r=n.users,i=n.token,o=n.sessionId,s=n.roomInfo,a=n.entries,c=n.offlineKickTime,u={};return ke(r,(function(t){var e=t.userId,n=t.userData,r={};ke(n,(function(t){var e=t.key,n=t.value;r[e]=n})),u[e]=r})),{users:u,token:i,sessionId:o,roomInfo:s,kvEntries:a,offlineKickTime:c}};!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"}(Ps||(Ps={})),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"}(xs||(xs={}));var Fs,Hs=((Ds={})[xs.OTHER_DEVICE_LOGIN]=V.RC_DISCONN_KICK,Ds[xs.BLOCK]=V.RC_DISCONN_EXCEPTION,Ds[xs.BLOCK_NEW]=V.RC_DISCONN_EXCEPTION,Ds[xs.REDIRECT_NEW]=V.RC_CONN_REDIRECTED,Ds[xs.TOKEN_EXPIRED]=V.RC_CONN_TOKEN_EXPIRED,Ds[xs.ILLEGAL_PROTOCOL_VERSION]=V.RC_CONN_PROTO_VERSION_ERROR,Ds[xs.ACCOUNT_CANCELLATION]=V.RC_ACCOUNT_CANCELLATION,Ds),Ks=((Vs={})[Ps.ACCEPTED]=V.SUCCESS,Vs[Ps.UNACCEPTABLE_PROTOCOL_VERSION]=V.RC_CONN_PROTO_VERSION_ERROR,Vs[Ps.IDENTIFIER_REJECTED]=V.RC_CONN_IDENTIFIER_REJECTED,Vs[Ps.SERVER_UNAVAILABLE]=V.RC_CONN_SERVER_UNAVAILABLE,Vs[Ps.TOKEN_INCORRECT]=V.RC_CONN_TOKEN_INCORRECT,Vs[Ps.NOT_AUTHORIZED]=V.RC_CONN_NOT_AUTHRORIZED,Vs[Ps.REDIRECT]=V.RC_CONN_REDIRECTED,Vs[Ps.PACKAGE_ERROR]=V.RC_CONN_PACKAGE_NAME_INVALID,Vs[Ps.APP_BLOCK_OR_DELETE]=V.RC_CONN_APP_BLOCKED_OR_DELETED,Vs[Ps.BLOCK]=V.RC_CONN_USER_BLOCKED,Vs[Ps.TOKEN_EXPIRE]=V.RC_CONN_TOKEN_EXPIRED,Vs[Ps.DEVICE_ERROR]=V.RC_CONN_DEVICE_ERROR,Vs[Ps.HOSTNAME_ERROR]=V.RC_CONN_HOSTNAME_ERROR,Vs[Ps.HASOHTERSAMECLIENTONLINE]=V.RC_DISCONN_SAME_CLIENT_ON_LINE,Vs[Ps.OUT_OF_LIMIT]=V.RC_LISCENSE_COUNT_OUT_OF_LIMIT,Vs[Ps.IN_OTHER_CLUSTER]=V.RC_CONN_WRONG_CLUSTER,Vs[Ps.APP_AUTH_NOT_PASS]=V.RC_APP_AUTH_NOT_PASS,Vs[Ps.OTP_USED]=V.RC_OTP_USED,Vs[Ps.PLATFORM_ERROR]=V.RC_PLATFORM_ERROR,Vs[Ps.ACCOUNT_CANCELLATION]=V.RC_ACCOUNT_CANCELLATION,Vs[Ps.LICENSE_EXPIRED]=V.RC_LICENSE_EXPIRED,Vs),qs=function(t){return t===V.RC_CONN_REDIRECTED};exports.RCConnectionStatus=void 0,(Fs=exports.RCConnectionStatus||(exports.RCConnectionStatus={}))[Fs.CONNECTED=0]="CONNECTED",Fs[Fs.CONNECTING=1]="CONNECTING",Fs[Fs.DISCONNECTED=2]="DISCONNECTED",Fs[Fs.SUSPENDED=3]="SUSPENDED";var Ys,js=function(){function t(t,e,n,r,i){this.appkey=t,this.navi=e,this.logger=n,this.statisticLog=r,this.listener=i,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:exports.NetworkType.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=exports.RCConnectionStatus.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!==exports.RCConnectionStatus.CONNECTED&&t!==exports.RCConnectionStatus.CONNECTING){var n={bid:Ue(),cod:e,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.statisticLog.__statistics(exports.StatisticsTag.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(t){case exports.RCConnectionStatus.CONNECTED:this.logger.info(exports.LogTagId.L_CONNECT_S,t),this.checkAlive(),this.listener.onConnected();break;case exports.RCConnectionStatus.CONNECTING:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),this.listener.onConnecting();break;case exports.RCConnectionStatus.SUSPENDED:this.logger.warn(exports.LogTagId.L_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),qs(e)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(e);break;default:this.logger.warn(exports.LogTagId.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(exports.StatisticsTag.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=t},t.prototype.getNetwork=function(){return this._network},t.prototype.connect=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._crtConnectionStatus===exports.RCConnectionStatus.CONNECTED?[2,{code:V.SUCCESS,data:this._crtUserId}]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=ne(),this.token=t,this.reconnectKick=e,this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:exports.ConnectReason.CONNECT,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(i),r),[4,this.try2Connect(t,e,!1,r)]);case 1:return o=c.sent(),s=o.code,a=o.data,s!==V.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,s),[2,{code:s}]):(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2,{code:s,data:a}])}}))}))},t.prototype.try2Connect=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,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,r),[4,this._crtConnectionTask]);case 1:return i=a.sent(),o=i.code,s=i.data,this._crtConnectionTask=null,[2,{code:o,data:s}]}}))}))},t.prototype.createConnectionTask=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return i={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(t,n,!1,r,i)];case 1:return o=l.sent(),s=o.code,a=o.data,s!==V.SUCCESS?[2,{code:s}]:1===(c=a).type?[2,{code:V.PACKAGE_ENVIRONMENT_ERROR}]:(this.logger.info(exports.LogTagId.L_CONNECT_T,JSON.stringify({token:t,reconnectKickEnable:e}),r),[4,this.connectWithToken(t.replace(/@.+$/,"@"),c,e,r)]);case 2:return u=l.sent(),h=u.code,d=u.data,qs(h)?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"redirect code: ".concat(h),r),this.clearCmpWeightCache(),[2,this.createConnectionTask(t,e,!0,r)]):[V.RC_TCP_RESET,V.RC_CONN_ACK_TIMEOUT,V.RC_TCP_DISCONNECTED_NO_RMTP].includes(h)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),this.logger.warn(exports.LogTagId.L_CONNECT_R,"cmp ack timeout, code: ".concat(h),r),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,h),this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING),[2,this.createConnectionTask(t,e,!1,r)]):h!==V.SUCCESS?(this.logger.warn(exports.LogTagId.L_CONNECT_R,"code: ".concat(h),r),[2,{code:h}]):(this.logger.info(exports.LogTagId.L_CONNECT_R,"userId: ".concat(d),r),this._connectDurSwitch=!0,this._crtUserId=d,[2,{code:h,data:d}])}}))}))},t.prototype.setReconnectReason=function(t){switch(t){case V.TIMEOUT:return void(this.reason=exports.ConnectReason.TIMEOUT);case V.RC_CONN_REDIRECTED:return void(this.reason=exports.ConnectReason.REDIRECTED);default:this.reason=exports.ConnectReason.RECONNECT}},t.prototype.try2Reconnect=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i=this;return l(this,(function(o){return n=this.logger.createTraceId(),this.logger.debug(exports.LogTagId.T,"try2Reconnect -> ignoreNaviCache: ".concat(t,", reason: ").concat(e),n),this.stopReconnectTimer(),r=function(){return u(i,void 0,void 0,(function(){var i,o;return l(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.SUSPENDED?[2]:(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTING,e),this.setReconnectReason(e),this.retryCount+=1,i={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.statisticLog.__statistics(exports.StatisticsTag.IM_STATS_CS,JSON.stringify(i)),[4,this.try2Connect(this.token,!0,t,n)]);case 1:return o=s.sent().code,this.reconnectTimer=null,o===V.SUCCESS?(this.setConnectionStatus(exports.RCConnectionStatus.CONNECTED),[2]):[V.SERVER_UNAVAILABLE,V.TIMEOUT,V.RC_SOCKET_DISCONNECTED,V.RC_SOCKET_NOT_CREATED,V.RC_CONN_ACK_TIMEOUT,V.RC_TCP_RESET,V.RC_NAVI_REQ_FAILED,V.RC_NETWORK_DOWN].includes(o)?(this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTING||(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,o),this.reconnectTimer=setTimeout(r,5e3)),[2]):(this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,o),[2])}}))}))},r(),[2]}))}))},t.prototype.onDisconnectByServer=function(t,e){var n=this;return qs(t)?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,t),void this.try2Reconnect(!0,t)):t===V.RC_UDP_DISCONNECTED?(this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,t),void setTimeout((function(){n.try2Reconnect(!0,t)}),1e3*(e||0))):void this.setConnectionStatus(exports.RCConnectionStatus.DISCONNECTED,t)},t.prototype.onDisconenctUnusual=function(t){this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,t),this.try2Reconnect(!1,t)},t.prototype.checkAlive=function(){return u(this,void 0,void 0,(function(){var t,e,n=this;return l(this,(function(r){switch(r.label){case 0:return this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?(this._failedCount=0,this.logger.debug(exports.LogTagId.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(t=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_T,null,t),[4,this.sendPing(15e3)]);case 1:return(e=r.sent())===V.SUCCESS?(this.logger.info(exports.LogTagId.L_CHECK_ALIVE_IM_R,e,t),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==exports.RCConnectionStatus.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(exports.LogTagId.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(exports.LogTagId.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(exports.RCConnectionStatus.SUSPENDED,V.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,V.RC_PING_EXCEED_LIMIT),[2]))}}))}))},t.prototype.disconnect=function(t){return u(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(exports.RCConnectionStatus.DISCONNECTED,V.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,r=t.backupServer,i=t.serverAddr,o=t.protocol,s=t.openTLS;if(i)return this.cmpWeightCache=h([],i,!0),h([],i,!0);var a=[],c=[];return n&&c.push(n),null==r||r.split(",").forEach((function(t){c.indexOf(t)<0&&c.push(t)})),c.forEach((function(t,r){var i;i=e?1===s?exports.EConnectProtocol.TLS:exports.EConnectProtocol.RMTP:"http"===o?exports.EConnectProtocol.WS:exports.EConnectProtocol.WSS,a.push({addr:t,protocol:i,weight:n.length-r,race:!1})})),this.cmpWeightCache=a,h([],a,!0)},t.prototype.updateCmpWeight=function(t,e,n){if(this.cmpWeightCache){var r=this.cmpWeightCache.find((function(e){return n?e.addr===t&&e.protocol===exports.EConnectProtocol.QUIC:e.addr===t}));if(r)if(e){var i=Math.max.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));r.weight!==i&&(r.weight=i+1)}else{var o=Math.min.apply(Math,this.cmpWeightCache.map((function(t){return t.weight})));r.weight!==o&&(r.weight=o-1)}}},t.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},t}(),Ws=function(){function t(e){this.logger=e,this._codec=t.createPBCodec()}return t.createPBCodec=function(){var t=Rn(Gs);return t.getModule=function(e){var n=new t[e];return n.getArrayData=function(){var t=n.toArrayBuffer();return t=Ht(t)?[].slice.call(new Int8Array(t)):t},n},t},t.prototype.decodeByPBName=function(t,e,n){var r,i=this,o=t,s=((r={})[oo]=i._formatSyncMessages,r[io]=i._formatReceivedMessage,r[no]=i._formatSentMessage,r[po]=i._formatHistoryMessages,r[fo]=i._formatConversationList,r[No]=i._formatChatRoomInfos,r[Go]=i._formatChatRoomKVList,r[jo]=i._formatUserSetting,r[Jo]=i._formatConversationStatus,r[as]=i._formatGrpReadReceiptQryResp,r[qo]=i._formatSetUserSettingOutput,r[Wo]=i._formatUserSettingNotification,r[vs]=i._formatUltraMsgChangeList,r[Ss]=i._formatUltraOperateStatusNotifyList,r[ms]=i._formatUltraMsgList,r[rs]=i._formatUltraGroupUnreadMentionedList,r[So]=i._formatChrmKVVersion,r[ws]=i._formatCallKVInfo,r[As]=i._fromatCallInfoDownStream,r)[e];try{o=t.length>0&&i._codec[e].decode(t),qt(o)&&(o=function(t){for(var e in t)qt(t[e])&&(t[e]=me(t[e]));return t}(o)),Yt(s)&&(o=s.call(this,o,n))}catch(t){this.logger.error(exports.LogTagId.L_PB_DECODE_E,e)}return o},t.prototype._readBytes=function(t){var e=t.offset,n=t.buffer,r=t.limit;if(e)try{var i=Ht(n)?new Uint8Array(n):n;return ii.readUTF(i.subarray(e,r))}catch(t){this.logger.error(exports.LogTagId.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(exports.LogTagId.O,null==t?void 0:t.stack)}return e||t},t.prototype._formatSyncMessages=function(t,e){e=e||{};var n=this,r=t.list,i=t.syncTime,o=t.finished;return(jt(o)||null===o)&&(t.finished=!0),t.syncTime=me(i),t.list=Fe(r,(function(t){return n._formatReceivedMessage(t,e)})),t},t.prototype._getUtfContent=function(t){if(t.user){var e=t.user,n=e.portrait,r=e.portraitUri,i=n||r;i&&(t.user.portrait=t.user.portraitUri=i)}return t},t.prototype._setExpansion=function(t){var e;return t&&(e=function(t){var e={},n=JSON.parse(t);return ke(n,(function(t,n){e[n]=t.v})),e}(t)),e},t.prototype._setPushConfig=function(t,e){var n=t.pushContent,r=t.pushExt,i=t.configFlag,o={};return r&&(o=Oe(e,r.pushConfigs,r.pushId)),c(c({},o),{pushTitle:null==r?void 0:r.title,pushContent:n,pushData:"",disablePushTitle:!!i&&Boolean(4&i),forceShowDetailContent:!!i&&Boolean(8&i),templateId:null==r?void 0:r.templateId})},t.prototype._formatReceivedMessage=function(t,e){if(!t)return t;var r=this,i=e||{},o=i.currentUserId,s=i.connectedTime,a=t.content,c=t.fromUserId,u=t.type,l=t.groupId,h=t.status,d=t.dataTime,p=t.extraContent,g=t.configFlag,f=t.extStatus,_=t.clientUniqueId,E=t.busChannel,T=t.msgId,C=t.classname,v=t.direction||x.RECEIVE,I=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),y=I.isPersited,m=I.isCounted,R=I.isMentioned,S=I.disableNotification,O=I.receivedStatus,N=I.canIncludeExpansion,L=!!(2&(f||0)),M=!!(4&(f||0)),U=!!(8&(f||0))?exports.UltraGroupChannelType.PRIVATE:exports.UltraGroupChannelType.PUBLIC,A=[B.GROUP,B.CHATROOM,B.RTC_ROOM,B.ULTRA_GROUP].indexOf(u)>-1?l:c,b=c,w=x.RECEIVE;v===x.SEND&&(b=o,w=x.SEND);var P=me(d),D=P<s,V=u===B.CHATROOM,G=r._setExpansion(p),k=r._formatBytes(a);k=r._getUtfContent(k);var F=r._setPushConfig(t,this.logger);V&&c===o&&(w=x.SEND);var H={conversationType:u,targetId:A,senderUserId:b,messageType:C,messageUId:T,isPersited:y,isCounted:m,isMentioned:R,sentTime:P,messageDirection:w,receivedTime:Je.getTime(),disableNotification:S,receivedStatus:O,canIncludeExpansion:N,content:k,expansion:G,configFlag:g,pushConfig:F,channelId:E||"",isInterrupt:L,isModifyMessage:M,messageId:me(_)||0,sentStatus:exports.SentStatus.SENT};return u!==B.ULTRA_GROUP?(H.isOffLineMessage=D,H):(H.channelType=U,H)},t.prototype._formatSentMessage=function(t,e){var n=this,r=t.content,i=t.classname,o=t.sessionId,s=t.msgId,a=t.extraContent,u=t.pushExt,l=t.pushContent,h=t.configFlag,d=t.extStatus,p=t.clientUniqueId,g=t.systemId,f=e.signal,_=e.currentUserId,E=f.date,T=f.topic,C=f.targetId,v=!!(2&(d||0)),I=function(t){return{isPersited:!!(1&t),isCounted:!!(2&t),disableNotification:!!(32&t),canIncludeExpansion:!!(64&t)}}(o),y=I.isPersited,m=I.isCounted,R=I.disableNotification,S=I.canIncludeExpansion,O=Qr[T]||B.PRIVATE,N=Ke(Lr,T),L=n._formatBytes(r),M=g||C;i===K.RECALL&&(O=L.conversationType||O,M=L.targetId||C);var U=n._setExpansion(a),A=n._setPushConfig(t,this.logger),b=c(c({},A),{pushTitle:null==u?void 0:u.title,pushContent:l,pushData:l,disablePushTitle:!!h&&Boolean(4&h),forceShowDetailContent:!!h&&Boolean(8&h),templateId:null==u?void 0:u.templateId});return{conversationType:O,targetId:M,messageType:i,messageUId:s,isPersited:y,isCounted:m,isStatusMessage:N,senderUserId:_,content:n._formatBytes(r),sentTime:1e3*E,receivedTime:Je.getTime(),messageDirection:x.SEND,isOffLineMessage:!1,disableNotification:R,canIncludeExpansion:S,expansion:U,pushConfig:b,channelId:t.busChannel||"",isInterrupt:v,messageId:me(p)||0}},t.prototype._formatHistoryMessages=function(t,e){var n=this,r=e.conversation||{},i=t.list,o=t.hasMsg,s=r.targetId,a=me(t.syncTime),c=[];return ke(i,(function(t){var i=n._formatReceivedMessage(t,e);r.conversationType===B.ULTRA_GROUP?i.targetId=t.groupId||r.targetId:i.targetId=s,c.push(i)}),{isReverse:!0}),{syncTime:a,list:c,hasMore:!!o}},t.prototype._formatUltraMsgChangeList=function(t){var e=t.list,n=t.syncTime,r=t.hasNext;return{syncTime:n,list:e&&e.map((function(t){var e=t.targetId,n=t.type,r=t.time,i=t.changeType,o=t.msgUID,s=t.msgTime,a=t.busChannel,c=t.isAdmin,u=t.isDel,l=t.operatorId,h=t.subChangeType,d=t.userGroupIds,p=t.busChannelType,g=t.remindType;return{targetId:e,conversationType:n,changeType:i,messageUId:o,changeTime:me(r),sendTime:me(s),channelId:a||"",isAdmin:c,isDel:u,operatorId:l,subChangeType:h,userGroupIds:d,busChannelType:p,mentionedType:g}})),hasNext:r}},t.prototype._formatUltraOperateStatusNotifyList=function(t){var e=t.type,n=t.notifyType,r=t.info,i=t.summary,o=[],s=[],a=2==(2&n),c=1==(1&n);return c&&Array.isArray(r)&&r.forEach((function(t){var e=t.targetId,n=t.busChannel,r=t.userId,i=t.opType,s=t.optime,a=me(s);o.push({targetId:e,channelId:n,userId:r,operationType:i,operationTime:a})})),a&&Array.isArray(i)&&i.forEach((function(t){var e=t.targetId,n=t.busChannel,r=t.count,i=t.opType;s.push({targetId:e,channelId:n,count:r,operationType:i})})),{conversationType:e,info:o,summary:s,hasInfo:c,hasSummary:a}},t.prototype._formatUltraMsgList=function(t,e){var n=this,r=t.list;return{list:r&&r.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:me(t.msgTime),mentionedType:t.remindType,messageType:t.className||""}}))},t.prototype._getUltraGroupConversationInfo=function(t,e){var n=e.versionTime,r=e.unreadCount,i=e.remindCount,o=e.busChannelType,s=e.msgInfo,a=e.remindMeCount;return t.versionTime=me(n)||0,t.unreadMessageCount=this._getUnreadCount(me(r)||0),t.unreadMentionedCount=this._getUnreadCount(me(i)||0),t.unreadMentionedMeCount=this._getUnreadCount(me(a)||0),t.channelType=o||exports.UltraGroupChannelType.PUBLIC,t.lastReadTime=0,s&&(t.firstUnreadMessage={sentTime:me(s.msgTime)},t.lastReadTime=me(s.msgTime)-1),t},t.prototype._getUnreadCount=function(t){return t>999?999:t},t.prototype._formatConversationList=function(t,e){var n=this,r=this,i=t.info,o=e.afterDecode,s={list:(i=Fe(i,(function(t){var i=t.msg,s=t.userId,a=t.type,c=t.unreadCount,u=t.busChannel,l=null;i&&((l=r._formatReceivedMessage(i,e)).targetId=s);var h={targetId:s,conversationType:a,unreadMessageCount:me(c)||0,latestMessage:l||{},channelId:u||""};return a===B.ULTRA_GROUP&&(h=n._getUltraGroupConversationInfo(h,t)),(null==o?void 0:o(h))||h})))||[]};return((null==e?void 0:e.conversationType)||B.NONE)===B.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:Fe(n,(function(t){var e=t.id,n=t.time;return{id:e,time:me(n)}}))}},t.prototype._formatChatRoomKVList=function(t){var e=t.entries,n=t.bFullUpdate,r=t.syncTime;return e=Fe(e=e||[],(function(t){var e=t.key,n=t.value,r=t.status,i=t.timestamp,o=t.uid,s=t.version,a=function(t){return{isAutoDelete:!!(1&t),isOverwrite:!!(2&t),type:4&t?rt.DELETE:rt.UPDATE}}(r);return{key:e,value:n,isAutoDelete:a.isAutoDelete,isOverwrite:a.isOverwrite,type:a.type,userId:o,timestamp:me(i),version:me(s)}})),{kvEntries:e,isFullUpdate:n,syncTime:r}},t.prototype._formatUserSetting=function(t){var e=this,n=t.items,r=t.version,i={};return ke(n||[],(function(t){var n=t.key,r=t.version,o=t.value;t.version=me(r),t.value=e._readBytes(o),"Tag"===n&&t.tags.forEach((function(t){t.createdTime=me(t.createdTime),t.tagName=t.name})),i[n]=t})),{settings:i,version:r}},t.prototype._formatConversationStatus=function(t){var e=t.state,n=[];return ke(e,(function(t){var e=t.type,r=t.channelId,i=t.time,o=t.stateItem,s=t.busChannel,a=Y.CLOSE,c=W.NOT_SET,u=!1,l=[];ke(o,(function(t){var e=t.sessionStateType,n=t.value,r=t.tags;switch(e){case $r:a=n===Zr?Y.OPEN:Y.CLOSE,c=Number(n)||W.NOT_SET;break;case ti:u=n===Zr;break;case ei:l=r}})),n.push({conversationType:e,type:e,targetId:r,notificationStatus:a,notificationLevel:c,isTop:u,updatedTime:me(i),tags:l,channelId:s||""})})),n},t.prototype._formatGrpReadReceiptQryResp=function(t){var e=t.totalMemberNum,n=t.list;return n.forEach((function(t){t.readTime=me(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,r=t.memberCount,i=t.chatroomBanState;return{joinTime:e,createTime:n||0,memberCount:r||0,isAllChatroomBanned:!!(1&i),isCurrentUserBanned:!!(2&i),isCurrentChatroomBanned:!!(4&i),isCurrentChatroomInWhitelist:!!(1&t.whiteListState)}},t.prototype._formatRTCJoinedUserInfo=function(t){return(t.info||[]).map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:me(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(so);return t.setNothing(1),t.getArrayData()},t.prototype._updateMentionedInfo=function(t,e,n){var r,i,o;return{userIdList:(null===(r=t.mentionedInfo)||void 0===r?void 0:r.userIdList)||e,type:(null===(i=t.mentionedInfo)||void 0===i?void 0:i.type)||n||J.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,r=t.pushConfig||{},i=0;return i|=n?1:0,i|=e?2:0,i|=r.disablePushTitle?4:0,i|=r.forceShowDetailContent?8:0},t.prototype._getPushExtraModule=function(t){var e=t.pushTitle,n=t.iOSConfig,r=t.androidConfig,i=t.templateId,o=void 0===i?"":i,s=this._codec.getModule(ro);if(e&&s.setTitle(e),n||r){var a=Se(n,r);s.setPushConfigs(a)}return(null==r?void 0:r.notificationId)&&s.setPushId(null==r?void 0:r.notificationId),s.setTemplateId(o),s},t.prototype._getUpMsgModule=function(t,e){var n=e.messageType,r=e.isMentioned,i=e.mentionedType,o=e.content,s=e.directionalUserIdList,a=e.canIncludeExpansion,c=e.expansion,u=e.pushConfig,l=e.channelId,h=e.pushData,d=void 0===h?"":h,p=e.mentionedUserIdList,g=void 0===p?[]:p,f=e.pushContent,_=void 0===f?"":f,E=e.messageId,T=void 0===E?0:E,C=t.conversationType,v=t.targetId,I=this._codec.getModule(no),y=function(t){var e=t.isStatusMessage,n=t.isPersited,r=t.isCounted;e&&(n=r=!1);var i=0;return n&&(i|=1),r&&(i|=2),t.isMentioned&&(i|=4),t.disableNotification&&(i|=32),t.canIncludeExpansion&&(i|=64),i}(e),m=u||{},R=m.pushContent,S=void 0===R?_:R,O=m.pushData,N=void 0===O?d:O;I.setSessionId(y),r&&o&&(o.mentionedInfo=this._updateMentionedInfo(o,g,i)),S&&I.setPushText(S),N&&I.setAppData(N),s&&I.setUserId(s);var L=this._calculateFlag(e);if(I.setConfigFlag(L),I.setClassname(n),o.user&&o.user.portraitUri&&(o.user.portrait=o.user.portraitUri),I.setContent(JSON.stringify(o)),a&&c){var M={};ke(c,(function(t,e){M[e]={v:t}})),I.setExtraContent(JSON.stringify(M))}if(u){var U=this._getPushExtraModule(u);I.setPushExt(U)}return I.setClientUniqueId(T),jt(l)||I.setBusChannel(l),C===B.SYSTEM&&I.setSystemId(v),I},t.prototype.encodeUpMsg=function(t,e){return this._getUpMsgModule(t,e).getArrayData()},t.prototype.encodeSyncMsg=function(t){var e=t.sendboxTime,n=t.inboxTime,r=t.broadcastSyncTime,i=this._codec.getModule(co);return i.setIspolling(!1),i.setIsPullSend(!0),i.setSendBoxSyncTime(e),i.setSyncTime(n),i.setBroadcastSyncTime(r),i.getArrayData()},t.prototype.encodeChrmSyncMsg=function(t,e){t=t||0,e=e||0;var n=this._codec.getModule(uo);return n.setCount(e),n.setSyncTime(t),n.getArrayData()},t.prototype.encodeGetHistoryMsg=function(t,e){var n=e.count,r=e.order,i=e.timestamp,o=e.channelId,s=this._codec.getModule(ho);return s.setTargetId(t),s.setTime(i),s.setCount(n),s.setOrder(r),s.setBusChannel(o||""),s.getArrayData()},t.prototype.encodeSuperSyncMsg=function(t){var e=this._codec.getModule(_s);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeGetConversationList=function(t){var e=(t=t||{}).count,n=t.startTime,r=this._codec.getModule(go);return r.setType(1),r.setCount(e),r.setStartTime(n),r.getArrayData()},t.prototype.encodeOldConversationList=function(t){var e=(t=t||{}).count,n=t.type,r=t.startTime,i=t.order;e=e||0,r=r||0,i=i||0;var o=this._codec.getModule(go);return o.setType(n),o.setCount(e),o.setStartTime(r),o.setOrder(i),o.getArrayData()},t.prototype.encodeRemoveOldConversationList=function(t){var e=(t=t||{}).conversationType,n=t.channelId,r=this._codec.getModule(vo);return r.setType(e),n&&r.setBusChannel([n]),r.getArrayData()},t.prototype.encodeRemoveConversationList=function(t){var e=this,n=this._codec.getModule(Eo),r=[];return ke(t,(function(t){var n=t.conversationType,i=t.targetId,o=e._codec.getModule(To);o.setType(n),o.setChannelId(i),r.push(o)})),n.setSessions(r),n.getArrayData()},t.prototype.encodeDeleteMessages=function(t,e,n,r){var i=this._codec.getModule(Io),o=[];return ke(n,(function(t){o.push({msgId:t.messageUId,msgDataTime:t.sentTime,direct:t.messageDirection})})),i.setType(t),i.setConversationId(e),i.setMsgs(o),i.setBusChannel(r),i.getArrayData()},t.prototype.encodeClearMessages=function(t,e,n,r){var i=this._codec.getModule(yo);return e=e||(new Date).getTime(),i.setDataTime(e),i.setTargetId(t),i.setBusChannel(n),i.setConversationType(r),i.getArrayData()},t.prototype.encodeClearUnreadCount=function(t,e){var n=t.conversationType,r=t.targetId,i=t.channelId,o=e.timestamp,s=this._codec.getModule(mo);return o=o||+new Date,s.setType(n),s.setChannelId(r),s.setMsgTime(o),s.setBusChannel(i),s.getArrayData()},t.prototype.encodeExpandUltraMessage=function(t,e){var n=t.targetId,r=t.conversationType,i=t.channelId,o=t.messageUId,s=t.sendTime,a=t.keys,c={mid:o,put:t.expansion,del:a,clear:t.removeAll?1:0},u=this._codec.getModule(Es);return u.setFromUserId(e),u.setTargetId(n),u.setType(r),u.setBusChannel(i||""),u.setMsgUID(o),u.setMsgTime(s),u.setContent(JSON.stringify(c)),u.getArrayData()},t.prototype.encodemodifyMessage=function(t,e){var n=t.targetId,r=t.conversationType,i=t.channelId,o=t.messageUId,s=t.sendTime,a=t.content,c=this._codec.getModule(Es);return c.setFromUserId(e),c.setTargetId(n),c.setType(r),c.setBusChannel(i||""),c.setMsgUID(o),c.setMsgTime(s),c.setContent(JSON.stringify(a)),c.getArrayData()},t.prototype.encodeQueryMsgChange=function(t){var e=this._codec.getModule(Ts);return e.setSyncTime(t),e.getArrayData()},t.prototype.encodeMsgQuery=function(t){var e=t.targetId,n=t.conversationType,r=t.messages,i=this._codec.getModule(Is),o=r.map((function(t){return{msgTime:t.sendTime,msgUID:t.messageUId,busChannel:t.channelId}}));return i.setTargetId(e),i.setType(n),i.setQuery(o),i.getArrayData()},t.prototype.encodeUnreadMentionedMsgQuery=function(t){var e=t.targetId,n=t.channelId,r=t.sentTime,i=t.count,o=this._codec.getModule(ns);return o.setGroupId(e),o.setBusChannel(n),o.setMsgTime(r),o.setSize(i),o.getArrayData()},t.prototype.encodeOperateStatus=function(t,e,n,r){var i=this._codec.getModule(Rs);return i.setTargetId(t),i.setType(e),i.setBusChannel(n),i.setOpType(r),i.getArrayData()},t.prototype.encodeJoinOrQuitChatRoom=function(){var t=this._codec.getModule(Ro);return t.setNothing(1),t.getArrayData()},t.prototype.encodeGetChatRoomInfo=function(t,e){var n=this._codec.getModule(Oo);return n.setCount(t),n.setOrder(e),n.getArrayData()},t.prototype.encodeSetUltraGroupDefaultNotificationLevel=function(t,e){var n=this._codec.getModule(es);return n.setUnpushLevel(t),n.setBusChannel(e),n.getArrayData()},t.prototype.encodeGetUltraGroupDefaultNotificationLevel=function(t){var e=this._codec.getModule(ts);return e.setBusChannel(t),e.getArrayData()},t.prototype.encodeGetFileToken=function(t,e,n,r,i,o){var s=this._codec.getModule(Lo);return s.setType(t),s.setKey(e),s.setHttpMethod(n),s.setQueryString(r),s.setUrl(i),s.getArrayData()},t.prototype.encodeGetFileUrl=function(t,e,n,r,i){var o=this._codec.getModule(t);return o.setType(e),o.setKey(n),r&&o.setFileName(r),o.getArrayData()},t.prototype.encodeModifyChatRoomKV=function(t,e,n){var r=this._codec.getModule(xo),i=e.key,o=e.value,s=e.notificationExtra,a=e.isSendNotification,c=e.type,u=e.timestamp,l=c||rt.UPDATE,h=Xe(e,l),d={key:i,value:o||"",uid:n,version:u};if(jt(h)||(d.status=h),r.setEntry(d),a){var p={conversationType:B.CHATROOM,targetId:t},g={key:i,value:o,extra:s,type:l},f=this._getUpMsgModule(p,{messageType:K.CHRM_KV_NOTIFY,content:g,isPersited:!1,isCounted:!1});r.setNotification(f),r.setBNotify(!0),r.setType(B.CHATROOM)}return r.getArrayData()},t.prototype.encodeModifyChatRoomKVS=function(t,e,n){var r=this._codec.getModule(Do),i=e.entries,o=e.type||rt.UPDATE,s=Xe(e,o),a=[];return i.forEach((function(t){var e={key:t.key,value:t.value||"",uid:n,version:t.timestamp};jt(s)||(e.status=s),a.push(e)})),r.setEntry(a),r.getArrayData()},t.prototype.encodePullChatRoomKV=function(t){var e=this._codec.getModule(Ho);return e.setTimestamp(t),e.getArrayData()},t.prototype.encodePullUserSetting=function(t){var e=this._codec.getModule(Yo);return e.setVersion(t),e.getArrayData()},t.prototype.encodeGetConversationStatus=function(t){var e=this._codec.getModule(Qo);return e.setTime(t),e.getArrayData()},t.prototype.encodeSetConversationStatus=function(t,e){var n=this,r=this._codec.getModule(zo),i=Je.getTime(),o=[];return ke(t,(function(t){var e=n._codec.getModule(Xo),r=t.conversationType,s=t.targetId,a=t.notificationStatus,c=t.isTop,u=t.channelId,l=t.notificationLevel,h=[];e.setType(r),e.setChannelId(s),e.setTime(i),e.setBusChannel(u);var d=a===Y.OPEN,p={};jt(a)||(p[$r]=d),jt(l)||(p[$r]=l),jt(c)||(p[ti]=c),ke(p,(function(t,e){if(!jt(t)){var r=n._codec.getModule(Zo);t=t?Zr:zr,jt(l)||Number(e)!==$r||(t=String(l)),r.setSessionStateType(Number(e)),r.setValue(t),h.push(r)}})),e.setStateItem(h),o.push(e)})),r.setVersion(e||i),r.setState(o),r.getArrayData()},t.prototype.encodeReadReceipt=function(t,e){var n=this._codec.getModule(os);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeCreateTag=function(t,e){var n=this,r=this._codec.getModule(us),i=[];return t.forEach((function(t){var e=n._codec.getModule(ls);e.setTagId(t.tagId),e.setName(t.tagName),i.push(e)})),r.setTags(i),r.setVersion(e),r.getArrayData()},t.prototype.encodeMessageReader=function(t,e){var n=this._codec.getModule(os);return n.setMsgId(t),e&&n.setChannelId(e),n.getArrayData()},t.prototype.encodeRemoveTag=function(t,e){var n=this,r=this._codec.getModule(hs),i=[];return t.forEach((function(t){var e=n._codec.getModule(ls);e.setTagId(t),i.push(e)})),r.setTags(i),r.setVersion(e),r.getArrayData()},t.prototype.encodeDisConversationTag=function(t){var e=this._codec.getModule(ds);return e.setTagId(t),e.getArrayData()},t.prototype.encodeUpdateConversationTag=function(t,e){var n=this,r=this._codec.getModule(zo),i=[];return e.forEach((function(e){var r=n._codec.getModule(Xo),o=n._codec.getModule(Zo),s=[];t.forEach((function(t){var e=n._codec.getModule(ls);e.setTagId(t.tagId),jt(t.isTop)||e.setIsTop(t.isTop),s.push(e)})),o.setSessionStateType(ei),o.setValue(JSON.stringify(s)),o.setTags(s),r.setType(e.conversationType),r.setChannelId(e.targetId),r.setTime(Date.now()),r.setStateItem([o]),i.push(r)})),r.setState(i),r.setVersion(Je.getTime()),r.getArrayData()},t.prototype.encodeReportSDKInfo=function(t){var e=this._codec.getModule(ps);return e.setSdkInfo(t),e.getArrayData()},t.prototype.encodeUltraGroup=function(t,e){var n=this._codec.getModule(fs);return n.setSyncTime(t),n.setIsEraseMsgContent(e),n.getArrayData()},t.prototype.encodebindRTCRoomForChatroom=function(t){var e=this._codec.getModule(Ls);return e.setRtcRoomId(t.rtcRoomId),e.getArrayData()},t.prototype.encodeSetCallInfo=function(t,e){var n=this._codec.getModule(Us);return n.setKey(t),n.setDataContent(e),n.getArrayData()},t.prototype.encodePullKVMsg=function(t){var e=this._codec.getModule(bs);return e.setSyncTime(t),e.getArrayData()},t}(),Qs=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e,n,r,i,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 Ws(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,r){return u(this,void 0,void 0,(function(){var n,i,o,s,a,c,u,h,d;return l(this,(function(p){switch(p.label){case 0:if(n=e.openAnti,i=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(exports.LogTagId.L_NAVI_CONF_E,"no service available",r),[2,{code:V.SERVER_UNAVAILABLE}];a=1===n?yr.V4:yr.V3,c=function(e){var n,o,c,h,d,p,g,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return n=s[e],o=n.protocol,c=n.addr,h=n.weight,d=function(t,e,n,r,i,o,s){var a=dr(i),c=a.type,u=a.version,l="browser"===i.tag?"|".concat(c,"|").concat(u):"||",h=s?"&protocolVer=".concat(s):"";return"".concat(t,"://").concat(e,"/websocket?appId=").concat(n,"&token=").concat(encodeURIComponent(r),"&sdkVer=").concat(L,"&pid=").concat(o,"&apiVer=").concat(i.isFromUniapp?"uniapp":i.tag+encodeURIComponent(l)).concat(i.connectPlatform?"&platform=".concat(i.connectPlatform):"").concat(h)}(o===exports.EConnectProtocol.WS?"ws":"wss",c,u.appkey,t,u.runtime,"",a),p=Date.now(),[4,u.connectWebSocket(d,a,r)];case 1:return g=l.sent(),f=g.code,_=g.data,E=u.cmpWeightCache.findIndex((function(t){return t.addr===c})),T={bid:Ue(),ptc:exports.ProtocalType.WS,cod:f,net:u.getNetwork().type,dur:Date.now()-p,spr:0,pr:i||0,hos:c,idx:E,rct:u.retryCount?exports.ConnectType.RECONNECT:exports.ConnectType.CONNECT,cid:"".concat(u.uuid,"_").concat(u.retryCount),v:exports.StatisticsVersion.CURRENT,rsn:u.reason,count:u.retryCount,weight:h},u.statisticLog.__statistics(exports.StatisticsTag.IM_WEBSOCKET,JSON.stringify(T),r),f===V.RC_SOCKET_DISCONNECTED||f===V.TIMEOUT?[2,"continue"]:f!==V.SUCCESS?[2,{value:{code:f}}]:(u._localConnectedTime=Math.floor((Date.now()+p)/2),u._socket=_.socket,u.updateCmpWeight(s[e].addr,!0),u.curCmpUrl=s[e].addr,[2,{value:{code:f,data:_.userId}}])}}))},u=this,h=0,p.label=1;case 1:return h<s.length?[5,c(h)]:[3,4];case 2:if("object"==typeof(d=p.sent()))return[2,d.value];p.label=3;case 3:return h+=1,[3,1];case 4:return[2,{code:V.SERVER_UNAVAILABLE}]}}))}))},e.prototype.connectWebSocket=function(t,e,n){return u(this,void 0,void 0,(function(){var r=this;return l(this,(function(i){return this.logger.info(exports.LogTagId.T,"connect start: ".concat(t),n),[2,new Promise((function(i){var o=r.runtime.createWebSocket(t);r._socketIndex=o.id;var s=setTimeout((function(){r.logger.info(exports.LogTagId.T,"connect timeout: ".concat(t),n),i({code:V.TIMEOUT}),o&&o.close()}),5e3);o.onOpen((function(){clearTimeout(s),r.logger.info(exports.LogTagId.T,"socket open",n)})),o.onMessage((function(t){if(r._socketIndex===o.id){if("[object ArrayBuffer]"===Object.prototype.toString.call(t)){var s,a=mi(r.logger,t,e);if(a instanceof li){var c=a.status;if(c!==Ps.ACCEPTED)return r.logger.info(exports.LogTagId.T,"connect failed: ".concat(c),n),void i({code:(s=c,Ks[s])});r.logger.info(exports.LogTagId.T,"connect success",n);var u=a.timestamp,l=a.userId,h=a.messageId;return r._connectedTime=u,r._idCount=h,void i({code:V.SUCCESS,data:{userId:l,socket:o}})}if(a instanceof hi){var d=a.status;return r.logger.info(exports.LogTagId.T,"recv disconnect signal -> status: ".concat(d)),void r.onRecvDisconnect(d,o)}r._onReceiveSignal(a)}}else r.logger.warn(exports.LogTagId.L_WEBSOCKET_DISACCORD_E,JSON.stringify({msg:"WebSocket id disaccord",_socketIndex:r._socketIndex,curSocketId:o.id}))})),o.onClose((function(){r.logger.info(exports.LogTagId.T,"socket close",n);var t=V.RC_SOCKET_DISCONNECTED;i({code:t}),r.onSocketEnd(o,t)})),o.onError((function(t){r.logger.info(exports.LogTagId.T,"socket error",n);var e=V.RC_SOCKET_DISCONNECTED;i({code:e}),r.onSocketEnd(o,e)}))}))]}))}))},e.prototype._qosNeedAck=function(t,e){t.header&&t.header.qos!==Cr.AT_MOST_ONCE&&(t instanceof _i&&!t.syncMsg&&(this.logger.debug(exports.LogTagId.O,"send pubAck -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Ci(e))),t instanceof yi&&(this.logger.debug(exports.LogTagId.O,"send queryCon -> ".concat(e," ").concat(t.topic)),this.sendOnly(new Ii(e))))},e.prototype._publishReader=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o=this;return l(this,(function(s){switch(s.label){case 0:return n=t.syncMsg,r=t.topic,this.logger.debug(exports.LogTagId.O,"recv PublishReader -> messageId: ".concat(e," ").concat(r)),r===sn?[2]:!n||function(t){return[Ri.ppMsgS,Ri.pgMsgS,Ri.chatMsgS].map((function(t){return Ri[t]})).indexOf(t)>=0}(r)?(this.wsListener.signal(t),[2]):[4,new Promise((function(t){o._syncMessageIds[e]=t}))];case 1:return i=s.sent(),delete this._syncMessageIds[e],this.wsListener.signal(t,i),[2]}}))}))},e.prototype._onReceiveSignal=function(t){return u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){switch(i.label){case 0:return e=t.messageId,t instanceof pi&&this._pingResolve?(this._pingResolve(V.SUCCESS),this._pingResolve=void 0,[2]):(this._qosNeedAck(t,e),e>0&&(t instanceof Ti||t instanceof yi)&&(this.logger.debug(exports.LogTagId.O,"recv ack -> messageId: ".concat(e," ").concat(t.topic)),(n=this._messageIds[e])&&(n(t),delete this._messageIds[e]),(r=this._syncMessageIds[e])&&(delete this._syncMessageIds[e],r(t))),t instanceof _i?[4,this._publishReader(t,e)]:[3,2]);case 1:i.sent(),i.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 Hs[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(V.RC_SOCKET_DISCONNECTED)}},e.prototype.sendPing=function(t){var e=this;return new Promise((function(n){e._pingResolve=n,setTimeout((function(){return n(V.TIMEOUT)}),t),e.sendOnly(new di)}))},e.prototype.sendOnly=function(t){this._socket&&((t instanceof Ei||t instanceof vi)&&(t.messageId=this._generateMessageId()),this._socket.send(t.getBufferData().buffer))},e.prototype.send=function(t,e,n,r){return void 0===r&&(r=3e4),u(this,void 0,void 0,(function(){var i,o,s,a,c=this;return l(this,(function(u){switch(u.label){case 0:return this._socket?(i=this._generateMessageId(),t.messageId=i,this._socket.send(t.getBufferData().buffer),[4,new Promise((function(t){c._messageIds[i]=t,setTimeout((function(){c._messageIds[i]&&delete c._messageIds[i],t()}),r)}))]):[2,{code:V.RC_NET_CHANNEL_INVALID}];case 1:return(o=u.sent())?o instanceof yi||o instanceof Ti?(s=e&&o.data&&[V.SUCCESS,V.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(exports.LogTagId.O,"send failed -> message: ".concat(i,", respPBName: ").concat(e,", status: ").concat(o.status)),[2,{code:o.status,data:e&&o.data?a:null}]):[2,{code:V.SUCCESS,data:a}]):[2,{code:o}]:(this.logger.warn(exports.LogTagId.O,"send timeout -> message: ".concat(i,", respPBName: ").concat(e,", timeout: ").concat(r)),[2,{code:V.TIMEOUT}])}}))}))},e.prototype.close=function(t){this._socket&&(this._socket.close(),this._socket=null),this.clearResolves()},e}(js);exports.StatisticL=void 0,(Ys=exports.StatisticL||(exports.StatisticL={}))[Ys.STATISTICS=-2]="STATISTICS",Ys[Ys.RECORD=-1]="RECORD";var Js=null,Xs="RC_CONF",Zs="RC_STATISTICS",zs=null,$s=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Js];case 1:return(e=n.sent())?[4,new Promise((function(n){var r=e.db.transaction(Zs,"readwrite").objectStore(Zs),i=IDBKeyRange.lowerBound(Date.now()-t),o=r.getAllKeys(i);o.onsuccess=function(){var t=o.result,e=t.length;if(e>0){var i=r.delete(IDBKeyRange.bound(t[0],t[e-1]));i.onsuccess=n,i.onerror=n}},o.onerror=n}))]:[2];case 2:return n.sent(),zs=setTimeout((function(){return $s(t)}),6e5),[2]}}))}))},ta=function(t,e,n){void 0===n&&(n=168),Js||("undefined"!=typeof window&&window&&window.indexedDB?Js=new Promise((function(r){var i=window.indexedDB;i.databases&&i.databases().then((function(t){t.some((function(t){return"RC_ENGINE_DB"===t.name}))&&i.deleteDatabase("RC_ENGINE_DB")}));var o="RC_STATISTIC_".concat(t),s=i.open(o,2);s.onerror=function(t){e.error(exports.LogTagId.L_LOGDB_OPEN_FAILED_E,t.target.error),r(null)},s.onsuccess=function(i){var o=i.target.result;o?(o.onclose=function(t){e.warn(exports.LogTagId.L_LOGDB_CLOSED_S)},o.onerror=function(t){e.error(exports.LogTagId.L_LOGDB_ERROR_E,t.target.error)},o.onabort=function(t){e.info(exports.LogTagId.L_LOGDB_ABORT_S,t.target.error)},$s(3600*Math.max(24,Math.min(168,n))*1e3),r({appkey:t,db:o})):r(null)},s.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(Zs)&&e.deleteObjectStore(Zs);var n=e.createObjectStore(Zs,{autoIncrement:!0});n.createIndex("level","level",{unique:!1}),n.createIndex("time","time",{unique:!1}),(n=e.createObjectStore(Xs,{keyPath:"key"})).createIndex("key","key",{unique:!0})}})):e.warn(exports.LogTagId.L_UNSUPPORT_INDEXDB_O))},ea=function(){return u(void 0,void 0,void 0,(function(){var t;return l(this,(function(e){switch(e.label){case 0:return Js?(zs&&(clearTimeout(zs),zs=null),[4,Js]):[2];case 1:return(t=e.sent())&&t.db.close(),Js=null,[2]}}))}))};function na(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,Js];case 1:return(e=n.sent())?[2,new Promise((function(n){var r=e.db.transaction(Xs,"readonly").objectStore(Xs).get(t);r.onsuccess=function(t){var e;n({value:null===(e=r.result)||void 0===e?void 0:e.value,success:!0})},r.onerror=function(t){n({success:!1})}}))]:[2,{success:!1}]}}))}))}var ra,ia="REPORT_SESSION",oa=function(t,e){return u(void 0,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return n="".concat(ia,"_").concat(t),[4,na("".concat(ia,"_").concat(t))];case 1:return r=s.sent(),i=r.success,o=r.value,i?(e===(null==o?void 0:o.sessionId)||function(t,e){u(this,void 0,void 0,(function(){var n,r;return l(this,(function(i){switch(i.label){case 0:return[4,Js];case 1:return(n=i.sent())?(r=n.db,r.transaction(Xs,"readwrite").objectStore(Xs).put({key:t,value:e}),[2,!0]):[2,!1]}}))}))}(n,{sessionId:e}),[2]):[2]}}))}))},sa=function(){return Js},aa=function(t){var e=t.sessionId,n=t.level,r=t.loggerId,i=t.traceId,o=t.time,s=t.tag,a=t.type,c=t.content,u=n<0?c||"":JSON.stringify({content:c,traceId:i,from:r});return u='"'.concat(u.replace(/"/g,'""'),'"'),"".concat(e,",").concat(o,",").concat(a,",").concat(n,",").concat(s,",").concat(u,"\n")},ca=re(),ua=Date.now(),la=0,ha=function(){function t(t,e,n){this._appkey=t,this._id=e,this._type=n,this.__statistics=this._writer.bind(this,exports.StatisticL.STATISTICS)}return t.prototype._writer=function(t,e,n,r){var i=new Date;/^[\w-]+$/.test(e)&&this.flush({time:+i,sessionId:ca,type:this._type,loggerId:this._id,tag:e,level:t,content:n,traceId:r})},t.prototype.createTraceId=function(){return"".concat(ca,"-").concat(++la)},t.prototype.getSessionId=function(){return ca},t}(),da=function(){function t(t,e,n,r,i,o){void 0===o&&(o=i),this.appkey=t,this.deviceId=e,this.deviceInfo=n,this.statisticDB=r,this.logger=i,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 u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){return this.started?[2]:(this.userId=t.userId,t.logSwitch?(e=bn.getLogUrlPolicyList(t,this.logger),n=e.policy,r=e.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,r.length>0&&this.realtimeReport(r[0].addr,n.level,n.itv),[2]):[2])}))}))},t.prototype.realtimeReport=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return r=Date.now(),i=this.statisticDB.getTimestamp4RealtimeLog()||ua,o=Math.max(r-5e3,i),s=this.reportClass.createTraceId(),this.logger.debug(exports.LogTagId.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:o,level:e}),s),[4,this.statisticDB.getStatistics(i,o,e,!0)];case 1:return a=l.sent(),c=a.dbReady,u=a.logs,c?[3,2]:(this.logger.warn(exports.LogTagId.L_REALTIME_LOG_R,"db error",s),[3,5]);case 2:return u.length>0?(this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,JSON.stringify({count:u.length}),s),[4,this.compressStatistics(u)]):[3,5];case 3:return h=l.sent(),d=h.success,p=h.data,d||this.logger.warn(exports.LogTagId.L_REALTIME_LOG_O,"compress failed",s),this.logger.info(exports.LogTagId.L_REALTIME_LOG_O,"compress done",s),g=Wt(t)?t:"https://".concat(t),g+="?version=".concat("5.8.5","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:g,body:p,method:"POST"})];case 4:f=l.sent().status,this.logger.info(exports.LogTagId.L_REALTIME_LOG_R,JSON.stringify({status:f}),s),200===f?(this.reportFailedNumber=0,n=this.itvByNavi,this.statisticDB.setTimestamp4RealtimeLog(u[u.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,r,i,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return"web"!==n.toLowerCase()?[2]:(s=this.reportClass.createTraceId(),this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:t,endTime:e,logId:i,messageUId:o}),s),[4,this.statisticDB.getStatistics(t,e,exports.StatisticL.STATISTICS,!1)]);case 1:return a=l.sent(),c=a.dbReady,u=a.logs,this.logger.info(exports.LogTagId.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),s),h=Wt(r)?r:"https://".concat(r),h+="?version=".concat("5.8.5","&appkey=").concat(this.appkey,"&userId=").concat(this.userId,"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),c?u.length>0?[4,this.compressStatistics(u)]:[3,3]:[3,5];case 2:return p=l.sent(),g=p.success,f=p.data,d=g?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(exports.LogTagId.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(exports.LogTagId.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}(),pa="RC_STATISTICS",ga=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.flush=function(t){Ta(t)},e}(ha),fa=!1,_a=[],Ea=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return fa||0===_a.length?[2]:(fa=!0,e=_a.splice(0),[4,new Promise((function(n){var r=t.transaction(pa,"readwrite");r.oncomplete=n,r.onabort=n;var i=r.objectStore(pa);e.forEach((function(t){try{i.add(t)}catch(e){null===console||void 0===console||console.error("write log failed ->",t)}}))}))]);case 1:return n.sent(),fa=!1,setTimeout((function(){return Ea(t)})),[2]}}))}))},Ta=function(t){return u(void 0,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return[4,sa()];case 1:return(e=n.sent())?(_a.push(t),Ea(e.db),[2]):[2]}}))}))},Ca=0,va=function(){return{setTimestamp4RealtimeLog:function(t){Ca=t},getTimestamp4RealtimeLog:function(){return Ca},getStatistics:function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return[4,sa()];case 1:return(n=r.sent())?[2,new Promise((function(r){var i=n.db.transaction(pa,"readonly").objectStore(pa),o=[],s=IDBKeyRange.bound(t,e),a=i.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 r({dbReady:!0,logs:o})},a.onerror=function(t){r({dbReady:!1,logs:[]})}}))]:[2,{dbReady:!1,logs:[]}]}}))}))}}},Ia=function(t){function e(e,n,r,i){var o=this,s=ie(n),a=dr(n),c="".concat(a.type,"|").concat(a.version,"|").concat(i.getSessionId());return(o=t.call(this,e,s,c,va(),r,i)||this).runtime=n,o}return a(e,t),e.prototype.send=function(t){return this.runtime.httpReq(t)},e.prototype.checkStart=function(e){return u(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,oa(e.userId,this.reportClass.getSessionId())];case 1:return n.sent(),[2,t.prototype.checkStart.call(this,e)]}}))}))},e.prototype.compressStatistics=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,{success:!0,data:ur(t.map(aa).join(""))}]}))}))},e.prototype.isReporter=function(){return u(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(),u(void 0,void 0,void 0,(function(){var t,r,i;return l(this,(function(o){switch(o.label){case 0:return[4,na("".concat(ia,"_").concat(e))];case 1:return t=o.sent(),r=t.success,i=t.value,[2,r&&(null==i?void 0:i.sessionId)===n]}}))})))];case 1:return[2,t.sent()]}var e,n}))}))},e.prototype.report=function(e,n,r,i,o,s){return u(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,r,i,o,s)]:[2]}}))}))},e.prototype.realtimeReport=function(e,n,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,t.prototype.realtimeReport.call(this,e,n,r)]}))}))},e}(da),ya=function(t){function e(e,n,r,i){void 0===i&&(i=exports.AreaCode.BJ);var o=t.call(this,e,n,i)||this;return o.appkey=e,o.logger=n,o.runtime=r,o.areaCode=i,o._storageKey="",o._storageKey=A.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 u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){switch(i.label){case 0:return[4,this.runtime.httpReq({url:t})];case 1:return e=i.sent(),n=e.status,r=e.data,[2,{code:n,data:r}]}}))}))},e.prototype.decryptData=function(t){return u(this,void 0,void 0,(function(){var e,n;return l(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,Ae(t,m,R)];case 1:return e=r.sent(),[2,JSON.parse(e)];case 2:return n=r.sent(),this.logger.error(exports.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},e}(wn),ma=function(){function t(t){this.reporter=t,this.logId="",this.uploadTask=[],this.taskLock=!0}return t.prototype.uploadLogCmdTask=function(t){this.uploadTask.push(t),this.enqueueTask()},t.prototype.reportLogCmdTask=function(t){var e,n,r,i,o=this;this.taskLock=!1;var s=null!==(e=t.startTime)&&void 0!==e?e:0,a=null!==(n=t.endTime)&&void 0!==n?n:0,c=null!==(r=t.platform)&&void 0!==r?r:"",u=null!==(i=t.uri)&&void 0!==i?i:"";t.logId!==this.logId&&""!==u&&(this.logId=t.logId,this.reporter.report(s,a,c,u,t.logId,"",!0).finally((function(){o.taskLock=!0,o.uploadTask.length>0&&o.enqueueTask()})))},t.prototype.enqueueTask=function(){if(this.taskLock){var t=this.uploadTask.shift();t&&this.reportLogCmdTask(t)}},t}();exports.InvokerType=void 0,(ra=exports.InvokerType||(exports.InvokerType={}))[ra.init=1]="init",ra[ra.newWorkChange=2]="newWorkChange",ra[ra.other=3]="other";var Ra={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]}};function Sa(){return Ra}var Oa=function(){function t(t,e,n,r){this.logger=t,this.appkey=e,this.reporter=n,this.statisticLog=r,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new ma(n)}return t.prototype.init=function(){try{var t=this.getLocalCloudControllerCache();this._cache=t?JSON.parse(t):Sa()}catch(t){this._cache=Sa()}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache))},t.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},t.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},t.prototype.logCmdMsgTasks=function(t){var e=this;t.uploadLog&&t.uploadLog.tasks.forEach((function(t){t.objectName===K.LOG_COMMAND&&e.uploadTaskManage.uploadLogCmdTask(t)}))},t.prototype.dataHandle=function(t){var e=this._cache;e.lastRequestTime=this.lastRequestTime,Qt(t)&&(e.timestamp=t.timestamp,t.uploadLog&&!t.uploadLog.temporary&&(e.uploadLog=t.uploadLog),t.cc&&!t.cc.temporary&&(e.cc=t.cc)),this.setCloudControllerCache(e),this.expire=e.cc.expire,this.interval=e.cc.interval,this.timestamp=e.timestamp,this.logCmdMsgTasks(t)},t.prototype.request=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return!this.isEable&&e===exports.InvokerType.init&&this.isExire()?(this.logger.info(exports.LogTagId.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&e===exports.InvokerType.newWorkChange&&this.isOverclock()?(this.logger.info(exports.LogTagId.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(r=be(t),this.lastRequestTime=(new Date).getTime(),i="".concat(r,"/v1/config"),o={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(o["RC-Token"]=n),s={platform:"web",version:"5.8.5",timestamp:this.timestamp},this.statisticLog.__statistics(exports.StatisticsTag.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:i})),[4,this.httpRequest(i,exports.HttpMethod.POST,o,s)]);case 1:return a=l.sent(),c=a.code,u=a.data,this.statisticLog.__statistics(exports.StatisticsTag.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:u})),c===V.CLOUD_DATA_CENTER_INVALID&&u?(h=u.targetRegion,this.changeAreaCode===h?[2,this.timestamp]:(this.changeAreaCode=h,(d=bn.getCloudControllerUrl(h))[0]?[4,this.request(d[0],exports.InvokerType.other)]:(this.logger.info(exports.LogTagId.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:i,msg:"appkey region error"})),[2,this.timestamp]))):[3,3];case 2:l.sent(),l.label=3;case 3:return u&&this.dataHandle(u),[2,this.timestamp||this.lastRequestTime]}}))}))},t}(),Na=function(t){function e(e,n,r,i,o){var s=t.call(this,r,e,i,o)||this;s.runtime=n;var a=je(n);return s.deviceId=ie(n),s.model="Web|".concat(a.type,"|").concat(a.version),s.init(),s}return a(e,t),e.prototype.httpRequest=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return(i=r).deviceId=this.deviceId,i.model=this.model,o={url:t,method:e,headers:n,body:JSON.stringify(i)},this.logger.info(exports.LogTagId.L_REQUEST_T,JSON.stringify(o)),[4,this.runtime.httpReq(o)];case 1:s=l.sent(),a=s.status,c=s.data,u=void 0===c?"":c,this.logger.info(exports.LogTagId.L_REQUEST_R,JSON.stringify({status:a,data:u}));try{return h=JSON.parse(u),d=h.data,[2,{code:parseInt(h.code,10),data:d}]}catch(t){return this.logger.warn(exports.LogTagId.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:u,error:t})),[2,{code:a,msg:t}]}return[2]}}))}))},e.prototype.setCloudControllerCache=function(t){var e=A.CLOUD_CONTROL_KEY(this.appkey);this.runtime.localStorage.setItem(e,JSON.stringify(t)),this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify(t))},e.prototype.getLocalCloudControllerCache=function(){var t=A.CLOUD_CONTROL_KEY(this.appkey),e=this.runtime.localStorage.getItem(t);return this.logger.info(exports.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify({appkey:this.appkey,key:t,data:e})),e},e}(Oa),La=function(t,e,r,i,o,s,a){return{conversationType:t,targetId:e,senderUserId:s,messageDirection:x.SEND,isCounted:!!r.isCounted,isMentioned:!!r.isMentioned,content:r.content,messageType:r.messageType,isOffLineMessage:!1,isPersited:!!r.isPersited,messageUId:i,sentTime:o,receivedTime:0,disableNotification:!!r.disableNotification,isStatusMessage:!!r.isStatusMessage,canIncludeExpansion:!!r.canIncludeExpansion,expansion:r.canIncludeExpansion?r.expansion:null,receivedStatus:n.UNREAD,pushConfig:r.pushConfig,channelId:r.channelId,isInterrupt:r.isInterrupt,messageId:a||0,sentStatus:exports.SentStatus.SENT}},Ma=function(t){return t.sort((function(t,e){var n,r,i=(null===(n=t.latestMessage)||void 0===n?void 0:n.sentTime)||0;return((null===(r=e.latestMessage)||void 0===r?void 0:r.sentTime)||0)-i})),t},Ua=function(t){function e(e,n,r,i){var o=t.call(this,e,n,r,i,new er(i.appkey,"RC-E","IM"),new ga(i.appkey,"RC-E","IM"))||this;o._customMessageType={},o._reconnectTimer=-1,o._pullOfflineFinished=!1,o.currentUserId="",o._openCallPlus=!1,o.cloudControllerUri="",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=i.appkey,a=i.logOutputLevel,c=i.logExpireTime,u=i.navigators,l=i.areaCode,h=i.logServerUrl,d=i.miniCMPProxy,p=i.environment;return o.logger.setOutputLevel(a),Fn(s,o.logger,e,c),o.reporter=new gr(s,o.runtime,o.logger,o._options.__reportLogLevel),o.navi=new ji(s,o.logger,o.statisticLog,e,new ya(s,o.logger,e,l),p),ta(s,o.logger,c),o.reporterStatistic=new Ia(s,o.runtime,o.logger,o.statisticLog),o._letterbox=new Si(e,s),o._sendMessageStore=new Wi(e,s),o._chrmEntryHandler=new Li(o),o._connMgr=new Qs(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}),bn.init({areaCode:l,navigators:u,logServerUrl:h,miniCMPProxy:d}),o._initCloudController(),o}return a(e,t),e.prototype._initCloudController=function(){var t=bn.getCloudControllerUrl();this.cloudControllerUri=t[0],this.cloudController=new Na(this._appkey,this.runtime,this.logger,this.reporter,this.statisticLog),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,exports.InvokerType.init)},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 Mi(t.joinMChrm)),this._conversationManager||(this._conversationManager=new Fi(this,this._appkey,this.currentUserId,this._watcher.conversation,this._watcher.conversationTag)),this._ultraGroupManager||(this._ultraGroupManager=new eo(this,this._appkey,this.currentUserId)),this._userSettingManager||(this._userSettingManager=new Hi(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 er(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,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return this._openCallPlus=n,[2,this._connMgr.connect(t,e,n,r)]}))}))},e.prototype._signalHandler=function(t,e){var n=t.syncMsg,r=t.topic;if(n)this._receiveSyncMsg(t,e);else{var i=this.logger.createTraceId();this.logger.debug(exports.LogTagId.L_RECV_RMTP_O,r,i);var o=Ri[r];if(o)switch(o){case Ri.s_ntf:this._pullMsg(t);break;case Ri.s_msg:this._receiveMsg(t);break;case Ri.s_cmd:this._receiveStateNotify(t);break;case Ri.s_us:this._receiveSettingNotify(t);break;case Ri.rtc_ntf:this._receiveRtcKv(t.data);break;case Ri.s_opNtf:this._pullOperateStatusNotify(t);break;case Ri.s_pubCall:this._pubCallInfo(t)}else this.logger.error(exports.LogTagId.L_RECV_RMTP_E,r,i)}},e.prototype._receiveStateNotify=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,lo),n=e.time,r=e.type,i=e.chrmId;switch(r){case 2:this._chrmEntryHandler.pullEntry(i,n);break;case 3:this._conversationManager.startPullConversationStatus(n);break;case 4:this._chrmEntryHandler.reset(i),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,Wo).version;this._userSettingManager.pullUserSettings(e)},e.prototype._receiveMessageExpansion=function(t){var e=t.content,n=e.put,r=e.del,i=e.mid;n&&this._watcher.expansion({updatedExpansion:{messageUId:i,expansion:n}}),r&&this._watcher.expansion({deletedExpansion:{messageUId:i,deletedKeys:r}})},e.prototype._clearUltraGroupUnreadCount=function(t,e){var n=this._connMgr.codec.decodeByPBName(t.data,mo),r=n.channelId,i=n.busChannel,o=n.msgTime,s=this._ultraGroupMap["".concat(i,"_").concat(r)];s&&(s.unreadMessageCount=0,s.unreadMentionedCount=0,s.unreadMentionedMeCount=0,s.firstUnreadMessage&&(s.firstUnreadMessage=null),s.lastReadTime=o,this._watcher.conversation(Qe([s]))),e&&(this._ultraMsgMap[e.messageUId]=e.timestamp)},e.prototype._receiveSyncMsg=function(t,e){if(Qi.includes(t.topic))if(t.topic!==Ri[Ri.updUgRTime]){var n=this._connMgr.codec.decodeByPBName(t.data,no,{currentUserId:this.currentUserId,signal:t});((n=this._handleMsgProperties(n)).conversationType!==B.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(exports.LogTagId.L_RECV_MULTI_SYNC_MSG_O,JSON.stringify({messageUId:n.messageUId,messgeId:n.messageId,sentTime:n.sentTime})),n.messageType!==K.EXPANSION_NOTIFY?((n.messageType===K.SYNC_READ_STATUS||n.messageType===K.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=[],r=[],i=[],o=t.length-1;o>=0;o-=1){var s=t[o];s.messageType===K.LOG_COMMAND&&s.senderUserId===U?r.unshift(s):s.messageType===K.CLOUD_CONTROL&&s.senderUserId===U?i.push(s):n.unshift(s)}this._watcher.batchMessage(n),r.forEach((function(t){var n=t.content,r=n.startTime,i=n.endTime,o=n.platform,s=n.logId,a=n.uri;e.reporter.report(parseInt(r,10),parseInt(i,10),o,a,s,t.messageUId)})),i.length>0&&this._ccMsgHandler(i)},e.prototype._ccMsgHandler=function(t){var e;return u(this,void 0,void 0,(function(){var n,r,i;return l(this,(function(o){switch(o.label){case 0:return t.shift()?(n=this._connMgr.getToken(),[4,null===(e=this.cloudController)||void 0===e?void 0:e.request(this.cloudControllerUri,exports.InvokerType.other,n)]):[3,2];case 1:r=o.sent()||0,(i=t.filter((function(t){return t.sentTime>r}))).length>0&&this._ccMsgHandler(i),o.label=2;case 2:return[2]}}))}))},e.prototype._pubCallInfo=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,As),n=e.key,r=e.dataContent,i=e.maxTime;this._latestPullKVMsgTimestamp=i,this._watcher.callInfo(JSON.stringify({list:[{key:n,value:r}]}))},e.prototype._pullMsg=function(t){var e=this._connMgr.codec.decodeByPBName(t.data,lo),n=e.type,r=e.chrmId,i=e.time;if(this.logger.info(exports.LogTagId.L_RECV_S_NTF_O,"type: ".concat(n,", chrmId: ").concat(n,", time: ").concat(i)),2===n){var o=this._chrmsQueue[r];if(!o)return;o.queue.push(i),this._pullChrmMsg(r)}else this._pullQueue.push(i),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 u(this,void 0,void 0,(function(){var t,e,n,r,i;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(t=this._connMgr.codec.encodePullKVMsg(this._latestPullKVMsgTimestamp),e=new vi(Hr,t,this.currentUserId),[4,this._connMgr.send(e,ws)]):[2];case 1:return n=o.sent(),r=n.code,i=n.data,r===V.SUCCESS&&i?(this._latestPullKVMsgTimestamp=i.maxTime,this._watcher.callInfo(JSON.stringify({list:i.info})),[2]):[2]}}))}))},Object.defineProperty(e.prototype,"_isConnected",{get:function(){return this._connMgr.getConnectionStatus()===exports.RCConnectionStatus.CONNECTED},enumerable:!1,configurable:!0}),e.prototype._messageProcessor=function(t){var e=this,n=0,r=[],i=[];return t.forEach((function(t){if((r.push(t.messageUId),t.messageDirection===x.SEND)&&(n=Math.max(t.sentTime,n),e._sendMessageStore.getSendMessageMap()[t.messageUId]))return void e._sendMessageStore.removeByUID(t.messageUId);if(t.messageType!==K.DELIVERED&&t.messageType!==K.DELIVERED_MSG)if(t.messageType!==K.EXPANSION_NOTIFY){if(t.messageType!==K.SYNC_READ_STATUS||t.senderUserId===e.currentUserId){(t.messageType===K.SYNC_READ_STATUS||t.messageType===K.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),i.push(o)}}else e._receiveMessageExpansion(t)})),{newOutboxTime:n,messageUIds:r,messages:i}},e.prototype._syncMsg=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,o,s,a,c,u,h,d,p,g,f,_,E,T,C,v;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),r=this._connMgr.codec.encodeSyncMsg({sendboxTime:t,inboxTime:e,broadcastSyncTime:n}),i=new vi(Ri[Ri.pullMsg],r,this.currentUserId),o=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_MSG_T,JSON.stringify({outboxTime:t,inboxTime:e,broadcastSyncTime:n}),o),[4,this._connMgr.send(i,oo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):(this._pullingMsg=!1,[2]);case 1:return s=l.sent(),a=s.code,c=s.data,this._latestSyncTimestamp=Date.now(),a!==V.SUCCESS||!c||jt(c.finished)||jt(c.list)||jt(c.syncTime)?(this.logger.warn(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,timestamp:this._latestSyncTimestamp}),o),this._pullingMsg=!1,[2]):(u=c.list,h=c.finished,d=c.syncTime,p=c.broadcastSyncTime,g=void 0===p?1:p,this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({syncTime:d,finished:h,messages:u.map((function(t){return{messageUId:t.messageUId,messageId:t.messageId,sentTime:t.sentTime}}))}),o),f=this._messageProcessor(u),_=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(g,this.currentUserId),this._sendMessageStore.removeByTimestamp(_),this._pullingMsg=!1,C=this._pullQueue.filter((function(t){return t>d})),this._pullQueue.length=0,(v=this._pullQueue).push.apply(v,C),h&&!this._pullOfflineFinished&&(this._pullOfflineFinished=!0,this._watcher.pullFinished()),this.logger.info(exports.LogTagId.L_PULL_MSG_R,JSON.stringify({code:a,messageUIds:E.join(","),timestamp:this._latestSyncTimestamp,hasmore:!h,tmpPullQueue:C}),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,io,{currentUserId:this.currentUserId,connectedTime:this._connMgr.getConnectedTime()});if(e=this._handleMsgProperties(e),this.logger.info(exports.LogTagId.L_RECV_S_MSG_O,JSON.stringify({messageUId:e.messageUId,messgeId:e.messageId,sentTime:e.sentTime})),e.messageType!==K.DELIVERED&&e.messageType!==K.DELIVERED_MSG){if(e.conversationType!==B.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!==K.EXPANSION_NOTIFY?e.messageType===K.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,r=t.messageType,i=t.isStatusMessage,o=t.isCounted,s=void 0!==o&&o,a=t.isPersited,u=void 0!==a&&a,l=r in S,h=r in this._customMessageType;if(n=l?c(c({},S[r]),{isStatusMessage:O.includes(r)}):h?this._customMessageType[r]:{isCounted:s,isPersited:u,isStatusMessage:!1},Object.assign(t,n),e&&!jt(i)&&(t.isStatusMessage=i),!e){var d=t.content.user;if(d){var p=d.portrait,g=d.portraitUri,f=p||g;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,r,i,o,s,a){var c;return void 0===o&&(o=""),u(this,void 0,void 0,(function(){var s,u,h,d,p,g,f,_,E,T;return l(this,(function(l){switch(l.label){case 0:return u=(s=this).currentUserId,h=s._connMgr,d=Jr[t]||Kr,p=1===r&&0===n,h?(g=h.codec.encodeGetHistoryMsg(e,{timestamp:n,count:p?2:r,order:i,channelId:o}),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:e,conversationType:t,channelId:o,timestamp:n,count:r,order:i}),a),[4,h.send(new vi(d,g,u),po,{currentUserId:u,connectedTime:h.getConnectedTime(),conversation:{targetId:e}})]):[3,2];case 1:return f=l.sent(),(_=f.code)===V.SUCCESS&&g?(E=f.data,E=this._fixDownstreamData(p,E,i),T=[],null===(c=E.list)||void 0===c||c.forEach((function(t){t&&T.push(t.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:T.join(",")}),a),[2,{code:_,data:{list:E.list,hasMore:E.hasMore}}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:_,messageUIds:""}),a),[2,{code:_}]);case 2:return[2,{code:V.RC_NET_CHANNEL_INVALID}]}}))}))},e.prototype.getMessages=function(t,e,n,r,i,o,s){return this.getHistoryMessage(t,e,n,r,i,o,s)},e.prototype.reportSDKInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=(e=this).currentUserId,r=e._connMgr,i=this.logger.createTraceId(),o=JSON.stringify(t),this.logger.debug(exports.LogTagId.L_VER_REPORT_T,o,i),s=r.codec.encodeReportSDKInfo(o),a=new vi(Ri[Ri.reportsdk],s,n),[4,r.send(a)]):[2];case 1:return(c=u.sent().code)!==V.SUCCESS&&this.logger.warn(exports.LogTagId.L_VER_REPORT_R,c,i),[2]}}))}))},e.prototype.deleteRemoteMessage=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeDeleteMessages(t,e,n,r),c=new vi(Mr,a,o),[4,s.send(c)]):[2,V.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),[2,u.code]}}))}))},e.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,a=s.codec.encodeClearMessages(e,n,r,t),c=Xr[t],u=new vi(c,a,o),[4,s.send(u)]):[2,V.RC_NET_UNAVAILABLE];case 1:return h=l.sent(),[2,h.code]}}))}))},e.prototype.getConversationList=function(t,e,n,r,i){return void 0===t&&(t=300),u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=(i=this).currentUserId,s=i._connMgr,e=e||B.PRIVATE,a=s.codec.encodeOldConversationList({count:t,type:e,startTime:n,order:r}),c=new vi(Vr,a,o),[4,s.send(c,fo,{currentUserId:o,connectedTime:s.getConnectedTime(),afterDecode:function(t){var e=t.conversationType,n=t.targetId,r=t.channelId,i=p._conversationManager.get(e,n,r);return Object.assign(t,i),t}})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,d=u.data,h!==V.SUCCESS?[2,{code:h}]:[2,{code:h,data:null==d?void 0:d.list}]}}))}))},e.prototype.removeConversation=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeRemoveOldConversationList({conversationType:t,channelId:n,targetId:e}),o=new vi(Gr,i,e),[4,r.send(o)]):[2,V.RC_NET_UNAVAILABLE];case 1:return s=a.sent(),[2,s.code]}}))}))},e.prototype.getConversation=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return t!==B.ULTRA_GROUP?[3,1]:(r=this._ultraGroupMap["".concat(n,"_").concat(e)])?[3,3]:[2,{code:V.CONVER_GET_ERROR}];case 1:return(i=this._conversationManager.get(t,e,n))?[4,this.getHistoryMessage(t,e,0,1,0)]:[2,{code:V.CONVER_GET_ERROR}];case 2:if(o=u.sent(),s=o.code,a=o.data,s!==V.SUCCESS)return[2,{code:V.CONVER_GET_ERROR}];c=(null==a?void 0:a.list[0])||null,r={conversationType:t,targetId:e,channelId:n,unreadMessageCount:i.unreadMessageCount||0,latestMessage:c,notificationStatus:i.notificationStatus||Y.CLOSE,notificationLevel:i.notificationLevel||W.NOT_SET,isTop:i.isTop||!1,lastUnreadTime:i.lastUnreadTime||0,unreadMentionedCount:i.unreadMentionedCount||0},u.label=3;case 3:return[2,{code:V.SUCCESS,data:r}]}}))}))},e.prototype.getAllConversationUnreadCount=function(t,e,n){var r=this._conversationManager.getAllUnreadCount(t,e,n);return Promise.resolve({code:V.SUCCESS,data:r})},e.prototype.getTotalUnreadCountByLevels=function(t,e,n){void 0===n&&(n=!1);var r=0;if(t.includes(B.ULTRA_GROUP)){if(!this._isUltraGroupListExist)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});for(var i in this._ultraGroupMap){var o=this._ultraGroupMap[i];(0===e.length||e.includes(o.notificationLevel))&&(r+=n?o.unreadMentionedCount:o.unreadMessageCount)}}return r+=this._conversationManager.getTotalUnreadCountByLevels(t,e,n),Promise.resolve({code:V.SUCCESS,data:r})},e.prototype.getConversationUnreadCount=function(t,e,n){var r,i;return t===B.ULTRA_GROUP?(i=(null===(r=this._ultraGroupMap["".concat(n,"_").concat(e)])||void 0===r?void 0:r.unreadMessageCount)||0,i=this._getUnreadCount(i)):i=this._conversationManager.getUnreadCount(t,e,n),Promise.resolve({code:V.SUCCESS,data:i})},e.prototype.clearConversationUnreadCount=function(t,e,n){return this._conversationManager.clearUnreadCount(t,e,n,!1),Promise.resolve(V.SUCCESS)},e.prototype.clearAllUnreadCount=function(){return this._conversationManager.clearAllUnreadCount(),Promise.resolve(V.SUCCESS)},e.prototype.getFirstUnreadMessage=function(t,e){throw new Error("Method not implemented.")},e.prototype.saveConversationMessageDraft=function(t,e,n,r){return this._conversationManager.setDraft(t,e,n,r),Promise.resolve(V.SUCCESS)},e.prototype.getConversationMessageDraft=function(t,e,n){var r=this._conversationManager.getDraft(t,e,n);return Promise.resolve({code:V.SUCCESS,data:r})},e.prototype.clearConversationMessageDraft=function(t,e,n){return this._conversationManager.clearDraft(t,e,n),Promise.resolve(V.SUCCESS)},e.prototype.pullConversationStatus=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,h=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this)._connMgr,r=e.currentUserId,i=n.codec.encodeGetConversationStatus(t),o=new vi(Ri[Ri.pullSeAtts],i,r),[4,n.send(o,Jo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,this.logger.info(exports.LogTagId.L_PULL_CONVERSATION_S,JSON.stringify({timestamp:t,userId:r})),a!==V.SUCCESS?[2,{code:a}]:(u=[],Array.isArray(c)&&c.forEach((function(t){var e=t.conversationType,n=t.updatedTime;n&&h._conversationManager.setConversationUpdatedTime(n),e===B.ULTRA_GROUP?h._setUltraConversationStatus(t):u.push(t)})),[2,{code:a,data:u}])}}))}))},e.prototype._setUltraConversationStatus=function(t){var e=t.targetId,n=t.notificationStatus,r=t.notificationLevel,i=t.channelId,o=t.isTop,s=this._ultraGroupMap["".concat(i,"_").concat(e)];return s&&void 0!==r&&(s.notificationLevel=r,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 u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,u,h,d,p,g,f=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=(e=this).currentUserId,r=e._connMgr,i=this._conversationManager.getConversationUpdatedTime(),o=r.codec.encodeSetConversationStatus(t,i),s=new vi(Br,o,n),[4,r.send(s,$o)]):[2,V.RC_NET_UNAVAILABLE];case 1:return a=l.sent(),u=a.code,h=a.data,u!==V.SUCCESS?[2,u]:(d=h,this._conversationManager.setConversationUpdatedTime(d.version),p=[],t.forEach((function(t){if(t.conversationType!==B.ULTRA_GROUP)f._conversationManager.addStatus(c(c({},t),{updatedTime:d.version}),!0);else{var e=f._setUltraConversationStatus(t);e&&p.push(e)}})),p.length>0&&(g=Qe(p),g=Ma(g),this._watcher.conversation(g)),[2,u])}}))}))},e.prototype.setConversationNotificationLevel=function(t,e,n,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this.batchSetConversationStatus([{conversationType:t,targetId:e,notificationLevel:n,channelId:r}])]}))}))},e.prototype._joinChrm=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p,g,f,_,E,T,C,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeJoinOrQuitChatRoom(),a=new vi(s=n?Ar:Ur,o,t),this.logger.info(exports.LogTagId.L_JOIN_CHATROOM_T,JSON.stringify({chatroomId:t,count:e,topic:s}),r),[4,i.send(a,So)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,d=u===V.SUCCESS?"info":"warn",this.logger[d](exports.LogTagId.L_JOIN_CHATROOM_R,JSON.stringify({code:u,timestamp:(new Date).getTime()}),r),u===V.SUCCESS?(g=(p=h).joinTime,f=p.createTime,_=p.memberCount,E=p.isAllChatroomBanned,T=p.isCurrentUserBanned,C=p.isCurrentChatroomBanned,v=p.isCurrentChatroomInWhitelist,this._chrmsQueue[t]||(this._chrmsQueue[t]={pulling:!1,queue:[],timestamp:0}),this._pullChrmMsg(t,e,g),this.getNaviInfoFromCache().kvStorage&&this._chrmEntryHandler.pullEntry(t,0),this._joinedChrmManager.set(t,e),this._startSyncIntervalForChrmPull(),[2,{code:u,data:{createTime:f,memberCount:_,isAllChatroomBanned:E,isCurrentUserBanned:T,isCurrentChatroomBanned:C,isCurrentChatroomInWhitelist:v}}]):[2,{code:u}]}}))}))},e.prototype._rejoinChrm=function(){return u(this,void 0,void 0,(function(){var t,e,n,r,i,o,s,a,u,h;return l(this,(function(l){switch(l.label){case 0:for(n in t=this._joinedChrmManager.get(),e=[],t)e.push(n);r=0,l.label=1;case 1:return r<e.length?(i=e[r],this.logger.info(exports.LogTagId.L_REJOIN_CHATROOM_T,JSON.stringify({chatroomId:i,count:t[i]||10,topic:Ar})),o=this.logger.createTraceId(),[4,this._joinChrm(i,t[i]||10,!0,o)]):[3,4];case 2:if(s=l.sent(),a=s.code,u=s.data,h=a===V.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_REJOIN_CHATROOM_R,JSON.stringify({code:a,timestamp:(new Date).getTime()}),o),a===V.SUCCESS)return this._watcher.chatroom({rejoinedRoom:c({chatroomId:i,count:t[i]},u)}),[2];a===V.RC_CHATROOM_USER_KICKED&&(this._joinedChrmManager.remove(i),delete this._chrmsQueue[i]),this._watcher.chatroom({rejoinedRoom:{chatroomId:i,errorCode:a}}),l.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))},e.prototype._pullChrmMsg=function(t,e,n){return void 0===e&&(e=10),void 0===n&&(n=0),u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=this._chrmsQueue[t],i=r.pulling,o=r.timestamp,i?[2]:(r.pulling=!0,s=this._connMgr.codec.encodeChrmSyncMsg(n?0:o,e),a=new vi(Ri[Ri.chrmPull],s,t),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_T,JSON.stringify({chatroomId:t,timestamp:o})),[4,this._connMgr.send(a,oo,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})])):[2];case 1:return c=l.sent(),u=c.code,h=c.data,r.pulling=!1,u===V.SUCCESS&&h?(d=h.list,p=h.syncTime,g=h.finished,r.timestamp=n?Math.max(p,n):p,r.queue=r.queue.filter((function(t){return t>p})),f=[],_=[],d.forEach((function(t){t.sentTime<o||(f.push(t.messageUId),_.push(t))})),this._batchMessage(_),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:f.join(",")})),(!g||r.queue.length>0)&&this._pullChrmMsg(t),[2]):(this.logger.warn(exports.LogTagId.L_PULL_CHATROOM_MSG_R,JSON.stringify({code:u,timestamp:o,messageUIds:""})),[2])}}))}))},e.prototype.joinChatroom=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._joinChrm(t,e,!1,n)];case 1:return[2,r.sent().code]}}))}))},e.prototype.joinExistChatroom=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._joinChrm(t,e,!0,n)]}))}))},e.prototype.quitChatroom=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr,n=e.codec.encodeJoinOrQuitChatRoom(),r=new vi(br,n,t),[4,e.send(r)]):[2,V.RC_NET_UNAVAILABLE];case 1:return i=s.sent(),(o=i.code)===V.SUCCESS&&(delete this._chrmsQueue[t],this._chrmEntryHandler.reset(t),this._joinedChrmManager.remove(t)),[2,o]}}))}))},e.prototype.getChatroomInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(r=this._connMgr,i=r.codec.encodeGetChatRoomInfo(e,n),o=new vi(Ri[Ri.queryChrmI],i,t),[4,r.send(o,No)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,a!==V.SUCCESS?[2,{code:a}]:[2,{code:a,data:c}]}}))}))},e.prototype.getChatroomHistoryMessages=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr,o=i.codec.encodeGetHistoryMsg(t,{timestamp:e,count:n,order:r}),s=new vi(Yr,o,t),[4,i.send(s,po,{conversation:{targetId:t}})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,c!==V.SUCCESS?[2,{code:c}]:[2,{code:c,data:{list:u.list,hasMore:u.hasMore}}]}}))}))},e.prototype._modifyChatroomKV=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=this._chrmEntryHandler.getVersion(t,e.key),e.version=null==o?this.getServerTime():o,s=r.codec.encodeModifyChatRoomKV(t,e,i),a=e.type===rt.UPDATE?wr:Pr,c=new vi(a,s,t),[4,r.send(c,So)]):[2,V.RC_NET_UNAVAILABLE];case 1:return u=l.sent(),(h=u.code)===V.SUCCESS?(this._chrmEntryHandler.setLocal(t,{kvEntries:[e],syncTime:this.getServerTime()},i),[2,h]):[2,h]}}))}))},e.prototype._chatroomKVStoreNotAllSuccess=function(t,e){var n=e.data,r=t;return n&&Array.isArray(n.errorKeys)&&n.errorKeys.forEach((function(t){var e=r.findIndex((function(e){return t.key===e.key}));-1!==e&&r.splice(e,1)})),r},e.prototype._modifyChatroomKVS=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,h,d,p,g,f,_=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,e.entries.forEach((function(e){var n=_._chrmEntryHandler.getVersion(t,e.key);e.version=null==n?_.getServerTime():n})),o=r.codec.encodeModifyChatRoomKVS(t,e,i),s=e.type===rt.UPDATE?xr:Dr,a=new vi(s,o,t),[4,r.send(a,Bo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return u=l.sent(),h=u.code,-1!==[V.SUCCESS,V.CHATROOM_KV_STORE_NOT_ALL_SUCCESS].indexOf(h)&&(p=[],delete(g=c({},e)).entries,e.entries.forEach((function(t){p.push(c(c({},t),g))})),h===V.CHATROOM_KV_STORE_NOT_ALL_SUCCESS&&(f=u.data,d=f.errorKeys,p=this._chatroomKVStoreNotAllSuccess(p,u)),this._chrmEntryHandler.setLocal(t,{kvEntries:p,syncTime:(new Date).getTime()},i)),[2,{code:h,data:d}]}}))}))},e.prototype.setChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.setChatroomEntries=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.UPDATE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceSetChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.UPDATE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.removeChatroomEntries=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.DELETE,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKVS(t,e)]}))}))},e.prototype.forceRemoveChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.type=rt.DELETE,e.isOverwrite=!0,e.userId=e.userId||this.currentUserId,[2,this._modifyChatroomKV(t,e)]}))}))},e.prototype.getChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return(n=this._chrmEntryHandler.getValue(t,e))?[2,{code:V.SUCCESS,data:n}]:this._isConnected?(r=this._connMgr,i=r.codec.encodePullChatRoomKV(0),o=new vi(Ri[Ri.pullKV],i,t),[4,r.send(o,Go)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),(a=s.data)&&a.kvEntries&&a.kvEntries.length&&(c=a.kvEntries.find((function(t){return t.key===e})),void 0!==c)?[2,{code:V.SUCCESS,data:null==c?void 0:c.value}]:[2,{code:V.CHATROOM_KEY_NOT_EXIST}]}}))}))},e.prototype.getAllChatroomEntry=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return(e=this._chrmEntryHandler.getAll(t))&&Object.keys(e).length?[2,{code:V.SUCCESS,data:e}]:this._isConnected?(n=this._connMgr,e={},r=n.codec.encodePullChatRoomKV(0),i=new vi(Ri[Ri.pullKV],r,t),[4,n.send(i,Go)]):[2,{code:V.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:V.SUCCESS,data:e}]}}))}))},e.prototype.pullChatroomEntry=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u,h,d,p,g=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=(n=this)._connMgr,i=n.currentUserId,o=r.codec.encodePullChatRoomKV(e),s=new vi(Ri[Ri.pullKV],o,t),this.logger.info(exports.LogTagId.L_PULL_CHATROOM_KV_T,JSON.stringify({chatroomId:t,timestamp:e})),[4,r.send(s,Go)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return a=l.sent(),c=a.code,u=a.data,h=c===V.SUCCESS?"info":"warn",this.logger[h](exports.LogTagId.L_PULL_CHATROOM_KV_R,JSON.stringify({code:c,timestamp:e})),c===V.SUCCESS&&u?(d=u.kvEntries,p=[],d.length>0&&(d.forEach((function(e){var n=e.key,r=e.value,i=e.type,o=e.timestamp,s=e.userId;g._chrmEntryHandler.getValue(t,n)===r&&s===g.getCurrentUserId()||p.push({key:n,value:r,type:i,timestamp:o,chatroomId:t})})),this._chrmEntryHandler.setLocal(t,u,i),p.length>0&&this._watcher.chatroom({updatedEntries:p})),[2,{code:c,data:u}]):[2,{code:c}]}}))}))},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()}),y)},e.prototype._stopSyncIntervalForChrmPull=function(){"number"!=typeof this._intervalTimerForChrmPull&&(clearInterval(this._intervalTimerForChrmPull),this._intervalTimerForChrmPull=-1)},e.prototype.sendMessage=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p,g,f,_,E;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=function(t,e){var n=t.messageType;if("RC:SRSMsg"===n&&Object.assign(t,{directionalUserIdList:[e]}),n===K.READ_RECEIPT_RESPONSE&&t.content.receiptMessageDic)for(var r in t.directionalUserIdList=[],t.content.receiptMessageDic)t.directionalUserIdList.push(r);return t}(n,this.currentUserId),n=this._handleMsgProperties(n,!0),o=!![B.PRIVATE,B.GROUP].includes(t)&&n.isStatusMessage,s=o?function(t){var e;return(e={},e[B.PRIVATE]=Ri.ppMsgS,e[B.GROUP]=Ri.pgMsgS,e)[t]}(t):function(t){var e;return(e={},e[B.PRIVATE]=Ri.ppMsgP,e[B.GROUP]=Ri.pgMsgP,e[B.CHATROOM]=Ri.chatMsg,e[B.CUSTOMER_SERVICE]=Ri.pcMsgP,e[B.RTC_ROOM]=Ri.prMsgS,e[B.SYSTEM]=Ri.pbMsgP,e)[t]}(t)||Ri.ppMsgP,o&&(n.isPersited=!1,n.isCounted=!1),a=n.messageId?n.messageId:Me(),n.messageId=a,u=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},n),(h=new Ei(Ri[s],u,t===B.SYSTEM?this.currentUserId:e)).setHeaderQos(Cr.AT_LEAST_ONCE),o?(this._connMgr.sendOnly(h),[2,{code:V.SUCCESS,data:La(t,e,c({},n),"",0,this.currentUserId,a)}]):(d=this._connMgr.getCrtServerTime(),p=La(t,e,c({},n),"",d,this.currentUserId,a),null==r||r(a),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:n.messageType,conversationType:t,targetId:e,channelId:n.channelId}),i),[4,this._connMgr.send(h)])):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return g=l.sent(),f=g.code,_=g.data,f!==V.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:p.messageUId,messageId:p.messageId}),i),p.sentStatus=exports.SentStatus.FAILED,[2,{code:f,data:p}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:f,messageUId:null==_?void 0:_.messageUId,messageId:null==_?void 0:_.messageId}),i),E=_,this._sendMessageStore.setMessage(E.messageUId,E.timestamp),p.sentTime=E.timestamp,p.messageUId=E.messageUId,this._conversationManager.setConversationCacheByMessage(p,!0),[2,{code:V.SUCCESS,data:p}])}}))}))},e.prototype.recallMsg=function(t,e,n,r,i){var o;return u(this,void 0,void 0,(function(){var s,a,u,h,d,p,g,f,_,E,T,C,v;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(s=i.user,a=i.extra,u=i.isDelete,h={conversationType:t,targetId:e,messageUId:n,sentTime:r,channelId:i.channelId||"",isDelete:u||!1},s&&(h.user=s),a&&(h.extra=a),d={content:h,messageType:"RC:RcCmd",disableNotification:null==i?void 0:i.disableNotification,pushConfig:null==i?void 0:i.pushConfig,pushContent:(null===(o=i.pushConfig)||void 0===o?void 0:o.pushContent)||i.pushContent||"",channelId:i.channelId},p=Ri[Ri.recallMsg],g=this._connMgr.codec.encodeUpMsg({conversationType:t,targetId:e},d),(f=new Ei(p,g,this.currentUserId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(f)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return _=l.sent(),E=_.code,T=_.data,t===B.ULTRA_GROUP&&this.logger.debug(exports.LogTagId.L_RECALL_ULTRA_MSG_S,JSON.stringify({code:E,conversationType:t,targetId:e,channelId:i.channelId})),E!==V.SUCCESS?[2,{code:E}]:(C=T,t===B.ULTRA_GROUP?(this._ultraMsgMap[C.messageUId]=C.timestamp,this._updateUltraGroupWhenRecallMsg(e,i.channelId||"",n),[2,{code:V.SUCCESS}]):(this._sendMessageStore.setMessage(C.messageUId,C.timestamp),v=La(t,e,c(c({},d),{isPersited:!0}),C.messageUId,C.timestamp,this.currentUserId),this._conversationManager.setConversationCacheByMessage(v,!0),[2,{code:V.SUCCESS,data:v}]))}}))}))},e.prototype.sendReadReceiptMessage=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i;return l(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeReadReceipt(e,n),i=new vi(Ri[Ri.rrMsg],r,t),[2,this._connMgr.send(i)]):[2,{code:V.RC_NET_UNAVAILABLE}]}))}))},e.prototype.getMessageReader=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i;return l(this,(function(o){return this._isConnected?(r=this._connMgr.codec.encodeMessageReader(e,n),i=new vi(Ri[Ri.rrList],r,t),[2,this._connMgr.send(i,as)]):[2,{code:V.RC_NET_UNAVAILABLE}]}))}))},e.prototype.pullUserSettings=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodePullUserSetting(t),n=new vi(Ri[Ri.pullUS],e,this.currentUserId),[4,this._connMgr.send(n,jo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===V.SUCCESS&&this._naviChangeHandler(o),[2,{code:i,data:o}]}}))}))},e.prototype._naviChangeHandler=function(t){var e;if(t){var n=t.settings,r=null===(e=null==n?void 0:n.VoipInfo)||void 0===e?void 0:e.value;if(r){var i=this._connMgr.getToken();this.navi.updateVoipCallInfo(i,r);var o=this.navi.getNaviInfoFromCache(i);this._watcher.onNaviDataChange(c({},o))}}else this.logger.warn(exports.LogTagId.L_NOTIFY_NAVI_CHANGE_E,JSON.stringify({data:t}))},e.prototype.getFileToken=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,u,h,d,p,g,f;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(o=r&&"uploads"!==r?e||"":Re(t,e),s=this.getNaviInfoFromCache(),a=De(s,this.logger),u={uploadDomain:a},h=this._connMgr.codec.encodeGetFileToken(t,o,n||"",r||"",i||"",JSON.stringify(u)),d=new vi(Ri[Ri.qnTkn],h,this.currentUserId),[4,this._connMgr.send(d,Mo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return p=l.sent(),g=p.code,f=p.data,f=c(c({},f),{fileName:o,downloadAuthInfo:f.downloadAuthInfo?JSON.parse(f.downloadAuthInfo):null}),g===V.SUCCESS?[2,{code:g,data:f}]:[2,{code:g}]}}))}))},e.prototype.getFileUrl=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u,h,d,p,g,f;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i="",o="",s="",a="",e===Z.QINIU?(o=Uo,s=bo):(o=Ao,s=wo),e===Z.QINIU?i=Ri[Ri.qnUrl]:e===Z.AWS?i=Ri[Ri.s3Url]:e===Z.STC?i=Ri[Ri.stcUrl]:e===Z.MINIO?(i=Ri[Ri.minioUrl],a=De(this.getNaviInfoFromCache(),this.logger)):i=Ri[Ri.aliUrl],c={url:a},u=this._connMgr.codec.encodeGetFileUrl(o,t,n,r,JSON.stringify(c)),h=new vi(i,u,this.currentUserId),[4,this._connMgr.send(h,s)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return d=l.sent(),p=d.code,g=d.data,f=g,p===V.SUCCESS?[2,{code:p,data:f}]:[2,{code:p}]}}))}))},e.prototype.disconnect=function(){return u(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,r,i){this._customMessageType[t]={isPersited:e,isCounted:n,isStatusMessage:i}},e.prototype.getServerTime=function(){return this._connMgr.getCrtServerTime()},e.prototype.getCurrentUserId=function(){return this.currentUserId},e.prototype.createTag=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,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),r=new vi(Ri[Ri.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,qo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return i=u.sent(),o=i.code,s=i.data,o!==V.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([c(c({},t),{createdTime:a})],a),[2,{code:V.SUCCESS}])}}))}))},e.prototype.removeTag=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(e=this._userSettingManager.getVersion(),n=this._connMgr.codec.encodeRemoveTag([t],e),r=new vi(Ri[Ri.delSeTag],n,this.currentUserId),[4,this._connMgr.send(r,qo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==V.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.deleteTag([t],a),[2,{code:V.SUCCESS}])}}))}))},e.prototype.updateTag=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,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),r=new vi(Ri[Ri.addSeTag],n,this.currentUserId),[4,this._connMgr.send(r,qo)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==V.SUCCESS?[2,{code:o}]:(a=s.version,this._userSettingManager.addTag([t],a),[2,{code:V.SUCCESS}])}}))}))},e.prototype.getTagList=function(){return u(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:V.SUCCESS,data:t}]}))}))},e.prototype.addTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,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),r=new vi(Ri[Ri.addTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:V.TAG_NOT_EXIST}]:[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(i=a.sent().code)!==V.SUCCESS?[2,{code:i}]:((o={})[t]={},e.forEach((function(t){s._conversationManager.addTagStatus(t.conversationType,t.targetId,o,t.channelId)})),[2,{code:V.SUCCESS}])}}))}))},e.prototype.removeTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o=this;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeUpdateConversationTag([{tagId:t}],e),r=new vi(Ri[Ri.delTag],n,this.currentUserId),[4,this._connMgr.send(r)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(i=s.sent().code)!==V.SUCCESS?[2,{code:i}]:(e.forEach((function(e){o._conversationManager.deleteTagStatus(e.conversationType,e.targetId,[t],e.channelId)})),[2,{code:V.SUCCESS}])}}))}))},e.prototype.removeTagsForConversation=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(n=t.conversationType,r=t.targetId,i=t.channelId,o=e.map((function(t){return{tagId:t}})),s=this._connMgr.codec.encodeUpdateConversationTag(o,[t]),a=new vi(Ri[Ri.delTag],s,this.currentUserId),[4,this._connMgr.send(a)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(c=u.sent().code)!==V.SUCCESS?[2,{code:c}]:(this._conversationManager.deleteTagStatus(n,r,e,i),[2,{code:V.SUCCESS}])}}))}))},e.prototype.getConversationListByTag=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=(r=this).currentUserId,o=r._connMgr,s=o.codec.encodeOldConversationList({count:n,type:B.PRIVATE,startTime:e}),a=new vi(Vr,s,i),[4,o.send(a,fo,{currentUserId:i,connectedTime:o.getConnectedTime()})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return c=l.sent(),u=c.code,h=c.data,u!==V.SUCCESS?[2,{code:u}]:(d=this._conversationHasTagFilter(t,null==h?void 0:h.list),[2,{code:u,data:d}])}}))}))},e.prototype._conversationHasTagFilter=function(t,e){var n=this,r=[],i=[];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,u=n._conversationManager.get(o,s,a),l=u.hasMentioned,h=u.mentionedInfo,d=u.lastUnreadTime,p=u.notificationStatus,g=u.isTop,f=u.tags,_=u.unreadMessageCount,E=f&&f[t];if(E){var T=c(c({},e),{hasMentioned:l,mentionedInfo:h,lastUnreadTime:d,notificationStatus:p,isTop:g,unreadMessageCount:_});E.isTop?r.push(c(c({},T),{isTopInTag:!0})):i.push(c(c({},T),{isTopInTag:!1}))}})),r.sort(o),i.sort(o),h(h([],r,!0),i,!0)},e.prototype.getUnreadCountByTag=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){return this._isConnected?(n=this._conversationManager.getUnreadCountByTag(t,e),[2,{code:V.SUCCESS,data:n}]):[2,{code:V.RC_NET_UNAVAILABLE}]}))}))},e.prototype.setConversationStatusInTag=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u,h,d,p;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(r=e.targetId,i=e.conversationType,o=e.channelId,s=n.isTop,a=[{tagId:t,isTop:s}],(c=this._conversationManager.get(i,r,o)).tags&&Object.hasOwnProperty.call(c.tags,t)?(u=this._connMgr.codec.encodeUpdateConversationTag(a,[e]),h=new vi(Ri[Ri.addTag],u,this.currentUserId),[4,this._connMgr.send(h)]):[2,{code:V.NO_TAG_IN_CONVER}]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(d=l.sent().code)!==V.SUCCESS?[2,{code:d}]:((p={})[t]={},s&&(p[t].isTop=!0),this._conversationManager.addTagStatus(i,r,p,o),[2,{code:V.SUCCESS}])}}))}))},e.prototype.getTagsForConversation=function(t){var e;return u(this,void 0,void 0,(function(){var n,r,i,o;return l(this,(function(s){if(!this._isConnected)return[2,{code:V.RC_NET_UNAVAILABLE}];if(n=this._conversationManager.get(t.conversationType,t.targetId,t.channelId),r=this._userSettingManager.getTagsInfo(),i=[],n.tags)for(o in n.tags)i.push({tagId:o,tagName:null===(e=r[o])||void 0===e?void 0:e.tagName});return[2,{code:V.SUCCESS,data:i}]}))}))},e.prototype.getBlockConversationList=function(){var t=this._conversationManager.getBlockConversationList();return Promise.resolve({code:V.SUCCESS,data:t})},e.prototype.getTopConversationList=function(t,e){var n=this._conversationManager.getTopConversationList(t,e);return Promise.resolve({code:V.SUCCESS,data:n})},e.prototype.getUnreadConversationList=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){return e=this._conversationManager.getUnreadConversationList(t),[2,Promise.resolve({code:V.SUCCESS,data:e})]}))}))},e.prototype.getUnreadMentionedCount=function(t){var e,n;return n=t.conversationType===B.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:V.SUCCESS,data:n})},e.prototype.getAllUnreadMentionedCount=function(){var t=this._conversationManager.getAllUnreadMentionedCount();return Promise.resolve({code:V.SUCCESS,data:t})},e.prototype.getConversationNotificationLevel=function(t,e,n){if(!this._isUltraGroupListExist&&t===B.ULTRA_GROUP)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});var r;if(!(r=t===B.ULTRA_GROUP?this._ultraGroupManager.get(B.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n)))return Promise.resolve({code:V.SUCCESS,data:W.NOT_SET});var i=r.notificationLevel;return jt(r.notificationLevel)&&!jt(r.notificationStatus)&&(i=Y.OPEN===r.notificationStatus?1:0),Promise.resolve({code:V.SUCCESS,data:i})},e.prototype.getConversationNotificationStatus=function(t,e,n){var r;return(r=t===B.ULTRA_GROUP?this._ultraGroupManager.get(B.ULTRA_GROUP,e,n):this._conversationManager.get(t,e,n))?Promise.resolve({code:V.SUCCESS,data:r.notificationStatus}):Promise.resolve({code:V.SUCCESS,data:Y.CLOSE})},e.prototype.getRemoteHistoryMessages=function(t,e,n,r,i,o){return this.getHistoryMessage(t,e,n,r,i,o)},e.prototype.getUltraGroupList=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o=this;return l(this,(function(s){return e=t.targetId,n=t.channelType,this._isUltraGroupListExist?(r=(r=Object.values(this._ultraGroupMap).filter((function(t){return!(t.targetId!==e&&e||t.channelType!==n&&kt(n))}))).map((function(t){var e=t.unreadMessageCount,n=t.unreadMentionedCount,r=t.unreadMentionedMeCount;return e=o._getUnreadCount(e),n=o._getUnreadCount(n),r=o._getUnreadCount(r),c(c({},t),{unreadMessageCount:e,unreadMentionedCount:n,unreadMentionedMeCount:r})})),r=Ma(r),i=Qe(r),[2,{code:V.SUCCESS,data:i}]):[2,{code:V.METHOD_NOT_AVAILABLE}]}))}))},e.prototype._getUnreadCount=function(t){return t>999?999:t},e.prototype.getBlockUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){(t.notificationStatus===Y.OPEN||t.notificationLevel>0)&&e.push({conversationType:B.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:V.SUCCESS,data:e})},e.prototype.getTopUltraGroupList=function(){if(!this._isUltraGroupListExist)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});var t=Object.values(this._ultraGroupMap),e=[];return t.forEach((function(t){!0===t.isTop&&e.push({conversationType:B.ULTRA_GROUP,targetId:t.targetId,channelId:t.channelId})})),Promise.resolve({code:V.SUCCESS,data:e})},e.prototype.getUltraGroupUnreadMentionedCountByTargetId=function(t,e){if(!this._isUltraGroupListExist)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});var n=0;for(var r in this._ultraGroupMap){r.match(/_.*/g)[0].substring(1)!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[r].notificationLevel)||(n+=this._ultraGroupMap[r].unreadMentionedCount)}return n=this._getUnreadCount(n),Promise.resolve({code:V.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadCountByTargetId=function(t,e){var n=0;for(var r in this._ultraGroupMap){var i=this._ultraGroupMap[r];i.targetId!==t||e&&0!==e.length&&!e.includes(this._ultraGroupMap[r].notificationLevel)||(n+=i.unreadMessageCount||0)}return n=this._getUnreadCount(n),Promise.resolve({code:V.SUCCESS,data:n})},e.prototype.getUltraGroupUnreadInfoList=function(t){var e=this;if(!this._isUltraGroupListExist)return Promise.resolve({code:V.METHOD_NOT_AVAILABLE});var n=[];return Object.keys(this._ultraGroupMap).forEach((function(r){var i=e._ultraGroupMap[r];t.includes(i.targetId)&&n.push({type:i.conversationType,targetId:i.targetId,channelId:i.channelId,unreadMessageCount:e._getUnreadCount(i.unreadMessageCount),mentionedCount:e._getUnreadCount(i.unreadMentionedCount),mentionedMeCount:e._getUnreadCount(i.unreadMentionedMeCount),notificationLevel:i.notificationLevel})})),Promise.resolve({code:V.SUCCESS,data:n})},e.prototype.getAllUltraGroupUnreadCount=function(t){if(void 0===t&&(t=!1),!this._isUltraGroupListExist)return Promise.resolve({code:V.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:V.SUCCESS,data:e})},e.prototype.clearUltraUnreadcount=function(t,e){return void 0===e&&(e=""),u(this,void 0,void 0,(function(){var n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this.getServerTime(),r=this._connMgr.codec.encodeClearUnreadCount({conversationType:B.ULTRA_GROUP,targetId:t,channelId:e},{timestamp:n}),(i=new Ei(Ri[Ri.updUgRTime],r,this.currentUserId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(i)]):[2,V.RC_NET_UNAVAILABLE]:[2,Promise.resolve(V.METHOD_NOT_AVAILABLE)];case 1:return(o=a.sent().code)===V.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 u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,h,d,p,g,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 vi(Ri[Ri.pullUgSes],e,this.currentUserId),[4,this._connMgr.send(n,fo,{currentUserId:this.currentUserId,conversationType:B.ULTRA_GROUP})]):[2];case 1:return r=l.sent(),i=r.code,o=r.data,i===V.SUCCESS&&o?(a=o.list,c=o.isFinished,a.forEach((function(t){t.notificationStatus=Y.CLOSE,t.notificationLevel=W.NOT_SET,t.isTop=!1,f._ultraGroupMap["".concat(t.channelId,"_").concat(t.targetId)]=t,f._ultraGroupManager.addUltraGroupStatus(t)})),!1!==c?[3,2]:(u=a.length>0&&a[a.length-1].versionTime||0,this._getUltraGroupList(u),[3,4])):(this.logger.warn(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation failured, code: ".concat(i,", try again")),s=setTimeout((function(){f._getUltraGroupList(t),clearTimeout(s)}),3e3),[2]);case 2:return this.logger.info(exports.LogTagId.L_ULTRA_SYNC_DONE_S,"Pull ultra group conversation success"),[4,this.pullConversationStatus(0)];case 3:h=l.sent(),d=h.code,p=h.data,d!==V.SUCCESS&&this.logger.warn(exports.LogTagId.O,"pullConversationStatus fail code: ".concat(d,", data: ").concat(p)),g=Object.values(this._ultraGroupMap),g=Ma(g),this._isUltraGroupListExist=!0,this._watcher.ultraGroupEnable(Qe(g)),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 u(this,void 0,void 0,(function(){var t,e,n,r=this;return l(this,(function(i){switch(i.label){case 0:return this._isConnected?[4,this._fetchUltraMsg(0)]:[2];case 1:return t=i.sent(),e=t.code,n=t.data,e===V.SUCCESS&&n?(this.logger.info(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online success."),this._getUltraGroupList(0),-1===this._ultraGroupTimer&&this._startUltraSyncInterval(),[2]):(this.logger.warn(exports.LogTagId.L_NOTIFY_ULTRA_ONLINE_S,"Notify ultra group online failured, try again."),setTimeout((function(){r._notificationOnline()}),3e3),[2])}}))}))},e.prototype._fetchUltraMsg=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return e=this._connMgr.codec.encodeSuperSyncMsg(t),n=new vi(Ri[Ri.pullUgMsg],e,this.currentUserId),r=this.logger.createTraceId(),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_T,JSON.stringify({timestamp:t}),r),[4,this._connMgr.send(n,oo,{currentUserId:this.currentUserId,conversation:{conversationType:B.ULTRA_GROUP}})];case 1:return i=l.sent(),o=i.code,s=i.data,o===V.SUCCESS&&s?(a=s.list,c=s.syncTime,u=a.map((function(t){return t.messageUId})).join(","),this.logger.info(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,messageUIds:u,timestamp:t,syncTime:c}),r)):this.logger.warn(exports.LogTagId.L_PULL_ULTRA_MSG_R,JSON.stringify({code:o,timestamp:t}),r),[2,{code:o,data:s}]}}))}))},e.prototype._getUltraGroup=function(t,e,n){var r,i,o,s=t.targetId,a=t.messageType,c=t.channelId,u=t.isCounted,l=t.channelType,h=t.sentTime,d=t.senderUserId,p=t.content,g=t.isMentioned,f=this._ultraGroupMap["".concat(c,"_").concat(s)],_=f||{conversationType:B.ULTRA_GROUP,targetId:s,channelId:c,unreadMessageCount:0,unreadMentionedCount:0,unreadMentionedMeCount:0,notificationStatus:Y.CLOSE,notificationLevel:W.NOT_SET,isTop:!1};return u&&d!==this.currentUserId&&a!==K.RECALL&&(_.unreadMessageCount+=1,_.unreadMentionedCount+=e,_.firstUnreadMessage||(_.firstUnreadMessage={sentTime:h}),g&&(null===(r=null==p?void 0:p.mentionedInfo)||void 0===r?void 0:r.type)!==J.ALL&&(null===(o=null===(i=null==p?void 0:p.mentionedInfo)||void 0===i?void 0:i.userIdList)||void 0===o?void 0:o.includes(this.currentUserId))&&(_.unreadMentionedMeCount+=1)),_.versionTime=n,_.latestMessage=t,_.channelType=l,f||(this._ultraGroupMap["".concat(c,"_").concat(s)]=_),_},e.prototype._syncUltraMsg=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,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,r=e.data,this._lastSyncUltraMsgLocalTimeStamp=Date.now(),this._isUltraPulling=!1,n===V.SUCCESS&&r?(i=r.list,o=r.syncTime,s=r.finished,a={},c=[],i.forEach((function(t){var e,n,r,i=t.targetId,s=t.content,u=t.messageUId,l=t.channelId,d=t.isMentioned;if(h._ultraMsgMap[u])delete h._ultraMsgMap[u];else{var p=0;d&&((null===(e=null==s?void 0:s.mentionedInfo)||void 0===e?void 0:e.type)===J.ALL||(null===(r=null===(n=null==s?void 0:s.mentionedInfo)||void 0===n?void 0:n.userIdList)||void 0===r?void 0:r.includes(h.currentUserId)))&&(p=1);var g=h._getUltraGroup(t,p,o);a["".concat(l,"_").concat(i)]=g,h._ultraGroupManager.addUltraGroupStatus(g),c.push(t)}})),Object.keys(a).length>0&&(this.logger.debug(exports.LogTagId.O,"notice ultragroups"),u=Object.values(a),u=Ma(u),this._watcher.conversation(Qe(u))),this.logger.debug(exports.LogTagId.O,"notice ultragroup message"),this._batchMessage(c),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,r){return u(this,void 0,void 0,(function(){var i,o,s,a,u,h,d,p,g,f,_;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?("RC:SRSMsg"===e.messageType&&this.logger.warn(exports.LogTagId.O,"ultra group -> direction message convert to message"),e=this._handleMsgProperties(e,!0),i=e.messageId?e.messageId:Me(),e.messageId=i,o=this._connMgr.codec.encodeUpMsg({conversationType:B.ULTRA_GROUP,targetId:t},e),(s=new Ei(Ri[Ri.ugMsg],o,t)).setHeaderQos(Cr.AT_LEAST_ONCE),a=this._connMgr.getCrtServerTime(),u=La(B.ULTRA_GROUP,t,c({},e),"",a,this.currentUserId,i),n&&n(i),this.logger.info(exports.LogTagId.L_SEND_MSG_T,JSON.stringify({messageType:e.messageType,conversationType:B.ULTRA_GROUP,targetId:t,channelId:e.channelId}),r),[4,this._connMgr.send(s)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return h=l.sent(),d=h.code,p=h.data,d!==V.SUCCESS?(this.logger.warn(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:u.messageUId,messageId:u.messageId}),r),u.sentStatus=exports.SentStatus.FAILED,[2,{code:d,data:u}]):(this.logger.info(exports.LogTagId.L_SEND_MSG_R,JSON.stringify({code:d,messageUId:null==p?void 0:p.messageUId,messageId:null==p?void 0:p.messageId}),r),g=p,u.sentTime=g.timestamp,u.messageUId=g.messageUId,this._ultraMsgMap[g.messageUId]=g.timestamp,f=e.channelId||"",(_=this._ultraGroupMap["".concat(f,"_").concat(t)])?(_.latestMessage=u,kt(_.channelType)&&(u.channelType=_.channelType)):(_={conversationType:B.ULTRA_GROUP,targetId:t,channelId:f,unreadMessageCount:0,unreadMentionedCount:0,versionTime:u.sentTime,latestMessage:u,notificationStatus:Y.CLOSE,notificationLevel:W.NOT_SET,isTop:!1},this._ultraGroupMap["".concat(f,"_").concat(t)]=_,this._ultraGroupManager.addUltraGroupStatus(_)),this._watcher.conversation(Qe([_])),[2,{code:d,data:u}])}}))}))},e.prototype.sendUltraGroupTypingStatus=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?(n=t.conversationType,r=t.channelId,i=t.targetId,o=this._connMgr.codec.encodeOperateStatus(i,n,r||"",e||0),(s=new Ei(Ri[Ri.operate],o,i)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(s)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(a=c.sent().code)!==V.SUCCESS?[2,{code:a,msg:V[a]}]:[2,{code:a}]}}))}))},e.prototype.getUltraGroupMessageListByMessageUId=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return this._isConnected?t.messages&&t.messages.length<1||t.messages&&t.messages.length>20?[2,{code:V.MSG_LIMIT_ERROR}]:(e={},t.messages.forEach((function(t){e[t.messageUId]=void 0})),n=this._connMgr.codec.encodeMsgQuery(t),(r=new vi(Ri[Ri.qryMsg],n,this.currentUserId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(r,ms,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return i=c.sent(),o=i.code,s=i.data,o!==V.SUCCESS?[2,{code:o,msg:V[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,Ss),n=e.conversationType,r=e.info,i=e.summary;this.logger.debug(exports.LogTagId.O,"s_opNtf -> type: ".concat(n,", info: ").concat(r,", summary: ").concat(i)),this._watcher.operateStatus(e)}},e.prototype.expandUltraMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,r;return l(this,(function(i){switch(i.label){case 0:return this._isConnected?(e=this._connMgr.codec.encodeExpandUltraMessage(t,this.currentUserId),(n=new vi(Ri[Ri.upMsgEx],e,t.targetId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return(r=i.sent().code)!==V.SUCCESS?[2,{code:r,msg:V[r]}]:[2,{code:r}]}}))}))},e.prototype.modifyMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,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 vi(Ri[Ri.modifyMsg],e,t.targetId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(n)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return r=a.sent(),i=r.code,o=r.data,i!==V.SUCCESS?[2,{code:i,msg:V[i]}]:(s=o,this._ultraMsgMap[s.messageUId]=s.timestamp,[2,{code:i}])}}))}))},e.prototype._pullUltraChangeMessageList=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,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 vi(Ri[Ri.qryMsgChange],e,this.currentUserId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(n,vs)]):[2];case 1:return r=l.sent(),i=r.code,o=r.data,this._isPullingUltraChangeMessage=!1,i===V.SUCCESS&&o?(s=o.hasNext,a=o.list,c=(null==o?void 0:o.syncTime)||0,this._handleUltraChangeList(a),u=this._pullUltraChangeMessageQue.filter((function(t){return t>c})),this._pullUltraChangeMessageQue.length=0,(h=this._pullUltraChangeMessageQue).push.apply(h,u),s?this._pullUltraChangeMessageList(c):this._lastPullingUltraChangeMessageTime=c,[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=exports.UltraMsgChangeType.CHANNEL_CHANGE,r=exports.UltraMsgChangeType.MSG_RECALL,i=exports.UltraMsgChangeType.MSG_EXPANSION,o=exports.UltraMsgChangeType.MSG_MODIFY,s=exports.UltraMsgChangeType.USER_GROUP_CHANGE;e[n]&&this._handleUltraChannelChange(e[n]),e[r]&&this._handleMsgRecall(e[r]),e[i]&&this._handleMsgUpdate(e[i]),e[o]&&this._handleMsgUpdate(e[o]),e[s]&&this._handleUserGroupStatus(e[s])},e.prototype._handleUltraChannelChange=function(t){var e=this,n=[],r=[],i=[];t.forEach((function(t){var o=t.subChangeType,s=t.targetId,a=t.channelId,c=t.sendTime,u=t.operatorId,l="".concat(a,"_").concat(s),h=e._ultraGroupMap[l];if(h){var d=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE,p=exports.UltraMsgSubChangeType.PRIVATE_TO_PUBLIC,g=exports.UltraMsgSubChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,f=exports.UltraMsgSubChangeType.CHANNEL_DELETE,_=exports.UltraMsgSubChangeType.CHANNEL_USER_KICKED;switch(o){case p:h.channelType=exports.UltraGroupChannelType.PUBLIC,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PRIVATE_TO_PUBLIC,channelType:h.channelType});break;case d:h.channelType=exports.UltraGroupChannelType.PRIVATE,n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE,channelType:h.channelType});break;case g:n.push({targetId:s,channelId:a,changeType:exports.UltraGroupChannelChangeType.PUBLIC_TO_PRIVATE_USER_NOT_IN,channelType:h.channelType}),delete e._ultraGroupMap[l];break;case f:r.push({targetId:s,channelId:a,channelType:h.channelType,deleteTime:c}),delete e._ultraGroupMap[l];break;case _:i.push({targetId:s,channelId:a,userId:u,channelType:exports.UltraGroupChannelType.PRIVATE}),u===e.currentUserId&&delete e._ultraGroupMap[l]}}})),n.length>0&&this._watcher.ultraGroupChannelChangeType(n),r.length>0&&this._watcher.ultraGroupChannelDelete(r),i.length>0&&this._watcher.ultraGroupChannelUserKicked(i)},e.prototype._handleMsgRecall=function(t){var e=this,n=[];t.forEach((function(t){var r=t.targetId,i=t.channelId,o=t.messageUId,s=t.sendTime,a=t.conversationType,c=t.operatorId,u=t.mentionedType;e._updateUltraGroupWhenRecallMsg(r,i,o,s,u),n.push({targetId:r,conversationType:a,sentTime:s,messageUId:o,senderUserId:c,channelId:i,content:{conversationType:a,targetId:r,messageUId:o,channelId:i},messageDirection:1,messageType:K.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,r=t.conversationType,i=t.sendTime,o=t.messageUId,s=t.channelId,a="".concat(r,"_").concat(n);e[a]||(e[a]=[]),e[a].push({messageUId:o,channelId:s,sendTime:i})})),e){var r=n.split("_"),i=r.shift(),o=r.join("_");this._pullUltraMessageList(t[0].changeType,{targetId:o,conversationType:Number(i),messages:h([],e[n],!0)})}},e.prototype._pullUltraMessageList=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c,u=this;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(n=this._connMgr.codec.encodeMsgQuery(e),(r=new vi(Ri[Ri.qryMsg],n,this.currentUserId)).setHeaderQos(Cr.AT_LEAST_ONCE),[4,this._connMgr.send(r,ms,{connectedTime:this._connMgr.getConnectedTime(),currentUserId:this.currentUserId})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return i=l.sent(),o=i.code,s=i.data,o!==V.SUCCESS?[2,{code:o,msg:V[o]}]:(a=(s||{}).list,c=[],Array.isArray(a)&&a.forEach((function(t){var e=t.targetId,n=t.channelId,r=t.messageUId,i=u._ultraGroupMap["".concat(n,"_").concat(e)];i&&i.latestMessage.messageUId===r&&(i.latestMessage=t),c.push(t)})),t===exports.UltraMsgChangeType.MSG_EXPANSION&&this._watcher.ultraGroupMessageExpansionUpdated(c),t===exports.UltraMsgChangeType.MSG_MODIFY&&this._watcher.ultraGroupMessageModified(c),[2])}}))}))},e.prototype._handleUserGroupStatus=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,h,d;return l(this,(function(l){return e=exports.UserGroupChangeType.REMOVE_USER_GROUP,n=exports.UserGroupChangeType.JOIN_USER_GROUP,r=exports.UserGroupChangeType.EXIT_USER_GROUP,i=exports.UserGroupChangeType.CHANNEL_BIND_USER_GROUP,o=exports.UserGroupChangeType.CHANNEL_UNBIND_USER_GROUP,s=[],a=[],c=[],u=[],h=[],t.forEach((function(t){var l=t.conversationType,d=t.targetId,p=t.userGroupIds,g=t.busChannelType,f=t.channelId;switch(t.subChangeType){case e:s.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case n:a.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case r:c.push({conversation:{conversationType:l,targetId:d},userGroupIds:p});break;case i:u.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p});break;case o:h.push({conversation:{conversationType:l,targetId:d,channelId:f},channelType:g,userGroupIds:p})}})),d={},s.length>0&&(d.userGroupDisband=s),a.length>0&&(d.userAdded=a),c.length>0&&(d.userRemoved=c),u.length>0&&(d.userGroupBindChannel=u),h.length>0&&(d.userGroupUnBindChannel=h),this._watcher.userGroupStatus(d),[2]}))}))},e.prototype.getUltraHistoryMsg=function(t,e,n){var r;return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return this._isConnected?(i=this._connMgr.codec.encodeGetHistoryMsg(t,e),o=new vi(Ri[Ri.qryUgMsg],i,this.currentUserId),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:B.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,po,{currentUserId:this.currentUserId,conversation:{conversationType:B.ULTRA_GROUP,targetId:t}})]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return s=l.sent(),a=s.code,c=s.data,a===V.SUCCESS&&c?(u=[],null===(r=c.list)||void 0===r||r.forEach((function(t){t&&u.push(t.messageUId)})),this.logger.info(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:u.join(",")}),n),[2,{code:a,data:c}]):(this.logger.warn(exports.LogTagId.L_GET_HISTORY_MSG_R,JSON.stringify({code:a,messageUIds:""}),n),[2,{code:a}])}}))}))},e.prototype.setUltraGroupDefaultNotificationLevel=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return this._isUltraGroupListExist?this._isConnected?(r=this._connMgr.codec.encodeSetUltraGroupDefaultNotificationLevel(e,n),i=new vi(Ri[Ri.ugUnpushSet],r,t),[4,this._connMgr.send(i)]):[2,{code:V.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:V.METHOD_NOT_AVAILABLE})];case 1:return o=a.sent(),s=o.code,V.SUCCESS,[2,{code:s}]}}))}))},e.prototype.getUltraGroupDefaultNotificationLevel=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isUltraGroupListExist?this._isConnected?(n=this._connMgr,r=n.codec.encodeGetUltraGroupDefaultNotificationLevel(e),i=new vi(Ri[Ri.ugUnpushQuery],r,t),[4,n.send(i,is)]):[2,{code:V.RC_NET_UNAVAILABLE}]:[2,Promise.resolve({code:V.METHOD_NOT_AVAILABLE})];case 1:return o=u.sent(),s=o.code,a=o.data,s===V.SUCCESS&&a?(c=a.unpushLevel,[2,{code:s,data:c}]):[2,{code:s}]}}))}))},e.prototype._updateUltraGroupWhenRecallMsg=function(t,e,n,r,i){var o="".concat(e,"_").concat(t);if(this._ultraGroupMap[o]){var s=this._ultraGroupMap[o],a=s.latestMessage,c=s.lastReadTime;a&&a.messageUId===n&&(s.latestMessage=null),r&&c<r&&s.unreadMessageCount>0&&(--s.unreadMessageCount,(i===exports.UltraMentionedType.ALL||i===exports.UltraMentionedType.ME)&&s.unreadMentionedCount>0&&--s.unreadMentionedCount,i===exports.UltraMentionedType.ME&&s.unreadMentionedCount>0&&--s.unreadMentionedMeCount,this._watcher.conversation(Qe([s])))}},e.prototype.getAllConversationState=function(){return Promise.resolve({code:V.SUCCESS,data:this._conversationManager.getAllConversationState()})},e.prototype.getUltraGroupUnreadMentionedMessages=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return this._isConnected?this._isUltraGroupListExist?(e=this._connMgr.codec.encodeUnreadMentionedMsgQuery(t),n=new vi(Ri[Ri.qryUgUal],e,this.currentUserId),[4,this._connMgr.send(n,rs)]):[2,Promise.resolve({code:V.METHOD_NOT_AVAILABLE})]:[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return r=s.sent(),i=r.code,o=r.data,i===V.SUCCESS&&o?[2,{code:i,data:o}]:[2,{code:i}]}}))}))},e.prototype.getUltraGroupFirstUnreadMessageTimestamp=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i;return l(this,(function(o){return this._isConnected?this._isUltraGroupListExist?(e=t.targetId,n=t.channelId,r=this._ultraGroupMap["".concat(n,"_").concat(e)]||{},i=r.firstUnreadMessage||null,[2,{code:V.SUCCESS,data:i}]):[2,Promise.resolve({code:V.METHOD_NOT_AVAILABLE})]:[2,{code:V.RC_NET_UNAVAILABLE}]}))}))},e.prototype.bindRTCRoomForChatroom=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i;return l(this,(function(o){switch(o.label){case 0:return this._isConnected?(e=t.chatRoomId,n=this._connMgr.codec.encodebindRTCRoomForChatroom(t),r=new vi(Ri[Ri.setRtcRoomId],n,e),[4,this._connMgr.send(r)]):[2,V.RC_NET_UNAVAILABLE];case 1:return i=o.sent(),[2,i.code]}}))}))},e.prototype.rtcSignaling=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return this._isConnected?(i=r instanceof ArrayBuffer?Array.prototype.slice.call(new Int8Array(r)):r,o=n?new vi(e,i,t):new Ei(e,i,t),[4,this._connMgr.send(o)]):[2,{code:V.RC_NET_UNAVAILABLE}];case 1:return s=u.sent(),a=s.code,c=s.data,[2,{code:a,buffer:null==c?void 0:c.data}]}}))}))},e.prototype.rtcPing=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=Bs(this.rtcCodec,e,n),[4,this.rtcSignaling(t,Ri[Ri.rtcPing],!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o!==V.SUCCESS?[2,{code:o}]:((a=this.rtcCodec.decode(Be.RtcOutput,s)).version=me(a.version),[2,{code:o,data:a}])}}))}))},e.prototype.getDeviceId=function(){return ie(this.runtime)},e.prototype.getOSInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:V.NOT_SUPPORT}]}))}))},e.prototype.getProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:V.NOT_SUPPORT}]}))}))},e.prototype.getMainProcessInfo=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,{code:V.NOT_SUPPORT}]}))}))},e.prototype.destroy=function(){Hn(),ea()},e.prototype.callExtra=function(t){return Promise.resolve({code:V.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,r){throw new Error("Method not implemented.")},e.prototype.getHistoryMessagesByObjectNames=function(t,e,n,r,i,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(V.NOT_SUPPORT)},e.prototype.removeFromBlacklist=function(t){return Promise.resolve(V.NOT_SUPPORT)},e.prototype.getBlacklist=function(){return Promise.resolve({code:V.NOT_SUPPORT})},e.prototype.getBlacklistStatus=function(t){return Promise.resolve({code:V.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,r,i){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,r){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,r,i,o){throw new Error("Method not implemented.")},e.prototype.searchMessagesByUser=function(t,e,n,r,i,o){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentWithAllChannel=function(t,e,n,r,i){throw new Error("Method not implemented.")},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,r,i,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,r){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,r){throw new Error("Method not implemented.")},e.prototype.setCallInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return(r=this._connMgr)?(i=r.codec.encodeSetCallInfo(e,n),[4,r.send(new vi(Fr,i,t),Us)]):[3,2];case 1:return o=c.sent(),s=o.code,a=o.data,s===V.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:V.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:V.NOT_SUPPORT})},e.prototype.getProxy=function(){return Promise.resolve({code:V.NOT_SUPPORT})},e.prototype.testProxy=function(t,e){return Promise.resolve({status:V.NOT_SUPPORT})},e.prototype.setNetwork=function(t,e){var n;if(this._connMgr.setNetwork(t,e),t.status&&this.cloudControllerUri){var r=this._connMgr.getToken();null===(n=this.cloudController)||void 0===n||n.request(this.cloudControllerUri,exports.InvokerType.newWorkChange,r)}},e}(mn),Aa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.joinRTCRoom=function(t,e,n,r,i,o){return u(this,void 0,void 0,(function(){var s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return s=Bs(this._context.rtcCodec,e,n,r,i,o),[4,this.rtcSignaling(t,ze,!0,s)];case 1:return a=l.sent(),c=a.code,u=a.buffer,c===V.SUCCESS&&u&&(h=ks(this._context.rtcCodec,u)),[2,{code:c,data:h}]}}))}))},e.prototype.quitRTCRoom=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return e=this._context.rtcCodec.encode(Be.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,$e,!0,e)];case 1:return[2,n.sent().code]}}))}))},e.prototype.rtcPing=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,this._context.rtcPing(t,e,n)];case 1:return[2,r.sent().code]}}))}))},e.prototype.rtcPingResVersion=function(t,e,n){return this._context.rtcPing(t,e,n)},e.prototype.getRTCRoomInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(Be.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,tn,!0,e)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===V.SUCCESS&&i&&(o=this._context.rtcCodec.decode(Be.RtcRoomInfoOutput,i)),[2,{code:r,data:o}]}}))}))},e.prototype.getRTCUserInfoList=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s;return l(this,(function(a){switch(a.label){case 0:return e=this._context.rtcCodec.encode(Be.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,en,!0,e)];case 1:return n=a.sent(),r=n.code,i=n.buffer,r===V.SUCCESS&&i&&(s=ks(this._context.rtcCodec,i),o={users:s.users}),[2,{code:r,data:o}]}}))}))},e.prototype.getRTCUserInfo=function(t){throw new Error("Method not implemented.")},e.prototype.setRTCUserInfo=function(t,e,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(Be.RtcValueInfo,{key:e,value:n}),[4,this.rtcSignaling(t,nn,!0,r)];case 1:return[2,i.sent().code]}}))}))},e.prototype.removeRTCUserInfo=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(Be.RtcKeyDeleteInput,{key:e}),[4,this.rtcSignaling(t,rn,!1,n)];case 1:return[2,r.sent().code]}}))}))},e.prototype.setRTCData=function(t,e,n,r,i,o){return u(this,void 0,void 0,(function(){var s;return l(this,(function(a){switch(a.label){case 0:return s=this._context.rtcCodec.encode(Be.RtcSetDataInput,{interior:r,target:i,key:e,value:n,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.rtcSignaling(t,on,!1,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCTotalRes=function(t,e,n,r,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){var o,s;return l(this,(function(a){switch(a.label){case 0:return o={objectName:r,content:this._context.rtcCodec.encode(Be.RtcValueInfo,{key:e.name,value:e.content},!0),valueInfo:[this._context.rtcCodec.encode(Be.RtcValueInfo,{key:"uris",value:n},!0),this._context.rtcCodec.encode(Be.RtcValueInfo,{key:"mcu_uris",value:i},!0)]},s=this._context.rtcCodec.encode(Be.RtcUserSetDataInput,o),[4,this.rtcSignaling(t,sn,!0,s)];case 1:return[2,a.sent().code]}}))}))},e.prototype.setRTCCDNUris=function(t,e,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){switch(i.label){case 0:return r=this._context.rtcCodec.encode(Be.RtcUserSetDataInput,{objectName:e,valueInfo:this._context.rtcCodec.encode(Be.RtcValueInfo,{key:"cdn_uris",value:n},!0)}),[4,this.rtcSignaling(t,sn,!0,r)];case 1:return[2,i.sent().code]}}))}))},e.prototype.getRTCData=function(t,e,n,r){return u(this,void 0,void 0,(function(){var i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return i=this._context.rtcCodec.encode(Be.RtcDataInput,{interior:n,target:r,key:e}),[4,this.rtcSignaling(t,an,!0,i)];case 1:return o=l.sent(),s=o.code,a=o.buffer,s===V.SUCCESS&&a?(c=this._context.rtcCodec.decode(Be.RtcQryOutput,a).outInfo,u={},c.forEach((function(t){u[t.key]=t.value})),[2,{code:s,data:u}]):[2,{code:s}]}}))}))},e.prototype.removeRTCData=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o;return l(this,(function(s){switch(s.label){case 0:return o=this._context.rtcCodec.encode(Be.RtcDataInput,{interior:n,target:r,key:e,objectName:null==i?void 0:i.name,content:null==i?void 0:i.content}),[4,this.rtcSignaling(t,cn,!1,o)];case 1:return[2,s.sent().code]}}))}))},e.prototype.setRTCOutData=function(t,e,n,r){return u(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 u(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 u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=Bs(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,un,!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o===V.SUCCESS&&s?(a=this._context.rtcCodec.decode(Be.RtcTokenOutput,s).rtcToken,[2,{code:o,data:{rtcToken:a}}]):[2,{code:o}]}}))}))},e.prototype.setRTCState=function(t,e){return u(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return n=this._context.rtcCodec.encode(Be.MCFollowInput,{state:e}),[4,this.rtcSignaling(t,ln,!0,n)];case 1:return[2,r.sent().code]}}))}))},e.prototype.getRTCUserList=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(Be.RtcQueryListInput,{order:2}),[4,this.rtcSignaling(t,hn,!0,e)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===V.SUCCESS&&i?(o=ks(this._context.rtcCodec,i),[2,{code:r,data:o}]):[2,{code:r}]}}))}))},e.prototype.joinLivingRoomAsAudience=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a,c,u;return l(this,(function(l){switch(l.label){case 0:return r=Bs(this._context.rtcCodec,e,n),[4,this.rtcSignaling(t,dn,!0,r)];case 1:return i=l.sent(),o=i.code,s=i.buffer,o===V.SUCCESS&&s?(a=this._context.rtcCodec.decode(Be.RtcViewerJoinedOutput,s),c=a.rtcToken,u=a.entries,[2,{code:o,data:{token:c,kvEntries:u}}]):[2,{code:o}]}}))}))},e.prototype.quitLivingRoomAsAudience=function(t){return u(this,void 0,void 0,(function(){var e,n;return l(this,(function(r){switch(r.label){case 0:return e=this._context.rtcCodec.encode(Be.SetUserStatusInput,{status:0}),[4,this.rtcSignaling(t,pn,!0,e)];case 1:return n=r.sent().code,this._context.rtcKVManager.reset(),[2,n]}}))}))},e.prototype.rtcIdentityChange=function(t,e,n){return u(this,void 0,void 0,(function(){var r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return r=this._context.rtcCodec.encode(Be.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:n,identityChangeType:e,needSysChatroom:!1}),[4,this.rtcSignaling(t,fn,!0,r)];case 1:return i=c.sent(),o=i.code,s=i.buffer,o===V.SUCCESS&&s?(a=ks(this._context.rtcCodec,s),[2,{code:o,data:a}]):[2,{code:o}]}}))}))},e.prototype.requestRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c;return l(this,(function(u){switch(u.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,r=t.inviteSessionId,i=t.inviteTimeout,o=t.inviteInfo,s=t.roomId,a=this._context.rtcCodec.encode(Be.RtcInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:r,timeoutTime:i,inviteInfo:o}),[4,this.rtcSignaling(s,_n,!0,a)];case 1:return c=u.sent().code,this._context.rtcKVManager.reset(),[2,c]}}))}))},e.prototype.cancelRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.invitedRoomId,n=t.invitedUserId,r=t.inviteSessionId,i=t.inviteInfo,o=t.roomId,s=this._context.rtcCodec.encode(Be.RtcCancelInviteInput,{invitedRoomId:e,invitedUserId:n,inviteSessionId:r,inviteInfo:i}),[4,this.rtcSignaling(o,En,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.responseRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,h;return l(this,(function(l){switch(l.label){case 0:return e=t.inviteUserId,n=t.inviteRoomId,r=t.inviteSessionId,i=t.content,o=t.key,s=t.value,a=t.agree,c=t.roomId,u=this._context.rtcCodec.encode(Be.RtcInviteAnswerInput,{inviteUserId:e,inviteRoomId:n,inviteSessionId:r,content:i,key:o,value:s,answerCode:a?1:0}),[4,this.rtcSignaling(c,Tn,!0,u)];case 1:return h=l.sent().code,this._context.rtcKVManager.reset(),[2,h]}}))}))},e.prototype.endRoomPK=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.endRoomId,n=t.sessionId,r=t.content,i=t.keys,o=t.roomId,s=this._context.rtcCodec.encode(Be.RtcEndInviteInput,{inviteRoomId:e,inviteSessionId:n,inviteContent:r,inviteRoomKeys:i}),[4,this.rtcSignaling(o,Cn,!0,s)];case 1:return a=c.sent().code,this._context.rtcKVManager.reset(),[2,a]}}))}))},e.prototype.registerRTCSignalListener=function(t){this._context.registerRTCSignalingListener(t)},e.prototype.rtcSignaling=function(t,e,n,r){return this._context.rtcSignaling(t,e,n,r)},e.prototype.getRTCJoinedUserInfo=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o;return l(this,(function(s){switch(s.label){case 0:return e=this._context.rtcCodec.encode(Be.RtcQueryUserJoinedInput,{userId:t}),[4,this.rtcSignaling("",vn,!0,e)];case 1:return n=s.sent(),r=n.code,i=n.buffer,r===V.SUCCESS&&i?(o=this._context.rtcCodec.decode(Be.RtcQueryUserJoinedOutput,i).info||[],[2,{code:r,data:o.map((function(t){return{deviceId:t.deviceId,roomId:t.roomId,joinTime:me(t.joinTime)}}))}]):[2,{code:r}]}}))}))},e}(mr);function ba(t){return c({},t)}var wa=function(){function t(t,e){var n,r;this._runtime=t,this._token="",this._pluginContextQueue=[],this._pluginInstanseMap={},this._versionInfo={},this._typingInfo={},this._compatibleMessageProccessor=((n={})[K.CHATROOM_JOIN]=this._processChatrormMessage.bind(this),n[K.CHATROOM_LEFT]=this._processChatrormMessage.bind(this),n[K.CHATROOM_MERGE_CHANGE]=this._processChrmMemChangeMessage.bind(this),n[K.TYPING_STATUS]=this._processTypingStatusMessage.bind(this),n[K.INTERCEPT]=this._processInterceptMessage.bind(this),n[K.CHATROOM_SYNC_MSG]=this._processChrmSyncMessage.bind(this),n[K.CHATROOM_MERGE_BLOCK]=this._processChrmMemBlockMessage.bind(this),n[K.CHATROOM_MERGE_BAN]=this._processChrmMemBanMessage.bind(this),n),this._messageProccessor=((r={})[K.READ_RECEIPT]=this._processReadReceiptMessage.bind(this),r[K.READ_RECEIPT_REQUEST]=this._processReadReceiptRequestMessage.bind(this),r[K.READ_RECEIPT_RESPONSE]=this._processReadReceiptResponseMessage.bind(this),r),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=c({},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 i={onConnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTED),onConnecting:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.CONNECTING),onSuspend:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.SUSPENDED),onDisconnected:this._onConnectionStatusChange.bind(this,exports.RCConnectionStatus.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(In,yn),this._engine=Ye()?new RCCppEngine(t,this.rtcCodec,i,this._options):new Ua(t,this.rtcCodec,i,this._options),this.logger=this._engine.getInnerLogger(),this.rtcKVManager=new Ze(this._engine)}return t.init=function(e,n){if(this._context)return this._context.logger.warn(exports.LogTagId.A_INIT_REPEAT_O),this._context;this._context=new t(e,n),this._context.logger.info(exports.LogTagId.L_INIT_O,JSON.stringify({appkey:n.appkey,navigators:n.navigators,typingExpireTime:n.typingExpireTime})),this._context.logger.warn(exports.LogTagId.L_IMSDK_VER_O,JSON.stringify({commitId:"6c5819c31229d7abce106e4b4832ba21ddca578d",version:"5.8.5"}));var r=this._context._engine;return e.setNetworkStatusListener(r.setNetwork.bind(r)),this._context},t.destroy=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this._context?(this._context.logger.info(exports.LogTagId.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 Nn(t,e)},t.prototype.install=function(t,e){var n=this.logger.createTraceId();if(this.logger.info(exports.LogTagId.L_INSTALL_PLUGIN_T,JSON.stringify({tag:t.tag}),n),this._pluginInstanseMap[t.tag])return this.logger.warn(exports.LogTagId.L_INSTALL_PLUGIN_R,"repeat install",n),this._pluginInstanseMap[t.tag];var r="RCRTC"===t.tag?new Aa(this):new mr(this),i=null;try{if(!t.verify(this._runtime))return null;i=t.setup(r,this._runtime,e)}catch(t){this.logger.error(exports.LogTagId.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),i&&(this._pluginContextQueue.push(r),this._pluginInstanseMap[t.tag]=i),i},t.prototype._onConnectionStatusChange=function(t,e){var n,r;this.logger.warn(exports.LogTagId.A_CONNECT_S,"status: ".concat(t,", code: ").concat(e)),null===(r=(n=this._watcher).connection)||void 0===r||r.call(n,t,e),this._pluginContextQueue.forEach((function(n){var r;null===(r=n.onconnectionstatechange)||void 0===r||r.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?st.QUIT:st.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(ba(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===B.ULTRA_GROUP){var n=t.content.sourceType;if(e.sourceType=n,(n===exports.MessageBlockSourceType.MSG_EXPANSION||n===exports.MessageBlockSourceType.MSG_MODIFY)&&t.content.sourceContent)try{e.sourceContent=JSON.parse(t.content.sourceContent)}catch(t){this.logger.warn(exports.LogTagId.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,r=this._engine.getCurrentUserId();n&&Array.isArray(n[r])&&"function"==typeof this._watcher.messageReceiptResponse&&this._watcher.messageReceiptResponse({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},t.senderUserId,n[r])},t.prototype._messageReceiver=function(t,e,n){var r,i,o,s,a=this;if(!(null===(i=(r=this._compatibleMessageProccessor)[t.messageType])||void 0===i?void 0:i.call(r,t))&&!this._pluginContextQueue.some((function(e){if(!e.onmessage)return!1;try{return e.onmessage(ba(t))}catch(t){return a.logger.error(exports.LogTagId.A_MSG_LISTENER_E,null==t?void 0:t.stack),!1}}))){if(null===(s=(o=this._watcher).message)||void 0===s||s.call(o,ba(t),e,n),!this._messageProccessor[t.messageType])return t;this._messageProccessor[t.messageType](t)}},t.prototype._batchMessageReceiver=function(t,e,n){var r=this,i=[];t.forEach((function(t){var o=r._messageReceiver(t,e,n);o&&i.push(o)})),i.length&&this._watcher.batchMessage&&(this.logger.debug(exports.LogTagId.L_BATCH_MESSAGE_O,i.map((function(t){return t.messageUId})).join(",")),this._watcher.batchMessage(i))},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(exports.LogTagId.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 r;null===(r=n.onrtcdatachange)||void 0===r||r.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 r=t[n];e._watcher[n]=Yt(r)||qt(r)?r: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,r=t.targetId,i=t.content,o=t.channelId,s=i.typingContentType,a=o||"",c="".concat(n,"#").concat(r,"#").concat(a);this._typingInfo[c]||(this._typingInfo[c]=[]);var u=this._typingInfo[c].findIndex((function(t){return t.userId===e}));u>=0&&this._typingInfo[c][u].messageType===s?this._typingInfo[c][u].timestamp=Date.now():(u>=0&&this._typingInfo[c].splice(u,1),this._typingInfo[c].push({userId:e,messageType:s,timestamp:Date.now()}),this._typingChangedList.includes(c)||this._typingChangedList.push(c),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 u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.refetchNaviInfo()]}))}))},t.prototype.connect=function(t,e,n){var r,i;return u(this,void 0,void 0,(function(){var o,s,a,c,u,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(),c=a.code,u=a.data,c!==V.SUCCESS?[2,{code:c}]:(1!==this._engine.getNaviInfoFromCache().type&&(h=te.getInfo(),null===(i=(r=this._engine).reportSDKInfo)||void 0===i||i.call(r,h)),[2,{code:c,userId:u}])}}))}))},t.prototype.disconnect=function(t){return u(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(exports.LogTagId.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,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1),Ft(r)&&r.length>0&&(this._registerMessageSearchPropsMapping[t]=r),this._engine.registerMessageType(t,e,n,r,i)},t.prototype.registerRTCSignalingListener=function(t){this._engine.registerRTCSignalingListener(t)},t.prototype.checkSearchPropsMsg=function(t,e){var n=this._registerMessageSearchPropsMapping[t],r={};return n&&qt(e)&&Object.keys(e).forEach((function(t){if(n.includes(t)){var i=e[t];kt(i)&&(i>-Math.pow(2,64)&&i<Math.pow(2,64)&&Number.isInteger(i)||(r[t]=i))}})),Object.keys(r).length>0?{msg:JSON.stringify(r),code:V.SEARCH_PROPS_LIMIT_ERROR}:{code:V.SUCCESS}},t.prototype.sendMessage=function(t,e,n,r,i){var o=this.checkSearchPropsMsg(n.messageType,n.content),s=o.code,a=o.msg;if(s!==V.SUCCESS)return Promise.resolve({code:s,msg:a});if(t===B.SYSTEM&&n.messageType!==K.SYNC_READ_STATUS)return Promise.resolve({code:V.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE});if(t!==B.ULTRA_GROUP){var c=this.getNaviInfoFromCache();if(1===((null==c?void 0:c.grpRRVer)||0)&&n.messageType===K.READ_RECEIPT_RESPONSE)return Promise.resolve({code:V.READ_RECEIPT_ERROR})}var u=n.canIncludeExpansion,l=void 0!==u&&u,h=n.expansion;if(l){var d=Zt(h),p=d.isIllgalEx,g=d.isExKeyOrValLengthExceedLimit;if(d.isExceedLimit||g)return Promise.resolve({code:V.EXPANSION_LIMIT_EXCEET});if(p)return Promise.resolve({code:V.BIZ_ERROR_INVALID_PARAMETER})}var E,T,C=JSON.stringify(n.content);return E=C,void 0===T&&(T="utf-8"),("utf-16"===T?f(E):_(E))>I?Promise.resolve({code:V.RC_MSG_CONTENT_EXCEED_LIMIT}):t===B.ULTRA_GROUP?this._engine.sendUltraMessage(e,n,r,i):this._engine.sendMessage(t,e,n,r,i)},t.prototype.sendExpansionMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,c,u,h,d;return l(this,(function(l){switch(l.label){case 0:return e=t.channelId,n=t.conversationType,r=t.targetId,i=t.messageUId,o=t.keys,s=t.expansion,a=t.removeAll,t.canIncludeExpansion?(c=Zt(s),u=c.isIllgalEx,h=c.isExKeyOrValLengthExceedLimit,c.isExceedLimit||h?[2,Promise.resolve({code:V.EXPANSION_LIMIT_EXCEET})]:u?[2,Promise.resolve({code:V.BIZ_ERROR_INVALID_PARAMETER})]:(d={mid:i},s&&(d.put=s),o&&(d.del=o),a&&(d.removeAll=1),[4,this._engine.sendMessage(n,r,{content:d,messageType:K.EXPANSION_NOTIFY,channelId:e})])):[2,{code:V.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:l.sent().code}]}}))}))},t.prototype.sendReadReceiptMessage=function(t,e,n){return u(this,void 0,void 0,(function(){var r;return l(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:V.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 u(this,void 0,void 0,(function(){var r;return l(this,(function(i){return r=this.getNaviInfoFromCache(),0===((null==r?void 0:r.grpRRVer)||0)?[2,{code:V.READ_RECEIPT_ERROR}]:[2,this._engine.getMessageReader(t,e,n)]}))}))},t.prototype._destroy=function(){return u(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(exports.LogTagId.L_CALLBACK_E,null==e?void 0:e.stack)}})),this._pluginContextQueue.length=0,this._pluginInstanseMap={},[2]}}))}))},t.prototype.getHistoryMessage=function(t,e,n,r,i,o,s,a){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),void 0===s&&(s=""),t===B.ULTRA_GROUP){var c={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(e,c,a)}return this._engine.getHistoryMessage(t,e,n,r,i,o,s||"",a)},t.prototype.getMessages=function(t,e,n,r,i,o,s){if(void 0===n&&(n=0),void 0===r&&(r=20),void 0===i&&(i=0),void 0===o&&(o=""),t===B.ULTRA_GROUP){var a={timestamp:n,count:r,order:i,channelId:o};return this._engine.getUltraHistoryMsg(e,a,s)}return this._engine.getMessages(t,e,n,r,i,o,s)},t.prototype.getHistoryMessagesByObjectNames=function(t,e,n,r,i,o,s){return this._engine.getHistoryMessagesByObjectNames(t,e,n,r,i,o,s)},t.prototype.getConversationList=function(t,e,n,r,i){if(void 0===t&&(t=300),void 0===i&&(i=""),e===B.ULTRA_GROUP){var o=V.METHOD_NOT_SUPPORT;return Promise.resolve({code:o,msg:V[o]})}return this._engine.getConversationList(t,e,n,r,i)},t.prototype.getConversationsByPage=function(t,e,n,r){return this._engine.getConversationsByPage(t,e,n,r)},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===B.ULTRA_GROUP?Promise.resolve(V.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===B.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(B.ULTRA_GROUP)){var r=V.METHOD_NOT_SUPPORT;return Promise.resolve({code:r,msg:V[r]})}return this._engine.getAllConversationUnreadCount(t,e&&e.length>0?e:[B.PRIVATE,B.GROUP,B.SYSTEM,B.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,r){return void 0===r&&(r=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.setConversationNotificationLevel(t,e,n,r)]}))}))},t.prototype.setConversationStatus=function(t,e,n,r,i){if(void 0===i&&(i=""),t===B.ULTRA_GROUP&&void 0!==n)return Promise.resolve(V.METHOD_NOT_SUPPORT);var o=[{conversationType:t,targetId:e,isTop:n,notificationStatus:r,channelId:i}];return this._engine.batchSetConversationStatus(o)},t.prototype.saveConversationMessageDraft=function(t,e,n,r){return void 0===r&&(r=""),this._engine.saveConversationMessageDraft(t,e,n,r)},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,r,i){return this._engine.recallMsg(t,e,n,r,i)},t.prototype.deleteRemoteMessage=function(t,e,n,r){return void 0===r&&(r=""),t===B.ULTRA_GROUP?Promise.resolve(V.METHOD_NOT_SUPPORT):this._engine.deleteRemoteMessage(t,e,n,r)},t.prototype.deleteRemoteMessageByTimestamp=function(t,e,n,r){return void 0===r&&(r=""),this._engine.deleteRemoteMessageByTimestamp(t,e,n,r)},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,r=e.value;return Ne(n)&&Le(r)?this._engine.setChatroomEntry(t,e):Promise.resolve(V.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.setChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var r=e.entries[n],i=r.key,o=r.value;if(!Ne(i)||!Le(o))return Promise.resolve({code:V.BIZ_ERROR_INVALID_PARAMETER})}var s=c(c({},e),{isOverwrite:e.isForce});return this._engine.setChatroomEntries(t,s)},t.prototype.forceSetChatroomEntry=function(t,e){var n=e.key,r=e.value;return Ne(n)&&Le(r)?this._engine.forceSetChatroomEntry(t,e):Promise.resolve(V.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntry=function(t,e){var n=e.key;return Ne(n)?this._engine.removeChatroomEntry(t,e):Promise.resolve(V.BIZ_ERROR_INVALID_PARAMETER)},t.prototype.removeChatroomEntries=function(t,e){for(var n=0;n<e.entries.length;n++){var r=e.entries[n].key;if(!Ne(r))return Promise.resolve({code:V.BIZ_ERROR_INVALID_PARAMETER})}return this._engine.removeChatroomEntries(t,e)},t.prototype.forceRemoveChatroomEntry=function(t,e){var n=e.key;return Ne(n)?this._engine.forceRemoveChatroomEntry(t,e):Promise.resolve(V.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,r){return void 0===e&&(e=20),void 0===n&&(n=0),void 0===r&&(r=0),this._engine.getChatroomHistoryMessages(t,r,e,n)},t.prototype.getFileToken=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){var o,s,a,c,u,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)||"",c=(null==o?void 0:o.ossConfig)||"",[4,this._engine.getFileToken(t,e,n,r,i)];case 1:return u=l.sent(),h=u.code,d=u.data,h===V.SUCCESS&&d?[2,Promise.resolve(Object.assign(d,{bos:s,qiniu:a,ossConfig:c}))]:[2,Promise.reject(h)]}}))}))},t.prototype.getFileUrl=function(t,e,n,r,i){return void 0===i&&(i=Z.QINIU),u(this,void 0,void 0,(function(){var o,s,a;return l(this,(function(c){switch(c.label){case 0:return(null==r?void 0:r.isBosRes)?[2,Promise.resolve(r)]:[4,this._engine.getFileUrl(t,i,e,n)];case 1:return o=c.sent(),s=o.code,a=o.data,s===V.SUCCESS?[2,Promise.resolve(a)]:[2,Promise.reject(s)]}}))}))},t.prototype.createTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.createTag(t)]}))}))},t.prototype.removeTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeTag(t)]}))}))},t.prototype.updateTag=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.updateTag(t)]}))}))},t.prototype.getTagList=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getTagList()]}))}))},t.prototype.addTagForConversations=function(t,e){return u(this,void 0,void 0,(function(){return l(this,(function(n){return e.length>1e3?[2,Promise.reject(V.CONVER_OUT_LIMIT_ERROR)]:[2,this._engine.addTagForConversations(t,e)]}))}))},t.prototype.removeTagForConversations=function(t,e){return u(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 u(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,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.getConversationListByTag(t,e,n,r)]}))}))},t.prototype.getUnreadCountByTag=function(t,e){return u(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 u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setConversationStatusInTag(t,e,n)]}))}))},t.prototype.getTagsForConversation=function(t){return u(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=[B.PRIVATE,B.CHATROOM,B.GROUP,B.SYSTEM,B.APP_PUBLIC_SERVICE,B.PUBLIC_SERVICE]),this._engine.getTopConversationList(t,e)},t.prototype.getUnreadConversationList=function(t){return t&&0!==t.length||(t=[B.PRIVATE,B.CHATROOM,B.GROUP,B.SYSTEM,B.APP_PUBLIC_SERVICE,B.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!==B.ULTRA_GROUP){var e=V.CONVERSATION_TYPE_NOT_SUPPORT;return Promise.resolve({code:e,msg:V[e]})}return this._engine.sendUltraGroupTypingStatus(t)},t.prototype.getUltraGroupMessageListByMessageUId=function(t){return this._engine.getUltraGroupMessageListByMessageUId(t)},t.prototype.expandUltraMessage=function(t){return u(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return l(this,(function(c){switch(c.label){case 0:return e=t.conversationType,n=t.expansion,r=t.canIncludeExpansion,e!==B.ULTRA_GROUP?[2,{code:i=V.CONVERSATION_TYPE_NOT_SUPPORT,msg:V[i]}]:r?(o=Zt(n),s=o.isIllgalEx,a=o.isExKeyOrValLengthExceedLimit,o.isExceedLimit||a?[2,{code:V.EXPANSION_LIMIT_EXCEET}]:s?[2,{code:V.BIZ_ERROR_INVALID_PARAMETER}]:[4,this._engine.expandUltraMessage(t)]):[2,{code:V.MESSAGE_KV_NOT_SUPPORT}];case 1:return[2,{code:c.sent().code}]}}))}))},t.prototype.modifyMessage=function(t){return u(this,void 0,void 0,(function(){var e;return l(this,(function(n){switch(n.label){case 0:return t.conversationType!==B.ULTRA_GROUP?[2,{code:e=V.CONVERSATION_TYPE_NOT_SUPPORT,msg:V[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=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];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 u(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(exports.LogTagId.L_CALLBACK_E,null==t?void 0:t.stack)}}))},t.prototype.addToBlacklist=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.addToBlacklist(t)]}))}))},t.prototype.removeFromBlacklist=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.removeFromBlacklist(t)]}))}))},t.prototype.getBlacklist=function(){return u(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this._engine.getBlacklist()]}))}))},t.prototype.getBlacklistStatus=function(t){return u(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 u(this,void 0,void 0,(function(){var r,i,o;return l(this,(function(s){return r=this.checkSearchPropsMsg(n.messageType,n.content),i=r.code,o=r.msg,i!==V.SUCCESS?[2,Promise.resolve({code:i,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=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.getMessageCount(t,e,n)]}))}))},t.prototype.deleteMessages=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.deleteMessages(t)]}))}))},t.prototype.deleteMessagesByTimestamp=function(t,e,n,r,i){return void 0===i&&(i=""),u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.deleteMessagesByTimestamp(t,e,n,r,i)]}))}))},t.prototype.clearMessages=function(t,e,n){return void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.clearMessages(t,e,n)]}))}))},t.prototype.getMessage=function(t){return u(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 u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setMessageContent(t,e,n)]}))}))},t.prototype.setMessageSearchField=function(t,e,n){return u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.setMessageSearchField(t,e,n)]}))}))},t.prototype.setMessageSentStatus=function(t,e){return u(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 u(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,r){return u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.updateMessageReceiptStatus(t,e,n,r)]}))}))},t.prototype.setUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.setUserStatus(t)]}))}))},t.prototype.subscribeUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.subscribeUserStatus(t)]}))}))},t.prototype.getUserStatus=function(t){return u(this,void 0,void 0,(function(){return l(this,(function(e){return[2,this._engine.getUserStatus(t)]}))}))},t.prototype.searchConversationByContent=function(t,e,n,r){return void 0===e&&(e=[]),void 0===n&&(n=""),u(this,void 0,void 0,(function(){return l(this,(function(i){return[2,this._engine.searchConversationByContent(t,e,n,r)]}))}))},t.prototype.searchConversationByContentWithAllChannel=function(t,e,n){return void 0===e&&(e=[]),u(this,void 0,void 0,(function(){return l(this,(function(r){return[2,this._engine.searchConversationByContentWithAllChannel(t,e,n)]}))}))},t.prototype.searchMessageByContent=function(t,e,n,r,i,o,s){return void 0===s&&(s=""),u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContent(t,e,n,r,i,o,s)]}))}))},t.prototype.searchMessagesByUser=function(t,e,n,r,i,o){return void 0===i&&(i=5),void 0===o&&(o=""),u(this,void 0,void 0,(function(){return l(this,(function(s){return[2,this._engine.searchMessagesByUser(t,e,n,r,i,o)]}))}))},t.prototype.searchMessageByContentWithAllChannel=function(t,e,n,r,i){return u(this,void 0,void 0,(function(){return l(this,(function(o){return[2,this._engine.searchMessageByContentWithAllChannel(t,e,n,r,i)]}))}))},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,e,n,r,i,o,s){return u(this,void 0,void 0,(function(){return l(this,(function(a){return[2,this._engine.searchMessageByContentInTimeRangeWithAllChannel(t,e,n,r,i,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,r){return void 0===r&&(r=""),this._engine.clearUnreadCountByTimestamp(t,e,n,r)},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,r,i,o){return this._engine.getRemoteHistoryMessages(t,e,n,r,i,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 u(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,r){return this._engine.rtcSignaling(t,e,n,r)},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}(),Pa=N;exports.AConnectionMgr=js,exports.AEngine=mn,exports.APIContext=wa,exports.AppStorage=o,exports.BaseCloudController=Oa,exports.BasicLogger=tr,exports.BasicNavi=qi,exports.BasicReporter=nr,exports.BasicStaticConfigManager=wn,exports.BasicStatistic=ha,exports.BasicStatisticReporter=da,exports.CPP_PROTOCAL_MSGTYPE_OPTION={"RC:DizNtf":{isCounted:!1,isPersited:!1}},exports.CallLibMsgType={"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"},exports.ChatroomEntryType=rt,exports.ChatroomSyncStatusReason=xt,exports.ChatroomUserChangeType=st,exports.ChrmMemBanType=Et,exports.ChrmMemOperateType=ft,exports.ChrmSyncStatus=pt,exports.Codec=Nn,exports.ConnectionStatus=F,exports.ConversationType=B,exports.DB_LOG_FLUSH_FREQUENCY=3e3,exports.DB_LOG_MAX_SIZE=1e5,exports.DelayTimer=Je,exports.ErrorCode=V,exports.EventEmitter=zt,exports.FORMATED_VERSION=L,exports.FileType=w,exports.HTTP_TIMEOUT=C,exports.IM_CHATROOM_PULL_INTERVAL_TIME=y,exports.IM_PING_INTERVAL_TIME=15e3,exports.IM_PING_MIN_TIMEOUT=2e3,exports.IM_PING_TIMEOUT=15e3,exports.IM_SIGNAL_TIMEOUT=3e4,exports.IndexDBLogger=er,exports.IndexDBReporter=gr,exports.IndexDBStatistic=ga,exports.IndexDBStatisticReporter=Ia,exports.LOCAL_STORAGE_KEYS=A,exports.MAX_MESSAGE_CONTENT_BYTES=I,exports.MAX_MESSAGE_EXPANSION_KEY_LENGTH=32,exports.MAX_MESSAGE_EXPANSION_VAL_LENGTH=4096,exports.MAX_UPLOAD_FILE_SIZE=5368709120,exports.MentionedType=J,exports.MessageBlockType=ct,exports.MessageDirection=x,exports.MessageType=K,exports.NAVI_CACHE_DURATION=T,exports.NAVI_REQ_TIMEOUT=v,exports.NotificationLevel=W,exports.NotificationStatus=Y,exports.ONE_LOG_SIZE_MAX=1e3,exports.OperateStatus=ht,exports.PluginContext=mr,exports.RCAssertError=Ee,exports.RC_DEFAULT_USER=U,exports.REAT_TIME_LOG_SIZE=20971520,exports.RTCPluginContext=Aa,exports.ReceivedStatus=n,exports.SEND_MESSAGE_TYPE_OPTION=S,exports.STATIC_CONFIG_CACHE_TIME=M,exports.STATIC_CONFIG_IV=R,exports.STATIC_CONFIG_KEY=m,exports.STATUS_MESSAGE=O,exports.UPLOAD_FILE_CHUNK_SIZE=10485760,exports.UploadMethod=Z,exports.VERSION=N,exports.VersionManage=te,exports.WEB_SOCKET_TIMEOUT=5e3,exports.WebSocketNavi=ji,exports.appendUrl=E,exports.assert=function(t,e,n,r){if(void 0===r&&(r=!1),!Te(t,e,n,r))throw new Ee("'".concat(t,"' is invalid: ").concat(JSON.stringify(e)))},exports.clone=Qe,exports.cloneByJSON=qe,exports.deInitLogDB=Hn,exports.decryptCBC=Ae,exports.fixUrlProtocol=be,exports.forEach=ke,exports.getBrowser=je,exports.getClientMessageId=Me,exports.getDeviceId=ie,exports.getMimeKey=function(t){var e="application/octet-stream";switch(t){case w.IMAGE:e="image/jpeg";break;case w.AUDIO:e="audio/amr";break;case w.VIDEO:e="video/3gpp";break;case w.SIGHT:e="video/mpeg4";break;case w.COMBINE_HTML:e="text/html"}return e},exports.getMinionURL=De,exports.getUUID=ne,exports.getUUID22=re,exports.getUploadFileName=Re,exports.getbundleId=Ue,exports.httpRequest=function(t){var e=t.method||exports.HttpMethod.GET,n=t.timeout||C,r=t.headers,i=t.query,o=t.body,s=t.onProgress,a=E(t.url,i),c=Ve(),u="[object XDomainRequest]"===Object.prototype.toString.call(c);if(c.open(e,a),r&&c.setRequestHeader)for(var l in r)c.setRequestHeader(l,r[l]);return u?function(t,e,n){return new Promise((function(r){0!==e&&(t.timeout=e),t.onload=function(){r({data:t.responseText,status:t.status||200})},t.onerror=function(){r({status:t.status})},t.ontimeout=function(){r({status:t.status})};var i="object"==typeof n?JSON.stringify(n):n;t.send(i)}))}(c,n,o):function(t,e,n,r){return new Promise((function(i){t.onreadystatechange=function(){4===t.readyState&&i({data:t.responseText,status:t.status,xhr:t})},t.onerror=function(){i({status:t.status})},r&&(t.upload.onprogress=function(t){return r(t)}),0!==e&&setTimeout((function(){t.abort(),i({status:t.status})}),e),t.send(n)}))}(c,n,o,s)},exports.indexOf=He,exports.initLogDB=Fn,exports.initStatisticDB=ta,exports.isArray=Ft,exports.isArrayBuffer=Ht,exports.isBoolean=function(t){return"boolean"==typeof t},exports.isConnnectAck=function(t){return Object.keys(Ks).some((function(e){return Ks[e]===t}))},exports.isDisconnectedByServer=function(t){return Object.keys(Hs).some((function(e){return Hs[e]===t}))},exports.isFunction=Yt,exports.isHttpUrl=Wt,exports.isInObject=Ke,exports.isInclude=function(t,e){return-1!==He(t,e)},exports.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},exports.isNumber=kt,exports.isObject=qt,exports.isStartCloudController=ee,exports.isString=Bt,exports.isTypeInConversationList=function(t){return[B.PRIVATE,B.GROUP,B.SYSTEM,B.PUBLIC_SERVICE,B.APP_PUBLIC_SERVICE].includes(t)},exports.isUndefined=jt,exports.isValidChannelId=Xt,exports.isValidChrmEntryKey=Ne,exports.isValidChrmEntryValue=Le,exports.isValidConversationType=Jt,exports.isValidExpansion=Zt,exports.isValidFileType=function(t){return kt(t)&&Object.prototype.hasOwnProperty.call(w,t)},exports.isValidNotificationLevel=function(t){return kt(t)&&Object.prototype.hasOwnProperty.call(W,t)},exports.logger=ge,exports.map=Fe,exports.notEmptyArray=function(t){return Ft(t)&&t.length>0},exports.notEmptyObject=Qt,exports.notEmptyString=Kt,exports.pushConfigsToJSON=Se,exports.pushJSONToConfigs=Oe,exports.statisticTranscsv=aa,exports.todo=function(t){return new p(t)},exports.transcsv=pr,exports.unInitStatisticDB=ea,exports.urlCenter=bn,exports.usingCppEngine=Ye,exports.validate=Te,exports.version=Pa;