@onyx-p/imlib-web 2.8.2 → 2.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
- var e,t;!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.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER"}(e||(e={})),function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT"}(t||(t={}));const r=e=>t[e];var n,o,s,i,a,c,l,u,d;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=3]="GROUP"}(n||(n={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(o||(o={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(s||(s={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(i||(i={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT"}(a||(a={})),function(e){e[e.IDLE=0]="IDLE",e[e.RECEIVED=1]="RECEIVED",e[e.READ=2]="READ",e[e.LISTENED=3]="LISTENED"}(c||(c={})),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"}(l||(l={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(u||(u={})),function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.CONVERSATION="CONVERSATION",e.PUSH="PUSH",e.RECALL="RECALL",e.ARRIVAL_RECEIPT_RECEIVED="ARRIVAL_RECEIPT_RECEIVED",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED"}(d||(d={}));var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f={exports:{}};var h,y={exports:{}};function m(){return h||(h=1,y.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==p&&p.crypto&&(r=p.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},i=s.lib={},a=i.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<o;s++){var i=r[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=i<<24-(n+s)%4*8}else for(var a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=s.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var s=t[o>>>2]>>>24-o%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var s=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},g=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=g.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,s=n.sigBytes,i=this.blockSize,a=s/(4*i),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*l,s);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=s.algo={};return s}(Math);return e}()),y.exports}var v,b={exports:{}};function O(){return v||(v=1,b.exports=function(e){return n=(r=e).lib,o=n.Base,s=n.WordArray,(i=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),i.WordArray=o.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),e;var t,r,n,o,s,i}(m())),b.exports}var C,I={exports:{}};function w(){return C||(C=1,I.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(m())),I.exports}var S,R={exports:{}};function E(){return S||(S=1,R.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var s=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],s=0;s<r;s+=2){var i=o(t[s>>>2]>>>16-s%4*8&65535);n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s<t;s++)n[s>>>1]|=o(e.charCodeAt(s)<<16-s%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(m())),R.exports}var T,_={exports:{}};function k(){return T||(T=1,_.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],s=0,i=0;i<t;i++)if(i%4){var a=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[s>>>2]|=a<<24-s%4*8,s++}return r.create(o,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],s=0;s<r;s+=3)for(var i=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)o.push(n.charAt(i>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s<r.length;s++)o[r.charCodeAt(s)]=s}var i=r.charAt(64);if(i){var a=e.indexOf(i);-1!==a&&(t=a)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(m())),_.exports}var A,M={exports:{}};function N(){return A||(A=1,M.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],s=0,i=0;i<t;i++)if(i%4){var a=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[s>>>2]|=a<<24-s%4*8,s++}return r.create(o,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var s=[],i=0;i<n;i+=3)for(var a=(r[i>>>2]>>>24-i%4*8&255)<<16|(r[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|r[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<n;c++)s.push(o.charAt(a>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,o=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var i=0;i<o.length;i++)s[o.charCodeAt(i)]=i}var a=o.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(r=c)}return n(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(m())),M.exports}var P,L={exports:{}};function D(){return P||(P=1,L.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=i.MD5=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,i=e[t+0],c=e[t+1],g=e[t+2],f=e[t+3],h=e[t+4],y=e[t+5],m=e[t+6],v=e[t+7],b=e[t+8],O=e[t+9],C=e[t+10],I=e[t+11],w=e[t+12],S=e[t+13],R=e[t+14],E=e[t+15],T=s[0],_=s[1],k=s[2],A=s[3];T=l(T,_,k,A,i,7,a[0]),A=l(A,T,_,k,c,12,a[1]),k=l(k,A,T,_,g,17,a[2]),_=l(_,k,A,T,f,22,a[3]),T=l(T,_,k,A,h,7,a[4]),A=l(A,T,_,k,y,12,a[5]),k=l(k,A,T,_,m,17,a[6]),_=l(_,k,A,T,v,22,a[7]),T=l(T,_,k,A,b,7,a[8]),A=l(A,T,_,k,O,12,a[9]),k=l(k,A,T,_,C,17,a[10]),_=l(_,k,A,T,I,22,a[11]),T=l(T,_,k,A,w,7,a[12]),A=l(A,T,_,k,S,12,a[13]),k=l(k,A,T,_,R,17,a[14]),T=u(T,_=l(_,k,A,T,E,22,a[15]),k,A,c,5,a[16]),A=u(A,T,_,k,m,9,a[17]),k=u(k,A,T,_,I,14,a[18]),_=u(_,k,A,T,i,20,a[19]),T=u(T,_,k,A,y,5,a[20]),A=u(A,T,_,k,C,9,a[21]),k=u(k,A,T,_,E,14,a[22]),_=u(_,k,A,T,h,20,a[23]),T=u(T,_,k,A,O,5,a[24]),A=u(A,T,_,k,R,9,a[25]),k=u(k,A,T,_,f,14,a[26]),_=u(_,k,A,T,b,20,a[27]),T=u(T,_,k,A,S,5,a[28]),A=u(A,T,_,k,g,9,a[29]),k=u(k,A,T,_,v,14,a[30]),T=d(T,_=u(_,k,A,T,w,20,a[31]),k,A,y,4,a[32]),A=d(A,T,_,k,b,11,a[33]),k=d(k,A,T,_,I,16,a[34]),_=d(_,k,A,T,R,23,a[35]),T=d(T,_,k,A,c,4,a[36]),A=d(A,T,_,k,h,11,a[37]),k=d(k,A,T,_,v,16,a[38]),_=d(_,k,A,T,C,23,a[39]),T=d(T,_,k,A,S,4,a[40]),A=d(A,T,_,k,i,11,a[41]),k=d(k,A,T,_,f,16,a[42]),_=d(_,k,A,T,m,23,a[43]),T=d(T,_,k,A,O,4,a[44]),A=d(A,T,_,k,w,11,a[45]),k=d(k,A,T,_,E,16,a[46]),T=p(T,_=d(_,k,A,T,g,23,a[47]),k,A,i,6,a[48]),A=p(A,T,_,k,v,10,a[49]),k=p(k,A,T,_,R,15,a[50]),_=p(_,k,A,T,y,21,a[51]),T=p(T,_,k,A,w,6,a[52]),A=p(A,T,_,k,f,10,a[53]),k=p(k,A,T,_,C,15,a[54]),_=p(_,k,A,T,c,21,a[55]),T=p(T,_,k,A,b,6,a[56]),A=p(A,T,_,k,E,10,a[57]),k=p(k,A,T,_,m,15,a[58]),_=p(_,k,A,T,S,21,a[59]),T=p(T,_,k,A,h,6,a[60]),A=p(A,T,_,k,I,10,a[61]),k=p(k,A,T,_,g,15,a[62]),_=p(_,k,A,T,O,21,a[63]),s[0]=s[0]+T|0,s[1]=s[1]+_|0,s[2]=s[2]+k|0,s[3]=s[3]+A|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;r[o>>>5]|=128<<24-o%32;var s=t.floor(n/4294967296),i=n;r[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,s,i){var a=e+(t&r|~t&n)+o+i;return(a<<s|a>>>32-s)+t}function u(e,t,r,n,o,s,i){var a=e+(t&n|r&~n)+o+i;return(a<<s|a>>>32-s)+t}function d(e,t,r,n,o,s,i){var a=e+(t^r^n)+o+i;return(a<<s|a>>>32-s)+t}function p(e,t,r,n,o,s,i){var a=e+(r^(t|~n))+o+i;return(a<<s|a>>>32-s)+t}r.MD5=s._createHelper(c),r.HmacMD5=s._createHmacHelper(c)}(Math),e.MD5}(m())),L.exports}var j,U={exports:{}};function B(){return j||(j=1,U.exports=function(e){return r=(t=e).lib,n=r.WordArray,o=r.Hasher,s=t.algo,i=[],a=s.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)i[l]=0|e[t+l];else{var u=i[l-3]^i[l-8]^i[l-14]^i[l-16];i[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+i[l];d+=l<20?1518500249+(o&s|~o&a):l<40?1859775393+(o^s^a):l<60?(o&s|o&a|s&a)-1894007588:(o^s^a)-899497514,c=a,a=s,s=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),e.SHA1;var t,r,n,o,s,i,a}(m())),U.exports}var F,x={exports:{}};function G(){return F||(F=1,x.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=s.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],i=r[3],a=r[4],u=r[5],d=r[6],p=r[7],g=0;g<64;g++){if(g<16)l[g]=0|e[t+g];else{var f=l[g-15],h=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,y=l[g-2],m=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;l[g]=h+l[g-7]+m+l[g-16]}var v=n&o^n&s^o&s,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),O=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&d)+c[g]+l[g];p=d,d=u,u=a,a=i+O|0,i=s,s=o,o=n,n=O+(b+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+s|0,r[3]=r[3]+i|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+p|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(m())),x.exports}var q,V={exports:{}};var K,H={exports:{}};function z(){return K||(K=1,H.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,o=n.Word,s=n.WordArray,i=t.algo;function a(){return o.create.apply(o,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var u=i.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],i=r[3],a=r[4],u=r[5],d=r[6],p=r[7],g=n.high,f=n.low,h=o.high,y=o.low,m=s.high,v=s.low,b=i.high,O=i.low,C=a.high,I=a.low,w=u.high,S=u.low,R=d.high,E=d.low,T=p.high,_=p.low,k=g,A=f,M=h,N=y,P=m,L=v,D=b,j=O,U=C,B=I,F=w,x=S,G=R,q=E,V=T,K=_,H=0;H<80;H++){var z,$,W=l[H];if(H<16)$=W.high=0|e[t+2*H],z=W.low=0|e[t+2*H+1];else{var J=l[H-15],Z=J.high,X=J.low,Y=(Z>>>1|X<<31)^(Z>>>8|X<<24)^Z>>>7,Q=(X>>>1|Z<<31)^(X>>>8|Z<<24)^(X>>>7|Z<<25),ee=l[H-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[H-7],ie=se.high,ae=se.low,ce=l[H-16],le=ce.high,ue=ce.low;$=($=($=Y+ie+((z=Q+ae)>>>0<Q>>>0?1:0))+ne+((z+=oe)>>>0<oe>>>0?1:0))+le+((z+=ue)>>>0<ue>>>0?1:0),W.high=$,W.low=z}var de,pe=U&F^~U&G,ge=B&x^~B&q,fe=k&M^k&P^M&P,he=A&N^A&L^N&L,ye=(k>>>28|A<<4)^(k<<30|A>>>2)^(k<<25|A>>>7),me=(A>>>28|k<<4)^(A<<30|k>>>2)^(A<<25|k>>>7),ve=(U>>>14|B<<18)^(U>>>18|B<<14)^(U<<23|B>>>9),be=(B>>>14|U<<18)^(B>>>18|U<<14)^(B<<23|U>>>9),Oe=c[H],Ce=Oe.high,Ie=Oe.low,we=V+ve+((de=K+be)>>>0<K>>>0?1:0),Se=me+he;V=G,K=q,G=F,q=x,F=U,x=B,U=D+(we=(we=(we=we+pe+((de+=ge)>>>0<ge>>>0?1:0))+Ce+((de+=Ie)>>>0<Ie>>>0?1:0))+$+((de+=z)>>>0<z>>>0?1:0))+((B=j+de|0)>>>0<j>>>0?1:0)|0,D=P,j=L,P=M,L=N,M=k,N=A,k=we+(ye+fe+(Se>>>0<me>>>0?1:0))+((A=de+Se|0)>>>0<de>>>0?1:0)|0}f=n.low=f+A,n.high=g+k+(f>>>0<A>>>0?1:0),y=o.low=y+N,o.high=h+M+(y>>>0<N>>>0?1:0),v=s.low=v+L,s.high=m+P+(v>>>0<L>>>0?1:0),O=i.low=O+j,i.high=b+D+(O>>>0<j>>>0?1:0),I=a.low=I+B,a.high=C+U+(I>>>0<B>>>0?1:0),S=u.low=S+x,u.high=w+F+(S>>>0<x>>>0?1:0),E=d.low=E+q,d.high=R+G+(E>>>0<q>>>0?1:0),_=p.low=_+K,p.high=T+V+(_>>>0<K>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(m(),O())),H.exports}var $,W={exports:{}};var J,Z={exports:{}};function X(){return J||(J=1,Z.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.x64.Word,a=r.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,s=0;s<24;s++){for(var a=0,d=0,p=0;p<7;p++){if(1&o){var g=(1<<p)-1;g<32?d^=1<<g:a^=1<<g-32}128&o?o=o<<1^113:o<<=1}u[s]=i.create(a,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=i.create()}();var p=a.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var s=e[t+2*o],i=e[t+2*o+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),(_=r[o]).high^=i,_.low^=s}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var g=0,f=0,h=0;h<5;h++)g^=(_=r[p+5*h]).high,f^=_.low;var y=d[p];y.high=g,y.low=f}for(p=0;p<5;p++){var m=d[(p+4)%5],v=d[(p+1)%5],b=v.high,O=v.low;for(g=m.high^(b<<1|O>>>31),f=m.low^(O<<1|b>>>31),h=0;h<5;h++)(_=r[p+5*h]).high^=g,_.low^=f}for(var C=1;C<25;C++){var I=(_=r[C]).high,w=_.low,S=c[C];S<32?(g=I<<S|w>>>32-S,f=w<<S|I>>>32-S):(g=w<<S-32|I>>>64-S,f=I<<S-32|w>>>64-S);var R=d[l[C]];R.high=g,R.low=f}var E=d[0],T=r[0];for(E.high=T.high,E.low=T.low,p=0;p<5;p++)for(h=0;h<5;h++){var _=r[C=p+5*h],k=d[C],A=d[(p+1)%5+5*h],M=d[(p+2)%5+5*h];_.high=k.high^~A.high&M.high,_.low=k.low^~A.low&M.low}_=r[0];var N=u[a];_.high^=N.high,_.low^=N.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,s=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var i=this._state,a=this.cfg.outputLength/8,c=a/8,l=[],u=0;u<c;u++){var d=i[u],p=d.high,g=d.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),l.push(g),l.push(p)}return new o.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(p),r.HmacSHA3=s._createHmacHelper(p)}(Math),e.SHA3}(m(),O())),Z.exports}var Y,Q={exports:{}};var ee,te={exports:{}};function re(){return ee||(ee=1,te.exports=function(e){var t,r,n;r=(t=e).lib.Base,n=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,o=4*r;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),i=this._iKey=t.clone(),a=s.words,c=i.words,l=0;l<r;l++)a[l]^=1549556828,c[l]^=909522486;s.sigBytes=i.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(m())),te.exports}var ne,oe={exports:{}};var se,ie={exports:{}};function ae(){return se||(se=1,ie.exports=function(e){return r=(t=e).lib,n=r.Base,o=r.WordArray,s=t.algo,i=s.MD5,a=s.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,s=n.hasher.create(),i=o.create(),a=i.words,c=n.keySize,l=n.iterations;a.length<c;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<l;u++)r=s.finalize(r),s.reset();i.concat(r)}return i.sigBytes=4*c,i}}),t.EvpKDF=function(e,t,r){return a.create(r).compute(e,t)},e.EvpKDF;var t,r,n,o,s,i,a}(m(),B(),re())),ie.exports}var ce,le={exports:{}};function ue(){return ce||(ce=1,le.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,o=n.Base,s=n.WordArray,i=n.BufferedBlockAlgorithm,a=r.enc;a.Utf8;var c=a.Base64,l=r.algo.EvpKDF,u=n.Cipher=i.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:m}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()});n.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},p=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),g=d.CBC=function(){var e=p.extend();function r(e,r,n){var o,s=this._iv;s?(o=s,this._iv=t):o=this._prevBlock;for(var i=0;i<n;i++)e[r+i]^=o[i]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,s=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=s}}),e}(),f=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,i=[],a=0;a<n;a+=4)i.push(o);var c=s.create(i,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=u.extend({cfg:u.cfg.extend({mode:g,padding:f}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var h=n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=s.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),h.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),s=o.finalize(t),i=o.cfg;return h.create({ciphertext:s,key:r,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(r.kdf={}).OpenSSL={execute:function(e,t,r,n,o){if(n||(n=s.random(8)),o)i=l.create({keySize:t+r,hasher:o}).compute(e,n);else var i=l.create({keySize:t+r}).compute(e,n);var a=s.create(i.words.slice(t),4*r);return i.sigBytes=4*t,h.create({key:i,iv:a,salt:n})}},b=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:v}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=o.iv;var s=m.encrypt.call(this,e,t,o.key,n);return s.mixIn(o),s},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=o.iv,m.decrypt.call(this,e,t,o.key,n)}})}()}(m(),ae())),le.exports}var de,pe={exports:{}};function ge(){return de||(de=1,pe.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var o,s=this._iv;s?(o=s.slice(0),this._iv=void 0):o=this._prevBlock,n.encryptBlock(o,0);for(var i=0;i<r;i++)e[t+i]^=o[i]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,s=e.slice(t,t+o);r.call(this,e,t,o,n),this._prevBlock=s}}),t}(),e.mode.CFB}(m(),ue())),pe.exports}var fe,he={exports:{}};function ye(){return fe||(fe=1,he.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0);var i=s.slice(0);r.encryptBlock(i,0),s[n-1]=s[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=i[a]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(m(),ue())),he.exports}var me,ve={exports:{}};function be(){return me||(me=1,ve.exports=function(e){
1
+ var e,t;!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.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER"}(e||(e={})),function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT"}(t||(t={}));const r=e=>t[e];var n,o,s,i,a,c,l,u,d;!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=3]="GROUP"}(n||(n={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(o||(o={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(s||(s={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(i||(i={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT"}(a||(a={})),function(e){e[e.IDLE=0]="IDLE",e[e.RECEIVED=1]="RECEIVED",e[e.READ=2]="READ",e[e.LISTENED=3]="LISTENED"}(c||(c={})),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"}(l||(l={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(u||(u={})),function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.CONVERSATION="CONVERSATION",e.PUSH="PUSH",e.RECALL="RECALL",e.ARRIVAL_RECEIPT_RECEIVED="ARRIVAL_RECEIPT_RECEIVED",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED"}(d||(d={}));var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f={exports:{}};var h,y={exports:{}};function m(){return h||(h=1,y.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==p&&p.crypto&&(r=p.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},i=s.lib={},a=i.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=i.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var s=0;s<o;s++){var i=r[s>>>2]>>>24-s%4*8&255;t[n+s>>>2]|=i<<24-(n+s)%4*8}else for(var a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=s.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var s=t[o>>>2]>>>24-o%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var s=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},g=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=g.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,s=n.sigBytes,i=this.blockSize,a=s/(4*i),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*l,s);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});i.Hasher=f.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}});var h=s.algo={};return s}(Math);return e}()),y.exports}var v,b={exports:{}};function O(){return v||(v=1,b.exports=function(e){return n=(r=e).lib,o=n.Base,s=n.WordArray,(i=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),i.WordArray=o.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return s.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),e;var t,r,n,o,s,i}(m())),b.exports}var I,C={exports:{}};function w(){return I||(I=1,C.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(m())),C.exports}var S,R={exports:{}};function E(){return S||(S=1,R.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var s=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],s=0;s<r;s+=2){var i=o(t[s>>>2]>>>16-s%4*8&65535);n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,n=[],s=0;s<t;s++)n[s>>>1]|=o(e.charCodeAt(s)<<16-s%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(m())),R.exports}var T,_={exports:{}};function k(){return T||(T=1,_.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],s=0,i=0;i<t;i++)if(i%4){var a=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[s>>>2]|=a<<24-s%4*8,s++}return r.create(o,s)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],s=0;s<r;s+=3)for(var i=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)o.push(n.charAt(i>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s<r.length;s++)o[r.charCodeAt(s)]=s}var i=r.charAt(64);if(i){var a=e.indexOf(i);-1!==a&&(t=a)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(m())),_.exports}var A,M={exports:{}};function N(){return A||(A=1,M.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],s=0,i=0;i<t;i++)if(i%4){var a=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[s>>>2]|=a<<24-s%4*8,s++}return r.create(o,s)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var s=[],i=0;i<n;i+=3)for(var a=(r[i>>>2]>>>24-i%4*8&255)<<16|(r[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|r[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<n;c++)s.push(o.charAt(a>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,o=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var i=0;i<o.length;i++)s[o.charCodeAt(i)]=i}var a=o.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(r=c)}return n(e,r,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(m())),M.exports}var P,L={exports:{}};function D(){return P||(P=1,L.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=i.MD5=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s=this._hash.words,i=e[t+0],c=e[t+1],g=e[t+2],f=e[t+3],h=e[t+4],y=e[t+5],m=e[t+6],v=e[t+7],b=e[t+8],O=e[t+9],I=e[t+10],C=e[t+11],w=e[t+12],S=e[t+13],R=e[t+14],E=e[t+15],T=s[0],_=s[1],k=s[2],A=s[3];T=l(T,_,k,A,i,7,a[0]),A=l(A,T,_,k,c,12,a[1]),k=l(k,A,T,_,g,17,a[2]),_=l(_,k,A,T,f,22,a[3]),T=l(T,_,k,A,h,7,a[4]),A=l(A,T,_,k,y,12,a[5]),k=l(k,A,T,_,m,17,a[6]),_=l(_,k,A,T,v,22,a[7]),T=l(T,_,k,A,b,7,a[8]),A=l(A,T,_,k,O,12,a[9]),k=l(k,A,T,_,I,17,a[10]),_=l(_,k,A,T,C,22,a[11]),T=l(T,_,k,A,w,7,a[12]),A=l(A,T,_,k,S,12,a[13]),k=l(k,A,T,_,R,17,a[14]),T=u(T,_=l(_,k,A,T,E,22,a[15]),k,A,c,5,a[16]),A=u(A,T,_,k,m,9,a[17]),k=u(k,A,T,_,C,14,a[18]),_=u(_,k,A,T,i,20,a[19]),T=u(T,_,k,A,y,5,a[20]),A=u(A,T,_,k,I,9,a[21]),k=u(k,A,T,_,E,14,a[22]),_=u(_,k,A,T,h,20,a[23]),T=u(T,_,k,A,O,5,a[24]),A=u(A,T,_,k,R,9,a[25]),k=u(k,A,T,_,f,14,a[26]),_=u(_,k,A,T,b,20,a[27]),T=u(T,_,k,A,S,5,a[28]),A=u(A,T,_,k,g,9,a[29]),k=u(k,A,T,_,v,14,a[30]),T=d(T,_=u(_,k,A,T,w,20,a[31]),k,A,y,4,a[32]),A=d(A,T,_,k,b,11,a[33]),k=d(k,A,T,_,C,16,a[34]),_=d(_,k,A,T,R,23,a[35]),T=d(T,_,k,A,c,4,a[36]),A=d(A,T,_,k,h,11,a[37]),k=d(k,A,T,_,v,16,a[38]),_=d(_,k,A,T,I,23,a[39]),T=d(T,_,k,A,S,4,a[40]),A=d(A,T,_,k,i,11,a[41]),k=d(k,A,T,_,f,16,a[42]),_=d(_,k,A,T,m,23,a[43]),T=d(T,_,k,A,O,4,a[44]),A=d(A,T,_,k,w,11,a[45]),k=d(k,A,T,_,E,16,a[46]),T=p(T,_=d(_,k,A,T,g,23,a[47]),k,A,i,6,a[48]),A=p(A,T,_,k,v,10,a[49]),k=p(k,A,T,_,R,15,a[50]),_=p(_,k,A,T,y,21,a[51]),T=p(T,_,k,A,w,6,a[52]),A=p(A,T,_,k,f,10,a[53]),k=p(k,A,T,_,I,15,a[54]),_=p(_,k,A,T,c,21,a[55]),T=p(T,_,k,A,b,6,a[56]),A=p(A,T,_,k,E,10,a[57]),k=p(k,A,T,_,m,15,a[58]),_=p(_,k,A,T,S,21,a[59]),T=p(T,_,k,A,h,6,a[60]),A=p(A,T,_,k,C,10,a[61]),k=p(k,A,T,_,g,15,a[62]),_=p(_,k,A,T,O,21,a[63]),s[0]=s[0]+T|0,s[1]=s[1]+_|0,s[2]=s[2]+k|0,s[3]=s[3]+A|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;r[o>>>5]|=128<<24-o%32;var s=t.floor(n/4294967296),i=n;r[15+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,s,i){var a=e+(t&r|~t&n)+o+i;return(a<<s|a>>>32-s)+t}function u(e,t,r,n,o,s,i){var a=e+(t&n|r&~n)+o+i;return(a<<s|a>>>32-s)+t}function d(e,t,r,n,o,s,i){var a=e+(t^r^n)+o+i;return(a<<s|a>>>32-s)+t}function p(e,t,r,n,o,s,i){var a=e+(r^(t|~n))+o+i;return(a<<s|a>>>32-s)+t}r.MD5=s._createHelper(c),r.HmacMD5=s._createHmacHelper(c)}(Math),e.MD5}(m())),L.exports}var j,U={exports:{}};function B(){return j||(j=1,U.exports=function(e){return r=(t=e).lib,n=r.WordArray,o=r.Hasher,s=t.algo,i=[],a=s.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)i[l]=0|e[t+l];else{var u=i[l-3]^i[l-8]^i[l-14]^i[l-16];i[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+i[l];d+=l<20?1518500249+(o&s|~o&a):l<40?1859775393+(o^s^a):l<60?(o&s|o&a|s&a)-1894007588:(o^s^a)-899497514,c=a,a=s,s=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),e.SHA1;var t,r,n,o,s,i,a}(m())),U.exports}var F,x={exports:{}};function G(){return F||(F=1,x.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=s.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],i=r[3],a=r[4],u=r[5],d=r[6],p=r[7],g=0;g<64;g++){if(g<16)l[g]=0|e[t+g];else{var f=l[g-15],h=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,y=l[g-2],m=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;l[g]=h+l[g-7]+m+l[g-16]}var v=n&o^n&s^o&s,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),O=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&d)+c[g]+l[g];p=d,d=u,u=a,a=i+O|0,i=s,s=o,o=n,n=O+(b+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+s|0,r[3]=r[3]+i|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+p|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=s._createHelper(u),r.HmacSHA256=s._createHmacHelper(u)}(Math),e.SHA256}(m())),x.exports}var q,V={exports:{}};var K,H={exports:{}};function z(){return K||(K=1,H.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,o=n.Word,s=n.WordArray,i=t.algo;function a(){return o.create.apply(o,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var u=i.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],s=r[2],i=r[3],a=r[4],u=r[5],d=r[6],p=r[7],g=n.high,f=n.low,h=o.high,y=o.low,m=s.high,v=s.low,b=i.high,O=i.low,I=a.high,C=a.low,w=u.high,S=u.low,R=d.high,E=d.low,T=p.high,_=p.low,k=g,A=f,M=h,N=y,P=m,L=v,D=b,j=O,U=I,B=C,F=w,x=S,G=R,q=E,V=T,K=_,H=0;H<80;H++){var z,$,W=l[H];if(H<16)$=W.high=0|e[t+2*H],z=W.low=0|e[t+2*H+1];else{var J=l[H-15],Z=J.high,X=J.low,Y=(Z>>>1|X<<31)^(Z>>>8|X<<24)^Z>>>7,Q=(X>>>1|Z<<31)^(X>>>8|Z<<24)^(X>>>7|Z<<25),ee=l[H-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[H-7],ie=se.high,ae=se.low,ce=l[H-16],le=ce.high,ue=ce.low;$=($=($=Y+ie+((z=Q+ae)>>>0<Q>>>0?1:0))+ne+((z+=oe)>>>0<oe>>>0?1:0))+le+((z+=ue)>>>0<ue>>>0?1:0),W.high=$,W.low=z}var de,pe=U&F^~U&G,ge=B&x^~B&q,fe=k&M^k&P^M&P,he=A&N^A&L^N&L,ye=(k>>>28|A<<4)^(k<<30|A>>>2)^(k<<25|A>>>7),me=(A>>>28|k<<4)^(A<<30|k>>>2)^(A<<25|k>>>7),ve=(U>>>14|B<<18)^(U>>>18|B<<14)^(U<<23|B>>>9),be=(B>>>14|U<<18)^(B>>>18|U<<14)^(B<<23|U>>>9),Oe=c[H],Ie=Oe.high,Ce=Oe.low,we=V+ve+((de=K+be)>>>0<K>>>0?1:0),Se=me+he;V=G,K=q,G=F,q=x,F=U,x=B,U=D+(we=(we=(we=we+pe+((de+=ge)>>>0<ge>>>0?1:0))+Ie+((de+=Ce)>>>0<Ce>>>0?1:0))+$+((de+=z)>>>0<z>>>0?1:0))+((B=j+de|0)>>>0<j>>>0?1:0)|0,D=P,j=L,P=M,L=N,M=k,N=A,k=we+(ye+fe+(Se>>>0<me>>>0?1:0))+((A=de+Se|0)>>>0<de>>>0?1:0)|0}f=n.low=f+A,n.high=g+k+(f>>>0<A>>>0?1:0),y=o.low=y+N,o.high=h+M+(y>>>0<N>>>0?1:0),v=s.low=v+L,s.high=m+P+(v>>>0<L>>>0?1:0),O=i.low=O+j,i.high=b+D+(O>>>0<j>>>0?1:0),C=a.low=C+B,a.high=I+U+(C>>>0<B>>>0?1:0),S=u.low=S+x,u.high=w+F+(S>>>0<x>>>0?1:0),E=d.low=E+q,d.high=R+G+(E>>>0<q>>>0?1:0),_=p.low=_+K,p.high=T+V+(_>>>0<K>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(m(),O())),H.exports}var $,W={exports:{}};var J,Z={exports:{}};function X(){return J||(J=1,Z.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,s=n.Hasher,i=r.x64.Word,a=r.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,s=0;s<24;s++){for(var a=0,d=0,p=0;p<7;p++){if(1&o){var g=(1<<p)-1;g<32?d^=1<<g:a^=1<<g-32}128&o?o=o<<1^113:o<<=1}u[s]=i.create(a,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=i.create()}();var p=a.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var s=e[t+2*o],i=e[t+2*o+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),(_=r[o]).high^=i,_.low^=s}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var g=0,f=0,h=0;h<5;h++)g^=(_=r[p+5*h]).high,f^=_.low;var y=d[p];y.high=g,y.low=f}for(p=0;p<5;p++){var m=d[(p+4)%5],v=d[(p+1)%5],b=v.high,O=v.low;for(g=m.high^(b<<1|O>>>31),f=m.low^(O<<1|b>>>31),h=0;h<5;h++)(_=r[p+5*h]).high^=g,_.low^=f}for(var I=1;I<25;I++){var C=(_=r[I]).high,w=_.low,S=c[I];S<32?(g=C<<S|w>>>32-S,f=w<<S|C>>>32-S):(g=w<<S-32|C>>>64-S,f=C<<S-32|w>>>64-S);var R=d[l[I]];R.high=g,R.low=f}var E=d[0],T=r[0];for(E.high=T.high,E.low=T.low,p=0;p<5;p++)for(h=0;h<5;h++){var _=r[I=p+5*h],k=d[I],A=d[(p+1)%5+5*h],M=d[(p+2)%5+5*h];_.high=k.high^~A.high&M.high,_.low=k.low^~A.low&M.low}_=r[0];var N=u[a];_.high^=N.high,_.low^=N.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,s=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var i=this._state,a=this.cfg.outputLength/8,c=a/8,l=[],u=0;u<c;u++){var d=i[u],p=d.high,g=d.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),l.push(g),l.push(p)}return new o.init(l,a)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=s._createHelper(p),r.HmacSHA3=s._createHmacHelper(p)}(Math),e.SHA3}(m(),O())),Z.exports}var Y,Q={exports:{}};var ee,te={exports:{}};function re(){return ee||(ee=1,te.exports=function(e){var t,r,n;r=(t=e).lib.Base,n=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,o=4*r;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),i=this._iKey=t.clone(),a=s.words,c=i.words,l=0;l<r;l++)a[l]^=1549556828,c[l]^=909522486;s.sigBytes=i.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(m())),te.exports}var ne,oe={exports:{}};var se,ie={exports:{}};function ae(){return se||(se=1,ie.exports=function(e){return r=(t=e).lib,n=r.Base,o=r.WordArray,s=t.algo,i=s.MD5,a=s.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,s=n.hasher.create(),i=o.create(),a=i.words,c=n.keySize,l=n.iterations;a.length<c;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var u=1;u<l;u++)r=s.finalize(r),s.reset();i.concat(r)}return i.sigBytes=4*c,i}}),t.EvpKDF=function(e,t,r){return a.create(r).compute(e,t)},e.EvpKDF;var t,r,n,o,s,i,a}(m(),B(),re())),ie.exports}var ce,le={exports:{}};function ue(){return ce||(ce=1,le.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,o=n.Base,s=n.WordArray,i=n.BufferedBlockAlgorithm,a=r.enc;a.Utf8;var c=a.Base64,l=r.algo.EvpKDF,u=n.Cipher=i.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:m}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()});n.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},p=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),g=d.CBC=function(){var e=p.extend();function r(e,r,n){var o,s=this._iv;s?(o=s,this._iv=t):o=this._prevBlock;for(var i=0;i<n;i++)e[r+i]^=o[i]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,s=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=s}}),e}(),f=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,i=[],a=0;a<n;a+=4)i.push(o);var c=s.create(i,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=u.extend({cfg:u.cfg.extend({mode:g,padding:f}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var h=n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=s.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),h.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),s=o.finalize(t),i=o.cfg;return h.create({ciphertext:s,key:r,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),v=(r.kdf={}).OpenSSL={execute:function(e,t,r,n,o){if(n||(n=s.random(8)),o)i=l.create({keySize:t+r,hasher:o}).compute(e,n);else var i=l.create({keySize:t+r}).compute(e,n);var a=s.create(i.words.slice(t),4*r);return i.sigBytes=4*t,h.create({key:i,iv:a,salt:n})}},b=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:v}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=o.iv;var s=m.encrypt.call(this,e,t,o.key,n);return s.mixIn(o),s},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=o.iv,m.decrypt.call(this,e,t,o.key,n)}})}()}(m(),ae())),le.exports}var de,pe={exports:{}};function ge(){return de||(de=1,pe.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var o,s=this._iv;s?(o=s.slice(0),this._iv=void 0):o=this._prevBlock,n.encryptBlock(o,0);for(var i=0;i<r;i++)e[t+i]^=o[i]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,s=e.slice(t,t+o);r.call(this,e,t,o,n),this._prevBlock=s}}),t}(),e.mode.CFB}(m(),ue())),pe.exports}var fe,he={exports:{}};function ye(){return fe||(fe=1,he.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0);var i=s.slice(0);r.encryptBlock(i,0),s[n-1]=s[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=i[a]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(m(),ue())),he.exports}var me,ve={exports:{}};function be(){return me||(me=1,ve.exports=function(e){
2
2
  /** @preserve
3
3
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
4
4
  * derived from CryptoJS.mode.CTR
5
5
  * Jan Hruby jhruby.web@gmail.com
6
6
  */
7
- return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,s=this._iv,i=this._counter;s&&(i=this._counter=s.slice(0),this._iv=void 0),n(i);var a=i.slice(0);r.encryptBlock(a,0);for(var c=0;c<o;c++)e[t+c]^=a[c]}});return t.Decryptor=o,t}(),e.mode.CTRGladman}(m(),ue())),ve.exports}var Oe,Ce={exports:{}};function Ie(){return Oe||(Oe=1,Ce.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,s=this._keystream;o&&(s=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var i=0;i<n;i++)e[t+i]^=s[i]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(m(),ue())),Ce.exports}var we,Se={exports:{}};var Re,Ee={exports:{}};var Te,_e={exports:{}};var ke,Ae={exports:{}};var Me,Ne={exports:{}};var Pe,Le={exports:{}};var De,je={exports:{}};var Ue,Be={exports:{}};var Fe,xe={exports:{}};function Ge(){return Fe||(Fe=1,xe.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.BlockCipher,s=t.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=s.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=i[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],s=0;s<16;s++){var l=o[s]=[],u=c[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),p.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],s=this._lBlock,i=this._rBlock,a=0,c=0;c<8;c++)a|=l[c][((i^o[c])&u[c])>>>0];this._lBlock=i,this._rBlock=s^a}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,p.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function g(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=o._createHelper(d);var f=s.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(f)}(),e.TripleDES}(m(),k(),D(),ae(),ue())),xe.exports}var qe,Ve={exports:{}};var Ke,He={exports:{}};var ze,$e={exports:{}};var We,Je={exports:{}};function Ze(){return We||(We=1,Je.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo;const o=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],i=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,o=t>>8&255,s=255&t,i=e.sbox[0][r]+e.sbox[1][n];return i^=e.sbox[2][o],i+=e.sbox[3][s],i}function l(e,t,r){let n,s=t,i=r;for(let t=0;t<o;++t)s^=e.pbox[t],i=c(e,s)^i,n=s,s=i,i=n;return n=s,s=i,i=n,i^=e.pbox[o],s^=e.pbox[o+1],{left:s,right:i}}function u(e,t,r){let n,s=t,i=r;for(let t=o+1;t>1;--t)s^=e.pbox[t],i=c(e,s)^i,n=s,s=i,i=n;return n=s,s=i,i=n,i^=e.pbox[1],s^=e.pbox[0],{left:s,right:i}}function d(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=i[t][r]}let n=0;for(let i=0;i<o+2;i++)e.pbox[i]=s[i]^t[n],n++,n>=r&&(n=0);let a=0,c=0,u=0;for(let t=0;t<o+2;t+=2)u=l(e,a,c),a=u.left,c=u.right,e.pbox[t]=a,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=l(e,a,c),a=u.left,c=u.right,e.sbox[t][r]=a,e.sbox[t][r+1]=c;return!0}var p=n.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;d(a,t,r)}},encryptBlock:function(e,t){var r=l(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(p)}(),e.Blowfish}(m(),k(),D(),ae(),ue())),Je.exports}var Xe;var Ye=(Xe||(Xe=1,f.exports=function(e){return e}(m(),O(),w(),E(),k(),N(),D(),B(),G(),q||(q=1,V.exports=function(e){return r=(t=e).lib.WordArray,n=t.algo,o=n.SHA256,s=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=o._createHelper(s),t.HmacSHA224=o._createHmacHelper(s),e.SHA224;var t,r,n,o,s}(m(),G())),z(),$||($=1,W.exports=function(e){return r=(t=e).x64,n=r.Word,o=r.WordArray,s=t.algo,i=s.SHA512,a=s.SHA384=i.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=i._createHelper(a),t.HmacSHA384=i._createHmacHelper(a),e.SHA384;var t,r,n,o,s,i,a}(m(),O(),z())),X(),Y||(Y=1,Q.exports=function(e){
7
+ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,s=this._iv,i=this._counter;s&&(i=this._counter=s.slice(0),this._iv=void 0),n(i);var a=i.slice(0);r.encryptBlock(a,0);for(var c=0;c<o;c++)e[t+c]^=a[c]}});return t.Decryptor=o,t}(),e.mode.CTRGladman}(m(),ue())),ve.exports}var Oe,Ie={exports:{}};function Ce(){return Oe||(Oe=1,Ie.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,s=this._keystream;o&&(s=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var i=0;i<n;i++)e[t+i]^=s[i]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(m(),ue())),Ie.exports}var we,Se={exports:{}};var Re,Ee={exports:{}};var Te,_e={exports:{}};var ke,Ae={exports:{}};var Me,Ne={exports:{}};var Pe,Le={exports:{}};var De,je={exports:{}};var Ue,Be={exports:{}};var Fe,xe={exports:{}};function Ge(){return Fe||(Fe=1,xe.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.BlockCipher,s=t.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=s.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=i[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],s=0;s<16;s++){var l=o[s]=[],u=c[s];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],p.call(this,4,252645135),p.call(this,16,65535),g.call(this,2,858993459),g.call(this,8,16711935),p.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],s=this._lBlock,i=this._rBlock,a=0,c=0;c<8;c++)a|=l[c][((i^o[c])&u[c])>>>0];this._lBlock=i,this._rBlock=s^a}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,p.call(this,1,1431655765),g.call(this,8,16711935),g.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function g(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=o._createHelper(d);var f=s.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(f)}(),e.TripleDES}(m(),k(),D(),ae(),ue())),xe.exports}var qe,Ve={exports:{}};var Ke,He={exports:{}};var ze,$e={exports:{}};var We,Je={exports:{}};function Ze(){return We||(We=1,Je.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo;const o=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],i=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,o=t>>8&255,s=255&t,i=e.sbox[0][r]+e.sbox[1][n];return i^=e.sbox[2][o],i+=e.sbox[3][s],i}function l(e,t,r){let n,s=t,i=r;for(let t=0;t<o;++t)s^=e.pbox[t],i=c(e,s)^i,n=s,s=i,i=n;return n=s,s=i,i=n,i^=e.pbox[o],s^=e.pbox[o+1],{left:s,right:i}}function u(e,t,r){let n,s=t,i=r;for(let t=o+1;t>1;--t)s^=e.pbox[t],i=c(e,s)^i,n=s,s=i,i=n;return n=s,s=i,i=n,i^=e.pbox[1],s^=e.pbox[0],{left:s,right:i}}function d(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=i[t][r]}let n=0;for(let i=0;i<o+2;i++)e.pbox[i]=s[i]^t[n],n++,n>=r&&(n=0);let a=0,c=0,u=0;for(let t=0;t<o+2;t+=2)u=l(e,a,c),a=u.left,c=u.right,e.pbox[t]=a,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)u=l(e,a,c),a=u.left,c=u.right,e.sbox[t][r]=a,e.sbox[t][r+1]=c;return!0}var p=n.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;d(a,t,r)}},encryptBlock:function(e,t){var r=l(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=u(a,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(p)}(),e.Blowfish}(m(),k(),D(),ae(),ue())),Je.exports}var Xe;var Ye=(Xe||(Xe=1,f.exports=function(e){return e}(m(),O(),w(),E(),k(),N(),D(),B(),G(),q||(q=1,V.exports=function(e){return r=(t=e).lib.WordArray,n=t.algo,o=n.SHA256,s=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=o._createHelper(s),t.HmacSHA224=o._createHmacHelper(s),e.SHA224;var t,r,n,o,s}(m(),G())),z(),$||($=1,W.exports=function(e){return r=(t=e).x64,n=r.Word,o=r.WordArray,s=t.algo,i=s.SHA512,a=s.SHA384=i.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=i._createHelper(a),t.HmacSHA384=i._createHmacHelper(a),e.SHA384;var t,r,n,o,s,i,a}(m(),O(),z())),X(),Y||(Y=1,Q.exports=function(e){
8
8
  /** @preserve
9
9
  (c) 2012 by Cédric Mesnil. All rights reserved.
10
10
 
@@ -15,7 +15,7 @@ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();functio
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
17
  */
18
- return function(){var t=e,r=t.lib,n=r.WordArray,o=r.Hasher,s=t.algo,i=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s,p,b,O,C,I,w,S,R,E,T,_=this._hash.words,k=u.words,A=d.words,M=i.words,N=a.words,P=c.words,L=l.words;for(I=s=_[0],w=p=_[1],S=b=_[2],R=O=_[3],E=C=_[4],r=0;r<80;r+=1)T=s+e[t+M[r]]|0,T+=r<16?g(p,b,O)+k[0]:r<32?f(p,b,O)+k[1]:r<48?h(p,b,O)+k[2]:r<64?y(p,b,O)+k[3]:m(p,b,O)+k[4],T=(T=v(T|=0,P[r]))+C|0,s=C,C=O,O=v(b,10),b=p,p=T,T=I+e[t+N[r]]|0,T+=r<16?m(w,S,R)+A[0]:r<32?y(w,S,R)+A[1]:r<48?h(w,S,R)+A[2]:r<64?f(w,S,R)+A[3]:g(w,S,R)+A[4],T=(T=v(T|=0,L[r]))+E|0,I=E,E=R,R=v(S,10),S=w,w=T;T=_[1]+b+R|0,_[1]=_[2]+O+E|0,_[2]=_[3]+C+I|0,_[3]=_[4]+s+w|0,_[4]=_[0]+p+S|0,_[0]=T},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,s=o.words,i=0;i<5;i++){var a=s[i];s[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function g(e,t,r){return e^t^r}function f(e,t,r){return e&t|~e&r}function h(e,t,r){return(e|~t)^r}function y(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),e.RIPEMD160}(m())),re(),ne||(ne=1,oe.exports=function(e){return n=(r=(t=e).lib).Base,o=r.WordArray,i=(s=t.algo).SHA256,a=s.HMAC,c=s.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),s=o.create(),i=o.create([1]),c=s.words,l=i.words,u=r.keySize,d=r.iterations;c.length<u;){var p=n.update(t).finalize(i);n.reset();for(var g=p.words,f=g.length,h=p,y=1;y<d;y++){h=n.finalize(h),n.reset();for(var m=h.words,v=0;v<f;v++)g[v]^=m[v]}s.concat(p),l[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return c.create(r).compute(e,t)},e.PBKDF2;var t,r,n,o,s,i,a,c}(m(),G(),re())),ae(),ue(),ge(),ye(),be(),Ie(),we||(we=1,Se.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(m(),ue())),Re||(Re=1,Ee.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,s=r+o-1;e.clamp(),e.words[s>>>2]|=o<<24-s%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(m(),ue())),Te||(Te=1,_e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(m(),ue())),ke||(ke=1,Ae.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(m(),ue())),Me||(Me=1,Ne.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(m(),ue())),Pe||(Pe=1,Le.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(m(),ue())),De||(De=1,je.exports=function(e){return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,n}(m(),ue())),Ue||(Ue=1,Be.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,o=[],s=[],i=[],a=[],c=[],l=[],u=[],d=[],p=[],g=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,o[r]=f,s[f]=r;var h=e[r],y=e[h],m=e[y],v=257*e[f]^16843008*f;i[r]=v<<24|v>>>8,a[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,l[r]=v,v=16843009*m^65537*y^257*h^16843008*r,u[f]=v<<24|v>>>8,d[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,g[f]=v,r?(r=h^e[e[e[m^h]]],n^=e[e[n]]):r=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],h=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],i=0;i<n;i++)i<r?s[i]=t[i]:(l=s[i-1],i%r?r>6&&i%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=f[i/r|0]<<24),s[i]=s[i-r]^l);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(i=n-c,c%4)var l=s[i];else l=s[i-4];a[c]=c<4||i<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^p[o[l>>>8&255]]^g[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,a,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,p,g,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,s,i,a){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],p=e[t+3]^r[3],g=4,f=1;f<c;f++){var h=n[l>>>24]^o[u>>>16&255]^s[d>>>8&255]^i[255&p]^r[g++],y=n[u>>>24]^o[d>>>16&255]^s[p>>>8&255]^i[255&l]^r[g++],m=n[d>>>24]^o[p>>>16&255]^s[l>>>8&255]^i[255&u]^r[g++],v=n[p>>>24]^o[l>>>16&255]^s[u>>>8&255]^i[255&d]^r[g++];l=h,u=y,d=m,p=v}h=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&p])^r[g++],y=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[p>>>8&255]<<8|a[255&l])^r[g++],m=(a[d>>>24]<<24|a[p>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[g++],v=(a[p>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^r[g++],e[t]=h,e[t+1]=y,e[t+2]=m,e[t+3]=v},keySize:8});t.AES=r._createHelper(h)}(),e.AES}(m(),k(),D(),ae(),ue())),Ge(),qe||(qe=1,Ve.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var s=0;o<256;o++){var i=o%r,a=t[i>>>2]>>>24-i%4*8&255;s=(s+n[o]+a)%256;var c=n[o];n[o]=n[s],n[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}t.RC4=r._createHelper(o);var i=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(i)}(),e.RC4}(m(),k(),D(),ae(),ue())),Ke||(Ke=1,He.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],s=[],i=[],a=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var s=t.words,i=s[0],a=s[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,p=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=p,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=p,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}t.Rabbit=r._createHelper(a)}(),e.Rabbit}(m(),k(),D(),ae(),ue())),ze||(ze=1,$e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],s=[],i=[],a=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var s=t.words,i=s[0],a=s[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,p=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=p,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=p,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}t.RabbitLegacy=r._createHelper(a)}(),e.RabbitLegacy}(m(),k(),D(),ae(),ue())),Ze())),f.exports),Qe=g(Ye);function et(e){return Object.prototype.toString.call(e).slice(8,-1)}const tt=e=>null!=e,rt=e=>"number"==typeof e&&!isNaN(e),nt=e=>"boolean"==typeof e,ot=e=>void 0===e||"Undefined"===et(e),st=e=>"function"==typeof e,it=e=>null!==e&&"object"==typeof e;function at(e){return"array"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function ct(e){return"string"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function lt(e){return ct(e)&&e.length>0}function ut(e){for(const t in e)return!0;return!1}const dt=e=>it(e)&&st(e.then)&&st(e.catch);const pt=e=>Object.keys(e),gt=e=>{if(Array.isArray(e))return e.filter(e=>tt(e)).map(e=>it(e)?gt(e):e);const t={};return Object.keys(e).forEach(r=>{const n=e[r];tt(n)&&(t[r]=it(n)?gt(n):n)}),t},ft=(e,t=200)=>{let r=null;return function(...n){r||(r=setTimeout(()=>{e.call(null,...n),r=null},t))}},ht=Qe.enc.Utf8.parse("skdjhfgc9829kslf"),yt=Qe.enc.Utf8.parse("qwdkshjf9838jsdf"),mt=()=>"undefined"!=typeof process&&void 0!==process.versions&&!!process.versions.electron;const vt={get:function(e){if(mt(),"undefined"!=typeof localStorage){let t=localStorage.getItem(e);if(!tt(t))return t;try{return t=JSON.parse(t),t}catch{return t}}return null},set:function(e,t){tt(t)?(mt(),"undefined"!=typeof localStorage&&localStorage.setItem(e,JSON.stringify(t))):this.remove(e)},remove:function(e){mt(),"undefined"!=typeof localStorage&&localStorage.removeItem(e)}},bt={get:function(e){let t;if(mt(),"undefined"==typeof localStorage)return null;if(t=localStorage.getItem(e),tt(t)){const e=Qe.enc.Hex.parse(t),r=Qe.enc.Base64.stringify(e);t=Qe.AES.decrypt(r,ht,{iv:yt}).toString(Qe.enc.Utf8)}if(!tt(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){if(!tt(t))return void this.remove(e);const r=Qe.AES.encrypt(JSON.stringify(t),ht,{iv:yt}).ciphertext.toString();mt(),"undefined"!=typeof localStorage&&localStorage.setItem(e,r)},remove:function(e){mt(),"undefined"!=typeof localStorage&&localStorage.removeItem(e)}},Ot="ACIM-";class Ct{cache;storageKey;saveFunc;constructor(e){const t=e?`${Ot}${e}`:Ot,r=vt.get(t)||{};this.cache=r,this.storageKey=t,this.saveFunc=ft(()=>{vt.set(this.storageKey,this.cache)},10)}set(e,t){this.cache[e]=t,this.saveFunc()}remove(e){delete this.cache[e],this.saveFunc()}clear(){vt.remove(this.storageKey),this.cache={}}get(e){return this.cache[e]}getCache(){return this.cache||{}}}class It{static instance;db=null;DB_NAME="ACIM_DB";DB_VERSION=1;constructor(){this.initDB()}static getInstance(){return It.instance||(It.instance=new It),It.instance}async initDB(){return new Promise((e,t)=>{const r=indexedDB.open(this.DB_NAME,this.DB_VERSION);r.onerror=()=>{console.error("Failed to open IndexedDB:",r.error),t(r.error)},r.onsuccess=()=>{this.db=r.result,e()},r.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains("logs")){t.createObjectStore("logs",{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp",{unique:!1})}t.objectStoreNames.contains("events")||t.createObjectStore("events",{keyPath:"id",autoIncrement:!0})}})}async getDB(){return this.db||await this.initDB(),this.db}}class wt{storeName="events";dbManager;constructor(){this.dbManager=It.getInstance()}async enqueue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName).add(e);o.onsuccess=()=>r(),o.onerror=()=>{console.error("Failed to enqueue event:",o.error),n(o.error)}})}async dequeue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName),s=[];let i=0;const a=o.openCursor();a.onsuccess=t=>{const n=t.target.result;n&&i<e?(s.push(n.value),n.delete(),i++,n.continue()):r(s)},a.onerror=()=>{console.error("Failed to dequeue events:",a.error),n(a.error)}})}async requeue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName);let s=0;const i=()=>{if(s<e.length){const t=o.add(e[s]);t.onsuccess=()=>{s++,i()},t.onerror=()=>{console.error("Failed to requeue event:",t.error),n(t.error)}}else r()};i()})}async requeueToEnd(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName);let s=0;const i=()=>{if(s<e.length){const t=o.add(e[s]);t.onsuccess=()=>{s++,i()},t.onerror=()=>{console.error("Failed to requeue event to end:",t.error),n(t.error)}}else r()};i()})}async clear(){const e=await this.dbManager.getDB();return new Promise((t,r)=>{const n=e.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();n.onsuccess=()=>t(),n.onerror=()=>{console.error("Failed to clear events:",n.error),r(n.error)}})}}var St,Rt=new class{uploader=void 0;deviceCode=void 0;deviceType=7;appVersion="1.0.10";getUploader(){return this.uploader}setUploader(e){this.uploader=e}getDeviceCode(){return this.deviceCode}setDeviceCode(e){this.deviceCode=e}getDeviceType(){return this.deviceType}setDeviceType(e){this.deviceType=e}};!function(e){e[e.Auth=805404708]="Auth",e[e.Heartbean=268439553]="Heartbean",e[e.GetServerTime=268439558]="GetServerTime",e[e.GetDialogKey=1610682389]="GetDialogKey",e[e.SendPrivateChatMessage=1610682369]="SendPrivateChatMessage",e[e.SendQuotePrivateChatMessage=1610682370]="SendQuotePrivateChatMessage",e[e.SendGroupChatMessage=1610747905]="SendGroupChatMessage",e[e.SendQuoteGroupChatMessage=1610747906]="SendQuoteGroupChatMessage",e[e.GetNewMessage=1610682407]="GetNewMessage",e[e.RecallPrivateMessage=1610682402]="RecallPrivateMessage",e[e.RecallGroupMessage=1610747947]="RecallGroupMessage",e[e.GetRemoteMessages=1610682419]="GetRemoteMessages",e[e.GetSuperGroupRemoteMessages=1610776956]="GetSuperGroupRemoteMessages",e[e.DeleteChatMessages=1610682381]="DeleteChatMessages",e[e.ClearChatHistoryMessage=1610682421]="ClearChatHistoryMessage",e[e.GetDialogList=1610711096]="GetDialogList",e[e.GetBriefDialogList=1610682399]="GetBriefDialogList",e[e.UpdatePrivateChatMuteConfig=1610682379]="UpdatePrivateChatMuteConfig",e[e.UpdateGroupChatMuteConfig=1610747915]="UpdateGroupChatMuteConfig",e[e.UpdatePrivateChatStickyConfig=1610682378]="UpdatePrivateChatStickyConfig",e[e.UpdateGroupChatStickyConfig=1610747914]="UpdateGroupChatStickyConfig",e[e.DeletePrivateDialog=1610682372]="DeletePrivateDialog",e[e.DeleteGroupDialog=1610747908]="DeleteGroupDialog",e[e.GetDialogChangedStatus=1610711094]="GetDialogChangedStatus",e[e.SendGroupChatArrivalAck=1610747952]="SendGroupChatArrivalAck",e[e.SendGroupChatReadAck=1610747953]="SendGroupChatReadAck",e[e.SendPrivateChatArrivalAck=1610682403]="SendPrivateChatArrivalAck",e[e.SendPrivateChatReadAck=1610682404]="SendPrivateChatReadAck",e[e.PostAnalyticsLogs=1879117827]="PostAnalyticsLogs",e[e.HeartbeanResp=268468225]="HeartbeanResp",e[e.NewMessagePush=1610711040]="NewMessagePush",e[e.DialogChangedPush=1610711096]="DialogChangedPush",e[e.SessionKilledPush=268468229]="SessionKilledPush",e[e.SignOutPish=268439559]="SignOutPish",e[e.SignOutPish2=268468231]="SignOutPish2",e[e.UserFrozenToLogin=805408766]="UserFrozenToLogin",e[e.UserFrozenToLogin2=805408767]="UserFrozenToLogin2"}(St||(St={}));var Et=St;var Tt,_t,kt={},At={};function Mt(){if(_t)return Tt;return _t=1,Tt=function(e,t){var r=new Array(arguments.length-1),n=0,o=2,s=!0;for(;o<arguments.length;)r[n++]=arguments[o++];return new Promise(function(o,i){r[n]=function(e){if(s)if(s=!1,e)i(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,i(e))}})},Tt}var Nt,Pt,Lt,Dt,jt,Ut,Bt,Ft={};function xt(){if(Bt)return Ut;return Bt=1,Ut=function(e){try{var t=void 0;t}catch(e){}return null}}var Gt,qt,Vt,Kt,Ht,zt,$t,Wt,Jt,Zt,Xt,Yt,Qt,er,tr={};function rr(){return zt||(zt=1,function(){var e=At;function t(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e}function r(e){function r(e,n){if(!(this instanceof r))return new r(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&t(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}e.asPromise=Mt(),e.base64=(Nt||(Nt=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,s=null,i=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:i[a++]=r[l>>2],o=(3&l)<<4,c=1;break;case 1:i[a++]=r[o|l>>4],o=(15&l)<<2,c=2;break;case 2:i[a++]=r[o|l>>6],i[a++]=r[63&l],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0)}return c&&(i[a++]=r[o],i[a++]=61,1===c&&(i[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var s="invalid encoding";t.decode=function(e,t,r){for(var o,i=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=n[l]))throw Error(s);switch(a){case 0:o=l,a=1;break;case 1:t[r++]=o<<2|(48&l)>>4,o=l,a=2;break;case 2:t[r++]=(15&o)<<4|(60&l)>>2,o=l,a=3;break;case 3:t[r++]=(3&o)<<6|l,a=0}}if(1===a)throw Error(s);return r-i},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(Ft)),Ft),e.EventEmitter=function(){if(Lt)return Pt;function e(){this._listeners={}}return Lt=1,Pt=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},Pt}(),e.float=function(){if(jt)return Dt;function e(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function s(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function i(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:s,e.writeFloatBE=n?s:o,e.readFloatLE=n?i:a,e.readFloatBE=n?a:i}():function(){function s(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((o<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function i(e,t,r){var n=e(t,r),o=2*(n>>31)+1,s=n>>>23&255,i=8388607&n;return 255===s?i?NaN:o*(1/0):0===s?1401298464324817e-60*o*i:o*Math.pow(2,s-150)*(i+8388608)}e.writeFloatLE=s.bind(null,t),e.writeFloatBE=s.bind(null,r),e.readFloatLE=i.bind(null,n),e.readFloatBE=i.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function s(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function i(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:s,e.writeDoubleBE=n?s:o,e.readDoubleLE=n?i:a,e.readDoubleBE=n?a:i}():function(){function s(e,t,r,n,o,s){var i=n<0?1:0;if(i&&(n=-n),0===n)e(0,o,s+t),e(1/n>0?0:2147483648,o,s+r);else if(isNaN(n))e(0,o,s+t),e(2146959360,o,s+r);else if(n>17976931348623157e292)e(0,o,s+t),e((i<<31|2146435072)>>>0,o,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,s+t),e((i<<31|a/4294967296)>>>0,o,s+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,s+t),e((i<<31|c+1023<<20|1048576*a&1048575)>>>0,o,s+r)}}}function i(e,t,r,n,o){var s=e(n,o+t),i=e(n,o+r),a=2*(i>>31)+1,c=i>>>20&2047,l=4294967296*(1048575&i)+s;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=s.bind(null,t,0,4),e.writeDoubleBE=s.bind(null,r,4,0),e.readDoubleLE=i.bind(null,n,0,4),e.readDoubleBE=i.bind(null,o,4,0)}(),e}function t(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function r(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return jt=1,Dt=e(e)}(),e.inquire=xt(),e.utf8=(Gt||(Gt=1,function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,s=[],i=0;t<r;)(n=e[t++])<128?s[i++]=n:n>191&&n<224?s[i++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[i++]=55296+(n>>10),s[i++]=56320+(1023&n)):s[i++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))},t.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(n=65536+((1023&n)<<10)+(1023&o),++i,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}}(tr)),tr),e.pool=Vt?qt:(Vt=1,qt=function(e,t,r){var n=r||8192,o=n>>>1,s=null,i=n;return function(r){if(r<1||r>o)return e(r);i+r>n&&(s=e(n),i=0);var a=t.call(s,i,i+=r);return 7&i&&(i=1+(7|i)),a}}),e.LongBits=function(){if(Ht)return Kt;Ht=1,Kt=t;var e=rr();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var o=e>>>0,s=(e-o)/4294967296>>>0;return n&&(s=~s>>>0,o=~o>>>0,++o>4294967295&&(o=0,++s>4294967295&&(s=0))),new t(o,s)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var o=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},Kt}(),e.isNode=Boolean(void 0!==p&&p&&p.process&&p.process.versions&&p.process.versions.node),e.global=e.isNode&&p||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||At,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.isString=function(e){return"string"==typeof e||e instanceof String},e.isObject=function(e){return e&&"object"==typeof e},e.isset=e.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},e.Buffer=function(){try{var t=e.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(t){return"number"==typeof t?e.Buffer?e._Buffer_allocUnsafe(t):new e.Array(t):e.Buffer?e._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},e.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(t){return t?e.LongBits.from(t).toHash():e.LongBits.zeroHash},e.longFromHash=function(t,r){var n=e.LongBits.fromHash(t);return e.Long?e.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},e.merge=t,e.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},e.newError=r,e.ProtocolError=r("ProtocolError"),e.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},e.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},e._configure=function(){var t=e.Buffer;t?(e._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,r){return new t(e,r)},e._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):e._Buffer_from=e._Buffer_allocUnsafe=null}}()),At}function nr(){if(Wt)return $t;Wt=1,$t=c;var e,t=rr(),r=t.LongBits,n=t.base64,o=t.utf8;function s(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function i(){}function a(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new s(i,0,0),this.tail=this.head,this.states=null}var l=function(){return t.Buffer?function(){return(c.create=function(){return new e})()}:function(){return new c}};function u(e,t,r){t[r]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function p(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.create=l(),c.alloc=function(e){return new t.Array(e)},t.Array!==Array&&(c.alloc=t.pool(c.alloc,t.Array.prototype.subarray)),c.prototype._push=function(e,t,r){return this.tail=this.tail.next=new s(e,t,r),this.len+=t,this},d.prototype=Object.create(s.prototype),d.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(p,10,r.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=r.from(e);return this._push(p,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=r.from(e).zzEncode();return this._push(p,t.length(),t)},c.prototype.bool=function(e){return this._push(u,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=r.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(t.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(t.float.writeDoubleLE,8,e)};var f=t.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};return c.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(u,1,0);if(t.isString(e)){var o=c.alloc(r=n.length(e));n.decode(e,o,0),e=o}return this.uint32(r)._push(f,r,e)},c.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(u,1,0)},c.prototype.fork=function(){return this.states=new a(this),this.head=this.tail=new s(i,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(i,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},c._configure=function(t){e=t,c.create=l(),e._configure()},$t}function or(){if(Yt)return Xt;Yt=1,Xt=s;var e,t=rr(),r=t.LongBits,n=t.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function s(e){this.buf=e,this.pos=0,this.len=e.length}var i,a="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new s(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new s(e);throw Error("illegal buffer")},c=function(){return t.Buffer?function(r){return(s.create=function(r){return t.Buffer.isBuffer(r)?new e(r):a(r)})(r)}:a};function l(){var e=new r(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function u(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw o(this,8);return new r(u(this.buf,this.pos+=4),u(this.buf,this.pos+=4))}return s.create=c(),s.prototype._slice=t.Array.prototype.subarray||t.Array.prototype.slice,s.prototype.uint32=(i=4294967295,function(){if(i=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return i;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return i}),s.prototype.int32=function(){return 0|this.uint32()},s.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},s.prototype.bool=function(){return 0!==this.uint32()},s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return u(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|u(this.buf,this.pos+=4)},s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},s.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw o(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var s=t.Buffer;return s?s.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)},s.prototype.string=function(){var e=this.bytes();return n.read(e,0,e.length)},s.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},s.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},s._configure=function(r){e=r,s.create=c(),e._configure();var n=t.Long?"toLong":"toNumber";t.merge(s.prototype,{int64:function(){return l.call(this)[n](!1)},uint64:function(){return l.call(this)[n](!0)},sint64:function(){return l.call(this).zzDecode()[n](!1)},fixed64:function(){return d.call(this)[n](!0)},sfixed64:function(){return d.call(this)[n](!1)}})},Xt}var sr,ir,ar,cr,lr,ur,dr,pr,gr={};function fr(){return ar||(ar=1,gr.Service=function(){if(ir)return sr;ir=1,sr=t;var e=rr();function t(t,r,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(n)}return(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,n,o,s,i){if(!s)throw TypeError("request must be specified");var a=this;if(!i)return e.asPromise(t,a,r,n,o,s);if(a.rpcImpl)try{return a.rpcImpl(r,n[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,t){if(e)return a.emit("error",e,r),i(e);if(null!==t){if(!(t instanceof o))try{t=o[a.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return a.emit("error",e,r),i(e)}return a.emit("data",t,r),i(null,t)}a.end(!0)})}catch(e){return a.emit("error",e,r),void setTimeout(function(){i(e)},0)}else setTimeout(function(){i(Error("already ended"))},0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},sr}()),gr}function hr(){return lr?cr:(lr=1,cr={})}function yr(){return ur||(ur=1,function(){var e=kt;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=nr(),e.BufferWriter=function(){if(Zt)return Jt;Zt=1,Jt=r;var e=nr();(r.prototype=Object.create(e.prototype)).constructor=r;var t=rr();function r(){e.call(this)}function n(e,r,n){e.length<40?t.utf8.write(e,r,n):r.utf8Write?r.utf8Write(e,n):r.write(e,n)}return r._configure=function(){r.alloc=t._Buffer_allocUnsafe,r.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&"set"===t.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},r.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(r.writeBytesBuffer,n,e),this},r.prototype.string=function(e){var r=t.Buffer.byteLength(e);return this.uint32(r),r&&this._push(n,r,e),this},r._configure(),Jt}(),e.Reader=or(),e.BufferReader=function(){if(er)return Qt;er=1,Qt=r;var e=or();(r.prototype=Object.create(e.prototype)).constructor=r;var t=rr();function r(t){e.call(this,t)}return r._configure=function(){t.Buffer&&(r.prototype._slice=t.Buffer.prototype.slice)},r.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},r._configure(),Qt}(),e.util=rr(),e.rpc=fr(),e.roots=hr(),e.configure=t,t()}()),kt}var mr=pr?dr:(pr=1,dr=yr());const vr=mr.Reader,br=mr.Writer,Or=mr.util,Cr=mr.roots.default||(mr.roots.default={}),Ir=Cr.NetworkRequest=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.sessionId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.uid=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.destId="",e.prototype.body=Or.newBuffer([]),e.prototype.deviceCode="",e.prototype.deviceType=0,e.encode=function(e,t){return t||(t=br.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(58).string(e.destId),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.deviceCode&&Object.hasOwnProperty.call(e,"deviceCode")&&t.uint32(74).string(e.deviceCode),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(96).int32(e.deviceType),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.NetworkRequest;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 7:n.destId=e.string();break;case 8:n.body=e.bytes();break;case 9:n.deviceCode=e.string();break;case 12:n.deviceType=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkRequest"},e})(),wr=Cr.NetworkResponse=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.uid=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.body=Or.newBuffer([]),e.prototype.code=0,e.encode=function(e,t){return t||(t=br.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(72).int32(e.code),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.NetworkResponse;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 8:n.body=e.bytes();break;case 9:n.code=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkResponse"},e})(),Sr=Cr.HeartbeatReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.pingId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.disconnectDelay=Or.Long?Or.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=br.create()),null!=e.pingId&&Object.hasOwnProperty.call(e,"pingId")&&t.uint32(8).int64(e.pingId),null!=e.disconnectDelay&&Object.hasOwnProperty.call(e,"disconnectDelay")&&t.uint32(16).int64(e.disconnectDelay),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.HeartbeatReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.pingId=e.int64();break;case 2:n.disconnectDelay=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/HeartbeatReq"},e})();Cr.SystemCurrentTimeMillisReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.encode=function(e,t){return t||(t=br.create()),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.SystemCurrentTimeMillisReq;for(;e.pos<r;){let t=e.uint32();e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisReq"},e})();const Rr=Cr.SystemCurrentTimeMillisResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.currentTimeMillis=Or.Long?Or.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=br.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.currentTimeMillis&&Object.hasOwnProperty.call(e,"currentTimeMillis")&&t.uint32(24).int64(e.currentTimeMillis),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.SystemCurrentTimeMillisResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.currentTimeMillis=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisResp"},e})(),Er=Cr.BaseResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.encode=function(e,t){return t||(t=br.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.BaseResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BaseResp"},e})(),Tr=Cr.LogReportReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.data="",e.encode=function(e,t){return t||(t=br.create()),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(10).string(e.data),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Cr.LogReportReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.data=e.string();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/LogReportReq"},e})();class _r{pool=[];writeIn8(e){this.pool.push(e)}writeInt16(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255)}writeInt32(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255),this.pool.push(e>>>16&255),this.pool.push(e>>>24&255)}writeArr(e){return this.pool.push(...e),e}getBytesArray(){return this.pool}}class kr{pool;position=0;constructor(e){this.pool=e}check(){return this.position>=this.pool.length}readInt8(){const e=this.pool[this.position];return this.position+=1,e<<24>>24}readInt32(){const e=this.pool[this.position+0],t=this.pool[this.position+1],r=this.pool[this.position+2],n=this.pool[this.position+3];return this.position+=4,e|t<<8|r<<16|n<<24}readArr(e){const t=this.pool.subarray(this.position,this.position+e);return this.position+=e,t}}const Ar=e=>{let r;switch(e){case 0:r=t.SUCCESS;break;case 1610743809:r=t.NOT_IN_GROUP;break;case 1610678275:r=t.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=t.REJECTED_BY_BLACKLIST;break;case 3:r=t.PARAMETER_ERROR;break;case 22408:r=t.FORBIDDEN_IN_GROUP;break;default:r=t.UNKNOWN}return r};
18
+ return function(){var t=e,r=t.lib,n=r.WordArray,o=r.Hasher,s=t.algo,i=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),d=n.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var s,p,b,O,I,C,w,S,R,E,T,_=this._hash.words,k=u.words,A=d.words,M=i.words,N=a.words,P=c.words,L=l.words;for(C=s=_[0],w=p=_[1],S=b=_[2],R=O=_[3],E=I=_[4],r=0;r<80;r+=1)T=s+e[t+M[r]]|0,T+=r<16?g(p,b,O)+k[0]:r<32?f(p,b,O)+k[1]:r<48?h(p,b,O)+k[2]:r<64?y(p,b,O)+k[3]:m(p,b,O)+k[4],T=(T=v(T|=0,P[r]))+I|0,s=I,I=O,O=v(b,10),b=p,p=T,T=C+e[t+N[r]]|0,T+=r<16?m(w,S,R)+A[0]:r<32?y(w,S,R)+A[1]:r<48?h(w,S,R)+A[2]:r<64?f(w,S,R)+A[3]:g(w,S,R)+A[4],T=(T=v(T|=0,L[r]))+E|0,C=E,E=R,R=v(S,10),S=w,w=T;T=_[1]+b+R|0,_[1]=_[2]+O+E|0,_[2]=_[3]+I+C|0,_[3]=_[4]+s+w|0,_[4]=_[0]+p+S|0,_[0]=T},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,s=o.words,i=0;i<5;i++){var a=s[i];s[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function g(e,t,r){return e^t^r}function f(e,t,r){return e&t|~e&r}function h(e,t,r){return(e|~t)^r}function y(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function v(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)}(),e.RIPEMD160}(m())),re(),ne||(ne=1,oe.exports=function(e){return n=(r=(t=e).lib).Base,o=r.WordArray,i=(s=t.algo).SHA256,a=s.HMAC,c=s.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:i,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),s=o.create(),i=o.create([1]),c=s.words,l=i.words,u=r.keySize,d=r.iterations;c.length<u;){var p=n.update(t).finalize(i);n.reset();for(var g=p.words,f=g.length,h=p,y=1;y<d;y++){h=n.finalize(h),n.reset();for(var m=h.words,v=0;v<f;v++)g[v]^=m[v]}s.concat(p),l[0]++}return s.sigBytes=4*u,s}}),t.PBKDF2=function(e,t,r){return c.create(r).compute(e,t)},e.PBKDF2;var t,r,n,o,s,i,a,c}(m(),G(),re())),ae(),ue(),ge(),ye(),be(),Ce(),we||(we=1,Se.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(m(),ue())),Re||(Re=1,Ee.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,s=r+o-1;e.clamp(),e.words[s>>>2]|=o<<24-s%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(m(),ue())),Te||(Te=1,_e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(m(),ue())),ke||(ke=1,Ae.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(m(),ue())),Me||(Me=1,Ne.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(m(),ue())),Pe||(Pe=1,Le.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(m(),ue())),De||(De=1,je.exports=function(e){return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,n}(m(),ue())),Ue||(Ue=1,Be.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,o=[],s=[],i=[],a=[],c=[],l=[],u=[],d=[],p=[],g=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,o[r]=f,s[f]=r;var h=e[r],y=e[h],m=e[y],v=257*e[f]^16843008*f;i[r]=v<<24|v>>>8,a[r]=v<<16|v>>>16,c[r]=v<<8|v>>>24,l[r]=v,v=16843009*m^65537*y^257*h^16843008*r,u[f]=v<<24|v>>>8,d[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,g[f]=v,r?(r=h^e[e[e[m^h]]],n^=e[e[n]]):r=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],h=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],i=0;i<n;i++)i<r?s[i]=t[i]:(l=s[i-1],i%r?r>6&&i%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=f[i/r|0]<<24),s[i]=s[i-r]^l);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(i=n-c,c%4)var l=s[i];else l=s[i-4];a[c]=c<4||i<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^p[o[l>>>8&255]]^g[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,a,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,p,g,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,s,i,a){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],p=e[t+3]^r[3],g=4,f=1;f<c;f++){var h=n[l>>>24]^o[u>>>16&255]^s[d>>>8&255]^i[255&p]^r[g++],y=n[u>>>24]^o[d>>>16&255]^s[p>>>8&255]^i[255&l]^r[g++],m=n[d>>>24]^o[p>>>16&255]^s[l>>>8&255]^i[255&u]^r[g++],v=n[p>>>24]^o[l>>>16&255]^s[u>>>8&255]^i[255&d]^r[g++];l=h,u=y,d=m,p=v}h=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&p])^r[g++],y=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[p>>>8&255]<<8|a[255&l])^r[g++],m=(a[d>>>24]<<24|a[p>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[g++],v=(a[p>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^r[g++],e[t]=h,e[t+1]=y,e[t+2]=m,e[t+3]=v},keySize:8});t.AES=r._createHelper(h)}(),e.AES}(m(),k(),D(),ae(),ue())),Ge(),qe||(qe=1,Ve.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var s=0;o<256;o++){var i=o%r,a=t[i>>>2]>>>24-i%4*8&255;s=(s+n[o]+a)%256;var c=n[o];n[o]=n[s],n[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}t.RC4=r._createHelper(o);var i=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});t.RC4Drop=r._createHelper(i)}(),e.RC4}(m(),k(),D(),ae(),ue())),Ke||(Ke=1,He.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],s=[],i=[],a=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var s=t.words,i=s[0],a=s[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,p=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=p,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=p,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}t.Rabbit=r._createHelper(a)}(),e.Rabbit}(m(),k(),D(),ae(),ue())),ze||(ze=1,$e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],s=[],i=[],a=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var s=t.words,i=s[0],a=s[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,p=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=p,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=p,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<s[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<s[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<s[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<s[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<s[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<s[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<s[6]>>>0?1:0)|0,this._b=t[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}t.RabbitLegacy=r._createHelper(a)}(),e.RabbitLegacy}(m(),k(),D(),ae(),ue())),Ze())),f.exports),Qe=g(Ye);function et(e){return Object.prototype.toString.call(e).slice(8,-1)}const tt=e=>null!=e,rt=e=>"number"==typeof e&&!isNaN(e),nt=e=>"boolean"==typeof e,ot=e=>void 0===e||"Undefined"===et(e),st=e=>"function"==typeof e,it=e=>null!==e&&"object"==typeof e;function at(e){return"array"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function ct(e){return"string"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function lt(e){return ct(e)&&e.length>0}function ut(e){for(const t in e)return!0;return!1}const dt=e=>it(e)&&st(e.then)&&st(e.catch);const pt=e=>Object.keys(e),gt=e=>{if(Array.isArray(e))return e.filter(e=>tt(e)).map(e=>it(e)?gt(e):e);const t={};return Object.keys(e).forEach(r=>{const n=e[r];tt(n)&&(t[r]=it(n)?gt(n):n)}),t},ft=(e,t=200)=>{let r=null;return function(...n){r||(r=setTimeout(()=>{e.call(null,...n),r=null},t))}},ht=Qe.enc.Utf8.parse("skdjhfgc9829kslf"),yt=Qe.enc.Utf8.parse("qwdkshjf9838jsdf"),mt=()=>"undefined"!=typeof process&&void 0!==process.versions&&!!process.versions.electron;const vt={get:function(e){if(mt(),"undefined"!=typeof localStorage){let t=localStorage.getItem(e);if(!tt(t))return t;try{return t=JSON.parse(t),t}catch{return t}}return null},set:function(e,t){tt(t)?(mt(),"undefined"!=typeof localStorage&&localStorage.setItem(e,JSON.stringify(t))):this.remove(e)},remove:function(e){mt(),"undefined"!=typeof localStorage&&localStorage.removeItem(e)}},bt={get:function(e){let t;if(mt(),"undefined"==typeof localStorage)return null;if(t=localStorage.getItem(e),tt(t)){const e=Qe.enc.Hex.parse(t),r=Qe.enc.Base64.stringify(e);t=Qe.AES.decrypt(r,ht,{iv:yt}).toString(Qe.enc.Utf8)}if(!tt(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){if(!tt(t))return void this.remove(e);const r=Qe.AES.encrypt(JSON.stringify(t),ht,{iv:yt}).ciphertext.toString();mt(),"undefined"!=typeof localStorage&&localStorage.setItem(e,r)},remove:function(e){mt(),"undefined"!=typeof localStorage&&localStorage.removeItem(e)}},Ot="ACIM-";class It{cache;storageKey;saveFunc;constructor(e){const t=e?`${Ot}${e}`:Ot,r=vt.get(t)||{};this.cache=r,this.storageKey=t,this.saveFunc=ft(()=>{vt.set(this.storageKey,this.cache)},10)}set(e,t){this.cache[e]=t,this.saveFunc()}remove(e){delete this.cache[e],this.saveFunc()}clear(){vt.remove(this.storageKey),this.cache={}}get(e){return this.cache[e]}getCache(){return this.cache||{}}}class Ct{static instance;db=null;DB_NAME="ACIM_DB";DB_VERSION=1;constructor(){this.initDB()}static getInstance(){return Ct.instance||(Ct.instance=new Ct),Ct.instance}async initDB(){return new Promise((e,t)=>{const r=indexedDB.open(this.DB_NAME,this.DB_VERSION);r.onerror=()=>{console.error("Failed to open IndexedDB:",r.error),t(r.error)},r.onsuccess=()=>{this.db=r.result,e()},r.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains("logs")){t.createObjectStore("logs",{keyPath:"id",autoIncrement:!0}).createIndex("timestamp","timestamp",{unique:!1})}t.objectStoreNames.contains("events")||t.createObjectStore("events",{keyPath:"id",autoIncrement:!0})}})}async getDB(){return this.db||await this.initDB(),this.db}}class wt{storeName="events";dbManager;constructor(){this.dbManager=Ct.getInstance()}async enqueue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName).add(e);o.onsuccess=()=>r(),o.onerror=()=>{console.error("Failed to enqueue event:",o.error),n(o.error)}})}async dequeue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName),s=[];let i=0;const a=o.openCursor();a.onsuccess=t=>{const n=t.target.result;n&&i<e?(s.push(n.value),n.delete(),i++,n.continue()):r(s)},a.onerror=()=>{console.error("Failed to dequeue events:",a.error),n(a.error)}})}async requeue(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName);let s=0;const i=()=>{if(s<e.length){const t=o.add(e[s]);t.onsuccess=()=>{s++,i()},t.onerror=()=>{console.error("Failed to requeue event:",t.error),n(t.error)}}else r()};i()})}async requeueToEnd(e){const t=await this.dbManager.getDB();return new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite").objectStore(this.storeName);let s=0;const i=()=>{if(s<e.length){const t=o.add(e[s]);t.onsuccess=()=>{s++,i()},t.onerror=()=>{console.error("Failed to requeue event to end:",t.error),n(t.error)}}else r()};i()})}async clear(){const e=await this.dbManager.getDB();return new Promise((t,r)=>{const n=e.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();n.onsuccess=()=>t(),n.onerror=()=>{console.error("Failed to clear events:",n.error),r(n.error)}})}}var St,Rt=new class{uploader=void 0;deviceCode=void 0;deviceType=7;appVersion="1.0.10";getUploader(){return this.uploader}setUploader(e){this.uploader=e}getDeviceCode(){return this.deviceCode}setDeviceCode(e){this.deviceCode=e}getDeviceType(){return this.deviceType}setDeviceType(e){this.deviceType=e}};!function(e){e[e.Auth=805404708]="Auth",e[e.Heartbean=268439553]="Heartbean",e[e.GetServerTime=268439558]="GetServerTime",e[e.GetDialogKey=1610682389]="GetDialogKey",e[e.SendPrivateChatMessage=1610682369]="SendPrivateChatMessage",e[e.SendQuotePrivateChatMessage=1610682370]="SendQuotePrivateChatMessage",e[e.SendGroupChatMessage=1610747905]="SendGroupChatMessage",e[e.SendQuoteGroupChatMessage=1610747906]="SendQuoteGroupChatMessage",e[e.GetNewMessage=1610682407]="GetNewMessage",e[e.RecallPrivateMessage=1610682402]="RecallPrivateMessage",e[e.RecallGroupMessage=1610747947]="RecallGroupMessage",e[e.GetRemoteMessages=1610682419]="GetRemoteMessages",e[e.GetSuperGroupRemoteMessages=1610776956]="GetSuperGroupRemoteMessages",e[e.DeleteChatMessages=1610682381]="DeleteChatMessages",e[e.ClearChatHistoryMessage=1610682421]="ClearChatHistoryMessage",e[e.GetDialogList=1610711096]="GetDialogList",e[e.GetBriefDialogList=1610682399]="GetBriefDialogList",e[e.UpdatePrivateChatMuteConfig=1610682379]="UpdatePrivateChatMuteConfig",e[e.UpdateGroupChatMuteConfig=1610747915]="UpdateGroupChatMuteConfig",e[e.UpdatePrivateChatStickyConfig=1610682378]="UpdatePrivateChatStickyConfig",e[e.UpdateGroupChatStickyConfig=1610747914]="UpdateGroupChatStickyConfig",e[e.DeletePrivateDialog=1610682372]="DeletePrivateDialog",e[e.DeleteGroupDialog=1610747908]="DeleteGroupDialog",e[e.GetDialogChangedStatus=1610711094]="GetDialogChangedStatus",e[e.SendGroupChatArrivalAck=1610747952]="SendGroupChatArrivalAck",e[e.SendGroupChatReadAck=1610747953]="SendGroupChatReadAck",e[e.SendPrivateChatArrivalAck=1610682403]="SendPrivateChatArrivalAck",e[e.SendPrivateChatReadAck=1610682404]="SendPrivateChatReadAck",e[e.PostAnalyticsLogs=1879117827]="PostAnalyticsLogs",e[e.HeartbeanResp=268468225]="HeartbeanResp",e[e.NewMessagePush=1610711040]="NewMessagePush",e[e.DialogChangedPush=1610711096]="DialogChangedPush",e[e.SessionKilledPush=268468229]="SessionKilledPush",e[e.SignOutPish=268439559]="SignOutPish",e[e.SignOutPish2=268468231]="SignOutPish2",e[e.UserFrozenToLogin=805408766]="UserFrozenToLogin",e[e.UserFrozenToLogin2=805408767]="UserFrozenToLogin2"}(St||(St={}));var Et=St;var Tt,_t,kt={},At={};function Mt(){if(_t)return Tt;return _t=1,Tt=function(e,t){var r=new Array(arguments.length-1),n=0,o=2,s=!0;for(;o<arguments.length;)r[n++]=arguments[o++];return new Promise(function(o,i){r[n]=function(e){if(s)if(s=!1,e)i(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,i(e))}})},Tt}var Nt,Pt,Lt,Dt,jt,Ut,Bt,Ft={};function xt(){if(Bt)return Ut;return Bt=1,Ut=function(e){try{var t=void 0;t}catch(e){}return null}}var Gt,qt,Vt,Kt,Ht,zt,$t,Wt,Jt,Zt,Xt,Yt,Qt,er,tr={};function rr(){return zt||(zt=1,function(){var e=At;function t(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e}function r(e){function r(e,n){if(!(this instanceof r))return new r(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&t(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}e.asPromise=Mt(),e.base64=(Nt||(Nt=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,s=null,i=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:i[a++]=r[l>>2],o=(3&l)<<4,c=1;break;case 1:i[a++]=r[o|l>>4],o=(15&l)<<2,c=2;break;case 2:i[a++]=r[o|l>>6],i[a++]=r[63&l],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0)}return c&&(i[a++]=r[o],i[a++]=61,1===c&&(i[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};var s="invalid encoding";t.decode=function(e,t,r){for(var o,i=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=n[l]))throw Error(s);switch(a){case 0:o=l,a=1;break;case 1:t[r++]=o<<2|(48&l)>>4,o=l,a=2;break;case 2:t[r++]=(15&o)<<4|(60&l)>>2,o=l,a=3;break;case 3:t[r++]=(3&o)<<6|l,a=0}}if(1===a)throw Error(s);return r-i},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(Ft)),Ft),e.EventEmitter=function(){if(Lt)return Pt;function e(){this._listeners={}}return Lt=1,Pt=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},Pt}(),e.float=function(){if(jt)return Dt;function e(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function s(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function i(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:s,e.writeFloatBE=n?s:o,e.readFloatLE=n?i:a,e.readFloatBE=n?a:i}():function(){function s(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((o<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function i(e,t,r){var n=e(t,r),o=2*(n>>31)+1,s=n>>>23&255,i=8388607&n;return 255===s?i?NaN:o*(1/0):0===s?1401298464324817e-60*o*i:o*Math.pow(2,s-150)*(i+8388608)}e.writeFloatLE=s.bind(null,t),e.writeFloatBE=s.bind(null,r),e.readFloatLE=i.bind(null,n),e.readFloatBE=i.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function s(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function i(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:s,e.writeDoubleBE=n?s:o,e.readDoubleLE=n?i:a,e.readDoubleBE=n?a:i}():function(){function s(e,t,r,n,o,s){var i=n<0?1:0;if(i&&(n=-n),0===n)e(0,o,s+t),e(1/n>0?0:2147483648,o,s+r);else if(isNaN(n))e(0,o,s+t),e(2146959360,o,s+r);else if(n>17976931348623157e292)e(0,o,s+t),e((i<<31|2146435072)>>>0,o,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,s+t),e((i<<31|a/4294967296)>>>0,o,s+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,s+t),e((i<<31|c+1023<<20|1048576*a&1048575)>>>0,o,s+r)}}}function i(e,t,r,n,o){var s=e(n,o+t),i=e(n,o+r),a=2*(i>>31)+1,c=i>>>20&2047,l=4294967296*(1048575&i)+s;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=s.bind(null,t,0,4),e.writeDoubleBE=s.bind(null,r,4,0),e.readDoubleLE=i.bind(null,n,0,4),e.readDoubleBE=i.bind(null,o,4,0)}(),e}function t(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function r(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return jt=1,Dt=e(e)}(),e.inquire=xt(),e.utf8=(Gt||(Gt=1,function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,s=[],i=0;t<r;)(n=e[t++])<128?s[i++]=n:n>191&&n<224?s[i++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[i++]=55296+(n>>10),s[i++]=56320+(1023&n)):s[i++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))},t.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(n=65536+((1023&n)<<10)+(1023&o),++i,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}}(tr)),tr),e.pool=Vt?qt:(Vt=1,qt=function(e,t,r){var n=r||8192,o=n>>>1,s=null,i=n;return function(r){if(r<1||r>o)return e(r);i+r>n&&(s=e(n),i=0);var a=t.call(s,i,i+=r);return 7&i&&(i=1+(7|i)),a}}),e.LongBits=function(){if(Ht)return Kt;Ht=1,Kt=t;var e=rr();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var o=e>>>0,s=(e-o)/4294967296>>>0;return n&&(s=~s>>>0,o=~o>>>0,++o>4294967295&&(o=0,++s>4294967295&&(s=0))),new t(o,s)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var o=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},Kt}(),e.isNode=Boolean(void 0!==p&&p&&p.process&&p.process.versions&&p.process.versions.node),e.global=e.isNode&&p||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||At,e.emptyArray=Object.freeze?Object.freeze([]):[],e.emptyObject=Object.freeze?Object.freeze({}):{},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.isString=function(e){return"string"==typeof e||e instanceof String},e.isObject=function(e){return e&&"object"==typeof e},e.isset=e.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},e.Buffer=function(){try{var t=e.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}(),e._Buffer_from=null,e._Buffer_allocUnsafe=null,e.newBuffer=function(t){return"number"==typeof t?e.Buffer?e._Buffer_allocUnsafe(t):new e.Array(t):e.Buffer?e._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},e.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,e.Long=e.global.dcodeIO&&e.global.dcodeIO.Long||e.global.Long||e.inquire("long"),e.key2Re=/^true|false|0|1$/,e.key32Re=/^-?(?:0|[1-9][0-9]*)$/,e.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,e.longToHash=function(t){return t?e.LongBits.from(t).toHash():e.LongBits.zeroHash},e.longFromHash=function(t,r){var n=e.LongBits.fromHash(t);return e.Long?e.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},e.merge=t,e.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},e.newError=r,e.ProtocolError=r("ProtocolError"),e.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},e.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},e.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},e._configure=function(){var t=e.Buffer;t?(e._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,r){return new t(e,r)},e._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):e._Buffer_from=e._Buffer_allocUnsafe=null}}()),At}function nr(){if(Wt)return $t;Wt=1,$t=c;var e,t=rr(),r=t.LongBits,n=t.base64,o=t.utf8;function s(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function i(){}function a(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new s(i,0,0),this.tail=this.head,this.states=null}var l=function(){return t.Buffer?function(){return(c.create=function(){return new e})()}:function(){return new c}};function u(e,t,r){t[r]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function p(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.create=l(),c.alloc=function(e){return new t.Array(e)},t.Array!==Array&&(c.alloc=t.pool(c.alloc,t.Array.prototype.subarray)),c.prototype._push=function(e,t,r){return this.tail=this.tail.next=new s(e,t,r),this.len+=t,this},d.prototype=Object.create(s.prototype),d.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(p,10,r.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=r.from(e);return this._push(p,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=r.from(e).zzEncode();return this._push(p,t.length(),t)},c.prototype.bool=function(e){return this._push(u,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=r.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(t.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(t.float.writeDoubleLE,8,e)};var f=t.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};return c.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(u,1,0);if(t.isString(e)){var o=c.alloc(r=n.length(e));n.decode(e,o,0),e=o}return this.uint32(r)._push(f,r,e)},c.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(u,1,0)},c.prototype.fork=function(){return this.states=new a(this),this.head=this.tail=new s(i,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(i,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},c._configure=function(t){e=t,c.create=l(),e._configure()},$t}function or(){if(Yt)return Xt;Yt=1,Xt=s;var e,t=rr(),r=t.LongBits,n=t.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function s(e){this.buf=e,this.pos=0,this.len=e.length}var i,a="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new s(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new s(e);throw Error("illegal buffer")},c=function(){return t.Buffer?function(r){return(s.create=function(r){return t.Buffer.isBuffer(r)?new e(r):a(r)})(r)}:a};function l(){var e=new r(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function u(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw o(this,8);return new r(u(this.buf,this.pos+=4),u(this.buf,this.pos+=4))}return s.create=c(),s.prototype._slice=t.Array.prototype.subarray||t.Array.prototype.slice,s.prototype.uint32=(i=4294967295,function(){if(i=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return i;if(i=(i|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return i;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return i}),s.prototype.int32=function(){return 0|this.uint32()},s.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},s.prototype.bool=function(){return 0!==this.uint32()},s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return u(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|u(this.buf,this.pos+=4)},s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=t.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=t.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},s.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw o(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var s=t.Buffer;return s?s.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)},s.prototype.string=function(){var e=this.bytes();return n.read(e,0,e.length)},s.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},s.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},s._configure=function(r){e=r,s.create=c(),e._configure();var n=t.Long?"toLong":"toNumber";t.merge(s.prototype,{int64:function(){return l.call(this)[n](!1)},uint64:function(){return l.call(this)[n](!0)},sint64:function(){return l.call(this).zzDecode()[n](!1)},fixed64:function(){return d.call(this)[n](!0)},sfixed64:function(){return d.call(this)[n](!1)}})},Xt}var sr,ir,ar,cr,lr,ur,dr,pr,gr={};function fr(){return ar||(ar=1,gr.Service=function(){if(ir)return sr;ir=1,sr=t;var e=rr();function t(t,r,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(n)}return(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,n,o,s,i){if(!s)throw TypeError("request must be specified");var a=this;if(!i)return e.asPromise(t,a,r,n,o,s);if(a.rpcImpl)try{return a.rpcImpl(r,n[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,t){if(e)return a.emit("error",e,r),i(e);if(null!==t){if(!(t instanceof o))try{t=o[a.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return a.emit("error",e,r),i(e)}return a.emit("data",t,r),i(null,t)}a.end(!0)})}catch(e){return a.emit("error",e,r),void setTimeout(function(){i(e)},0)}else setTimeout(function(){i(Error("already ended"))},0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},sr}()),gr}function hr(){return lr?cr:(lr=1,cr={})}function yr(){return ur||(ur=1,function(){var e=kt;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=nr(),e.BufferWriter=function(){if(Zt)return Jt;Zt=1,Jt=r;var e=nr();(r.prototype=Object.create(e.prototype)).constructor=r;var t=rr();function r(){e.call(this)}function n(e,r,n){e.length<40?t.utf8.write(e,r,n):r.utf8Write?r.utf8Write(e,n):r.write(e,n)}return r._configure=function(){r.alloc=t._Buffer_allocUnsafe,r.writeBytesBuffer=t.Buffer&&t.Buffer.prototype instanceof Uint8Array&&"set"===t.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},r.prototype.bytes=function(e){t.isString(e)&&(e=t._Buffer_from(e,"base64"));var n=e.length>>>0;return this.uint32(n),n&&this._push(r.writeBytesBuffer,n,e),this},r.prototype.string=function(e){var r=t.Buffer.byteLength(e);return this.uint32(r),r&&this._push(n,r,e),this},r._configure(),Jt}(),e.Reader=or(),e.BufferReader=function(){if(er)return Qt;er=1,Qt=r;var e=or();(r.prototype=Object.create(e.prototype)).constructor=r;var t=rr();function r(t){e.call(this,t)}return r._configure=function(){t.Buffer&&(r.prototype._slice=t.Buffer.prototype.slice)},r.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},r._configure(),Qt}(),e.util=rr(),e.rpc=fr(),e.roots=hr(),e.configure=t,t()}()),kt}var mr=pr?dr:(pr=1,dr=yr());const vr=mr.Reader,br=mr.Writer,Or=mr.util,Ir=mr.roots.default||(mr.roots.default={}),Cr=Ir.NetworkRequest=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.sessionId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.uid=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.destId="",e.prototype.body=Or.newBuffer([]),e.prototype.deviceCode="",e.prototype.deviceType=0,e.encode=function(e,t){return t||(t=br.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(58).string(e.destId),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.deviceCode&&Object.hasOwnProperty.call(e,"deviceCode")&&t.uint32(74).string(e.deviceCode),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(96).int32(e.deviceType),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.NetworkRequest;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 7:n.destId=e.string();break;case 8:n.body=e.bytes();break;case 9:n.deviceCode=e.string();break;case 12:n.deviceType=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkRequest"},e})(),wr=Ir.NetworkResponse=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.uid=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.body=Or.newBuffer([]),e.prototype.code=0,e.encode=function(e,t){return t||(t=br.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(72).int32(e.code),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.NetworkResponse;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 8:n.body=e.bytes();break;case 9:n.code=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkResponse"},e})(),Sr=Ir.HeartbeatReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.pingId=Or.Long?Or.Long.fromBits(0,0,!1):0,e.prototype.disconnectDelay=Or.Long?Or.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=br.create()),null!=e.pingId&&Object.hasOwnProperty.call(e,"pingId")&&t.uint32(8).int64(e.pingId),null!=e.disconnectDelay&&Object.hasOwnProperty.call(e,"disconnectDelay")&&t.uint32(16).int64(e.disconnectDelay),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.HeartbeatReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.pingId=e.int64();break;case 2:n.disconnectDelay=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/HeartbeatReq"},e})();Ir.SystemCurrentTimeMillisReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.encode=function(e,t){return t||(t=br.create()),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.SystemCurrentTimeMillisReq;for(;e.pos<r;){let t=e.uint32();e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisReq"},e})();const Rr=Ir.SystemCurrentTimeMillisResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.currentTimeMillis=Or.Long?Or.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=br.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.currentTimeMillis&&Object.hasOwnProperty.call(e,"currentTimeMillis")&&t.uint32(24).int64(e.currentTimeMillis),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.SystemCurrentTimeMillisResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.currentTimeMillis=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisResp"},e})(),Er=Ir.BaseResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.encode=function(e,t){return t||(t=br.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.BaseResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BaseResp"},e})(),Tr=Ir.LogReportReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.data="",e.encode=function(e,t){return t||(t=br.create()),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(10).string(e.data),t},e.decode=function(e,t){e instanceof vr||(e=vr.create(e));let r=void 0===t?e.len:e.pos+t,n=new Ir.LogReportReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.data=e.string();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/LogReportReq"},e})();class _r{pool=[];writeIn8(e){this.pool.push(e)}writeInt16(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255)}writeInt32(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255),this.pool.push(e>>>16&255),this.pool.push(e>>>24&255)}writeArr(e){return this.pool.push(...e),e}getBytesArray(){return this.pool}}class kr{pool;position=0;constructor(e){this.pool=e}check(){return this.position>=this.pool.length}readInt8(){const e=this.pool[this.position];return this.position+=1,e<<24>>24}readInt32(){const e=this.pool[this.position+0],t=this.pool[this.position+1],r=this.pool[this.position+2],n=this.pool[this.position+3];return this.position+=4,e|t<<8|r<<16|n<<24}readArr(e){const t=this.pool.subarray(this.position,this.position+e);return this.position+=e,t}}const Ar=e=>{let r;switch(e){case 0:r=t.SUCCESS;break;case 1610743809:r=t.NOT_IN_GROUP;break;case 1610678275:r=t.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=t.REJECTED_BY_BLACKLIST;break;case 3:r=t.PARAMETER_ERROR;break;case 22408:r=t.FORBIDDEN_IN_GROUP;break;default:r=t.UNKNOWN}return r};
19
19
  /**
20
20
  * @license
21
21
  * Copyright 2009 The Closure Library Authors
@@ -34,4 +34,4 @@ return function(){var t=e,r=t.lib,n=r.WordArray,o=r.Hasher,s=t.algo,i=n.create([
34
34
  * limitations under the License.
35
35
  *
36
36
  * SPDX-License-Identifier: Apache-2.0
37
- */var Mr=null;try{Mr=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Nr(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function Pr(e){return!0===(e&&e.__isLong__)}function Lr(e){var t=Math.clz32(e&-e);return e?31-t:t}Nr.prototype.__isLong__,Object.defineProperty(Nr.prototype,"__isLong__",{value:!0}),Nr.isLong=Pr;var Dr={},jr={};function Ur(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=jr[e])?n:(r=Fr(e,0,!0),o&&(jr[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=Dr[e])?n:(r=Fr(e,e<0?-1:0,!1),o&&(Dr[e]=r),r)}function Br(e,t){if(isNaN(e))return t?Wr:$r;if(t){if(e<0)return Wr;if(e>=Kr)return Qr}else{if(e<=-Hr)return en;if(e+1>=Hr)return Yr}return e<0?Br(-e,t).neg():Fr(e%Vr|0,e/Vr|0,t)}function Fr(e,t,r){return new Nr(e,t,r)}Nr.fromInt=Ur,Nr.fromNumber=Br,Nr.fromBits=Fr;var xr=Math.pow;function Gr(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?Wr:$r;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return Gr(e.substring(1),t,r).neg();for(var o=Br(xr(r,8)),s=$r,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+a),r);if(a<8){var l=Br(xr(r,a));s=s.mul(l).add(Br(c))}else s=(s=s.mul(o)).add(Br(c))}return s.unsigned=t,s}function qr(e,t){return"number"==typeof e?Br(e,t):"string"==typeof e?Gr(e,t):Fr(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}Nr.fromString=Gr,Nr.fromValue=qr;var Vr=4294967296,Kr=Vr*Vr,Hr=Kr/2,zr=Ur(1<<24),$r=Ur(0);Nr.ZERO=$r;var Wr=Ur(0,!0);Nr.UZERO=Wr;var Jr=Ur(1);Nr.ONE=Jr;var Zr=Ur(1,!0);Nr.UONE=Zr;var Xr=Ur(-1);Nr.NEG_ONE=Xr;var Yr=Fr(-1,2147483647,!1);Nr.MAX_VALUE=Yr;var Qr=Fr(-1,-1,!0);Nr.MAX_UNSIGNED_VALUE=Qr;var en=Fr(0,-2147483648,!1);Nr.MIN_VALUE=en;var tn=Nr.prototype;tn.toInt=function(){return this.unsigned?this.low>>>0:this.low},tn.toNumber=function(){return this.unsigned?(this.high>>>0)*Vr+(this.low>>>0):this.high*Vr+(this.low>>>0)},tn.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(en)){var t=Br(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=Br(xr(e,6),this.unsigned),s=this,i="";;){var a=s.div(o),c=(s.sub(a.mul(o)).toInt()>>>0).toString(e);if((s=a).isZero())return c+i;for(;c.length<6;)c="0"+c;i=""+c+i}},tn.getHighBits=function(){return this.high},tn.getHighBitsUnsigned=function(){return this.high>>>0},tn.getLowBits=function(){return this.low},tn.getLowBitsUnsigned=function(){return this.low>>>0},tn.getNumBitsAbs=function(){if(this.isNegative())return this.eq(en)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},tn.isZero=function(){return 0===this.high&&0===this.low},tn.eqz=tn.isZero,tn.isNegative=function(){return!this.unsigned&&this.high<0},tn.isPositive=function(){return this.unsigned||this.high>=0},tn.isOdd=function(){return!(1&~this.low)},tn.isEven=function(){return!(1&this.low)},tn.equals=function(e){return Pr(e)||(e=qr(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},tn.eq=tn.equals,tn.notEquals=function(e){return!this.eq(e)},tn.neq=tn.notEquals,tn.ne=tn.notEquals,tn.lessThan=function(e){return this.comp(e)<0},tn.lt=tn.lessThan,tn.lessThanOrEqual=function(e){return this.comp(e)<=0},tn.lte=tn.lessThanOrEqual,tn.le=tn.lessThanOrEqual,tn.greaterThan=function(e){return this.comp(e)>0},tn.gt=tn.greaterThan,tn.greaterThanOrEqual=function(e){return this.comp(e)>=0},tn.gte=tn.greaterThanOrEqual,tn.ge=tn.greaterThanOrEqual,tn.compare=function(e){if(Pr(e)||(e=qr(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&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},tn.comp=tn.compare,tn.negate=function(){return!this.unsigned&&this.eq(en)?en:this.not().add(Jr)},tn.neg=tn.negate,tn.add=function(e){Pr(e)||(e=qr(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,c=0,l=0,u=0,d=0;return u+=(d+=o+(65535&e.low))>>>16,l+=(u+=n+a)>>>16,c+=(l+=r+i)>>>16,c+=t+s,Fr((u&=65535)<<16|(d&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},tn.subtract=function(e){return Pr(e)||(e=qr(e)),this.add(e.neg())},tn.sub=tn.subtract,tn.multiply=function(e){if(this.isZero())return this;if(Pr(e)||(e=qr(e)),Mr)return Fr(Mr.mul(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned);if(e.isZero())return this.unsigned?Wr:$r;if(this.eq(en))return e.isOdd()?en:$r;if(e.eq(en))return this.isOdd()?en:$r;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(zr)&&e.lt(zr))return Br(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,c=65535&e.low,l=0,u=0,d=0,p=0;return d+=(p+=o*c)>>>16,u+=(d+=n*c)>>>16,d&=65535,u+=(d+=o*a)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=n*a)>>>16,u&=65535,l+=(u+=o*i)>>>16,l+=t*c+r*a+n*i+o*s,Fr((d&=65535)<<16|(p&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},tn.mul=tn.multiply,tn.divide=function(e){if(Pr(e)||(e=qr(e)),e.isZero())throw Error("division by zero");var t,r,n;if(Mr)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?Fr((this.unsigned?Mr.div_u:Mr.div_s)(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Wr:$r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Wr;if(e.gt(this.shru(1)))return Zr;n=Wr}else{if(this.eq(en))return e.eq(Jr)||e.eq(Xr)?en:e.eq(en)?Jr:(t=this.shr(1).div(e).shl(1)).eq($r)?e.isNegative()?Jr:Xr:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(en))return this.unsigned?Wr:$r;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();n=$r}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),s=o<=48?1:xr(2,o-48),i=Br(t),a=i.mul(e);a.isNegative()||a.gt(r);)a=(i=Br(t-=s,this.unsigned)).mul(e);i.isZero()&&(i=Jr),n=n.add(i),r=r.sub(a)}return n},tn.div=tn.divide,tn.modulo=function(e){return Pr(e)||(e=qr(e)),Mr?Fr((this.unsigned?Mr.rem_u:Mr.rem_s)(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},tn.mod=tn.modulo,tn.rem=tn.modulo,tn.not=function(){return Fr(~this.low,~this.high,this.unsigned)},tn.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},tn.clz=tn.countLeadingZeros,tn.countTrailingZeros=function(){return this.low?Lr(this.low):Lr(this.high)+32},tn.ctz=tn.countTrailingZeros,tn.and=function(e){return Pr(e)||(e=qr(e)),Fr(this.low&e.low,this.high&e.high,this.unsigned)},tn.or=function(e){return Pr(e)||(e=qr(e)),Fr(this.low|e.low,this.high|e.high,this.unsigned)},tn.xor=function(e){return Pr(e)||(e=qr(e)),Fr(this.low^e.low,this.high^e.high,this.unsigned)},tn.shiftLeft=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Fr(0,this.low<<e-32,this.unsigned)},tn.shl=tn.shiftLeft,tn.shiftRight=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Fr(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},tn.shr=tn.shiftRight,tn.shiftRightUnsigned=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):Fr(32===e?this.high:this.high>>>e-32,0,this.unsigned)},tn.shru=tn.shiftRightUnsigned,tn.shr_u=tn.shiftRightUnsigned,tn.rotateLeft=function(e){var t;return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?Fr(this.high,this.low,this.unsigned):e<32?(t=32-e,Fr(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),Fr(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},tn.rotl=tn.rotateLeft,tn.rotateRight=function(e){var t;return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?Fr(this.high,this.low,this.unsigned):e<32?(t=32-e,Fr(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),Fr(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},tn.rotr=tn.rotateRight,tn.toSigned=function(){return this.unsigned?Fr(this.low,this.high,!1):this},tn.toUnsigned=function(){return this.unsigned?this:Fr(this.low,this.high,!0)},tn.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},tn.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},tn.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Nr.fromBytes=function(e,t,r){return r?Nr.fromBytesLE(e,t):Nr.fromBytesBE(e,t)},Nr.fromBytesLE=function(e,t){return new Nr(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Nr.fromBytesBE=function(e,t){return new Nr(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var rn=new class{_user;constructor(){this._user=this.createDefaultUser()}get uid(){return this.user.uid}get isActive(){return this.user.active}get user(){return this._user}setLogged(e){this._user={active:!0,uid:Nr.isLong(e.uid)?e.uid.toString():e.uid,deviceId:Nr.isLong(e.deviceId)?e.deviceId.toString():e.deviceId,sessionId:Nr.isLong(e.sessionId)?e.sessionId.toString():e.sessionId}}logOut(){this._user=this.createDefaultUser()}createDefaultUser(){return{active:!1,uid:"0",deviceId:"0",sessionId:"0",token:""}}};const nn={webSocketTimeout:5e3,signalTimeout:3e4,pingInterval:15e3,pingTimeout:5e3,pingFailedTimes:2,reconnectIntervalMin:250,reconnectIntervalMax:64e3,reconnectRaisingBase:2};const on=t=>e[t],sn=e=>{const t=new _r;return t.writeIn8(67),t.writeIn8(255),t.writeInt32(e.length+7),t.writeArr(Array.from(e)),t.writeIn8(0),new Int8Array(t.getBytesArray()).buffer},an=e=>{const t=new kr(new Uint8Array(e));t.readInt8(),t.readInt8();const r=t.readInt32(),n=t.readArr(r-7);if(t.readInt8(),e.byteLength!==r)throw new Error("packet resolve failed");return n};var cn=new class{url="";watcher;options;socket;status=e.DISCONNECTED;autoReconnect=!1;isConnected=!1;responseCallbacks=new Map;failedCount=0;reconnectTimer;connectResolve;pendingMessages=[];constructor(e){this.options=Object.assign(nn,e)}setServerInfo(e){this.url=e}setCallback(e){this.watcher=e}async connect(){return this.autoReconnect=!0,new Promise(r=>{this.connectResolve=r,this.open().then(n=>{r(n),n===t.SUCCESS?(this.isConnected=!0,this.onConnect()):this.onDisconnect(n===t.TIMEOUT?e.NETWORK_UNAVAILABLE:e.WEBSOCKET_UNAVAILABLE)})})}async request(e,r,n,o=this.options.signalTimeout){const{code:s,data:i}=await this.sendRawData(e,tt(r)&&tt(n.encoder)?n.encoder.encode(r).finish():new Uint8Array,o);if(0!==s)return{code:s,msg:"time out",data:null};if(!tt(i)||!tt(n.decoder))return{code:t.SUCCESS,msg:""};const a=n.decoder?.decode(i);return a.errorCode?{code:a.errorCode,msg:a.errorMessage,data:null}:{data:a,code:t.SUCCESS,msg:""}}async send(e,r,n,o=this.options.signalTimeout){const s=await this.request(e,r,n,o);return s.code!==t.SUCCESS?{code:Ar(s.code),msg:s.msg,data:null}:{data:s.data,code:t.SUCCESS,msg:s.msg}}async sendRawData(e,r,n=this.options.signalTimeout){if(!this.socket)return{code:t.RC_NET_CHANNEL_INVALID};const o=this.generateMessageSeq();this.isConnected?this.doSendRawData(e,r,o):this.pendingMessages.push({cmdId:e,body:r,messageSeq:o});const s=await new Promise(e=>{this.responseCallbacks.set(o,e),setTimeout(()=>{this.responseCallbacks.get(o)&&this.responseCallbacks.delete(o),e(null)},n)});return s?{code:0,data:s}:(ks.warn(`send timeout -> cmd: 0x${e.toString(16)}, messageSeq: ${o}, timeout: ${n}`),{code:t.TIMEOUT})}doSendRawData(e,t,r){const n={cmdId:e,messageSeq:Nr.fromNumber(r),deviceId:Nr.fromString(rn.user.deviceId),sessionId:Nr.fromString(rn.user.sessionId),uid:Nr.fromString(rn.user.uid),protocolVersion:0,destId:"",body:t,deviceCode:Rt.getDeviceCode()??"",deviceType:Rt.getDeviceType()};e!==Et.Heartbean&&ks.info(`websocket send -> cmd: 0x${e.toString(16)}, messageSeq: ${r}`),this.socket?.send(sn(Ir.encode(n).finish()))}close(){this.autoReconnect=!1,this.doClose(),this.setStatus(e.DISCONNECTED),this.connectResolve?.(t.RC_SOCKET_DISCONNECTED)}async open(){const r=this.url;ks.info(`connect start -> ${r}`),this.setStatus(e.CONNECTING);const n=function(e,t){const r=new WebSocket(e,t);return r.binaryType="arraybuffer",{onClose(e){r.onclose=t=>{const{code:r,reason:n}=t;e?.(r,n)}},onError(e){r.onerror=t=>{e(t)}},onMessage(e){r.onmessage=t=>{e(t.data)}},onOpen(e){r.onopen=e},send(e){r.send(e)},close(e,t){r.close(e,t)}}}(this.url);this.socket=n;return await new Promise(o=>{n.onMessage(e=>{"ArrayBuffer"===et(e)?this.onReceiveMessage(e):ks.error("Socket received invalid data:",e)}),n.onClose((r,n)=>{ks.warn("websocket closed -> code:",r,"reason:",n),this.onDisconnect(e.CONNECTION_CLOSED),o(t.RC_SOCKET_DISCONNECTED)}),n.onError(r=>{ks.warn("websocket error -> ",r),this.onDisconnect(e.WEBSOCKET_ERROR),o(t.RC_SOCKET_NOT_CREATED)}),n.onOpen(()=>{ks.info("websocket open -> ",r),o(t.SUCCESS)}),setTimeout(()=>{o(t.TIMEOUT)},this.options.webSocketTimeout)})}async checkAlive(){if(!this.socket||!this.isConnected)return;ks.debug("send ping ->");const r={pingId:Nr.ZERO,disconnectDelay:Nr.ZERO},{code:n}=await this.send(Et.Heartbean,r,{encoder:Sr},this.options.pingTimeout);n===t.SUCCESS?(ks.debug("recv pong <-"),this.failedCount=0,setTimeout(()=>this.checkAlive(),this.options.pingInterval)):(this.failedCount+=1,ks.warn(`ping failed count: ${this.failedCount}, code: ${n}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,ks.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=an(t);r=wr.decode(e)}catch(t){return ks.error("unpack payload error -> ",t),void this.onDisconnect(e.DISCONNECT_BY_SERVER)}if(r.code)return ks.error("on received message error -> ",r.code),void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===Et.SessionKilledPush)return void this.onDisconnect(e.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===Et.SignOutPish||r.cmdId===Et.SignOutPish2)return ks.warn("on received signoutpush -> ",r.cmdId),void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===Et.UserFrozenToLogin||r.cmdId===Et.UserFrozenToLogin2)return void this.onDisconnect(e.BLOCKED);const n=Nr.isLong(r.messageSeq)?r.messageSeq.toNumber():0,o=n>0?this.responseCallbacks.get(n):null;tt(o)?(r.cmdId!==Et.HeartbeanResp&&ks.info(`websocket recv ack -> messageSeq: ${n}`),o(r.body),this.responseCallbacks.delete(n)):(ks.info(`websocket recv -> cmd: 0x${r.cmdId.toString(16)}`),this.watcher?.message(r.cmdId,r.body))}async try2Reconnect(){this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},5e3)}async onConnect(){for(this.setStatus(e.CONNECTED),this.checkAlive(),tt(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);this.pendingMessages.length>0;){let{cmdId:e,body:t,messageSeq:r}=this.pendingMessages.shift();this.doSendRawData(e,t,r),await new Promise(e=>setTimeout(e,200))}}onDisconnect(e){tt(this.socket)&&(this.doClose(),this.isConnectionAvailable()&&(this.setStatus(e),this.autoReconnect&&this.isConnectionAvailable()&&this.try2Reconnect()))}doClose(){if(tt(this.socket)){this.pendingMessages.length=0;const e=this.socket;this.socket=null,e.onClose(null),e.close()}tt(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.isConnected=!1;for(const e of this.responseCallbacks.values())e(null);this.responseCallbacks.clear()}isConnectionAvailable(){return this.status!==e.DISCONNECTED&&this.status!==e.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.BLOCKED&&this.status!==e.DISCONNECT_BY_SERVER}setStatus(e){ks.info(`socketServer is changing status from ${on(this.status)} to ${on(e)}`),this.status=e,this.watcher?.status(e)}idCount=0;generateMessageSeq(){return++this.idCount}};const ln=mr.Reader,un=mr.Writer,dn=mr.util,pn=mr.roots.default||(mr.roots.default={}),gn=pn.SendPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageReq"},e})(),fn=pn.SendPrivateChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageResp"},e})(),hn=pn.DeletePrivateChatDialogReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeletePrivateChatDialogReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.destId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatDialogReq"},e})(),yn=pn.GetNewMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=un.create()),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(16).int32(e.rows),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetNewMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.offset=e.int64();break;case 2:n.rows=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageReq"},e})(),mn=pn.GetNewMessageResp=(()=>{function e(e){if(this.msg={},this.reference={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msg=dn.emptyObject,e.prototype.reference=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(24).int64(e.offset),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(32).int64(e.seqno),null!=e.msg&&Object.hasOwnProperty.call(e,"msg"))for(let r=Object.keys(e.msg),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.DialogMessageList.encode(e.msg[r[n]],t.uint32(18).fork()).ldelim().ldelim();if(null!=e.reference&&Object.hasOwnProperty.call(e,"reference"))for(let r=Object.keys(e.reference),n=0;n<r.length;++n)t.uint32(50).fork().uint32(10).string(r[n]),pn.ReferenceDialogMessage.encode(e.reference[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetNewMessageResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.offset=e.int64();break;case 4:s.seqno=e.int64();break;case 5:{s.msg===dn.emptyObject&&(s.msg={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.DialogMessageList.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.msg[r]=n;break}case 6:{s.reference===dn.emptyObject&&(s.reference={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.ReferenceDialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.reference[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageResp"},e})();pn.DialogMessageList=(()=>{function e(e){if(this.dialogMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.dialogMessage&&e.dialogMessage.length)for(let r=0;r<e.dialogMessage.length;++r)pn.DialogMessage.encode(e.dialogMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DialogMessageList;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.dialogMessage&&n.dialogMessage.length||(n.dialogMessage=[]),n.dialogMessage.push(pn.DialogMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessageList"},e})(),pn.DialogMessage=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgStatus=0,e.prototype.srcId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.isOut=!1,e.prototype.senderCategory=0,e.prototype.msgCategory=0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.burnAfterReadingFlag=!1,e.prototype.atFlag=!1,e.prototype.replyFlag=!1,e.prototype.referenceFlag=!1,e.prototype.msgIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.uploadFlag=!1,e.prototype.burnAfterReadingTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.sharingGroupFlag=!1,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.replyMarkup="",e.prototype.extra="",e.prototype.msgArrival=!1,e.prototype.msgRead=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(8).int64(e.msgId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgStatus&&Object.hasOwnProperty.call(e,"msgStatus")&&t.uint32(24).int32(e.msgStatus),null!=e.srcId&&Object.hasOwnProperty.call(e,"srcId")&&t.uint32(32).int64(e.srcId),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(40).int64(e.destId),null!=e.isOut&&Object.hasOwnProperty.call(e,"isOut")&&t.uint32(48).bool(e.isOut),null!=e.senderCategory&&Object.hasOwnProperty.call(e,"senderCategory")&&t.uint32(56).int32(e.senderCategory),null!=e.msgCategory&&Object.hasOwnProperty.call(e,"msgCategory")&&t.uint32(64).int32(e.msgCategory),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(74).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(82).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(88).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(96).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(106).string(e.mediaAttribute),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(112).int64(e.msgSendTime),null!=e.burnAfterReadingFlag&&Object.hasOwnProperty.call(e,"burnAfterReadingFlag")&&t.uint32(120).bool(e.burnAfterReadingFlag),null!=e.atFlag&&Object.hasOwnProperty.call(e,"atFlag")&&t.uint32(128).bool(e.atFlag),null!=e.replyFlag&&Object.hasOwnProperty.call(e,"replyFlag")&&t.uint32(136).bool(e.replyFlag),null!=e.referenceFlag&&Object.hasOwnProperty.call(e,"referenceFlag")&&t.uint32(144).bool(e.referenceFlag),null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(152).int64(e.msgIdReferenced),null!=e.uploadFlag&&Object.hasOwnProperty.call(e,"uploadFlag")&&t.uint32(160).bool(e.uploadFlag),null!=e.burnAfterReadingTime&&Object.hasOwnProperty.call(e,"burnAfterReadingTime")&&t.uint32(168).int64(e.burnAfterReadingTime),null!=e.sharingGroupFlag&&Object.hasOwnProperty.call(e,"sharingGroupFlag")&&t.uint32(176).bool(e.sharingGroupFlag),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(184).int64(e.seqno),null!=e.replyMarkup&&Object.hasOwnProperty.call(e,"replyMarkup")&&t.uint32(194).string(e.replyMarkup),null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(202).string(e.extra),null!=e.msgArrival&&Object.hasOwnProperty.call(e,"msgArrival")&&t.uint32(208).bool(e.msgArrival),null!=e.msgRead&&Object.hasOwnProperty.call(e,"msgRead")&&t.uint32(216).bool(e.msgRead),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DialogMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.msgId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgStatus=e.int32();break;case 4:n.srcId=e.int64();break;case 5:n.destId=e.int64();break;case 6:n.isOut=e.bool();break;case 7:n.senderCategory=e.int32();break;case 8:n.msgCategory=e.int32();break;case 9:n.msgPreContent=e.string();break;case 10:n.msgPostContent=e.string();break;case 11:n.mediaFlag=e.bool();break;case 12:n.mediaConstructor=e.int32();break;case 13:n.mediaAttribute=e.string();break;case 14:n.msgSendTime=e.int64();break;case 15:n.burnAfterReadingFlag=e.bool();break;case 16:n.atFlag=e.bool();break;case 17:n.replyFlag=e.bool();break;case 18:n.referenceFlag=e.bool();break;case 19:n.msgIdReferenced=e.int64();break;case 20:n.uploadFlag=e.bool();break;case 21:n.burnAfterReadingTime=e.int64();break;case 22:n.sharingGroupFlag=e.bool();break;case 23:n.seqno=e.int64();break;case 24:n.replyMarkup=e.string();break;case 25:n.extra=e.string();break;case 26:n.msgArrival=e.bool();break;case 27:n.msgRead=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessage"},e})(),pn.ReferenceDialogMessage=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.srcId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.srcName="",e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.destName="",e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(8).int64(e.msgId),null!=e.srcId&&Object.hasOwnProperty.call(e,"srcId")&&t.uint32(16).int64(e.srcId),null!=e.srcName&&Object.hasOwnProperty.call(e,"srcName")&&t.uint32(26).string(e.srcName),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(32).int64(e.destId),null!=e.destName&&Object.hasOwnProperty.call(e,"destName")&&t.uint32(42).string(e.destName),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(50).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(58).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(64).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(72).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(82).string(e.mediaAttribute),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(88).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReferenceDialogMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.msgId=e.int64();break;case 2:n.srcId=e.int64();break;case 3:n.srcName=e.string();break;case 4:n.destId=e.int64();break;case 5:n.destName=e.string();break;case 6:n.msgPreContent=e.string();break;case 7:n.msgPostContent=e.string();break;case 8:n.mediaFlag=e.bool();break;case 9:n.mediaConstructor=e.int32();break;case 10:n.mediaAttribute=e.string();break;case 11:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReferenceDialogMessage"},e})();const vn=pn.UpdatePrivateChatDialogStickyConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.UpdatePrivateChatDialogStickyConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.stickyFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogStickyConfigReq"},e})(),bn=pn.UpdatePrivateChatDialogMuteConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.UpdatePrivateChatDialogMuteConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.muteFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogMuteConfigReq"},e})(),On=pn.DeleteChatMessageReq=(()=>{function e(e){if(this.msgIdList=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(let r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeleteChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;case 3:if(n.msgIdList&&n.msgIdList.length||(n.msgIdList=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgIdList.push(e.int64())}else n.msgIdList.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteChatMessageReq"},e})();pn.DeletePrivateChatHistoryReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeletePrivateChatHistoryReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatHistoryReq"},e})();const Cn=pn.CleanHistoryMessageReq=(()=>{function e(e){if(this.msgIdList=[],this.destIdList=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=dn.emptyArray,e.prototype.destIdList=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(let r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}if(null!=e.destIdList&&e.destIdList.length)for(let r=0;r<e.destIdList.length;++r)t.uint32(34).string(e.destIdList[r]);return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.CleanHistoryMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.string();break;case 2:n.msgId=e.int64();break;case 3:if(n.msgIdList&&n.msgIdList.length||(n.msgIdList=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgIdList.push(e.int64())}else n.msgIdList.push(e.int64());break;case 4:n.destIdList&&n.destIdList.length||(n.destIdList=[]),n.destIdList.push(e.string());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/CleanHistoryMessageReq"},e})(),In=pn.GetBriefDialogListReq=(()=>{function e(e){if(this.destId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&e.destId.length){t.uint32(10).fork();for(let r=0;r<e.destId.length;++r)t.int64(e.destId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetBriefDialogListReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.destId&&n.destId.length||(n.destId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.destId.push(e.int64())}else n.destId.push(e.int64());else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListReq"},e})(),wn=pn.GetBriefDialogListResp=(()=>{function e(e){if(this.notExistDestId=[],this.briefDialog={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.notExistDestId=dn.emptyArray,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.briefDialog=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.notExistDestId&&e.notExistDestId.length){t.uint32(26).fork();for(let r=0;r<e.notExistDestId.length;++r)t.int64(e.notExistDestId[r]);t.ldelim()}if(null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(32).int64(e.seqno),null!=e.briefDialog&&Object.hasOwnProperty.call(e,"briefDialog"))for(let r=Object.keys(e.briefDialog),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.BriefDialog.encode(e.briefDialog[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetBriefDialogListResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:if(s.notExistDestId&&s.notExistDestId.length||(s.notExistDestId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)s.notExistDestId.push(e.int64())}else s.notExistDestId.push(e.int64());break;case 4:s.seqno=e.int64();break;case 5:{s.briefDialog===dn.emptyObject&&(s.briefDialog={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.briefDialog[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListResp"},e})();pn.BriefDialog=(()=>{function e(e){if(this.groupMemberSmallAvatarUrl=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.dialogTitle="",e.prototype.smallAvatarUrl="",e.prototype.backgroundImage="",e.prototype.stickyFlag=!1,e.prototype.muteFlag=!1,e.prototype.blockFlag=!1,e.prototype.burnAfterReadingFlag=!1,e.prototype.takeScreenshotFlag=!1,e.prototype.groupFlag=!1,e.prototype.totalMemberNumber=0,e.prototype.groupMemberSmallAvatarUrl=dn.emptyArray,e.prototype.burnAfterReadingTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.dialogMenuContent="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.dialogTitle&&Object.hasOwnProperty.call(e,"dialogTitle")&&t.uint32(18).string(e.dialogTitle),null!=e.smallAvatarUrl&&Object.hasOwnProperty.call(e,"smallAvatarUrl")&&t.uint32(26).string(e.smallAvatarUrl),null!=e.backgroundImage&&Object.hasOwnProperty.call(e,"backgroundImage")&&t.uint32(34).string(e.backgroundImage),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(40).bool(e.stickyFlag),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(48).bool(e.muteFlag),null!=e.blockFlag&&Object.hasOwnProperty.call(e,"blockFlag")&&t.uint32(56).bool(e.blockFlag),null!=e.burnAfterReadingFlag&&Object.hasOwnProperty.call(e,"burnAfterReadingFlag")&&t.uint32(64).bool(e.burnAfterReadingFlag),null!=e.takeScreenshotFlag&&Object.hasOwnProperty.call(e,"takeScreenshotFlag")&&t.uint32(72).bool(e.takeScreenshotFlag),null!=e.groupFlag&&Object.hasOwnProperty.call(e,"groupFlag")&&t.uint32(80).bool(e.groupFlag),null!=e.totalMemberNumber&&Object.hasOwnProperty.call(e,"totalMemberNumber")&&t.uint32(88).int32(e.totalMemberNumber),null!=e.groupMemberSmallAvatarUrl&&e.groupMemberSmallAvatarUrl.length)for(let r=0;r<e.groupMemberSmallAvatarUrl.length;++r)t.uint32(98).string(e.groupMemberSmallAvatarUrl[r]);return null!=e.burnAfterReadingTime&&Object.hasOwnProperty.call(e,"burnAfterReadingTime")&&t.uint32(104).int64(e.burnAfterReadingTime),null!=e.dialogMenuContent&&Object.hasOwnProperty.call(e,"dialogMenuContent")&&t.uint32(114).string(e.dialogMenuContent),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.BriefDialog;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.dialogTitle=e.string();break;case 3:n.smallAvatarUrl=e.string();break;case 4:n.backgroundImage=e.string();break;case 5:n.stickyFlag=e.bool();break;case 6:n.muteFlag=e.bool();break;case 7:n.blockFlag=e.bool();break;case 8:n.burnAfterReadingFlag=e.bool();break;case 9:n.takeScreenshotFlag=e.bool();break;case 10:n.groupFlag=e.bool();break;case 11:n.totalMemberNumber=e.int32();break;case 12:n.groupMemberSmallAvatarUrl&&n.groupMemberSmallAvatarUrl.length||(n.groupMemberSmallAvatarUrl=[]),n.groupMemberSmallAvatarUrl.push(e.string());break;case 13:n.burnAfterReadingTime=e.int64();break;case 14:n.dialogMenuContent=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BriefDialog"},e})();const Sn=pn.GetDialogKeyReq=(()=>{function e(e){if(this.destId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&e.destId.length){t.uint32(10).fork();for(let r=0;r<e.destId.length;++r)t.int64(e.destId[r]);t.ldelim()}return null!=e.clientSign&&Object.hasOwnProperty.call(e,"clientSign")&&t.uint32(18).string(e.clientSign),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetDialogKeyReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:if(n.destId&&n.destId.length||(n.destId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.destId.push(e.int64())}else n.destId.push(e.int64());break;case 2:n.clientSign=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyReq"},e})(),Rn=pn.GetDialogKeyResp=(()=>{function e(e){if(this.retryUid=[],this.entry={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.dialogKeyVersion=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.retryUid=dn.emptyArray,e.prototype.entry=dn.emptyObject,e.prototype.serverSign="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.dialogKeyVersion&&Object.hasOwnProperty.call(e,"dialogKeyVersion")&&t.uint32(24).int64(e.dialogKeyVersion),null!=e.retryUid&&e.retryUid.length){t.uint32(34).fork();for(let r=0;r<e.retryUid.length;++r)t.int64(e.retryUid[r]);t.ldelim()}if(null!=e.entry&&Object.hasOwnProperty.call(e,"entry"))for(let r=Object.keys(e.entry),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.AesKeyAndIV.encode(e.entry[r[n]],t.uint32(18).fork()).ldelim().ldelim();return null!=e.serverSign&&Object.hasOwnProperty.call(e,"serverSign")&&t.uint32(50).string(e.serverSign),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetDialogKeyResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.dialogKeyVersion=e.int64();break;case 4:if(s.retryUid&&s.retryUid.length||(s.retryUid=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)s.retryUid.push(e.int64())}else s.retryUid.push(e.int64());break;case 5:{s.entry===dn.emptyObject&&(s.entry={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.AesKeyAndIV.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.entry[r]=n;break}case 6:s.serverSign=e.string();break;default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyResp"},e})();pn.AesKeyAndIV=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.encode=function(e,t){return t||(t=un.create()),null!=e.aesKey&&Object.hasOwnProperty.call(e,"aesKey")&&t.uint32(10).string(e.aesKey),null!=e.aesIV&&Object.hasOwnProperty.call(e,"aesIV")&&t.uint32(18).string(e.aesIV),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.AesKeyAndIV;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AesKeyAndIV"},e})();const En=pn.RecallPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.RecallPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallPrivateChatMessageReq"},e})(),Tn=pn.GetHistoryMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogKeys="",e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.dialogKeys&&Object.hasOwnProperty.call(e,"dialogKeys")&&t.uint32(10).string(e.dialogKeys),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.oldOffset&&Object.hasOwnProperty.call(e,"oldOffset")&&t.uint32(24).int64(e.oldOffset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(32).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(40).bool(e.newToOld),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetHistoryMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.dialogKeys=e.string();break;case 2:n.offset=e.int64();break;case 3:n.oldOffset=e.int64();break;case 4:n.rows=e.int32();break;case 5:n.newToOld=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageReq"},e})(),_n=pn.GetHistoryMessageResp=(()=>{function e(e){if(this.reference={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.msg=null,e.prototype.isEnd=!1,e.prototype.reference=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.msg&&Object.hasOwnProperty.call(e,"msg")&&pn.DialogMessageList.encode(e.msg,t.uint32(26).fork()).ldelim(),null!=e.isEnd&&Object.hasOwnProperty.call(e,"isEnd")&&t.uint32(32).bool(e.isEnd),null!=e.reference&&Object.hasOwnProperty.call(e,"reference"))for(let r=Object.keys(e.reference),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.ReferenceDialogMessage.encode(e.reference[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetHistoryMessageResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.msg=pn.DialogMessageList.decode(e,e.uint32());break;case 4:s.isEnd=e.bool();break;case 5:{s.reference===dn.emptyObject&&(s.reference={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.ReferenceDialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.reference[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageResp"},e})(),kn=pn.GetWebDialogListReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type=0,e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(24).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(32).bool(e.newToOld),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetWebDialogListReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.type=e.int32();break;case 2:n.offset=e.int64();break;case 3:n.rows=e.int32();break;case 4:n.newToOld=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListReq"},e})(),An=pn.GetWebDialogListResp=(()=>{function e(e){if(this.fullDialog=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.fullDialog=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.fullDialog&&e.fullDialog.length)for(let r=0;r<e.fullDialog.length;++r)pn.WebFullDialog.encode(e.fullDialog[r],t.uint32(26).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetWebDialogListResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.fullDialog&&n.fullDialog.length||(n.fullDialog=[]),n.fullDialog.push(pn.WebFullDialog.decode(e,e.uint32()));break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListResp"},e})();pn.WebFullDialog=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialog=null,e.prototype.msg=null,e.encode=function(e,t){return t||(t=un.create()),null!=e.dialog&&Object.hasOwnProperty.call(e,"dialog")&&pn.BriefDialog.encode(e.dialog,t.uint32(10).fork()).ldelim(),null!=e.msg&&Object.hasOwnProperty.call(e,"msg")&&pn.DialogMessage.encode(e.msg,t.uint32(18).fork()).ldelim(),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.WebFullDialog;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.dialog=pn.BriefDialog.decode(e,e.uint32());break;case 2:n.msg=pn.DialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebFullDialog"},e})();const Mn=pn.GetNewSettingDialogListReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.time=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.time&&Object.hasOwnProperty.call(e,"time")&&t.uint32(8).int64(e.time),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetNewSettingDialogListReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.time=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListReq"},e})(),Nn=pn.GetNewSettingDialogListResp=(()=>{function e(e){if(this.briefDialog={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.briefDialog=dn.emptyObject,e.prototype.setTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.briefDialog&&Object.hasOwnProperty.call(e,"briefDialog"))for(let r=Object.keys(e.briefDialog),n=0;n<r.length;++n)t.uint32(26).fork().uint32(10).string(r[n]),pn.BriefDialog.encode(e.briefDialog[r[n]],t.uint32(18).fork()).ldelim().ldelim();return null!=e.setTime&&Object.hasOwnProperty.call(e,"setTime")&&t.uint32(32).int64(e.setTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetNewSettingDialogListResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:{s.briefDialog===dn.emptyObject&&(s.briefDialog={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.briefDialog[r]=n;break}case 4:s.setTime=e.int64();break;default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListResp"},e})(),Pn=pn.NewMessageNotificationResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(24).int64(e.seqno),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.NewMessageNotificationResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NewMessageNotificationResp"},e})();pn.ChatMessage=(()=>{function e(e){if(this.msgId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&e.msgId.length){t.uint32(18).fork();for(let r=0;r<e.msgId.length;++r)t.int64(e.msgId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ChatMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:if(n.msgId&&n.msgId.length||(n.msgId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgId.push(e.int64())}else n.msgId.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ChatMessage"},e})();const Ln=pn.SendPrivateChatArrivalAckReq=(()=>{function e(e){if(this.chatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.chatMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.chatMessage&&e.chatMessage.length)for(let r=0;r<e.chatMessage.length;++r)pn.ChatMessage.encode(e.chatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatArrivalAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.chatMessage&&n.chatMessage.length||(n.chatMessage=[]),n.chatMessage.push(pn.ChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatArrivalAckReq"},e})(),Dn=pn.SendPrivateChatReadAckReq=(()=>{function e(e){if(this.chatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.chatMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.chatMessage&&e.chatMessage.length)for(let r=0;r<e.chatMessage.length;++r)pn.ChatMessage.encode(e.chatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatReadAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.chatMessage&&n.chatMessage.length||(n.chatMessage=[]),n.chatMessage.push(pn.ChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatReadAckReq"},e})(),jn=pn.ReplyPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSrcIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgDestIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContentReferenced="",e.prototype.msgPostContentReferenced="",e.prototype.mediaFlagReferenced=!1,e.prototype.mediaConstructorReferenced=0,e.prototype.mediaAttributeReferenced="",e.prototype.msgSendTimeReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(64).int64(e.msgIdReferenced),null!=e.msgSrcIdReferenced&&Object.hasOwnProperty.call(e,"msgSrcIdReferenced")&&t.uint32(72).int64(e.msgSrcIdReferenced),null!=e.msgDestIdReferenced&&Object.hasOwnProperty.call(e,"msgDestIdReferenced")&&t.uint32(80).int64(e.msgDestIdReferenced),null!=e.msgPreContentReferenced&&Object.hasOwnProperty.call(e,"msgPreContentReferenced")&&t.uint32(90).string(e.msgPreContentReferenced),null!=e.msgPostContentReferenced&&Object.hasOwnProperty.call(e,"msgPostContentReferenced")&&t.uint32(98).string(e.msgPostContentReferenced),null!=e.mediaFlagReferenced&&Object.hasOwnProperty.call(e,"mediaFlagReferenced")&&t.uint32(104).bool(e.mediaFlagReferenced),null!=e.mediaConstructorReferenced&&Object.hasOwnProperty.call(e,"mediaConstructorReferenced")&&t.uint32(112).int32(e.mediaConstructorReferenced),null!=e.mediaAttributeReferenced&&Object.hasOwnProperty.call(e,"mediaAttributeReferenced")&&t.uint32(122).string(e.mediaAttributeReferenced),null!=e.msgSendTimeReferenced&&Object.hasOwnProperty.call(e,"msgSendTimeReferenced")&&t.uint32(128).int64(e.msgSendTimeReferenced),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReplyPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:n.msgIdReferenced=e.int64();break;case 9:n.msgSrcIdReferenced=e.int64();break;case 10:n.msgDestIdReferenced=e.int64();break;case 11:n.msgPreContentReferenced=e.string();break;case 12:n.msgPostContentReferenced=e.string();break;case 13:n.mediaFlagReferenced=e.bool();break;case 14:n.mediaConstructorReferenced=e.int32();break;case 15:n.mediaAttributeReferenced=e.string();break;case 16:n.msgSendTimeReferenced=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyPrivateChatMessageReq"},e})(),Un=pn.ReplyPrivateChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReplyPrivateChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyPrivateChatMessageResp"},e})(),Bn=mr.Reader,Fn=mr.Writer,xn=mr.util,Gn=mr.roots.default||(mr.roots.default={}),qn=Gn.SendGroupChatMessageReq=(()=>{function e(e){if(this.at=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(let r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:if(n.at&&n.at.length||(n.at=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.at.push(e.int64())}else n.at.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageReq"},e})(),Vn=Gn.SendGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.seqno=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(48).int64(e.seqno),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageResp"},e})();Gn.DeleteGroupChatHistoryReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.DeleteGroupChatHistoryReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatHistoryReq"},e})();const Kn=Gn.UpdateGroupChatDialogStickyConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.UpdateGroupChatDialogStickyConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.stickyFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogStickyConfigReq"},e})(),Hn=Gn.UpdateGroupChatDialogMuteConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.UpdateGroupChatDialogMuteConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.muteFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogMuteConfigReq"},e})(),zn=Gn.RecallGroupChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.RecallGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallGroupChatMessageReq"},e})();Gn.DeleteGroupChatDialogReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.DeleteGroupChatDialogReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatDialogReq"},e})(),Gn.GroupChatMessage=(()=>{function e(e){if(this.msgId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.userId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.userId&&Object.hasOwnProperty.call(e,"userId")&&t.uint32(16).int64(e.userId),null!=e.msgId&&e.msgId.length){t.uint32(26).fork();for(let r=0;r<e.msgId.length;++r)t.int64(e.msgId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.GroupChatMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.userId=e.int64();break;case 3:if(n.msgId&&n.msgId.length||(n.msgId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgId.push(e.int64())}else n.msgId.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GroupChatMessage"},e})();const $n=Gn.SendGroupChatArrivalAckReq=(()=>{function e(e){if(this.groupChatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupChatMessage=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupChatMessage&&e.groupChatMessage.length)for(let r=0;r<e.groupChatMessage.length;++r)Gn.GroupChatMessage.encode(e.groupChatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatArrivalAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupChatMessage&&n.groupChatMessage.length||(n.groupChatMessage=[]),n.groupChatMessage.push(Gn.GroupChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatArrivalAckReq"},e})(),Wn=Gn.SendGroupChatReadAckReq=(()=>{function e(e){if(this.groupChatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupChatMessage=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupChatMessage&&e.groupChatMessage.length)for(let r=0;r<e.groupChatMessage.length;++r)Gn.GroupChatMessage.encode(e.groupChatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatReadAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupChatMessage&&n.groupChatMessage.length||(n.groupChatMessage=[]),n.groupChatMessage.push(Gn.GroupChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatReadAckReq"},e})(),Jn=Gn.ReplyGroupChatMessageReq=(()=>{function e(e){if(this.at=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=xn.emptyArray,e.prototype.msgIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSrcIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgDestIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContentReferenced="",e.prototype.msgPostContentReferenced="",e.prototype.mediaFlagReferenced=!1,e.prototype.mediaConstructorReferenced=0,e.prototype.mediaAttributeReferenced="",e.prototype.msgSendTimeReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(let r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(72).int64(e.msgIdReferenced),null!=e.msgSrcIdReferenced&&Object.hasOwnProperty.call(e,"msgSrcIdReferenced")&&t.uint32(80).int64(e.msgSrcIdReferenced),null!=e.msgDestIdReferenced&&Object.hasOwnProperty.call(e,"msgDestIdReferenced")&&t.uint32(88).int64(e.msgDestIdReferenced),null!=e.msgPreContentReferenced&&Object.hasOwnProperty.call(e,"msgPreContentReferenced")&&t.uint32(98).string(e.msgPreContentReferenced),null!=e.msgPostContentReferenced&&Object.hasOwnProperty.call(e,"msgPostContentReferenced")&&t.uint32(106).string(e.msgPostContentReferenced),null!=e.mediaFlagReferenced&&Object.hasOwnProperty.call(e,"mediaFlagReferenced")&&t.uint32(112).bool(e.mediaFlagReferenced),null!=e.mediaConstructorReferenced&&Object.hasOwnProperty.call(e,"mediaConstructorReferenced")&&t.uint32(120).int32(e.mediaConstructorReferenced),null!=e.mediaAttributeReferenced&&Object.hasOwnProperty.call(e,"mediaAttributeReferenced")&&t.uint32(130).string(e.mediaAttributeReferenced),null!=e.msgSendTimeReferenced&&Object.hasOwnProperty.call(e,"msgSendTimeReferenced")&&t.uint32(136).int64(e.msgSendTimeReferenced),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.ReplyGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:if(n.at&&n.at.length||(n.at=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.at.push(e.int64())}else n.at.push(e.int64());break;case 9:n.msgIdReferenced=e.int64();break;case 10:n.msgSrcIdReferenced=e.int64();break;case 11:n.msgDestIdReferenced=e.int64();break;case 12:n.msgPreContentReferenced=e.string();break;case 13:n.msgPostContentReferenced=e.string();break;case 14:n.mediaFlagReferenced=e.bool();break;case 15:n.mediaConstructorReferenced=e.int32();break;case 16:n.mediaAttributeReferenced=e.string();break;case 17:n.msgSendTimeReferenced=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyGroupChatMessageReq"},e})(),Zn=Gn.ReplyGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.ReplyGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyGroupChatMessageResp"},e})();function Xn(e){return(ct(e)?Nr.fromString(e):e).greaterThan(Nr.fromNumber(9e10))?n.GROUP:n.PRIVATE}const Yn=e=>e.targetId,Qn=e=>({conversationType:Xn(e),targetId:Nr.isLong(e)?e.toString():e});let eo=0;const to=async()=>{const e=(new Date).getTime(),{code:r,data:n}=await cn.send(Et.GetServerTime,null,{decoder:Rr});if(r===t.SUCCESS){const{currentTimeMillis:t}=n;eo=t.toNumber()-e}},ro=()=>(new Date).getTime()+eo,no=new Set;var oo={addMessage(e){no.add(e)},remove(e){no.delete(e)},has:e=>no.has(e),reset(){no.clear()}};const so=new Set;var io={addMessage(e){so.add(e)},remove(e){so.delete(e)},has:e=>so.has(e),reset(){so.clear()}};const ao=new Map;function co(e,t){ao.set(e,t)}function lo(e,t){const r=ao.get(e);if(!r)return console.warn(`No message constructor found for type: ${e}`),null;try{return new r(t)}catch(t){return console.error(`Failed to decode message type ${e}:`,t),null}}var uo=new class{aesKeyRecord=new Map;async getDialogAesKey(e){return lt(e)?this.aesKeyRecord.has(e)?this.aesKeyRecord.get(e):new Promise(t=>{this.getDialogAesKeyListFromRemote([e]).then(r=>{t(r.get(e))}),setTimeout(()=>{t(null)},8e3)}):null}getDialogAesKeyList(e){return new Promise(t=>{const r=new Map;this.getDialogAesKeyListInBatches(e,(n,o)=>{if(o.size)for(const[e,t]of o)r.set(e,t);(r.size===e.length||n)&&t(r)})})}getDialogAesKeyListInBatches(e,t){const r=new Map,n=[];e.forEach(e=>{if(!lt(e))return;const t=this.getDialogAesKeyFromLocal(e);t?r.set(e,t):n.push(e)}),t(!1,r),n.length&&this.getDialogAesKeyListFromRemote(n).then(e=>{t(!0,e)})}reset(){this.aesKeyRecord.clear()}async getDialogAesKeyListFromRemote(e){if(!e.length)return new Map;try{const{code:n,data:o}=await(r=e.map(e=>Nr.fromString(e)),cn.send(Et.GetDialogKey,{destId:r,clientSign:""},{encoder:Sn,decoder:Rn}));if(n===t.SUCCESS){const e=new Map;for(const t in o.entry){const r=o.entry[t];if(r.aesKey?.length&&r.aesIV?.length){const n={key:r.aesKey,iv:r.aesIV};e.set(t,n),this.aesKeyRecord.set(t,n)}}return e}}catch(e){ks.error("getDialogAesKeyListFromRemote error",e)}var r;return new Map}getDialogAesKeyFromLocal(e){return lt(e)?this.aesKeyRecord.get(e):null}};const po="time",go=(e,t)=>[e,t,po].join("_");class fo{appkey;userId;inBoxOffset=Nr.ZERO;constructor(e,t){this.appkey=e,this.userId=t}setInboxOffset(e){if(this.inBoxOffset>e)return;this.inBoxOffset=e;const t=go(this.appkey,this.userId);bt.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=go(this.appkey,this.userId);this.inBoxOffset=Nr.fromString(bt.get(e)??"0")}return this.inBoxOffset}}const ho=(e,t)=>{if(!lt(e))return"";const r=Qe.AES.encrypt(e,Qe.enc.Utf8.parse(t.key),{iv:tt(t.iv)?Qe.enc.Utf8.parse(t.iv):void 0});return Array.from(mo(r.ciphertext.words)).map(e=>e.toString(16).padStart(2,"0")).join("")},yo=(e,t)=>{const r=new Uint8Array(e.match(/.{1,2}/g)?.map(e=>parseInt(e,16))||[]),n=window.btoa(String.fromCharCode(...r));return Qe.AES.decrypt(n,Qe.enc.Utf8.parse(t.key),{iv:tt(t.iv)?Qe.enc.Utf8.parse(t.iv):void 0}).toString(Qe.enc.Utf8)},mo=e=>{const t=[];let r,n,o;for(n=0;n<e.length;++n)for(r=e[n],o=3;o>=0;--o)t.push(r>>8*o&255);return new Uint8Array(t)},vo={TEXT:0,IMAGE:805310464,GIF:805310475,FILE:805310490,AUDIO:805310481,VIDEO:805310470,RECALL:1610678301,LOCATION:805310469,CHAT_RECORD:805310489,CONTACT:268439554,GROUP_INVITATION:805310467,REDPACKET:268439616,TRANSFER:268439600,LINK:268439556},bo={GROUP_ARRIVAL_RECEIPT:1610743844,GROUP_READ_RECEIPT:1610743845,PRIVATE_ARRIVAL_RECEIPT:1610678284,PRIVATE_READ_RECEIPT:1610678285,PRIVATE_OPEN_BURNAFTERREADING:1610678274,PRIVATE_CLOSE_BURNAFTERREADING:1610678275,GROUP_OPEN_BURNAFTERREADING:1610743816,GROUP_CLOSE_BURNAFTERREADING:1610743817};function Oo(e){if(!tt(e))return e;if(Array.isArray(e))return e.map(e=>Oo(e));if(it(e)){const t={};return Object.keys(e).forEach(r=>{t[r]=Oo(e[r])}),t}return e}const Co={unreadMessageCount:{keyName:"c",defaultVal:0},lastUnreadTime:{keyName:"lt",defaultVal:0},notificationStatus:{keyName:"nc",defaultVal:2},notificationLevel:{keyName:"nl",defaultVal:0},isTop:{keyName:"it",defaultVal:!1},mentionedUIds:{keyName:"mu",defaultVal:null},dialogTitle:{keyName:"dt",defaultVal:null},smallAvatarUrl:{keyName:"sa",defaultVal:null},burnAfterReadingFlag:{keyName:"brf",defaultVal:!1},burnAfterReadingTime:{keyName:"brt",defaultVal:0},updateTime:{keyName:"ut",defaultVal:0}};class Io{localStore;constructor(e,t){const r=`con-${e}-${t}`;this.localStore=new Ct(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}\n }`}getConOptionByKey(e){const t=(e=e||"").split("_");if(t.length>=2){const e=t.shift(),r=t.shift();return{conversationType:Number(e),targetId:r}}return{conversationType:n.PRIVATE,targetId:"0"}}updateUnreadCount(e){const{conversationType:t,targetId:r,content:n,messageType:o,sentTime:s,isCounted:a,messageDirection:c}=e,l=c===i.SEND,u=o===vo.RECALL,d=it(n),p={conversationType:t,targetId:r},g=this.get(p)||{},f=g.lastUnreadTime||Nr.ZERO,h=g.unreadMessageCount||0;if(!(s<=f)&&!l){if(a&&(g.unreadMessageCount=h+1,f||(g.lastUnreadTime=s)),u&&d){n.sentTime>=f&&h&&(g.unreadMessageCount=h-1)}this.set(p,g)}}updateMentionedData(e){const{conversationType:t,targetId:r,messageUId:o,messageType:s,isMentioned:a,messageDirection:c,content:l}=e;if(!o||c===i.SEND||!a&&s!==vo.RECALL)return;const u=this.getStoreKey({conversationType:t,targetId:r}),d=this.localStore.get(u)||{},p=Co.mentionedUIds.keyName,g=d[p]||[];if(a&&t===n.GROUP&&(g.includes(o.toString())||g.push(o.toString())),s===vo.RECALL&&t===n.GROUP){const e=l,t=g.indexOf(e.messageUId?.toString()??"");t>=0&&g.splice(t,1)}g.length?d[p]=g:delete d[p],ut(d)?this.localStore.set(u,d):this.localStore.remove(u)}updateUpdateTime(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};n[Co.updateTime.keyName]=t,this.localStore.set(r,n)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of pt(t)){const r=Co[e],o=t[e];if(ot(r?.keyName)||ot(o))continue;o===r.defaultVal?delete n[r.keyName]:n[r.keyName]=o,n[Co.unreadMessageCount.keyName]||(delete n[Co.lastUnreadTime.keyName],delete n[Co.mentionedUIds.keyName])}ut(n)?this.localStore.set(r,n):this.localStore.remove(r)}remove(e){const t=this.getStoreKey(e);this.localStore.remove(t)}get(e){const t=this.getStoreKey(e),r=this.localStore.get(t)||{},n={};for(const e of pt(Co)){const{keyName:t,defaultVal:o}=Co[e];"mentionedUIds"===e?(n.unreadMentionedCount=r[t]?.length??0,n.hasMentioned=!!n.unreadMentionedCount):n[e]=r[t]||Oo(o)}return n}getAll(){const e=this.localStore.getCache()||{},t=[];for(const r in e){const n=this.getConOptionByKey(r),o=e[r];for(const e of pt(Co)){const{keyName:t,defaultVal:r}=Co[e];"mentionedUIds"!==e&&(n[e]=o[t]||Oo(r))}t.push(n)}return t}}const wo=e=>{const t=e.destId??"",r=Qn(t);if(!r)return;e.dialogTitle,e.smallAvatarUrl;return{...r,unreadMessageCount:0,notificationStatus:e.muteFlag?s.OPEN:s.CLOSE,notificationLevel:e.muteFlag?l.NOT_MESSAGE_NOTIFICATION:l.ALL_MESSAGE,isTop:!!e.stickyFlag,dialogTitle:e.dialogTitle,smallAvatarUrl:e.smallAvatarUrl,lastUnreadTime:"0",burnAfterReadingFlag:!!e.burnAfterReadingFlag,burnAfterReadingTime:e.burnAfterReadingTime&&e.burnAfterReadingTime.toNumber()}};class So{events={};on(e,t,r){const n=this.events[e]||(this.events[e]=[]);n.some(e=>e.listener===t&&e.target===r)||n.push({listener:t,target:r})}emit(e,...t){const r=this.events[e];r?.length&&r.map(e=>{const{target:r,listener:n}=e;try{n.call(r,...t)}catch(e){}})}off(e,t,r){let n=this.events[e];n?.length&&(n=n.filter(e=>e.listener!==t||e.target!==r),n.length?this.events[e]=n:delete this.events[e])}once(e,t,r){const n=(...o)=>{t.call(r,...o),this.off(e,n,r)};return this.on(e,n,r),this}}const Ro="STATUS_CHANGED";class Eo{storageKey;eventEmitter;isPulling=!1;constructor(e,t){this.storageKey=`con-s-${e}-${t}`,this.eventEmitter=new So}async pull(){if(this.isPulling)return;let e;this.isPulling=!0;const r=bt.get(this.storageKey);e=rt(r)&&r>0?r:ro()-1e4;let{code:n,data:o}=await(e=>cn.send(Et.GetDialogChangedStatus,{time:Nr.fromNumber(e)},{encoder:Mn,decoder:Nn}))(e);n===t.SUCCESS&&(Nr.isLong(o.setTime)&&o.setTime.toNumber()>0&&bt.set(this.storageKey,o.setTime.toNumber()),o.briefDialog&&pt(o.briefDialog).forEach(e=>{const t=o.briefDialog[e],r=wo(t);r&&this.eventEmitter.emit(Ro,r)})),this.isPulling=!1}watch(e){this.eventEmitter.on(Ro,t=>{e(t)})}}class To{updatedConversationFunc;store;draftMap=new Map;localConversationSet=new Set;updatedConversations=[];notify;statusManager;constructor(e,t,r){this.updatedConversationFunc=r,this.store=new Io(e,t),this.notify=ft(this.notifyConversationChanged.bind(this),0),this.statusManager=new Eo(e,t),this.statusManager.watch(e=>{this.addStatus(e,!0)})}getConversationKey(e){return`${e.conversationType}_${e.targetId}\n }`}setUpdatedConversation(e){const t=this.updatedConversations.findIndex(t=>this.getConversationKey(e.conversation)===this.getConversationKey(t.conversation));t>=0?(e={conversation:Object.assign(this.updatedConversations[t].conversation,e.conversation),updatedItems:Object.assign(this.updatedConversations[t].updatedItems,e.updatedItems)},this.updatedConversations[t]=e):this.updatedConversations.push(e),this.notify()}notifyConversationChanged(){const e=this.updatedConversations.map(e=>({conversation:{...e.conversation,...this.store.get(e.conversation)},updatedItems:e.updatedItems}));this.updatedConversations=[],this.updatedConversationFunc?.(e)}syncConversationStatus(){this.statusManager.pull()}async loadConvsationsIfNotExist(e){if(!e?.length)return;const r=e.filter(e=>!this.localConversationSet.has(this.getConversationKey(e)));if(!r.length)return;const n=r.map(Yn);if(!n.length)return;const{code:o,data:s}=await(e=>cn.send(Et.GetBriefDialogList,{destId:e.map(e=>Nr.fromString(e))},{encoder:In,decoder:wn}))(n);o===t.SUCCESS&&pt(s.briefDialog).forEach(e=>{const t=s.briefDialog[e],r=wo(t);r&&(this.localConversationSet.add(this.getConversationKey(r)),this.addStatus(r,!0))})}addLocalConversation(e){const{conversationType:t,targetId:r,isTop:n,notificationStatus:o,notificationLevel:s,dialogTitle:i,smallAvatarUrl:a,burnAfterReadingFlag:c,burnAfterReadingTime:l,updateTime:u}=e;this.localConversationSet.add(this.getConversationKey(e)),this.addStatus({conversationType:t,targetId:r,isTop:n,notificationStatus:o,notificationLevel:s,dialogTitle:i,smallAvatarUrl:a,burnAfterReadingFlag:c,burnAfterReadingTime:l,updateTime:u},!1)}addStatus(e,t=!1){const{conversationType:r,targetId:n,notificationStatus:o,notificationLevel:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,burnAfterReadingFlag:l,burnAfterReadingTime:u,updateTime:d}=e,p={conversationType:r,targetId:n},g=ro(),f=this.store.get(p),h={};tt(s)&&f.notificationLevel!==s&&(h.notificationLevel={time:g,val:s}),tt(o)&&f.notificationStatus!==o&&(h.notificationStatus={time:g,val:o}),tt(i)&&f.isTop!==i&&(h.isTop={time:g,val:i}),tt(a)&&f.dialogTitle!==a&&(h.dialogTitle={time:g,val:a}),tt(c)&&f.smallAvatarUrl!==c&&(h.smallAvatarUrl={time:g,val:c}),tt(l)&&f.burnAfterReadingFlag!==l&&(h.burnAfterReadingFlag={time:g,val:l}),tt(u)&&f.burnAfterReadingTime!==u&&(h.burnAfterReadingTime={time:g,val:u}),this.store.set(p,{notificationStatus:o,isTop:i,notificationLevel:s,dialogTitle:a,smallAvatarUrl:c,burnAfterReadingFlag:l,burnAfterReadingTime:u,updateTime:d}),Object.keys(h).length&&t&&this.setUpdatedConversation({conversation:p,updatedItems:h})}setConversationCacheByMessage(e){const{conversationType:t,isPersited:r,targetId:n}=e;if(!r)return;const o={conversationType:t,targetId:n},s={conversation:o,updatedItems:{}},i=Oo(this.get(o));this.store.updateUnreadCount(e),this.store.updateMentionedData(e),this.store.updateUpdateTime(o,parseInt(e.sentTime));const a=this.get(o);i.unreadMessageCount!==a.unreadMessageCount&&(s.updatedItems.unreadMessageCount={time:parseInt(e.sentTime),val:a.unreadMessageCount}),i.hasMentioned!==a.hasMentioned&&(s.updatedItems.hasMentioned={time:parseInt(e.sentTime),val:a.hasMentioned}),i.unreadMentionedCount!==a.unreadMentionedCount&&(s.updatedItems.unreadMentionedCount={time:parseInt(e.sentTime),val:a.unreadMentionedCount}),Object.keys(s.updatedItems).length&&this.setUpdatedConversation(s)}get(e){return this.store.get(e)}getAllUnreadCount(e,t){const r=this.store.getAll();let n=0;return r.forEach(({unreadMessageCount:r,notificationStatus:o,notificationLevel:i,conversationType:a})=>{r=r||0;const c=o===s.OPEN||i>0;!t&&c||(e.length>0?e.includes(+a)&&(n+=+r):n+=+r)}),n}getUnreadCount(e){return this.store.get(e).unreadMessageCount||0}clearUnreadCount(e){const t=this.store.get(e),{unreadMessageCount:r,unreadMentionedCount:n}=t;(r||n)&&(t.unreadMessageCount=0,t.hasMentioned=!1,t.unreadMentionedCount=0),this.store.set(e,t);const o={};r&&(o.unreadMessageCount={val:0,time:ro()}),n&&(o.hasMentioned={val:!1,time:ro()},o.unreadMentionedCount={val:0,time:ro()}),Object.keys(o).length&&this.setUpdatedConversation({conversation:e,updatedItems:o})}clearAllUnreadCount(){this.store.getAll().forEach(e=>this.clearUnreadCount(e))}getNotificationLevel(e){return this.store.get(e).notificationLevel}getNotificationStatus(e){return this.store.get(e).notificationStatus||2}setDraft(e,t){this.draftMap.set(this.getConversationKey(e),t)}getDraft(e){return this.draftMap.get(this.getConversationKey(e))??""}clearDraft(e){this.draftMap.delete(this.getConversationKey(e))}getBlockConversationList(){return this.store.getAll().filter(e=>e.notificationStatus===s.OPEN||e.notificationLevel>0).map(e=>({conversationType:e.conversationType,targetId:e.targetId}))}getTopConversationList(){return(this.store.getAll()||{}).filter(e=>e.isTop).map(e=>({conversationType:e.conversationType,targetId:e.targetId}))}getUnreadMentionedCount(e){return this.get(e).unreadMentionedCount||0}getAllUnreadMentionedCount(){const e=this.store.getAll();let t=0;return e.forEach(({unreadMentionedCount:e})=>{e=e||0,t+=Number(e)}),t}getConversationState(e){let t=this.get(e);if(t){let{unreadMessageCount:r,unreadMentionedCount:n,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}=t;return{...e,unreadCount:r,unreadMentionedCount:n??0,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}}return null}getAllConversationState(){return this.store.getAll().map(({conversationType:e,targetId:t,unreadMessageCount:r,unreadMentionedCount:n,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l})=>({conversationType:e,targetId:t,unreadCount:r,unreadMentionedCount:n??0,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}))}remove(e){this.store.remove(e),this.localConversationSet.delete(this.getConversationKey(e))}clearHistoryMessages(e){this.clearUnreadCount(e);const t={conversation:e,updatedItems:{}};t.conversation.latestMessage=void 0,t.updatedItems.latestMessage={val:null,time:ro()},this.setUpdatedConversation(t)}updateLatestMessage(e,t){tt(t)&&this.store.set(e,{updateTime:parseInt(t.sentTime)});const r={conversation:e,updatedItems:{}};tt(t)&&(r.conversation.updateTime=parseInt(t.sentTime)),r.conversation.latestMessage=t,r.updatedItems.latestMessage={val:t,time:ro()},this.setUpdatedConversation(r)}destroyed(){this.updatedConversationFunc=void 0}}const _o={addStatus:function(e,t){},setConversationCacheByMessage:function(e){},updateLatestMessage:function(e,t){},get:function(e){return null},getAllUnreadCount:function(e,t){return 0},getUnreadCount:function(e){return 0},clearUnreadCount:function(e){},clearAllUnreadCount(){},getNotificationLevel:function(e){return l.NOT_SET},getNotificationStatus:function(e){return s.CLOSE},setDraft:function(e,t){},getDraft:function(e){return""},clearDraft:function(e){},getBlockConversationList:function(){return[]},getTopConversationList:function(){return[]},getUnreadMentionedCount:function(e){return 0},getAllUnreadMentionedCount:function(){return 0},getConversationState:e=>null,getAllConversationState:function(){return[]},addLocalConversation:function(e){},loadConvsationsIfNotExist:function(e){return Promise.resolve()},destroyed(){},syncConversationStatus:function(){},remove:function(e){},clearHistoryMessages:function(e){}};let ko;var Ao={create(e,t,r){ko=new To(e,t,r)},get:()=>ko??_o};const Mo=(e,t,r=a.SENDING)=>{const n=Ao.get().get(t.conversation);return{conversationType:t.conversation.conversationType,targetId:t.conversation.targetId,senderUserId:t.senderUserId,messageDirection:i.SEND,isCounted:e.isCounted,isMentioned:!1,content:Oo(e.content),messageType:e.messageType,isOffLineMessage:!1,isPersited:e.isPersited,messageId:t.messageId,messageUId:"local"+t.sentTime,sentTime:t.sentTime,sentStatus:r,receivedTime:t.sentTime,isStatusMessage:e.isStatusMessage,receivedStatus:c.IDLE,disableNotification:!0,burnAfterReadingFlag:n?.burnAfterReadingFlag??!1,burnAfterReadingTime:n?.burnAfterReadingTime??0}};function No(e){const t={...e};return"content"in t&&delete t.content,"quotedReply"in t&&delete t.quotedReply,"msgPreContent"in t&&delete t.msgPreContent,"msgPostContent"in t&&delete t.msgPostContent,t}const Po=(e,t,r,n)=>{const o=new Map;return e.forEach(e=>{const s=Lo(e,t.get(e),r.get(e),n);s.length&&o.set(e,s)}),o},Lo=(e,t,r,n)=>{const o=Qn(e);if(!o)return[];const l=Ao.get().get(o);let u=[];return t.forEach(e=>{const t=e;let d=t.mediaConstructor,p=Do(t,r);if(!p)return;if(1610678290===d||1610743841===d){const{msgId:e}=p;d=vo.RECALL,p={messageUId:e}}const g=lo(d,p);if(tt(g)){const d={...o,senderUserId:t.srcId.toString(),messageDirection:t.isOut?i.SEND:i.RECEIVE,isCounted:g.isCounted,isMentioned:t.atFlag,content:g.content,messageType:g.messageType,isOffLineMessage:!1,isPersited:g.isPersited,messageId:Nr.isLong(t.localId)?t.localId.toNumber():0,messageUId:t.msgId.toString(),sentTime:t.seqno.toString(),sentStatus:a.SENT,receivedTime:ro().toString(),isStatusMessage:g.isStatusMessage,receivedStatus:t.msgRead?c.READ:t.msgArrival?c.RECEIVED:c.IDLE,disableNotification:l?.notificationStatus===s.OPEN||t.srcId.toString()==rn.uid,burnAfterReadingFlag:t.burnAfterReadingFlag,burnAfterReadingTime:t.burnAfterReadingTime&&t.burnAfterReadingTime.toNumber()};if(d.isStatusMessage&&Nr.fromNumber(ro()).subtract(d.sentTime).greaterThan(6e3))return;if(t.msgIdReferenced&&Nr.isLong(t.msgIdReferenced)){const e=n[t.msgIdReferenced.toString()];if(e){let t=Do({mediaAttribute:e.mediaAttribute,msgPreContent:e.msgPreContent,msgPostContent:e.msgPostContent,mediaConstructor:e.mediaConstructor??0,msgId:e.msgId??Nr.fromNumber(0)},r);if(t){const r=lo(e.mediaConstructor??0,t);tt(r)&&(d.quotedReply=((e,t,r)=>({conversationType:r.conversationType,targetId:e.destId.toString(),senderUserId:e.srcId.toString(),messageDirection:e.srcId.toString()===rn.uid?i.SEND:i.RECEIVE,isCounted:t.isCounted,isMentioned:!1,content:Oo(t.content),messageType:t.messageType,isOffLineMessage:!1,isPersited:t.isPersited,messageId:1,messageUId:e.msgId.toString(),sentTime:e.msgSendTime.toString(),sentStatus:a.SENT,receivedTime:e.msgSendTime.toString(),isStatusMessage:t.isStatusMessage,receivedStatus:c.RECEIVED,disableNotification:!0,burnAfterReadingFlag:!1,burnAfterReadingTime:0,senderUserName:e.srcName}))(e,r,o))}}}lt(d.messageUId)?u.push(d):ks.error("message is invalid",No(e))}}),u},Do=(e,t)=>{try{let r,n;return r=e.mediaAttribute?.length?yo(e.mediaAttribute,t):e.msgPreContent??"",e.msgPostContent?.length&&(n=yo(e.msgPostContent,t)),jo(e.mediaConstructor,r,n)}catch(t){return ks.error("decode message content fail",e,t),null}},jo=(e,t,r)=>{let n={};if(e==vo.TEXT&&r)n.content=r;else if(t?.length){const e=Uo(t);n=JSON.parse(e)}return n},Uo=e=>{let t=e.replace(/("[\w\d_]+"\s*:\s*)(?<!\d\.)(\d{15,})(?!\.\d*)([\s,}\]])/g,'$1"$2"$3');return t=t.replace(/(\[\s*|,\s*)(?<!\d\.)(\d{15,})(?!\.\d*)([\s,\]])/g,'$1"$2"$3'),t};var Bo={parse:function(e,t,r){const n=new Map;if(Object.keys(e).forEach(t=>{const r=e[t].dialogMessage?.filter(e=>!e.sharingGroupFlag);r?.length&&n.set(t,r)}),!n.size)return void r(!0,new Map);const o=new Set([...n.keys()]);uo.getDialogAesKeyListInBatches([...n.keys()],(e,s)=>{try{if(s.size){const e=[...s.keys()];for(const t of e)o.delete(t);r(!o.size,Po(e,n,s,t))}o.size&&e&&r(!0,new Map)}catch(t){ks.error("parseDialogsMessages error",t),o.size&&e&&r(!0,new Map)}})},parseSingleDialogMessages:Lo,decodeChatRecordMsgDetails2ReceivedMessages:(e,t)=>{let r=[];return t.forEach(t=>{const n=jo(t.mediaConstructor,t.mediaAttribute,t.msgPostContent);if(!n)return;const o=lo(t.mediaConstructor,n);if(tt(o)){const n={...e,senderUserId:t.srcId.toString(),messageDirection:t.srcId==rn.uid?i.SEND:i.RECEIVE,isCounted:o.isCounted,isMentioned:!1,content:o.content,messageType:o.messageType,isOffLineMessage:!1,isPersited:o.isPersited,messageId:0,messageUId:t.msgId+"",sentTime:t.msgSendTime+"",sentStatus:a.SENT,receivedTime:t.msgSendTime+"",isStatusMessage:o.isStatusMessage,receivedStatus:c.READ,disableNotification:!1};r.push(n)}}),r},encodeReceivedMessage2ChatRecordMsgDetail:e=>{const t=lo(e.messageType,e.content);if(!t)return null;const r=JSON.stringify(t.content),n=e.messageType===vo.TEXT?t.content.content:void 0;return{senderNickname:e.senderNickname,senderAvatar:e.senderAvatar||void 0,msgId:e.messageUId,srcId:e.senderUserId,destId:e.targetId,mediaConstructor:e.messageType,mediaAttribute:r,msgPostContent:n,msgSendTime:e.sentTime}}};const Fo="unreadMessageUids";class xo{localStore;constructor(e,t){const r=`receipt-v2-${e}-${t}`;this.localStore=new Ct(r)}storeUnreadMessageUids(e){const t=e.filter(e=>e.isCounted&&e.messageDirection!==i.SEND).map(e=>({uid:e.messageUId,timestamp:Date.now()})),r=[...this.localStore.get(Fo)||[],...t];this.localStore.set(Fo,r)}cleanExpiredMessages(){const e=this.localStore.get(Fo)||[],t=Date.now(),r=e.filter(e=>t-e.timestamp<=1728e5);this.localStore.set(Fo,r)}formatReceiptMessages(e){const t=[],r=[];e.forEach(e=>{e.conversationType===n.PRIVATE?t.push(e):r.push(e)});return{privateReceiptMessages:Object.entries(t.reduce((e,t)=>(e[t.targetId]||(e[t.targetId]=[]),e[t.targetId].push(t.messageUId),e),{})).map(([e,t])=>({destId:Nr.fromString(e),msgId:t.map(e=>Nr.fromString(e))})),groupReceiptMessages:r.reduce((e,t)=>{const r=e.find(e=>e.groupId.equals(Nr.fromString(t.targetId))&&e.userId.equals(Nr.fromString(t.senderUserId)));return r?r.msgId.push(Nr.fromString(t.messageUId)):e.push({groupId:Nr.fromString(t.targetId),userId:Nr.fromString(t.senderUserId),msgId:[Nr.fromString(t.messageUId)]}),e},[])}}filterValidMessages(e){return e.filter(e=>e.isCounted&&e.messageDirection!==i.SEND)}async sendArrivalReceipts(e){this.storeUnreadMessageUids(e);const t=this.filterValidMessages(e),{privateReceiptMessages:r,groupReceiptMessages:n}=this.formatReceiptMessages(t);var o;r.length&&await(o={chatMessage:r},cn.send(Et.SendPrivateChatArrivalAck,o,{encoder:Ln,decoder:Er})),n.length&&await(e=>cn.send(Et.SendGroupChatReadAck,e,{encoder:Wn,decoder:Er}))({groupChatMessage:n})}async sendReadReceipts(e){const t=this.localStore.get(Fo)||[],r=this.filterValidMessages(e).filter(e=>t.some(t=>t.uid===e.messageUId));try{const{privateReceiptMessages:e,groupReceiptMessages:t}=this.formatReceiptMessages(r);e.length&&await(n={chatMessage:e},cn.send(Et.SendPrivateChatReadAck,n,{encoder:Dn,decoder:Er})),t.length&&await(e=>cn.send(Et.SendGroupChatArrivalAck,e,{encoder:$n,decoder:Er}))({groupChatMessage:t});const o=this.localStore.get(Fo)||[],s=r.map(e=>e.messageUId),i=o.filter(e=>!s.includes(e.uid));this.localStore.set(Fo,i)}catch(e){throw console.error("发送已读回执失败:",e),e}var n}}let Go;var qo={create(e,t){Go=new xo(e,t),Go.cleanExpiredMessages()},get:()=>Go};let Vo=0,Ko=0;function Ho(e,t){Vo=e+100,Ko=t+100}function zo(){return Ko++,Ko}function $o(){return Vo--,Vo}function Wo(){return Ko}class Jo{loadedEndMap=new Map;db=null;currentAppKey="";currentUserId="";APP_INFO_KEY="im_app_info";DB_NAME_PREFIX="im_message_cache_1";DB_VERSION=2;STORE_NAME="messages_new";DIALOG_STATE_STORE="dialogStates_new";encryptKey={key:""};SALT_PREFIX="im_message_cache_salt_prefix";SALT_SUFFIX="im_message_cache_salt_suffix";constructor(e,t){this.generateEncryptKey(e,t),this.currentAppKey=e,this.currentUserId=t}generateEncryptKey(e,t){const r=`${this.SALT_PREFIX}${e}_${t}${this.SALT_SUFFIX}`,n=Qe.SHA256(r).toString(),o=n.substring(0,16),s=n.substring(16,48),i=Qe.SHA256(`${o}:${this.SALT_PREFIX}:${t}:${e}`).toString().substring(0,8),a=Qe.PBKDF2(s,i,{keySize:8,iterations:1e3,hasher:Qe.algo.SHA256}).toString();this.encryptKey={key:a.substring(0,32),iv:o}}async initDB(){await this.checkAndResetDatabase(),await this.initDatabase()}async checkAndResetDatabase(){const e=vt.get(this.APP_INFO_KEY);if(e)try{const t=JSON.parse(e);t.appKey===this.currentAppKey&&t.userId===this.currentUserId||await this.deleteDatabase()}catch(e){ks.error("Failed to parse stored AppKey and UserId",e),await this.deleteDatabase()}vt.set(this.APP_INFO_KEY,JSON.stringify({appKey:this.currentAppKey,userId:this.currentUserId,timestamp:Date.now()}))}async deleteDatabase(){return this.db&&(this.db.close(),this.db=null),this.loadedEndMap.clear(),new Promise((e,t)=>{const r=this.getDBName(),n=indexedDB.deleteDatabase(r);n.onsuccess=()=>{ks.info(`Database ${r} successfully deleted`),e()},n.onerror=t=>{ks.error(`Failed to delete database ${r}`,t),e()}})}getDBName(){return`${this.DB_NAME_PREFIX}_${this.currentAppKey}_${this.currentUserId}`}initDatabase(){return new Promise((e,t)=>{const r=this.getDBName(),n=indexedDB.open(r,this.DB_VERSION);n.onerror=e=>{ks.error("Failed to open database",e),t(new Error("Failed to open database"))},n.onsuccess=t=>{this.db=t.target.result,this.loadAllDialogStates().then(()=>{e()}).catch(t=>{ks.error("Failed to load conversation states",t),e()})},n.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains(this.STORE_NAME)){const e=t.createObjectStore(this.STORE_NAME,{keyPath:"messageId"});e.createIndex("messageUId","messageUId",{unique:!0}),e.createIndex("dialogId","dialogId",{unique:!1}),e.createIndex("dialogId_sentTime",["dialogId","sentTime"],{unique:!1}),e.createIndex("receivedStatus","receivedStatus",{unique:!1}),e.createIndex("burnAfterReadingFlag","burnAfterReadingFlag",{unique:!1}),e.createIndex("dialogId_receivedStatus",["dialogId","receivedStatus"],{unique:!1})}t.objectStoreNames.contains(this.DIALOG_STATE_STORE)||t.createObjectStore(this.DIALOG_STATE_STORE,{keyPath:"dialogId"})}})}async loadAllDialogStates(){if(this.db)return new Promise((e,t)=>{const r=this.db.transaction(this.DIALOG_STATE_STORE,"readonly").objectStore(this.DIALOG_STATE_STORE).getAll();r.onsuccess=()=>{const t=r.result;this.loadedEndMap.clear(),t.forEach(e=>{this.loadedEndMap.set(e.dialogId,e.isEnd)}),e()},r.onerror=e=>{t(new Error("Failed to load conversation states"))}})}async updateDialogState(e,t){if(this.db)return this.loadedEndMap.set(e,t),new Promise((r,n)=>{const o=this.db.transaction(this.DIALOG_STATE_STORE,"readwrite").objectStore(this.DIALOG_STATE_STORE).put({dialogId:e,isEnd:t,updateTime:Date.now()});o.onsuccess=()=>{r()},o.onerror=e=>{ks.error("Failed to update conversation state",e),n(new Error("Failed to update conversation state"))}})}encryptContent(e){if(!e)return"";try{const t=JSON.stringify(e);return ho(t,this.encryptKey)}catch(e){return ks.error("Failed to encrypt message content",e),""}}decryptContent(e){if(!e)return null;try{const t=yo(e,this.encryptKey);return JSON.parse(t)}catch(e){return ks.error("Failed to decrypt message content",e),null}}decryptMessage(e){const t={...e};if("string"==typeof t.content&&t.content)try{t.content=this.decryptContent(t.content)}catch(e){ks.error("Failed to decrypt message content",e),t.content=null}if(t.quotedReply&&"string"==typeof t.quotedReply.content&&t.quotedReply.content)try{t.quotedReply.content=this.decryptContent(t.quotedReply.content)}catch(e){ks.error("Failed to decrypt quoted message content",e),t.quotedReply.content=null}return t}async addMessages(e,t,r=void 0){let n=e?.filter(e=>e.isPersited);if(ks.info("addMessages to db -> ",n),!n||0===n.length||!this.db){if(tt(r)){const e=Yn(t);await this.updateDialogState(e,r)}return}const o=Yn(t);return new Promise(e=>{try{const t=this.db.transaction(this.STORE_NAME,"readwrite"),s=t.objectStore(this.STORE_NAME);t.oncomplete=async()=>{if(tt(r))try{await this.updateDialogState(o,r)}catch(e){ks.error("Failed to update dialog state:",e)}e()},t.onerror=s=>{ks.error("Transaction failed in addMessages:",function(e){return e.map(No)}(n),t.error),tt(r)?this.updateDialogState(o,r).catch(e=>ks.error("Failed to update dialog state after transaction error:",e)).finally(()=>e()):e()};for(const e of n)try{const t={...Oo(e),dialogId:o};t.content&&(t.content=this.encryptContent(t.content)),t.quotedReply?.content&&(t.quotedReply.content=this.encryptContent(t.quotedReply.content)),s.put(t)}catch(t){ks.error("Error processing message:",No(e),t)}}catch(t){ks.error("Failed to start transaction:",t),tt(r)?this.updateDialogState(o,r).catch(e=>ks.error("Failed to update dialog state:",e)).finally(()=>e()):e()}})}async getPreviousMessages(e,t="0",r=20){const n=Yn(e);if(!this.db)return{messages:[],hasMore:!1};const o=await this.getDialogLoadedState(n);return new Promise((e,s)=>{const i=this.db.transaction(this.STORE_NAME,"readonly"),a=i.objectStore(this.STORE_NAME).index("dialogId_sentTime");let c;c="0"===t?IDBKeyRange.bound([n,""],[n,"￿"]):IDBKeyRange.bound([n,""],[n,t]);const l=[];let u=!1,d=0;const p=a.count(c);p.onsuccess=()=>{const t=p.result;a.openCursor(c,"prev").onsuccess=e=>{const t=e.target.result;if(t)if(d<r){const e=this.decryptMessage(t.value);l.push(e),d++,t.continue()}else u=!0,n();else n()};const n=()=>{l.sort((e,t)=>Nr.fromString(e.sentTime).compare(Nr.fromString(t.sentTime))),e({messages:l,hasMore:u||t>r||!o})}},i.onerror=e=>{ks.error("Failed to query message",e),s(new Error("Failed to query message"))}})}async clearConversationCache(e){const t=Yn(e);if(!this.db)return void this.loadedEndMap.set(t,!0);const r=new Promise((e,r)=>{const n=this.db.transaction(this.STORE_NAME,"readwrite");n.objectStore(this.STORE_NAME).index("dialogId").openCursor(IDBKeyRange.only(t)).onsuccess=e=>{const t=e.target.result;t&&(t.delete(),t.continue())},n.oncomplete=()=>{e()},n.onerror=e=>{ks.error("Failed to clear conversation messages"),r(new Error("Failed to clear conversation messages"))}});await Promise.all([r,this.updateDialogState(t,!0)])}async clearAllCache(){if(!this.db)return void this.loadedEndMap.clear();const e=new Promise((e,t)=>{const r=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME).clear();r.onsuccess=()=>{e()},r.onerror=e=>{ks.error("Failed to clear all messages"),t(new Error("Failed to clear all messages"))}}),t=new Promise((e,t)=>{const r=this.db.transaction(this.DIALOG_STATE_STORE,"readwrite").objectStore(this.DIALOG_STATE_STORE).clear();r.onsuccess=()=>{this.loadedEndMap.clear(),e()},r.onerror=e=>{ks.error("Failed to clear all conversation states"),t(new Error("Failed to clear all conversation states"))}});await Promise.all([e,t])}async getDialogLoadedState(e){return this.loadedEndMap.has(e)?this.loadedEndMap.get(e):!!this.db&&new Promise((t,r)=>{const n=this.db.transaction(this.DIALOG_STATE_STORE,"readonly").objectStore(this.DIALOG_STATE_STORE).get(e);n.onsuccess=()=>{const r=n.result;r?(this.loadedEndMap.set(e,r.isEnd),t(r.isEnd)):t(!1)},n.onerror=e=>{t(!1)}})}async removeMessagesByUId(e){if(!e||0===e.length||!this.db)return;const t=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME),r=t.index("messageUId");e.forEach(e=>{const n=r.get(e);n.onsuccess=()=>{const e=n.result;e&&t.delete(e.messageId)}})}async updateMessageReceiptStatus(e,t){if(!e||!e.messageUIdList||0===e.messageUIdList.length||!this.db)return;const r=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME),n=r.index("messageUId");e.messageUIdList.forEach(e=>{const o=n.get(e);o.onsuccess=()=>{const e=o.result;if(e){let n=!1;0===t&&e.receivedStatus<c.RECEIVED?(e.receivedStatus=c.RECEIVED,n=!0):1===t&&e.receivedStatus<c.READ&&(e.receivedStatus=c.READ,n=!0),n&&r.put(e)}}})}async clearBurnAfterReadingExpiredMessages(e){const t=Yn(e);if(!this.db)return[];const r=Date.now();return new Promise((e,n)=>{const o=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME).index("dialogId"),s=[],i=o.openCursor(IDBKeyRange.only(t));i.onsuccess=t=>{const n=t.target.result;if(n){const e=n.value;if(e.burnAfterReadingFlag){const t=e.burnAfterReadingTime||0;let o=0===t;if(!o&&t>0){const n=Nr.fromString(e.sentTime),s=Nr.fromNumber(r),i=Nr.fromNumber(t),a=n.add(i);o=s.greaterThan(a)}o&&(s.push(e.messageUId),n.delete())}n.continue()}else e(s)},i.onerror=e=>{ks.error("Failed to clear expired messages",e),n(new Error("Failed to clear expired messages"))}})}async getLatestMessage(e){const t=Yn(e);return this.db?new Promise((e,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).index("dialogId_sentTime"),o=IDBKeyRange.bound([t,""],[t,"￿"]),s=n.openCursor(o,"prev");s.onsuccess=t=>{const r=t.target.result;if(r){const t=this.decryptMessage(r.value);e(t)}else e(null)},s.onerror=t=>{ks.error("Failed to get latest message",t),e(null)}}):null}async upsertMessage(e){this.addMessages([e],e)}async getMessageById(e){return this.db?new Promise((t,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).get(e);n.onsuccess=()=>{const e=n.result;if(e){const r=this.decryptMessage(e);t(r)}else t(null)},n.onerror=e=>{ks.error("Failed to query message",e),t(null)}}):null}async getMessageIdRange(){return this.db?new Promise((e,t)=>{const r=this.db.transaction(this.STORE_NAME,"readonly"),n=r.objectStore(this.STORE_NAME);let o=null,s=null;n.openCursor().onsuccess=t=>{const r=t.target.result;if(r){s=r.value.messageId;n.openCursor(null,"prev").onsuccess=t=>{const r=t.target.result;r?(o=r.value.messageId,e(o&&s?{newest:o,oldest:s}:null)):e(null)}}else e(null)},r.onerror=t=>{e(null)}}):null}async convertToRecallMessages(e){if(e&&0!==e.length&&this.db)return new Promise(t=>{const r=this.db.transaction(this.STORE_NAME,"readwrite"),n=r.objectStore(this.STORE_NAME),o=n.index("messageUId");let s=e.length;for(const t of e){if(!t){i();continue}const e=o.get(t);e.onsuccess=()=>{const r=e.result;if(r){const e={messageUId:t},o={...r,messageType:vo.RECALL,content:this.encryptContent(e),isPersited:!0,isCounted:!1,isMentioned:!1,disableNotification:!0},s=n.put(o);s.onerror=()=>{i()},s.onsuccess=()=>{i()}}else i()},e.onerror=()=>{i()}}function i(){s--,0===s&&t()}r.oncomplete=()=>{t()},r.onerror=()=>{t()}})}async getMessageByUId(e){return this.db?new Promise((t,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).index("messageUId").get(e);n.onsuccess=()=>{const e=n.result;if(e){const r=this.decryptMessage(e);t(r)}else t(null)},n.onerror=e=>{ks.error("Failed to query message",e),t(null)}}):null}}let Zo=null;var Xo={create(e,t){Zo=new Jo(e,t)},get:()=>Zo};class Yo{watcher;pullingMsg=!1;letterbox;serverMsgSeqno=Nr.ZERO;pullOfflineFinished=!1;intervalTimer;retryTimer;latestSyncTimestamp=0;started=!1;constructor(e,t){this.watcher=e,this.letterbox=new fo(t.appkey,rn.uid.toString())}start(){this.started=!0,this.pullOfflineFinished=!1,this.startPullInterval()}stop(){this.started=!1,this.stopPullInterval(),this.cancelRetryTask()}syncMsg(e){this.serverMsgSeqno=e,this.pullMsg()}startPullInterval(){this.stopPullInterval();this.intervalTimer=setInterval(()=>{Date.now()-this.latestSyncTimestamp>=18e4&&this.pullMsg()},3e4),this.latestSyncTimestamp=Date.now(),this.pullMsg()}stopPullInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}try2RePullMsg(){this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.pullMsg()},1e3)}cancelRetryTask(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async pullMsg(){if(this.pullingMsg)return;if(!this.started)return;this.cancelRetryTask(),this.pullingMsg=!0;const r=this.letterbox.getInboxOffset();ks.info(`pullMsg -> time: ${r}`),this.latestSyncTimestamp=Date.now();const{code:n,data:o}=await((e,t)=>cn.send(Et.GetNewMessage,{offset:e,rows:t},{encoder:yn,decoder:mn}))(r,60);if(n!==t.SUCCESS)return ks.warn("pullMsg failed -> code:",n),this.pullingMsg=!1,void(ws.loader?.getConnectionStatus()==e.CONNECTED&&this.try2RePullMsg());const{offset:s,seqno:i,msg:a,reference:c}=o,l=Object.keys(a).map(e=>({conversationType:Xn(Nr.fromString(e)),targetId:e}));await Ao.get().loadConvsationsIfNotExist(l),Bo.parse(a,c,async(e,t)=>{try{for(const[e,r]of t.entries()){if(0===r.length)return;await this.processMessages(r,!this.pullOfflineFinished)}}catch(e){ks.error("processMessages error -> ",e)}if(e)try{let e;i&&(Nr.isLong(i)?e=i:"string"==typeof i?e=Nr.fromString(i):"number"==typeof i&&(e=Nr.fromNumber(i))),e&&Nr.isLong(e)&&e.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=e);const t=this.serverMsgSeqno.lessThanOrEqual(s);ks.info(`pullMsg success -> syncTime: ${s}, finished: ${t}`),this.letterbox?.setInboxOffset(s),this.pullingMsg=!1,t&&!this.pullOfflineFinished&&(this.pullOfflineFinished=!0,this.watcher.pullFinished&&this.watcher.pullFinished()),t||this.pullMsg()}catch(e){ks.error("setPullMsgDone error",e),this.pullingMsg=!1}})}async processMessages(e,t){const r={conversationType:e[0].conversationType,targetId:e[0].targetId};let n=[];const o=[];let s=[];e.forEach(e=>{e.messageType===vo.RECALL&&io.has(e.content.messageUId)?e.content.messageUId?(io.remove(e.content.messageUId),s.push(e.content.messageUId)):ks.error("recallMessage's messageUId is undefined",No(e)):e.messageUId?(e.isOffLineMessage=t,(!e.messageId||e.messageId>Wo())&&(e.messageId=zo()),Ao.get().setConversationCacheByMessage(e),n.push(e),e.messageType===vo.RECALL&&o.push(n.length-1),[bo.PRIVATE_OPEN_BURNAFTERREADING,bo.GROUP_OPEN_BURNAFTERREADING,bo.PRIVATE_CLOSE_BURNAFTERREADING,bo.GROUP_CLOSE_BURNAFTERREADING].includes(e.messageType)&&this.handleBurnAfterReadingMessage(e)):ks.error("message's messageUId is undefined",No(e))});let i=[];for(let e=o.length-1;e>=0;e--){const t=o[e],r=n[t],a=r.content,c=n.findIndex(e=>e.messageUId===a.messageUId);if(-1!==c){const e=n[c];r.messageId=e.messageId,r.sentTime=e.sentTime,n[c]=r,n[t]=e,i.push(t)}else s.push(a.messageUId),i.push(t)}if(i.length){let e=[];n.forEach((t,r)=>{i.includes(r)||e.push(t)}),n=e}let a=this.handleReceiptMessages(n);a.length&&(await(Xo.get()?.addMessages(a,{conversationType:a[0].conversationType,targetId:a[0].targetId})),this.handleBatchMessages(a),qo.get()?.sendArrivalReceipts(a)),s.length&&(await(Xo.get()?.convertToRecallMessages(s)),this.watcher.onRecall?.(s));if(n.some(e=>e.isPersited)){const e=await(Xo.get()?.getLatestMessage(r));Ao.get().updateLatestMessage(r,e)}}handleBurnAfterReadingMessage(e){const t=e.content,r=e.conversationType,n=e.targetId,{templateId:o,burnAfterReadingTime:s}=t,i=60010010===o||60010011===o;Ao.get().addStatus({conversationType:r,targetId:n,burnAfterReadingFlag:i,burnAfterReadingTime:i?s:null},!0)}handleReceiptMessages(e){try{const t=[],r=[];e.forEach(e=>{e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.GROUP_READ_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_READ_RECEIPT?r.push(e):t.push(e)});const n=t.filter(e=>e.messageDirection===i.SEND);return r.forEach(e=>{const t=e.content,r=e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT;n.forEach(e=>{t.msgIdList.includes(e.messageUId)&&(e.receivedStatus=r?c.RECEIVED:c.READ)}),this.watcher.onReceiptReceived?.({conversation:{conversationType:e.conversationType,targetId:e.targetId},messageUIdList:t.msgIdList.map(e=>e.toString())},e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT?0:1)}),t}catch(e){return ks.error("handleReceiptMessages error",e),[]}}async handleBatchMessages(e){const t=e.filter(e=>e.messageDirection!==i.SEND||!e.messageId||!oo.has(e.messageId)||(oo.remove(e.messageId),!1));t.length&&this.watcher.batchMessage?.(t)}}class Qo{messageType;content;isPersited;isCounted;isStatusMessage;constructor(e,t,r=!0,n=!0,o=!1){this.messageType=e,this.content=t,o?(this.isPersited=!1,this.isCounted=!1):(this.isPersited=r,this.isCounted=n),this.isStatusMessage=o}}const es=(e,t,r,n)=>function(o){return new Qo(e,o,t,r,n)},ts=es(vo.TEXT,!0,!0,!1),rs=es(vo.IMAGE,!0,!0,!1),ns=es(vo.GIF,!0,!0,!1),os=es(vo.AUDIO,!0,!0,!1),ss=es(vo.FILE,!0,!0,!1),is=es(vo.VIDEO,!0,!0,!1);let as=es(vo.LOCATION,!0,!0,!1),cs=es(vo.CHAT_RECORD,!0,!0,!1),ls=es(vo.CONTACT,!0,!0,!1),us=es(vo.GROUP_INVITATION,!0,!0,!1),ds=es(vo.REDPACKET,!0,!0,!1),ps=es(vo.TRANSFER,!0,!0,!1),gs=es(vo.LINK,!0,!0,!1);const fs=es(bo.GROUP_ARRIVAL_RECEIPT,!1,!1,!1),hs=es(bo.GROUP_READ_RECEIPT,!1,!1,!1),ys=es(bo.PRIVATE_ARRIVAL_RECEIPT,!1,!1,!1),ms=es(bo.PRIVATE_READ_RECEIPT,!1,!1,!1),vs=es(bo.PRIVATE_OPEN_BURNAFTERREADING,!1,!1,!1),bs=es(bo.PRIVATE_CLOSE_BURNAFTERREADING,!1,!1,!1),Os=es(bo.GROUP_OPEN_BURNAFTERREADING,!1,!1,!1),Cs=es(bo.GROUP_CLOSE_BURNAFTERREADING,!1,!1,!1),Is=es(vo.RECALL,!0,!1,!1);class ws{options;connectionStatus=e.DISCONNECTED;isInternalConnected=!1;watcher;messageLoader;static _loader;static init(e){return this._loader||(this._loader=new ws(e)),this._loader}static get loader(){return this._loader}constructor(e){this.options=e,this.watcher={onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,pullFinished:void 0,batchMessage:void 0,conversationState:void 0,onPush:void 0,onRecall:void 0,onReceiptReceived:void 0},cn.setServerInfo(this.getWebSocketUrl()),cn.setCallback({status:this.connectionStatusListener.bind(this),message:this.messageListener.bind(this)}),this.registerMessage()}getWebSocketUrl(){const e=this.options?.serverInfo;return lt(e)?ct(t=e)&&/wss?:\/\//.test(t)?e:"ws://"+e:"wss://test.gametalk.ai";var t}registerMessage(){co(vo.TEXT,ts),co(vo.IMAGE,rs),co(vo.GIF,ns),co(vo.AUDIO,os),co(vo.FILE,ss),co(vo.VIDEO,is),co(vo.RECALL,Is),co(vo.LOCATION,as),co(vo.CHAT_RECORD,cs),co(vo.CONTACT,ls),co(vo.GROUP_INVITATION,us),co(vo.REDPACKET,ds),co(vo.TRANSFER,ps),co(vo.LINK,gs),co(bo.GROUP_ARRIVAL_RECEIPT,fs),co(bo.GROUP_READ_RECEIPT,hs),co(bo.PRIVATE_ARRIVAL_RECEIPT,ys),co(bo.PRIVATE_READ_RECEIPT,ms),co(bo.PRIVATE_OPEN_BURNAFTERREADING,vs),co(bo.PRIVATE_CLOSE_BURNAFTERREADING,bs),co(bo.GROUP_OPEN_BURNAFTERREADING,Os),co(bo.GROUP_CLOSE_BURNAFTERREADING,Cs)}async connect(){if(this.connectionStatus===e.CONNECTED)return{code:t.SUCCESS};if(this.connectionStatus===e.CONNECTING)return{code:t.BIZ_ERROR_CONNECTING};cn.close();const r=await cn.connect();return this.isInternalConnected=!0,{code:r}}reconnect(){return this.isInternalConnected?Promise.resolve({code:t.CAN_NOT_RECONNECT}):this.connect()}disconnect(){return this.isInternalConnected=!1,cn.close(),Promise.resolve()}async setUserLogged(){Rs.setUserId(rn.uid.toString()),Ao.get().destroyed(),Ao.create(this.options.appkey,rn.uid.toString(),this.watcher.conversationState),qo.create(this.options.appkey,rn.uid.toString()),this.messageLoader?.stop(),this.messageLoader=new Yo(this.watcher,this.options),oo.reset(),io.reset(),uo.reset(),Xo.create(this.options.appkey,rn.uid.toString()),Xo.get().initDB().then(()=>Xo.get().getMessageIdRange()).then(e=>{if(e){const{oldest:t,newest:r}=e;Ho(t,r)}else Ho(1e4,1e4)}),this.getConnectionStatus()===e.CONNECTED&&this.handleUserConnected()}setUserLogout(){this.messageLoader?.stop()}getConnectionStatus(){return this.connectionStatus}assignWatcher(e){pt(this.watcher).forEach(t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];this.watcher[t]=st(r)?r:void 0}})}resetWatcher(){pt(this.watcher).forEach(e=>{this.watcher[e]=void 0})}async connectionStatusListener(t){switch(this.connectionStatus=t,t){case e.BLOCKED:case e.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.CONNECTING:this.handleConnecting();break;case e.CONNECTED:this.handleConnected();break;case e.DISCONNECTED:this.handleDisconnect()}}handleConnecting(){this.watcher.onConnecting?.()}handleConnected(){rn.isActive&&(this.handleUserConnected(),to()),this.watcher.onConnected?.(),ks.cleanupOldLogs()}handleDisconnect(){this.watcher.onDisconnect?.(),this.messageLoader?.stop()}handleSuspend(){this.watcher.onSuspend?.()}handleUserConnected(){ks.info("user connected -> ",rn.uid.toString()),this.messageLoader||(this.messageLoader=new Yo(this.watcher,this.options)),this.messageLoader?.start(),setTimeout(()=>{this.connectionStatus===e.CONNECTED&&Ao.get().syncConversationStatus()},2e3)}messageListener(e,t){if(e===Et.NewMessagePush){const e=Pn.decode(t);this.messageLoader?.syncMsg(e.seqno)}else e===Et.DialogChangedPush?Ao.get().syncConversationStatus():this.watcher.onPush?.(e,t)}}class Ss{static instance;messageQueue;config;flushTimer=null;userId=null;isFlushing=!1;constructor(e){this.config=e,this.messageQueue=new wt,this.startFlushTimer()}static getInstance(e){return Ss.instance||(Ss.instance=new Ss(e)),Ss.instance}trackEvent(e,t){const r={type:e,...this.collectAutomaticProperties(),content:t};this.messageQueue.enqueue(r),this.config.debugMode&&this.flush()}collectAutomaticProperties(){return{user_id:this.userId,os:"web",appVersion:Rt.appVersion,eventTime:Date.now()}}async flush(){if(!this.shouldFlush()||this.isFlushing)return;this.isFlushing=!0;let e=[];try{if(e=await this.messageQueue.dequeue(this.config.flushBulkSize),0===e.length)return;const t=await async function(e){const t=JSON.stringify(e),r=(new TextEncoder).encode(t);if("CompressionStream"in window){const e=new Response(r).body?.pipeThrough(new CompressionStream("gzip"));if(e){const t=await new Response(e).arrayBuffer();return btoa(String.fromCharCode(...new Uint8Array(t)))}}return btoa(t)}(e);await this.sendData(t)}catch(t){console.error("Failed to flush analytics data:",t),await this.messageQueue.requeueToEnd(e)}finally{this.isFlushing=!1}}shouldFlush(){return ws.loader?.getConnectionStatus()==e.CONNECTED}async sendData(e){try{const r=await(e=>cn.send(Et.PostAnalyticsLogs,{data:e},{encoder:Tr,decoder:Er}))(e);if(r.code!==t.SUCCESS)throw new Error(`Socket error! status: ${r.code}`)}catch(e){throw e}}startFlushTimer(){this.config.flushInterval>0&&(this.flushTimer=setInterval(()=>{this.flush()},this.config.flushInterval))}setUserId(e){this.userId=e}destroy(){this.flushTimer&&clearInterval(this.flushTimer),this.messageQueue.clear()}}var Rs=Ss.getInstance({flushInterval:6e4,flushBulkSize:100,debugMode:!1});const Es=bt.get("ACIM-slf")===(new Date).getDate();const Ts={[u.DEBUG]:console.debug.bind(console),[u.INFO]:console.info.bind(console),[u.WARN]:console.warn.bind(console),[u.ERROR]:console.error.bind(console),[u.FATAL]:console.log.bind(console),[u.NONE]:null},_s=e=>ct(e)||rt(e)||ot(e)||nt(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e);var ks=new class{debug;info;warn;error;fatal;outLevel=u.WARN;tag;logStdout;constructor(e){this.tag=e,this.debug=this.log.bind(this,u.DEBUG),this.info=this.log.bind(this,u.INFO),this.warn=this.log.bind(this,u.WARN),this.error=this.log.bind(this,u.ERROR),this.fatal=this.log.bind(this,u.FATAL)}async addLog(e,t){const r={timestamp:(new Date).toISOString(),level:e,content:t};try{e===u.ERROR&&Rs.trackEvent("error_log",{timestamp:r.timestamp,content:r.content})}catch(e){console.error("Failed to add log:",e)}}defaultStdout(e,t,...r){const n=Ts[e];tt(n)&&n(`${t}:`,...r)}reqInfo(...e){this.info(...e)}setLogLevel(e){this.outLevel=e}setLogStdout(e){this.logStdout=e}log(e,...t){if(Es){const r=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`;return this.defaultStdout(e,r,...t),void this.addLog(e,t.map(_s).join(" "))}if(e<this.outLevel)return;const r=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`,n=`${r} - ${t.map(_s).join(" ")}`;if(this.logStdout)return this.logStdout(e,n),void this.addLog(e,t.map(_s).join(" "));this.defaultStdout(e,r,...t),this.addLog(e,t.map(_s).join(" "))}async exportLogs(){return[]}async clearLogs(){}async cleanupOldLogs(){}}("ACLog");const As=lt,Ms=rt,Ns=nt,Ps=it,Ls=at,Ds=e=>rt(e)&&Object.prototype.hasOwnProperty.call(n,e),js=e=>{if(!it(e))return!1;const{conversationType:t,targetId:r,channelId:o}=e;return rt(t)&&Object.prototype.hasOwnProperty.call(n,t)&&(rt(r)||lt(r)||Nr.isLong(r)&&!r.isZero())&&(!tt(o)||ct(o)&&!/_/g.test(o)&&o.length<=20)};class Us extends Error{constructor(e){super(e),this.name="ACAssertError"}}const Bs=(e,t,r,n=!1)=>{if(!Fs(e,t,r,n))throw new Us(`'${e}' is invalid: ${JSON.stringify(t)}`)},Fs=(e,t,r,n=!1)=>{const o=n&&!r(t)||!n&&tt(t)&&!r(t);return o&&ks.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};var xs,Gs,qs,Vs,Ks={exports:{}},Hs={exports:{}},zs={exports:{}};var $s,Ws={};var Js,Zs,Xs,Ys,Qs,ei,ti,ri,ni,oi,si,ii,ai,ci,li,ui,di,pi,gi,fi={};function hi(){return Js||(Js=1,function(e){var t=e,r=ea(),n=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,o={};for(t|=0;r<e.length;)o[n[r+t]]=e[r++];return o}t.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),t.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),t.long=o([0,0,0,1,1],7),t.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),t.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])}(fi)),fi}function yi(){if(Xs)return Zs;Xs=1,Zs=i;var e=ta();((i.prototype=Object.create(e.prototype)).constructor=i).className="Field";var t,r=ra(),n=hi(),o=ea(),s=/^required|optional|repeated$/;function i(t,r,i,a,c,l,u){if(o.isObject(a)?(u=c,l=a,a=c=void 0):o.isObject(c)&&(u=l,l=c,c=void 0),e.call(this,t,l),!o.isInteger(r)||r<0)throw TypeError("id must be a non-negative integer");if(!o.isString(i))throw TypeError("type must be a string");if(void 0!==a&&!s.test(a=a.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==c&&!o.isString(c))throw TypeError("extend must be a string");"proto3_optional"===a&&(a="optional"),this.rule=a&&"optional"!==a?a:void 0,this.type=i,this.id=r,this.extend=c||void 0,this.required="required"===a,this.optional=!this.required,this.repeated="repeated"===a,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!o.Long&&void 0!==n.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}return i.fromJSON=function(e,t){return new i(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(i.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),i.prototype.setOption=function(t,r,n){return"packed"===t&&(this._packed=null),e.prototype.setOption.call(this,t,r,n)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},i.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=n.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof t?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof r&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof r)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=o.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var s;o.base64.test(this.typeDefault)?o.base64.decode(this.typeDefault,s=o.newBuffer(o.base64.length(this.typeDefault)),0):o.utf8.write(this.typeDefault,s=o.newBuffer(o.utf8.length(this.typeDefault)),0),this.typeDefault=s}return this.map?this.defaultValue=o.emptyObject:this.repeated?this.defaultValue=o.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof t&&(this.parent.ctor.prototype[this.name]=this.defaultValue),e.prototype.resolve.call(this)},i.d=function(e,t,r,n){return"function"==typeof t?t=o.decorateType(t).name:t&&"object"==typeof t&&(t=o.decorateEnum(t).name),function(s,a){o.decorateType(s.constructor).add(new i(a,e,t,r,{default:n}))}},i._configure=function(e){t=e},Zs}function mi(){if(Qs)return Ys;Qs=1,Ys=n;var e=ta();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=yi(),r=ea();function n(t,r,n,o){if(Array.isArray(r)||(n=r,r=void 0),e.call(this,t,n),void 0!==r&&!Array.isArray(r))throw TypeError("fieldNames must be an Array");this.oneof=r||[],this.fieldsArray=[],this.comment=o}function o(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}return n.fromJSON=function(e,t){return new n(e,t.oneof,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},n.prototype.add=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,o(this),this},n.prototype.remove=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),(r=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(r,1),e.partOf=null,this},n.prototype.onAdd=function(t){e.prototype.onAdd.call(this,t);for(var r=0;r<this.oneof.length;++r){var n=t.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}o(this)},n.prototype.onRemove=function(t){for(var r,n=0;n<this.fieldsArray.length;++n)(r=this.fieldsArray[n]).parent&&r.parent.remove(r);e.prototype.onRemove.call(this,t)},n.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,o){r.decorateType(t.constructor).add(new n(o,e)),Object.defineProperty(t,o,{get:r.oneOfGetter(e),set:r.oneOfSetter(e)})}},Ys}function vi(){if(ti)return ei;ti=1,ei=c;var e=ta();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=yi(),s=ea(),i=mi();function a(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function c(t,r){e.call(this,t,r),this.nested=void 0,this._nestedArray=null}function l(e){return e._nestedArray=null,e}return c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=a,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=s.toArray(this.nested))}}),c.prototype.toJSON=function(e){return s.toObject(["options",this.options,"nested",a(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var s,i=Object.keys(e),a=0;a<i.length;++a)s=e[i[a]],this.add((void 0!==s.fields?t.fromJSON:void 0!==s.values?n.fromJSON:void 0!==s.methods?r.fromJSON:void 0!==s.id?o.fromJSON:c.fromJSON)(i[a],s));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof t||e instanceof i||e instanceof n||e instanceof r||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(e.name);if(s){if(!(s instanceof c&&e instanceof c)||s instanceof t||s instanceof r)throw Error("duplicate name '"+e.name+"' in "+this);for(var a=s.nestedArray,u=0;u<a.length;++u)e.add(a[u]);this.remove(s),this.nested||(this.nested={}),e.setOptions(s.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),l(this)},c.prototype.remove=function(t){if(!(t instanceof e))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),l(this)},c.prototype.define=function(e,t){if(s.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(n))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),s.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof c&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof c&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var r=this.lookup(e,[t]);if(!r)throw Error("no such type: "+e);return r},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[t,n]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r},c.prototype.lookupService=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,o,s){t=e,r=o,n=s},ei}function bi(){if(ni)return ri;ni=1,ri=n;var e=yi();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=hi(),r=ea();function n(t,n,o,s,i,a){if(e.call(this,t,n,s,void 0,void 0,i,a),!r.isString(o))throw TypeError("keyType must be a string");this.keyType=o,this.resolvedKeyType=null,this.map=!0}return n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===t.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return e.prototype.resolve.call(this)},n.d=function(e,t,o){return"function"==typeof o?o=r.decorateType(o).name:o&&"object"==typeof o&&(o=r.decorateEnum(o).name),function(s,i){r.decorateType(s.constructor).add(new n(i,e,t,o))}},ri}function Oi(){if(si)return oi;si=1,oi=r;var e=ta();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=ea();function r(r,n,o,s,i,a,c,l,u){if(t.isObject(i)?(c=i,i=a=void 0):t.isObject(a)&&(c=a,a=void 0),void 0!==n&&!t.isString(n))throw TypeError("type must be a string");if(!t.isString(o))throw TypeError("requestType must be a string");if(!t.isString(s))throw TypeError("responseType must be a string");e.call(this,r,c),this.type=n||"rpc",this.requestType=o,this.requestStream=!!i||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}return r.fromJSON=function(e,t){return new r(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},r.prototype.toJSON=function(e){var r=!!e&&Boolean(e.keepComments);return t.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])},r.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),e.prototype.resolve.call(this))},oi}function Ci(){if(ai)return ii;ai=1,ii=o;var e=vi();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=Oi(),r=ea(),n=fr();function o(t,r){e.call(this,t,r),this.methods={},this._methodsArray=null}function s(e){return e._methodsArray=null,e}return o.fromJSON=function(e,r){var n=new o(e,r.options);if(r.methods)for(var s=Object.keys(r.methods),i=0;i<s.length;++i)n.add(t.fromJSON(s[i],r.methods[s[i]]));return r.nested&&n.addJSON(r.nested),n.comment=r.comment,n},o.prototype.toJSON=function(t){var n=e.prototype.toJSON.call(this,t),o=!!t&&Boolean(t.keepComments);return r.toObject(["options",n&&n.options||void 0,"methods",e.arrayToJSON(this.methodsArray,t)||{},"nested",n&&n.nested||void 0,"comment",o?this.comment:void 0])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=r.toArray(this.methods))}}),o.prototype.get=function(t){return this.methods[t]||e.prototype.get.call(this,t)},o.prototype.resolveAll=function(){for(var t=this.methodsArray,r=0;r<t.length;++r)t[r].resolve();return e.prototype.resolve.call(this)},o.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof t?(this.methods[r.name]=r,r.parent=this,s(this)):e.prototype.add.call(this,r)},o.prototype.remove=function(r){if(r instanceof t){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,s(this)}return e.prototype.remove.call(this,r)},o.prototype.create=function(e,t,o){for(var s,i=new n.Service(e,t,o),a=0;a<this.methodsArray.length;++a){var c=r.lcFirst((s=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=r.codegen(["r","c"],r.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:s,q:s.resolvedRequestType.ctor,s:s.resolvedResponseType.ctor})}return i},ii}function Ii(){if(li)return ci;li=1,ci=t;var e=rr();function t(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}return t.create=function(e){return this.$type.create(e)},t.encode=function(e,t){return this.$type.encode(e,t)},t.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},t.decode=function(e){return this.$type.decode(e)},t.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},t.verify=function(e){return this.$type.verify(e)},t.fromObject=function(e){return this.$type.fromObject(e)},t.toObject=function(e,t){return this.$type.toObject(e,t)},t.prototype.toJSON=function(){return this.$type.toObject(this,e.toJSONOptions)},ci}function wi(){if(di)return ui;di=1,ui=function(o){var s=r.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break");s("switch(t>>>3){");for(var i=0;i<o.fieldsArray.length;++i){var a=o._fieldsArray[i].resolve(),c=a.resolvedType instanceof e?"int32":a.type,l="m"+r.safeProp(a.name);s("case %i: {",a.id),a.map?(s("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==t.defaults[a.keyType]?s("k=%j",t.defaults[a.keyType]):s("k=null"),void 0!==t.defaults[c]?s("value=%j",t.defaults[c]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===t.basic[c]?s("value=types[%i].decode(r,r.uint32())",i):s("value=r.%s()",c),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==t.long[a.keyType]?s('%s[typeof k==="object"?util.longToHash(k):k]=value',l):s("%s[k]=value",l)):a.repeated?(s("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==t.packed[c]&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===t.basic[c]?s(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,i):s("%s.push(r.%s())",l,c)):void 0===t.basic[c]?s(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,i):s("%s=r.%s()",l,c),s("break")("}")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),i=0;i<o._fieldsArray.length;++i){var u=o._fieldsArray[i];u.required&&s("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",n(u))}return s("return m")};var e=ra(),t=hi(),r=ea();function n(e){return"missing required '"+e.name+"'"}return ui}function Si(){if(gi)return pi;gi=1,pi=function(e){var s=t.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,a={};i.length&&s("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+t.safeProp(l.name);if(l.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)s("if(!util.isObject(%s))",u)("return%j",r(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),o(s,l,"k[i]"),n(s,l,c,u+"[k[i]]")("}");else if(l.repeated)s("if(!Array.isArray(%s))",u)("return%j",r(l,"array"))("for(var i=0;i<%s.length;++i){",u),n(s,l,c,u+"[i]")("}");else{if(l.partOf){var d=t.safeProp(l.partOf.name);1===a[l.partOf.name]&&s("if(p%s===1)",d)("return%j",l.partOf.name+": multiple values"),a[l.partOf.name]=1,s("p%s=1",d)}n(s,l,c,u)}l.optional&&s("}")}return s("return null")};var e=ra(),t=ea();function r(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function n(t,n,o,s){if(n.resolvedType)if(n.resolvedType instanceof e){t("switch(%s){",s)("default:")("return%j",r(n,"enum value"));for(var i=Object.keys(n.resolvedType.values),a=0;a<i.length;++a)t("case %i:",n.resolvedType.values[i[a]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s);",o,s)("if(e)")("return%j+e",n.name+".")("}");else switch(n.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",s)("return%j",r(n,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",s,s,s,s)("return%j",r(n,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',s)("return%j",r(n,"number"));break;case"bool":t('if(typeof %s!=="boolean")',s)("return%j",r(n,"boolean"));break;case"string":t("if(!util.isString(%s))",s)("return%j",r(n,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',s,s,s)("return%j",r(n,"buffer"))}return t}function o(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",r(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",r(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",r(t,"boolean key"))}return e}return pi}var Ri,Ei={};function Ti(){return Ri||(Ri=1,function(e){var t=e,r=ra(),n=ea();function o(e,t,n,o){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",o);for(var i=t.resolvedType.values,a=Object.keys(i),c=0;c<a.length;++c)i[a[c]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',o,o,o),t.repeated||e("break"),s=!0),e("case%j:",a[c])("case %i:",i[a[c]])("m%s=%j",o,i[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',o)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",o,n,o);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",o,o);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,l)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length >= 0)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function s(e,t,n,o){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",o,n,o,o,n,o,o):e("d%s=types[%i].toObject(m%s,o)",o,n,o);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,s?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,s=n.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return s("return new this.ctor");s("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),c=n.safeProp(a.name);a.map?(s("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(s,a,i,c+"[ks[i]]")("}")("}")):a.repeated?(s("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(s,a,i,c+"[i]")("}")("}")):(a.resolvedType instanceof r||s("if(d%s!=null){",c),o(s,a,i,c),a.resolvedType instanceof r||s("}"))}return s("return m")},t.toObject=function(e){var t=e.fieldsArray.slice().sort(n.compareFieldsById);if(!t.length)return n.codegen()("return {}");for(var o=n.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],a=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?i:t[l].map?a:c).push(t[l]);if(i.length){for(o("if(o.arrays||o.defaults){"),l=0;l<i.length;++l)o("d%s=[]",n.safeProp(i[l].name));o("}")}if(a.length){for(o("if(o.objects||o.defaults){"),l=0;l<a.length;++l)o("d%s={}",n.safeProp(a[l].name));o("}")}if(c.length){for(o("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],d=n.safeProp(u.name);if(u.resolvedType instanceof r)o("d%s=o.enums===String?%j:%j",d,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)o("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",d)("}else")("d%s=o.longs===String?%j:%i",d,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var p="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";o("if(o.bytes===String)d%s=%j",d,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",d,p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",d,d)("}")}else o("d%s=%j",d,u.typeDefault)}o("}")}var g=!1;for(l=0;l<t.length;++l){u=t[l];var f=e._fieldsArray.indexOf(u);d=n.safeProp(u.name);u.map?(g||(g=!0,o("var ks2")),o("if(m%s&&(ks2=Object.keys(m%s)).length){",d,d)("d%s={}",d)("for(var j=0;j<ks2.length;++j){"),s(o,u,f,d+"[ks2[j]]")("}")):u.repeated?(o("if(m%s&&m%s.length){",d,d)("d%s=[]",d)("for(var j=0;j<m%s.length;++j){",d),s(o,u,f,d+"[j]")("}")):(o("if(m%s!=null&&m.hasOwnProperty(%j)){",d,u.name),s(o,u,f,d),u.partOf&&o("if(o.oneofs)")("d%s=%j",n.safeProp(u.partOf.name),u.name)),o("}")}return o("return d")}}(Ei)),Ei}var _i,ki,Ai,Mi,Ni,Pi,Li,Di,ji,Ui,Bi,Fi,xi,Gi,qi,Vi,Ki,Hi,zi,$i,Wi,Ji,Zi={};function Xi(){return _i||(_i=1,function(e){var t=e,r=Ii();t[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",o="";if(t&&t.json&&e.type_url&&e.value){o=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(o);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof r){var i=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),o=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),i["@type"]=o,i}return this.toObject(e,t)}}}(Zi)),Zi}function Yi(){if(Ai)return ki;Ai=1,ki=h;var e=vi();((h.prototype=Object.create(e.prototype)).constructor=h).className="Type";var t=ra(),r=mi(),n=yi(),o=bi(),s=Ci(),i=Ii(),a=or(),c=nr(),l=ea(),u=na(),d=wi(),p=Si(),g=Ti(),f=Xi();function h(t,r){e.call(this,t,r),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}return Object.defineProperties(h.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=l.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=l.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=h.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof i||((e.prototype=new i).constructor=e,l.merge(e.prototype,t)),e.$type=e.prototype.$type=this,l.merge(e,i,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:l.oneOfGetter(this._oneofsArray[r].oneof),set:l.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),h.generateConstructor=function(e){for(var t,r=l.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",l.safeProp(t.name)):t.repeated&&r("this%s=[]",l.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},h.fromJSON=function(i,a){var c=new h(i,a.options);c.extensions=a.extensions,c.reserved=a.reserved;for(var l=Object.keys(a.fields),u=0;u<l.length;++u)c.add((void 0!==a.fields[l[u]].keyType?o.fromJSON:n.fromJSON)(l[u],a.fields[l[u]]));if(a.oneofs)for(l=Object.keys(a.oneofs),u=0;u<l.length;++u)c.add(r.fromJSON(l[u],a.oneofs[l[u]]));if(a.nested)for(l=Object.keys(a.nested),u=0;u<l.length;++u){var d=a.nested[l[u]];c.add((void 0!==d.id?n.fromJSON:void 0!==d.fields?h.fromJSON:void 0!==d.values?t.fromJSON:void 0!==d.methods?s.fromJSON:e.fromJSON)(l[u],d))}return a.extensions&&a.extensions.length&&(c.extensions=a.extensions),a.reserved&&a.reserved.length&&(c.reserved=a.reserved),a.group&&(c.group=!0),a.comment&&(c.comment=a.comment),c},h.prototype.toJSON=function(t){var r=e.prototype.toJSON.call(this,t),n=!!t&&Boolean(t.keepComments);return l.toObject(["options",r&&r.options||void 0,"oneofs",e.arrayToJSON(this.oneofsArray,t),"fields",e.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),t)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])},h.prototype.resolveAll=function(){for(var t=this.fieldsArray,r=0;r<t.length;)t[r++].resolve();var n=this.oneofsArray;for(r=0;r<n.length;)n[r++].resolve();return e.prototype.resolveAll.call(this)},h.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},h.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof n&&void 0===t.extend){if(this._fieldsById?this._fieldsById[t.id]:this.fieldsById[t.id])throw Error("duplicate id "+t.id+" in "+this);if(this.isReservedId(t.id))throw Error("id "+t.id+" is reserved in "+this);if(this.isReservedName(t.name))throw Error("name '"+t.name+"' is reserved in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),y(this)}return t instanceof r?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),y(this)):e.prototype.add.call(this,t)},h.prototype.remove=function(t){if(t instanceof n&&void 0===t.extend){if(!this.fields||this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.parent=null,t.onRemove(this),y(this)}if(t instanceof r){if(!this.oneofs||this.oneofs[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.oneofs[t.name],t.parent=null,t.onRemove(this),y(this)}return e.prototype.remove.call(this,t)},h.prototype.isReservedId=function(t){return e.isReservedId(this.reserved,t)},h.prototype.isReservedName=function(t){return e.isReservedName(this.reserved,t)},h.prototype.create=function(e){return new this.ctor(e)},h.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=u(this)({Writer:c,types:t,util:l}),this.decode=d(this)({Reader:a,types:t,util:l}),this.verify=p(this)({types:t,util:l}),this.fromObject=g.fromObject(this)({types:t,util:l}),this.toObject=g.toObject(this)({types:t,util:l});var n=f[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},h.prototype.encode=function(e,t){return this.setup().encode(e,t)},h.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},h.prototype.decode=function(e,t){return this.setup().decode(e,t)},h.prototype.decodeDelimited=function(e){return e instanceof a||(e=a.create(e)),this.decode(e,e.uint32())},h.prototype.verify=function(e){return this.setup().verify(e)},h.prototype.fromObject=function(e){return this.setup().fromObject(e)},h.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},h.d=function(e){return function(t){l.decorateType(t,e)}},ki}function Qi(){if(Ni)return Mi;Ni=1,Mi=c;var e=vi();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=yi(),s=ra(),i=mi(),a=ea();function c(t){e.call(this,"",t),this.deferred=[],this.files=[]}function l(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=a.path.resolve,c.prototype.fetch=a.fetch,c.prototype.load=function e(t,o,s){"function"==typeof o&&(s=o,o=void 0);var i=this;if(!s)return a.asPromise(e,i,t,o);var c=s===l;function u(e,t){if(s){if(c)throw e;var r=s;s=null,r(e,t)}}function d(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in n)return r}return null}function p(e,t){try{if(a.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),a.isString(t)){r.filename=e;var n,s=r(t,i,o),l=0;if(s.imports)for(;l<s.imports.length;++l)(n=d(s.imports[l])||i.resolvePath(e,s.imports[l]))&&g(n);if(s.weakImports)for(l=0;l<s.weakImports.length;++l)(n=d(s.weakImports[l])||i.resolvePath(e,s.weakImports[l]))&&g(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}c||f||u(null,i)}function g(e,t){if(e=d(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in n)c?p(e,n[e]):(++f,setTimeout(function(){--f,p(e,n[e])}));else if(c){var r;try{r=a.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}p(e,r)}else++f,i.fetch(e,function(r,n){--f,s&&(r?t?f||u(null,i):u(r):p(e,n))})}var f=0;a.isString(t)&&(t=[t]);for(var h,y=0;y<t.length;++y)(h=i.resolvePath("",t[y]))&&g(h);if(c)return i;f||u(null,i)},c.prototype.loadSync=function(e,t){if(!a.isNode)throw Error("not supported");return this.load(e,t,l)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return e.prototype.resolveAll.call(this)};var u=/^[A-Z]/;function d(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new o(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}return c.prototype._handleAdd=function(e){if(e instanceof o)void 0===e.extend||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof s)u.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof i)){if(e instanceof t)for(var r=0;r<this.deferred.length;)d(0,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);u.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(t){if(t instanceof o){if(void 0!==t.extend)if(t.extensionField)t.extensionField.parent.remove(t.extensionField),t.extensionField=null;else{var r=this.deferred.indexOf(t);r>-1&&this.deferred.splice(r,1)}}else if(t instanceof s)u.test(t.name)&&delete t.parent[t.name];else if(t instanceof e){for(var n=0;n<t.nestedArray.length;++n)this._handleRemove(t._nestedArray[n]);u.test(t.name)&&delete t.parent[t.name]}},c._configure=function(e,o,s){t=e,r=o,n=s},Mi}function ea(){if(Pi)return zs.exports;Pi=1;var e,t,r=zs.exports=rr(),n=hr();r.codegen=function(){if(Gs)return xs;function e(t,r){"string"==typeof t&&(r=t,t=void 0);var n=[];function o(t){if("string"!=typeof t){var r=s();if(e.verbose&&console.log("codegen: "+r),r="return "+r,t){for(var i=Object.keys(t),a=new Array(i.length+1),c=new Array(i.length),l=0;l<i.length;)a[l]=i[l],c[l]=t[i[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),d=0;d<u.length;)u[d]=arguments[++d];if(d=0,t=t.replace(/%([%dfijs])/g,function(e,t){var r=u[d++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"}),d!==u.length)throw Error("parameter count mismatch");return n.push(t),o}function s(e){return"function "+(e||r||"")+"("+(t&&t.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return o.toString=s,o}return Gs=1,xs=e,e.verbose=!1,xs}(),r.fetch=function(){if(Vs)return qs;Vs=1,qs=r;var e=Mt(),t=xt()("fs");function r(n,o,s){return"function"==typeof o?(s=o,o={}):o||(o={}),s?!o.xhr&&t&&t.readFile?t.readFile(n,function(e,t){return e&&"undefined"!=typeof XMLHttpRequest?r.xhr(n,o,s):e?s(e):s(null,o.binary?t:t.toString("utf8"))}):r.xhr(n,o,s):e(r,this,n,o)}return r.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o<n.responseText.length;++o)e.push(255&n.responseText.charCodeAt(o))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()},qs}(),r.path=($s||($s=1,function(e){var t=e,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):n?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}}(Ws)),Ws),r.fs=r.inquire("fs"),r.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},r.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t};var o=/\\/g,s=/"/g;r.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},r.safeProp=function(e){return!/^[$\w_]+$/.test(e)||r.isReserved(e)?'["'+e.replace(o,"\\\\").replace(s,'\\"')+'"]':"."+e},r.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var i=/_([a-z])/g;r.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(i,function(e,t){return t.toUpperCase()})},r.compareFieldsById=function(e,t){return e.id-t.id},r.decorateType=function(t,n){if(t.$type)return n&&t.$type.name!==n&&(r.decorateRoot.remove(t.$type),t.$type.name=n,r.decorateRoot.add(t.$type)),t.$type;e||(e=Yi());var o=new e(n||t.name);return r.decorateRoot.add(o),o.ctor=t,Object.defineProperty(t,"$type",{value:o,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:o,enumerable:!1}),o};var a=0;return r.decorateEnum=function(e){if(e.$type)return e.$type;t||(t=ra());var n=new t("Enum"+a++,e);return r.decorateRoot.add(n),Object.defineProperty(e,"$type",{value:n,enumerable:!1}),n},r.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var o=r.shift();if("__proto__"===o||"prototype"===o)return t;if(r.length>0)t[o]=e(t[o]||{},r,n);else{var s=t[o];s&&(n=[].concat(s).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(r,"decorateRoot",{get:function(){return n.decorated||(n.decorated=new(Qi()))}}),zs.exports}function ta(){if(Di)return Li;Di=1,Li=r,r.className="ReflectionObject";var e,t=ea();function r(e,r){if(!t.isString(e))throw TypeError("name must be a string");if(r&&!t.isObject(r))throw TypeError("options must be an object");this.options=r,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(r.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),r.prototype.toJSON=function(){throw Error()},r.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;r instanceof e&&r._handleAdd(this)},r.prototype.onRemove=function(t){var r=t.root;r instanceof e&&r._handleRemove(this),this.parent=null,this.resolved=!1},r.prototype.resolve=function(){return this.resolved||this.root instanceof e&&(this.resolved=!0),this},r.prototype.getOption=function(e){if(this.options)return this.options[e]},r.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},r.prototype.setParsedOption=function(e,r,n){this.parsedOptions||(this.parsedOptions=[]);var o=this.parsedOptions;if(n){var s=o.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(s){var i=s[e];t.setProperty(i,n,r)}else(s={})[e]=t.setProperty({},n,r),o.push(s)}else{var a={};a[e]=r,o.push(a)}return this},r.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},r.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},r._configure=function(t){e=t},Li}function ra(){if(Ui)return ji;Ui=1,ji=n;var e=ta();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=vi(),r=ea();function n(t,r,n,o,s,i){if(e.call(this,t,n),r&&"object"!=typeof r)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=s||{},this.valuesOptions=i,this.reserved=void 0,r)for(var a=Object.keys(r),c=0;c<a.length;++c)"number"==typeof r[a[c]]&&(this.valuesById[this.values[a[c]]=r[a[c]]]=a[c])}return n.fromJSON=function(e,t){var r=new n(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},n.prototype.add=function(e,t,n,o){if(!r.isString(e))throw TypeError("name must be a string");if(!r.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return o&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=o||null),this.comments[e]=n||null,this},n.prototype.remove=function(e){if(!r.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},n.prototype.isReservedId=function(e){return t.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return t.isReservedName(this.reserved,e)},ji}function na(){if(Fi)return Bi;Fi=1,Bi=function(o){for(var s,i=r.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),a=o.fieldsArray.slice().sort(r.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=o._fieldsArray.indexOf(l),d=l.resolvedType instanceof e?"int32":l.type,p=t.basic[d];s="m"+r.safeProp(l.name),l.map?(i("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|t.mapKey[l.keyType],l.keyType),void 0===p?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,s):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,d,s),i("}")("}")):l.repeated?(i("if(%s!=null&&%s.length){",s,s),l.packed&&void 0!==t.packed[d]?i("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",d,s)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",s),void 0===p?n(i,l,u,s+"[i]"):i("w.uint32(%i).%s(%s[i])",(l.id<<3|p)>>>0,d,s)),i("}")):(l.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,l.name),void 0===p?n(i,l,u,s):i("w.uint32(%i).%s(%s)",(l.id<<3|p)>>>0,d,s))}return i("return w")};var e=ra(),t=hi(),r=ea();function n(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}return Bi}function oa(){if(qi)return Gi;qi=1,Gi=u;var e=/[\s{}=;:[\],'"()<>]/g,t=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,r=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,n=/^ *[*/]+ */,o=/^\s*\*?\/*/,s=/\n/g,i=/\s/,a=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function l(e){return e.replace(a,function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}})}function u(a,c){a=a.toString();var u=0,d=a.length,p=1,g=0,f={},h=[],y=null;function m(e){return Error("illegal "+e+" (line "+p+")")}function v(e){return a.charAt(e)}function b(e,t,r){var i,l={type:a.charAt(e++),lineEmpty:!1,leading:r},u=e-(c?2:3);do{if(--u<0||"\n"===(i=a.charAt(u))){l.lineEmpty=!0;break}}while(" "===i||"\t"===i);for(var d=a.substring(e,t).split(s),h=0;h<d.length;++h)d[h]=d[h].replace(c?o:n,"").trim();l.text=d.join("\n").trim(),f[p]=l,g=p}function O(e){var t=C(e),r=a.substring(e,t);return/^\s*\/\//.test(r)}function C(e){for(var t=e;t<d&&"\n"!==v(t);)t++;return t}function I(){if(h.length>0)return h.shift();if(y)return function(){var e="'"===y?r:t;e.lastIndex=u-1;var n=e.exec(a);if(!n)throw m("string");return u=e.lastIndex,w(y),y=null,l(n[1])}();var n,o,s,g,f,I=0===u;do{if(u===d)return null;for(n=!1;i.test(s=v(u));)if("\n"===s&&(I=!0,++p),++u===d)return null;if("/"===v(u)){if(++u===d)throw m("comment");if("/"===v(u))if(c){if(g=u,f=!1,O(u-1)){f=!0;do{if((u=C(u))===d)break;if(u++,!I)break}while(O(u))}else u=Math.min(d,C(u)+1);f&&(b(g,u,I),I=!0),p++,n=!0}else{for(f="/"===v(g=u+1);"\n"!==v(++u);)if(u===d)return null;++u,f&&(b(g,u-1,I),I=!0),++p,n=!0}else{if("*"!==(s=v(u)))return"/";g=u+1,f=c||"*"===v(g);do{if("\n"===s&&++p,++u===d)throw m("comment");o=s,s=v(u)}while("*"!==o||"/"!==s);++u,f&&(b(g,u-2,I),I=!0),n=!0}}}while(n);var S=u;if(e.lastIndex=0,!e.test(v(S++)))for(;S<d&&!e.test(v(S));)++S;var R=a.substring(u,u=S);return'"'!==R&&"'"!==R||(y=R),R}function w(e){h.push(e)}function S(){if(!h.length){var e=I();if(null===e)return null;w(e)}return h[0]}return Object.defineProperty({next:I,peek:S,push:w,skip:function(e,t){var r=S();if(r===e)return I(),!0;if(!t)throw m("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t,r=null;return void 0===e?(t=f[p-1],delete f[p-1],t&&(c||"*"===t.type||t.lineEmpty)&&(r=t.leading?t.text:null)):(g<e&&S(),t=f[e],delete f[e],!t||t.lineEmpty||!c&&"/"!==t.type||(r=t.leading?null:t.text)),r}},"line",{get:function(){return p}})}return u.unescape=l,Gi}function sa(){if(Ki)return Vi;Ki=1,Vi=C,C.filename=null,C.defaults={keepCase:!1};var e=oa(),t=Qi(),r=Yi(),n=yi(),o=bi(),s=mi(),i=ra(),a=Ci(),c=Oi(),l=hi(),u=ea(),d=/^[1-9][0-9]*$/,p=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,f=/^-?0[x][0-9a-fA-F]+$/,h=/^0[0-7]+$/,y=/^-?0[0-7]+$/,m=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,v=/^[a-zA-Z_][a-zA-Z_0-9]*$/,b=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,O=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function C(I,w,S){w instanceof t||(S=w,w=new t),S||(S=C.defaults);var R,E,T,_,k,A=S.preferTrailingComment||!1,M=e(I,S.alternateCommentMode||!1),N=M.next,P=M.push,L=M.peek,D=M.skip,j=M.cmnt,U=!0,B=!1,F=w,x=S.keepCase?function(e){return e}:u.camelCase;function G(e,t,r){var n=C.filename;return r||(C.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+M.line+")")}function q(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw G(e);t.push(N()),D(e),e=L()}while('"'===e||"'"===e);return t.join("")}function V(e){var t=N();switch(t){case"'":case'"':return P(t),q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(d.test(e))return r*parseInt(e,10);if(g.test(e))return r*parseInt(e,16);if(h.test(e))return r*parseInt(e,8);if(m.test(e))return r*parseFloat(e);throw G(e,"number",t)}(t,!0)}catch(r){if(e&&b.test(t))return t;throw G(t,"value")}}function K(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=H(N()),D("to",!0)?H(N()):n]):e.push(q())}while(D(",",!0));var o={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Z(o,function(e){if("option"!==e)throw G(e);ee(o,e),D(";")},function(){ne(o)})}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw G(e,"id");if(p.test(e))return parseInt(e,10);if(f.test(e))return parseInt(e,16);if(y.test(e))return parseInt(e,8);throw G(e,"id")}function z(){if(void 0!==R)throw G("package");if(R=N(),!b.test(R))throw G(R,"name");F=F.define(R),D(";")}function $(){var e,t=L();switch(t){case"weak":e=T||(T=[]),N();break;case"public":N();default:e=E||(E=[])}t=q(),D(";"),e.push(t)}function W(){if(D("="),_=q(),!(B="proto3"===_)&&"proto2"!==_)throw G(_,"syntax");w.setOption("syntax",_),D(";")}function J(e,t){switch(t){case"option":return ee(e,t),D(";"),!0;case"message":return X(e,t),!0;case"enum":return Q(e,t),!0;case"service":return function(e,t){if(!v.test(t=N()))throw G(t,"service name");var r=new a(t);Z(r,function(e){if(!J(r,e)){if("rpc"!==e)throw G(e);!function(e,t){var r=j(),n=t;if(!v.test(t=N()))throw G(t,"name");var o,s,i,a,l=t;D("("),D("stream",!0)&&(s=!0);if(!b.test(t=N()))throw G(t);o=t,D(")"),D("returns"),D("("),D("stream",!0)&&(a=!0);if(!b.test(t=N()))throw G(t);i=t,D(")");var u=new c(l,n,o,i,s,a);u.comment=r,Z(u,function(e){if("option"!==e)throw G(e);ee(u,e),D(";")}),e.add(u)}(r,e)}}),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!b.test(t=N()))throw G(t,"reference");var r=t;Z(null,function(t){switch(t){case"required":case"repeated":Y(e,t,r);break;case"optional":Y(e,B?"proto3_optional":"optional",r);break;default:if(!B||!b.test(t))throw G(t);P(t),Y(e,"optional",r)}})}(e,t),!0}return!1}function Z(e,t,r){var n=M.line;if(e&&("string"!=typeof e.comment&&(e.comment=j()),e.filename=C.filename),D("{",!0)){for(var o;"}"!==(o=N());)t(o);D(";",!0)}else r&&r(),D(";"),e&&("string"!=typeof e.comment||A)&&(e.comment=j(n)||e.comment)}function X(e,t){if(!v.test(t=N()))throw G(t,"type name");var n=new r(t);Z(n,function(e){if(!J(n,e))switch(e){case"map":!function(e){D("<");var t=N();if(void 0===l.mapKey[t])throw G(t,"type");D(",");var r=N();if(!b.test(r))throw G(r,"type");D(">");var n=N();if(!v.test(n))throw G(n,"name");D("=");var s=new o(x(n),H(N()),t,r);Z(s,function(e){if("option"!==e)throw G(e);ee(s,e),D(";")},function(){ne(s)}),e.add(s)}(n);break;case"required":case"repeated":Y(n,e);break;case"optional":Y(n,B?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!v.test(t=N()))throw G(t,"name");var r=new s(x(t));Z(r,function(e){"option"===e?(ee(r,e),D(";")):(P(e),Y(r,"optional"))}),e.add(r)}(n,e);break;case"extensions":K(n.extensions||(n.extensions=[]));break;case"reserved":K(n.reserved||(n.reserved=[]),!0);break;default:if(!B||!b.test(e))throw G(e);P(e),Y(n,"optional")}}),e.add(n)}function Y(e,t,o){var i=N();if("group"!==i){for(;i.endsWith(".")||L().startsWith(".");)i+=N();if(!b.test(i))throw G(i,"type");var a=N();if(!v.test(a))throw G(a,"name");a=x(a),D("=");var c=new n(a,H(N()),i,t,o);if(Z(c,function(e){if("option"!==e)throw G(e);ee(c,e),D(";")},function(){ne(c)}),"proto3_optional"===t){var d=new s("_"+a);c.setOption("proto3_optional",!0),d.add(c),e.add(d)}else e.add(c);B||!c.repeated||void 0===l.packed[i]&&void 0!==l.basic[i]||c.setOption("packed",!1,!0)}else!function(e,t){var o=N();if(!v.test(o))throw G(o,"name");var s=u.lcFirst(o);o===s&&(o=u.ucFirst(o));D("=");var i=H(N()),a=new r(o);a.group=!0;var c=new n(s,i,o,t);c.filename=C.filename,Z(a,function(e){switch(e){case"option":ee(a,e),D(";");break;case"required":case"repeated":Y(a,e);break;case"optional":Y(a,B?"proto3_optional":"optional");break;case"message":X(a,e);break;case"enum":Q(a,e);break;default:throw G(e)}}),e.add(a).add(c)}(e,t)}function Q(e,t){if(!v.test(t=N()))throw G(t,"name");var r=new i(t);Z(r,function(e){switch(e){case"option":ee(r,e),D(";");break;case"reserved":K(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!v.test(t))throw G(t,"name");D("=");var r=H(N(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Z(n,function(e){if("option"!==e)throw G(e);ee(n,e),D(";")},function(){ne(n)}),e.add(t,r,n.comment,n.options)}(r,e)}}),e.add(r)}function ee(e,t){var r=D("(",!0);if(!b.test(t=N()))throw G(t,"name");var n,o=t,s=o;r&&(D(")"),s=o="("+o+")",t=L(),O.test(t)&&(n=t.slice(1),o+=t,N())),D("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,s,te(e,o),n)}function te(e,t){if(D("{",!0)){for(var r={};!D("}",!0);){if(!v.test(k=N()))throw G(k,"name");if(null===k)throw G(k,"end of input");var n,o=k;if(D(":",!0),"{"===L())n=te(e,t+"."+k);else if("["===L()){var s;if(n=[],D("[",!0)){do{s=V(!0),n.push(s)}while(D(",",!0));D("]"),void 0!==s&&re(e,t+"."+k,s)}}else n=V(!0),re(e,t+"."+k,n);var i=r[o];i&&(n=[].concat(i).concat(n)),r[o]=n,D(",",!0),D(";",!0)}return r}var a=V(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(D("[",!0)){do{ee(e,"option")}while(D(",",!0));D("]")}return e}for(;null!==(k=N());)switch(k){case"package":if(!U)throw G(k);z();break;case"import":if(!U)throw G(k);$();break;case"syntax":if(!U)throw G(k);W();break;case"option":ee(F,k),D(";");break;default:if(J(F,k)){U=!1;continue}throw G(k)}return C.filename=null,{package:R,imports:E,weakImports:T,syntax:_,root:w}}return Vi}function ia(){if($i)return Ks.exports;$i=1;var e=Ks.exports=function(){if(xi)return Hs.exports;xi=1;var e=Hs.exports=yr();return e.build="light",e.load=function(t,r,n){return"function"==typeof r?(n=r,r=new e.Root):r||(r=new e.Root),r.load(t,n)},e.loadSync=function(t,r){return r||(r=new e.Root),r.loadSync(t)},e.encoder=na(),e.decoder=wi(),e.verifier=Si(),e.converter=Ti(),e.ReflectionObject=ta(),e.Namespace=vi(),e.Root=Qi(),e.Enum=ra(),e.Type=Yi(),e.Field=yi(),e.OneOf=mi(),e.MapField=bi(),e.Service=Ci(),e.Method=Oi(),e.Message=Ii(),e.wrappers=Xi(),e.types=hi(),e.util=ea(),e.ReflectionObject._configure(e.Root),e.Namespace._configure(e.Type,e.Service,e.Enum),e.Root._configure(e.Type),e.Field._configure(e.Type),Hs.exports}();return e.build="full",e.tokenize=oa(),e.parse=sa(),e.common=function(){if(zi)return Hi;zi=1,Hi=r;var e,t=/\/|\./;function r(e,n){t.test(e)||(e="google/protobuf/"+e+".proto",n={nested:{google:{nested:{protobuf:{nested:n}}}}}),r[e]=n}return r("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),r("duration",{Duration:e={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),r("timestamp",{Timestamp:e}),r("empty",{Empty:{fields:{}}}),r("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),r("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),r("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),r.get=function(e){return r[e]||null},Hi}(),e.Root._configure(e.Type,e.parse,e.common),Ks.exports}var aa=g(Ji?Wi:(Ji=1,Wi=ia()));const ca=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},la=e=>{const t=e.name;return lt(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},ua=e=>{(window.URL||window.webkitURL).revokeObjectURL(e)},da=e=>{const t=e.match(/data:([^;]+)/)[1],r=e.replace(/^[^,]+,/,""),n=window.atob(r);let o=n.length;const s=new Uint8Array(n.length);for(;o--;)s[o]=n.charCodeAt(o);return new Blob([s],{type:t})},pa=1680,ga=160,fa=e=>new Promise((t,r)=>{const n=e=>{0!==e.width||0!==e.height?t(e):r()},o=new Image;if(o.addEventListener("load",e=>n(e.target)),o.addEventListener("error",r),o.src=e,o.complete)return void n(o);const s=setInterval(()=>{o.complete&&(n(o),clearInterval(s))},40)}),ha=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d"),o=function(e,t,r){let n=e,o=t,s=0,i=0;const a=e*t,c=r.maxWidth*r.maxHeight;if(a<=c)return s=(r.maxWidth-n)/2,i=(r.maxHeight-o)/2,{w:n,h:o,x:s,y:i};const l=Math.sqrt(c/a);return n=e*l,o=t*l,s=(r.maxWidth-n)/2,i=(r.maxHeight-o)/2,{w:n,h:o,x:s,y:i}}(e.width,e.height,t);r.width=o.w,r.height=o.h,n.fillStyle="#FFFFFF",n.fillRect(0,0,r.width,r.height),n?.drawImage(e,0,0,o.w,o.h);try{let e=r.toDataURL("image/jpeg",t.quality);return da(e)}catch(e){throw new Error(e)}};function ya(e){const t=Math.max(0,e),r=t%60,n=Math.floor(t/60%60),o=Math.floor(t/3600);return o>0?`${o}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${n}:${r.toString().padStart(2,"0")}`}const ma={maxHeight:500,maxWidth:500,quality:.6,scale:2.4};class va{async create(e,t){try{const r=ca(e),n=await fa(r);let o,s,i;if(ua(r),t?.full)o=e,s=n.width,i=n.height;else{const t=((e,t=1,r="image/jpeg")=>{t=Math.min(1,t);const n=e.width,o=e.height;let s=n,i=o;if(t<1){const e=n<o,t=e?o/pa:n/pa;n>pa&&o>pa?e?(i=pa,s/=t):(s=pa,i/=t):n>pa&&o>ga?(s=pa,i/=t,i<ga&&(i=ga,s=n/(o/ga))):o>pa&&n>ga&&(i=pa,s/=t,s<ga&&(s=ga,i=o/(n/ga)))}s=Math.floor(s),i=Math.floor(i);const a=document.createElement("canvas");a.width=s,a.height=i;const c=a.getContext("2d");return c.fillStyle="#FFF",c.fillRect(0,0,s,i),c.drawImage(e,0,0,n,o,0,0,s,i),r&&"image/png"!=r||(r="image/jpeg"),{imageFile:da(a.toDataURL(r,Math.min(.92,t))),compressWidth:s,compressHeight:i}})(n,.85,e.type);o=t.imageFile,s=t.compressWidth,i=t.compressHeight}const a=ha(n,ma);return{success:!0,message:new rs({thumbnailObjectKey:ca(a),originalObjectKey:ca(o),width:s,height:i}),files:[a,o]}}catch(e){return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n,o],encryptedKey:s}=t;return r.originalObjectKey=o,r.thumbnailObjectKey=n,r.encryptKey=s,r}}class ba{async create(e){if(e.size>2097152)return{success:!1};try{const t=ca(e),r=await fa(t);return{success:!0,message:new ns({originalObjectKey:t,extension:la(e),width:r.width,height:r.height}),files:[e]}}catch{return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.originalObjectKey=n,r.encryptKey=o,r}}let Oa;class Ca{create(e){return(t=e,dt(t.arrayBuffer)?t.arrayBuffer():new Promise((e,r)=>{const n=new FileReader;n.addEventListener("load",t=>{t.target?e(t.target.result):r("null")}),n.addEventListener("error",e=>r(e)),n.readAsArrayBuffer(t)})).then(this.getAudioInfo).then(t=>({success:!0,message:new os({audioObjectKey:ca(e),length:t.duration,extension:la(e)}),files:[e]})).catch(()=>({success:!1}));var t}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.audioObjectKey=n,r.encryptKey=o,r}getAudioInfo(e){const t=Oa||new AudioContext;return Oa=t,new Promise((r,n)=>{t.decodeAudioData(e,function(e){r({duration:e.duration,length:e.length})},n)})}}class Ia{async create(e){return e.size>104857600?{success:!1}:{success:!0,message:new ss({fileKey:"",title:e.name,extension:la(e),size:e.size}),files:[e]}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.fileKey=n,r.encryptKey=o,r}}class wa{async create(e){try{if(e.size>104857600)return{success:!1};const t=ca(e),r=document.createElement("video");r.src=t,await new Promise((e,t)=>{r.onloadedmetadata=e,r.onerror=t}),r.currentTime=.001,await new Promise(e=>{r.onseeked=e});const n=r.duration,o=r.videoWidth,s=r.videoHeight,i=Math.min(ma.maxWidth/o,ma.maxHeight/s,ma.scale),a=Math.floor(o*i),c=Math.floor(s*i),l=document.createElement("canvas");l.width=a,l.height=c;const u=l.getContext("2d");u?.drawImage(r,0,0,a,c);const d=await new Promise(e=>{l.toBlob(t=>e(t),"image/jpeg",ma.quality)});return ua(t),{success:!0,message:new is({videoObjectKey:"",thumbnailObjectKey:"",during:ya(n),width:o,height:s,extension:la(e)}),files:[e,d]}}catch(e){return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n,o],encryptedKey:s}=t;return r.videoObjectKey=n,r.thumbnailObjectKey=o,r.encryptKey=s,r}}var Sa;!function(e){e[e.IMAGE=1]="IMAGE",e[e.GIF=2]="GIF",e[e.AUDIO=3]="AUDIO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT"}(Sa||(Sa={}));async function Ra(e,t,r){return La(e,t,r)}const Ea=Na.bind(null,Sa.IMAGE),Ta=Na.bind(null,Sa.GIF),_a=Na.bind(null,Sa.AUDIO),ka=Na.bind(null,Sa.SIGHT),Aa=Na.bind(null,Sa.FILE),Ma=async(e,r)=>{const o=Yn(e);io.addMessage(r.messageUId);const s=await((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.RecallGroupMessage,{groupId:Nr.fromString(e),msgId:Nr.fromString(t)},{encoder:zn,decoder:Er}):cn.send(Et.RecallPrivateMessage,{destId:Nr.fromString(e),msgId:Nr.fromString(t)},{encoder:En,decoder:Er}),r})(o,r.messageUId);if(s.code!==t.SUCCESS)return{code:s.code};const i=new Is({messageUId:r.messageUId}),c={conversation:e,senderUserId:rn.uid,messageId:0,sentTime:ro().toString()},l=Mo(i,c,a.SENT);return l.burnAfterReadingFlag=!1,l.burnAfterReadingTime=0,Ao.get().setConversationCacheByMessage(l),{code:t.SUCCESS,data:l}};async function Na(e,r,n,o,s){const i=(e=>{let t;switch(e){case Sa.IMAGE:t=new va;break;case Sa.AUDIO:t=new Ca;break;case Sa.GIF:t=new ba;break;case Sa.FILE:t=new Ia;break;case Sa.SIGHT:t=new wa}return t})(e);if(!i)return{code:t.NOT_SUPPORT};const{success:a,message:c,files:l}=await i.create(n.file,s);if(!a||!c||!l)return{code:t.MEDIA_EXCEPTION};c.content.user=n.user,c.content.extra=n.extra;const u=Rt.getUploader();try{const e=await u.prepare(l);return c.content=i.updateMessageRemoteUrlProperty(c.content,{urls:e.items.map(e=>e.url),encryptedKey:e.encryptKey}),La(r,c,s,{uploadItems:e,task:(e,t)=>new Promise(r=>{u.upload(t,{onProgress:e=>o?.onProgress?.(e),onError:()=>{r({finished:!1,message:e})},onCompleted:t=>{r({finished:!0,message:o?.onComplete?.(t)??e})}})})})}catch(e){return{code:t.UPLOAD_FILE_FAILED}}}const Pa=async(e,r,o)=>{const s=await Da({conversationType:r.conversationType,targetId:r.targetId},e,r,o);if(s.code!==t.SUCCESS||!s.message||!s.sentArgs)return{code:s.code};const c=Mo(s.message,s.sentArgs);c.quotedReply=r,await Ba(c,s.sentArgs);const l=Yn(r),u=await uo.getDialogAesKey(l.toString());if(!u)return c.sentStatus=a.FAILED,await Ba(c,s.sentArgs),{code:t.MSG_ENCRYPT_ERROR,data:c};let d,p,g,f;if(e.messageType===vo.TEXT){let t=Oo(e.content),r=t.content;delete t.content,d=ho(r,u),p=JSON.stringify(gt(t))}else p=JSON.stringify(gt(e.content));const h=ho(p,u);if(r){if(r.messageType===vo.TEXT){let e=Oo(r.content),t=e.content;delete e.content,g=ho(t,u),f=JSON.stringify(gt(e))}else f=JSON.stringify(gt(r.content));f=ho(f,u)}oo.addMessage(s.sentArgs.messageId);const y={localId:Nr.fromNumber(s.sentArgs.messageId),mediaFlag:e.messageType!==vo.TEXT,mediaConstructor:e.messageType,msgPreContent:"",msgPostContent:d,mediaAttribute:h,msgIdReferenced:Nr.fromString(r.messageUId),msgSrcIdReferenced:Nr.fromString(r.senderUserId),msgDestIdReferenced:r.messageDirection==i.RECEIVE?Nr.fromString(rn.uid):Nr.fromString(r.targetId),msgPostContentReferenced:g,mediaFlagReferenced:r.messageType!==vo.TEXT,mediaConstructorReferenced:r.messageType,mediaAttributeReferenced:f,msgSendTimeReferenced:Nr.fromString(r.sentTime)};let m;if(r.conversationType===n.GROUP){const t={...y,groupId:Nr.fromString(l)};if(tt(e.content.mentionedInfo)){const r=e.content.mentionedInfo;if(r.userList?.length){t.at=r.userList.map(e=>Nr.fromString(e.uin));const e=JSON.stringify({atInfo:JSON.stringify(r.userList)});t.msgPreContent=e}}m=await(v=t,cn.send(Et.SendQuoteGroupChatMessage,v,{encoder:Jn,decoder:Zn}))}else{const e={...y,destId:Nr.fromString(l)};m=await(e=>cn.send(Et.SendQuotePrivateChatMessage,e,{encoder:jn,decoder:Un}))(e)}var v;const b=Oo(c);return m.code===t.SUCCESS?(b.sentTime=m.data.msgSendTime.toString(),b.messageUId=m.data.msgId.toString(),b.sentStatus=a.SENT,await Ba(b,s.sentArgs)):(b.sentStatus=a.FAILED,await Ba(b,s.sentArgs)),{code:m.code,data:b}};async function La(e,r,o,s){const i=await Da(e,r,null,o,s?.uploadItems);if(i.code!==t.SUCCESS||!i.message||!i.sentArgs)return{code:i.code};{const e=Mo(i.message,i.sentArgs);await Ba(e,i.sentArgs)}let{message:c,sentArgs:l}=i;if(tt(s)){const e=await s.task(c,s.uploadItems);if(c=e.message,!e.finished){const e=Mo(i.message,i.sentArgs,a.FAILED);return await Ba(e,l),{code:t.UPLOAD_FILE_FAILED,data:e}}}return async function(e,r){const o=Yn(r.conversation),s=Mo(e,r),i=await uo.getDialogAesKey(o.toString());if(!i)return s.sentStatus=a.FAILED,await Ba(s,r),{code:t.MSG_ENCRYPT_ERROR,data:s};let c,l;if(e.messageType===vo.TEXT){let t=Oo(e.content),r=t.content;delete t.content,c=ho(r,i),l=JSON.stringify(gt(t))}else l=JSON.stringify(gt(e.content));const u=ho(l,i);oo.addMessage(r.messageId);const d={localId:Nr.fromNumber(r.messageId),mediaFlag:e.messageType!==vo.TEXT,mediaConstructor:e.messageType,msgPreContent:"",msgPostContent:c,mediaAttribute:u};let p;if(r.conversation.conversationType===n.GROUP){const t={...d,groupId:Nr.fromString(o)};if(tt(e.content.mentionedInfo)){const r=e.content.mentionedInfo;if(r.userList?.length){t.at=r.userList.map(e=>Nr.fromString(e.uin));const e=JSON.stringify({atInfo:JSON.stringify(r.userList)});t.msgPreContent=e}}p=await(g=t,cn.send(Et.SendGroupChatMessage,g,{encoder:qn,decoder:Vn}))}else{const e={...d,destId:Nr.fromString(o)};p=await(e=>cn.send(Et.SendPrivateChatMessage,e,{encoder:gn,decoder:fn}))(e)}var g;p.code===t.SUCCESS?(s.sentTime=p.data.msgSendTime.toString(),s.messageUId=p.data.msgId.toString(),s.sentStatus=a.SENT,await Ba(s,r)):(s.sentStatus=a.FAILED,await Ba(s,r));return{code:p.code,data:s}}(c,l)}async function Da(e,r,n,o,s){if(((e,t="utf-8")=>{let r=0;if("utf-16"===t)for(let t=0,n=e.length;t<n;t++)r+=e.charCodeAt(t)<=65535?2:4;else for(let t=0,n=e.length;t<n;t++){const n=e.charCodeAt(t);r+=n<127?1:n<=2047?2:n<=65535?3:4}return r})(JSON.stringify(gt(r.content)))>81920)return{code:t.RC_MSG_CONTENT_EXCEED_LIMIT};r.isPersited&&await Ao.get().loadConvsationsIfNotExist([e]);const i={conversation:e,senderUserId:rn.uid,messageId:zo(),sentTime:Ua().toString(),pushConfig:o?.pushConfig};if(o?.onSendBefore){const e=Mo(r,i);n&&(e.quotedReply=n),o.onSendBefore(e,s)}return{code:t.SUCCESS,message:r,sentArgs:i}}let ja=1;function Ua(){ja++;const e=ro();return ja<e&&(ja=e),ja}async function Ba(e,t){try{const r=Xo.get();if(e.isPersited&&r){await r.upsertMessage(e);const n=await r.getLatestMessage(t.conversation);let o=e;n&&Nr.fromString(n.sentTime).greaterThan(Nr.fromString(e.sentTime))&&(o=n),Ao.get().updateLatestMessage(t.conversation,o)}}catch(e){ks.error("saveSentMessage -> ",e)}}class Fa extends So{options;static imClient;libLoader;constructor(e){if(Fa.imClient)return ks.warn("Please do not perform the init method repeatedly"),Fa.imClient;super(),this.options=e,this.fixedProtobuf(),tt(e.logLevel)&&ks.setLogLevel(e.logLevel),tt(e.logStdout)&&ks.setLogStdout(e.logStdout),ks.debug("IMClient.init -> "),tt(e.uploader)&&Rt.setUploader(e.uploader),Rt.setDeviceCode(e.deviceCode),Rt.setDeviceType(e.deviceType),this.libLoader=ws.init(e),this.watch(),Fa.imClient=this}fixedProtobuf(){aa.util.Long=Nr,aa.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(d.CONNECTING)},onConnected:()=>{this.emit(d.CONNECTED)},onDisconnect:()=>{this.emit(d.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(d.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:e=>{this.emit(d.MESSAGES,{messages:e})},pullFinished:()=>{this.emit(d.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:e=>{this.emit(d.CONVERSATION,{conversations:e})},onPush:(e,t)=>{this.emit(d.PUSH,{cmdId:e,body:t})},onRecall:e=>{e.forEach(e=>{this.emit(d.RECALL,e)})},onReceiptReceived:(e,t)=>{Xo.get()?.updateMessageReceiptStatus(e,t),0===t?this.emit(d.ARRIVAL_RECEIPT_RECEIVED,e):this.emit(d.READ_RECEIPT_RECEIVED,e)}})}connect(){return this.libLoader.connect()}disconnect(){return this.libLoader.disconnect()}setUserLogged(e){e.uid!==rn.uid.toString()&&(rn.setLogged(e),this.libLoader.setUserLogged())}logOut(){rn.logOut(),this.libLoader.setUserLogout()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}getServerTime=ro;async insertMessage(e,r,n){(!r.messageId||r.messageId>Wo())&&(r.messageId=zo()),Ao.get().setConversationCacheByMessage(r);try{const e=Xo.get();if(r.isPersited&&e){await e.upsertMessage(r);const t=await e.getLatestMessage(r);let n=r;t&&Nr.fromString(t.sentTime).greaterThan(Nr.fromString(r.sentTime))&&(n=t),Ao.get().updateLatestMessage(r,n)}}catch(e){ks.error("insertMessage -> ",e)}return{code:t.SUCCESS,data:r}}sendMessage=Ra;sendImageMessage=Ea;sendGIFMessage=Ta;sendHQVoiceMessage=_a;sendFileMessage=Aa;sendSightMessage=ka;async recallMsg(e,t){return await Ma(e,t)}sendQuoteReplyMessage=Pa;async getRemoteHistoryMessages(e,n){const o=n.timestamp??"0",s=n.count??20,i=Yn(e);return(e=>{const t={dialogKeys:e.dialogId,newToOld:e.newToOld,rows:e.count};return e.newToOld?t.offset=Nr.fromString(e.offset):t.oldOffset=Nr.fromString(e.offset),cn.send(Et.GetRemoteMessages,t,{encoder:Tn,decoder:_n})})({dialogId:i,offset:o,count:s,newToOld:0===n.order}).then(({code:e,data:n})=>new Promise(o=>{e===t.SUCCESS?Bo.parse({[i]:n.msg??{}},{[i]:n.reference??{}},(e,r)=>{const s=r.get(i)??[];s.sort((e,t)=>Nr.fromString(e.sentTime).lessThan(Nr.fromString(t.sentTime))?-1:1),o({code:t.SUCCESS,data:{list:s,hasMore:!n.isEnd}})}):o({code:e,msg:r(e)})}))}async getPreviousHistoryMessages(e,r,n=20){const o=await Xo.get().getPreviousMessages(e,r??"0",n);if(!r&&o.messages.length&&Ao.get().updateLatestMessage(e,o.messages[o.messages.length-1]),o.messages.length>=n||!o.hasMore)return{code:t.SUCCESS,data:{list:o.messages,hasMore:o.hasMore}};const s=o.messages[0]?.sentTime??r,i=await this.getRemoteHistoryMessages(e,{timestamp:s,count:n-o.messages.length,order:0});if(i.code!==t.SUCCESS)return i;const a=i.data.list;for(let e=a.length-1;e>=0;e--){const t=a[e];(!t.messageId||t.messageId>Wo())&&(t.messageId=$o())}return s&&"0"!=s||Ao.get().updateLatestMessage(e,a[a.length-1]),Xo.get().addMessages(a,e,!i.data.hasMore),{code:t.SUCCESS,data:{list:[...i.data.list,...o.messages],hasMore:i.data.hasMore}}}async deleteRemoteMessage(e,r){const n=await(o=Yn(e),s=r.map(e=>e.messageUId),cn.send(Et.DeleteChatMessages,{destId:Nr.fromString(o),msgIdList:s.map(e=>Nr.fromString(e))},{encoder:On,decoder:Er})).then(e=>e.code);var o,s;if(n===t.SUCCESS){const t=await(Xo.get()?.getLatestMessage(e));if(await(Xo.get()?.removeMessagesByUId(r.map(e=>e.messageUId))),t&&r.some(e=>e.messageUId===t.messageUId)){const t=await(Xo.get()?.getLatestMessage(e));Ao.get().updateLatestMessage(e,t)}}return n}async deleteHistoryMessages(e){return Xo.get()?.clearConversationCache(e),Ao.get().clearHistoryMessages(e),(t=Yn(e),cn.send(Et.ClearChatHistoryMessage,{destId:t},{encoder:Cn,decoder:Er})).then(e=>e.code);var t}async getConversationList(e,r,n,o){const s={rows:e,type:r??0,offset:Nr.fromNumber(n),newToOld:0===o},{code:i,data:a}=await(e=>cn.send(Et.GetDialogList,e,{encoder:kn,decoder:An}))(s);if(i!==t.SUCCESS)return{code:i};const c=a.fullDialog.map(e=>e.dialog?.destId).filter(tt);await uo.getDialogAesKeyList(c.map(e=>e.toString()));let l=1e4;const u=[];for(const e of a.fullDialog){const t=this.formatConversation(e);if(!t)continue;const r={conversationType:t.conversationType,targetId:t.targetId},n=t.latestMessage;t.latestMessage=await(Xo.get()?.getLatestMessage(r));const o=Ao.get().get(r);o||Object.assign(t,o),tt(t.latestMessage)&&!t.updateTime&&(t.updateTime=parseInt(t.latestMessage.sentTime)),t.updateTime||(n?t.updateTime=parseInt(n.sentTime):(t.updateTime=l,l++)),Ao.get().addLocalConversation(t),u.push(t)}return u.sort((e,t)=>(e.updateTime??0)-(t.updateTime??0)),{code:t.SUCCESS,data:u}}getBlockConversationList(){const e=Ao.get().getBlockConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}getTopConversationList(){const e=Ao.get().getTopConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}async getConversation(e){const r=Ao.get().get(e);if(!r)return{code:t.CONVER_GET_ERROR};const n=await(Xo.get()?.getLatestMessage(e)),o={...e,...r,updateTime:tt(n?.sentTime)?parseInt(n.sentTime):void 0,latestMessage:n};return{code:t.SUCCESS,data:o}}removeConversation(e){return Ao.get().remove(e),(t=Yn(e),cn.send(Et.DeletePrivateDialog,{destId:Nr.fromString(t)},{encoder:hn,decoder:Er})).then(e=>e.code);var t}getUnreadMentionedCount(e){return Ao.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return Ao.get().getAllUnreadMentionedCount()}getConversationState(e){return Ao.get().getConversationState(e)}getAllConversationState(){return Ao.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return Ao.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return Ao.get().getUnreadCount(e)}clearConversationUnreadCount(e){Ao.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){Ao.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return Ao.get().getNotificationLevel(e)}setConversationNotificationStatus(e,t){return((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.UpdateGroupChatMuteConfig,{groupId:Nr.fromString(e),muteFlag:t},{encoder:Hn,decoder:Er}):cn.send(Et.UpdatePrivateChatMuteConfig,{destId:Nr.fromString(e),muteFlag:t},{encoder:bn,decoder:Er}),r})(Yn(e),t===s.OPEN).then(r=>(!r.code&&Ao.get().addStatus({...e,notificationStatus:t,notificationLevel:t==s.OPEN?l.AT_USER_NOTIFICATION:l.NOT_SET},!0),r.code))}getConversationNotificationStatus(e){return Ao.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.UpdateGroupChatStickyConfig,{groupId:Nr.fromString(e),stickyFlag:t},{encoder:Kn,decoder:Er}):cn.send(Et.UpdatePrivateChatStickyConfig,{destId:Nr.fromString(e),stickyFlag:t},{encoder:vn,decoder:Er}),r})(Yn(e),t).then(r=>(!r.code&&Ao.get().addStatus({...e,isTop:t},!0),r.code))}saveConversationMessageDraft(e,t){Ao.get().setDraft(e,t)}getConversationMessageDraft(e){return Ao.get().getDraft(e)}clearConversationMessageDraft(e){Ao.get().clearDraft(e)}async sendReadReceipts(e){await(qo.get()?.sendReadReceipts(e))}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId;if(!tt(n))return;const o=wo(t);if(!o)return;const s=uo.getDialogAesKeyFromLocal(n.toString());if(s){if(tt(r)){const e=Bo.parseSingleDialogMessages(n.toString(),[r],s,{})[0];o.latestMessage=e}return o}}async clearBurnAfterReadingExpiredMessages(e){const t=Xo.get();if(!t)return Promise.resolve([]);const r=await t.getLatestMessage(e),n=await t.clearBurnAfterReadingExpiredMessages(e);if(r&&n.includes(r.messageUId)){const r=await t.getLatestMessage(e);Ao.get().updateLatestMessage(e,r)}return n}async getMessageById(e){return Xo.get()?.getMessageById(e)}async getMessageByUId(e){return Xo.get()?.getMessageByUId(e)}}const xa=mr.Reader,Ga=mr.Writer,qa=mr.util,Va=mr.roots.default||(mr.roots.default={}),Ka=Va.AuthSignIn2Req=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.langCode="",e.prototype.phoneNum="",e.prototype.password="",e.prototype.appVersionCode=0,e.prototype.deviceType=0,e.prototype.imei="",e.prototype.brand="",e.prototype.model="",e.prototype.apnsToken="",e.prototype.bandId="",e.prototype.appVersion="",e.prototype.osVersion="",e.prototype.version=0,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(10).string(e.langCode),null!=e.phoneNum&&Object.hasOwnProperty.call(e,"phoneNum")&&t.uint32(18).string(e.phoneNum),null!=e.password&&Object.hasOwnProperty.call(e,"password")&&t.uint32(26).string(e.password),null!=e.appVersionCode&&Object.hasOwnProperty.call(e,"appVersionCode")&&t.uint32(32).int32(e.appVersionCode),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(40).int32(e.deviceType),null!=e.imei&&Object.hasOwnProperty.call(e,"imei")&&t.uint32(50).string(e.imei),null!=e.brand&&Object.hasOwnProperty.call(e,"brand")&&t.uint32(58).string(e.brand),null!=e.model&&Object.hasOwnProperty.call(e,"model")&&t.uint32(66).string(e.model),null!=e.apnsToken&&Object.hasOwnProperty.call(e,"apnsToken")&&t.uint32(74).string(e.apnsToken),null!=e.bandId&&Object.hasOwnProperty.call(e,"bandId")&&t.uint32(82).string(e.bandId),null!=e.appVersion&&Object.hasOwnProperty.call(e,"appVersion")&&t.uint32(90).string(e.appVersion),null!=e.osVersion&&Object.hasOwnProperty.call(e,"osVersion")&&t.uint32(98).string(e.osVersion),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(104).int32(e.version),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.AuthSignIn2Req;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.langCode=e.string();break;case 2:n.phoneNum=e.string();break;case 3:n.password=e.string();break;case 4:n.appVersionCode=e.int32();break;case 5:n.deviceType=e.int32();break;case 6:n.imei=e.string();break;case 7:n.brand=e.string();break;case 8:n.model=e.string();break;case 9:n.apnsToken=e.string();break;case 10:n.bandId=e.string();break;case 11:n.appVersion=e.string();break;case 12:n.osVersion=e.string();break;case 13:n.version=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2Req"},e})(),Ha=Va.AuthSignIn2Resp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.sessionId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.prototype.frozenDays=0,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.noNickName&&Object.hasOwnProperty.call(e,"noNickName")&&t.uint32(40).bool(e.noNickName),null!=e.noEmail&&Object.hasOwnProperty.call(e,"noEmail")&&t.uint32(48).bool(e.noEmail),null!=e.cert&&Object.hasOwnProperty.call(e,"cert")&&t.uint32(58).string(e.cert),null!=e.userFileDomain&&Object.hasOwnProperty.call(e,"userFileDomain")&&t.uint32(74).string(e.userFileDomain),null!=e.dialogFileDomain&&Object.hasOwnProperty.call(e,"dialogFileDomain")&&t.uint32(82).string(e.dialogFileDomain),null!=e.user&&Object.hasOwnProperty.call(e,"user")&&Va.User.encode(e.user,t.uint32(90).fork()).ldelim(),null!=e.frozenDays&&Object.hasOwnProperty.call(e,"frozenDays")&&t.uint32(104).int32(e.frozenDays),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.AuthSignIn2Resp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Va.User.decode(e,e.uint32());break;case 13:n.frozenDays=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2Resp"},e})();Va.User=(()=>{function e(e){if(this.aliasMobile=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.uid=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.nickName="",e.prototype.langCode="",e.prototype.phone="",e.prototype.numberInPhoneBook="",e.prototype.smallAvatarUrl="",e.prototype.originalAvatarUrl="",e.prototype.email="",e.prototype.qrcodeString="",e.prototype.gender=0,e.prototype.contactStatus=0,e.prototype.alias="",e.prototype.aliasMobile=qa.emptyArray,e.prototype.aliasDesp="",e.encode=function(e,t){if(t||(t=Ga.create()),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(8).int64(e.uid),null!=e.nickName&&Object.hasOwnProperty.call(e,"nickName")&&t.uint32(18).string(e.nickName),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(26).string(e.langCode),null!=e.phone&&Object.hasOwnProperty.call(e,"phone")&&t.uint32(34).string(e.phone),null!=e.numberInPhoneBook&&Object.hasOwnProperty.call(e,"numberInPhoneBook")&&t.uint32(42).string(e.numberInPhoneBook),null!=e.smallAvatarUrl&&Object.hasOwnProperty.call(e,"smallAvatarUrl")&&t.uint32(50).string(e.smallAvatarUrl),null!=e.originalAvatarUrl&&Object.hasOwnProperty.call(e,"originalAvatarUrl")&&t.uint32(58).string(e.originalAvatarUrl),null!=e.email&&Object.hasOwnProperty.call(e,"email")&&t.uint32(66).string(e.email),null!=e.qrcodeString&&Object.hasOwnProperty.call(e,"qrcodeString")&&t.uint32(74).string(e.qrcodeString),null!=e.gender&&Object.hasOwnProperty.call(e,"gender")&&t.uint32(80).int32(e.gender),null!=e.contactStatus&&Object.hasOwnProperty.call(e,"contactStatus")&&t.uint32(88).int32(e.contactStatus),null!=e.alias&&Object.hasOwnProperty.call(e,"alias")&&t.uint32(98).string(e.alias),null!=e.aliasMobile&&e.aliasMobile.length)for(let r=0;r<e.aliasMobile.length;++r)t.uint32(106).string(e.aliasMobile[r]);return null!=e.aliasDesp&&Object.hasOwnProperty.call(e,"aliasDesp")&&t.uint32(114).string(e.aliasDesp),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.User;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.uid=e.int64();break;case 2:n.nickName=e.string();break;case 3:n.langCode=e.string();break;case 4:n.phone=e.string();break;case 5:n.numberInPhoneBook=e.string();break;case 6:n.smallAvatarUrl=e.string();break;case 7:n.originalAvatarUrl=e.string();break;case 8:n.email=e.string();break;case 9:n.qrcodeString=e.string();break;case 10:n.gender=e.int32();break;case 11:n.contactStatus=e.int32();break;case 12:n.alias=e.string();break;case 13:n.aliasMobile&&n.aliasMobile.length||(n.aliasMobile=[]),n.aliasMobile.push(e.string());break;case 14:n.aliasDesp=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/User"},e})();const za=Va.WebGetLoginCodeReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.account="",e.prototype.langCode="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.account&&Object.hasOwnProperty.call(e,"account")&&t.uint32(10).string(e.account),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(18).string(e.langCode),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.account=e.string();break;case 2:n.langCode=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeReq"},e})(),$a=Va.WebGetLoginCodeResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeResp"},e})(),Wa=Va.WebGetLoginCodeVerifyReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.account="",e.prototype.langCode="",e.prototype.code="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.account&&Object.hasOwnProperty.call(e,"account")&&t.uint32(10).string(e.account),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(18).string(e.langCode),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(26).string(e.code),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeVerifyReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.account=e.string();break;case 2:n.langCode=e.string();break;case 3:n.code=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeVerifyReq"},e})(),Ja=Va.ClickOKToWebResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.sessionId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.noNickName&&Object.hasOwnProperty.call(e,"noNickName")&&t.uint32(40).bool(e.noNickName),null!=e.noEmail&&Object.hasOwnProperty.call(e,"noEmail")&&t.uint32(48).bool(e.noEmail),null!=e.cert&&Object.hasOwnProperty.call(e,"cert")&&t.uint32(58).string(e.cert),null!=e.userFileDomain&&Object.hasOwnProperty.call(e,"userFileDomain")&&t.uint32(74).string(e.userFileDomain),null!=e.dialogFileDomain&&Object.hasOwnProperty.call(e,"dialogFileDomain")&&t.uint32(82).string(e.dialogFileDomain),null!=e.user&&Object.hasOwnProperty.call(e,"user")&&Va.User.encode(e.user,t.uint32(90).fork()).ldelim(),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.ClickOKToWebResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Va.User.decode(e,e.uint32());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ClickOKToWebResp"},e})();let Za;const Xa=e=>{Za=Za||new Fa(e)},Ya=async()=>{console.log("imlib-web connect ->");const e=await Za.connect();return e.code===t.SUCCESS?{code:e.code}:{code:e.code,msg:r(e.code)}},Qa=()=>Za.disconnect(),ec=e=>{Za.setUserLogged(e)},tc=()=>{Za.logOut()},rc=()=>Za.getConnectionStatus(),nc=(e,t,r,n=3e4)=>(console.log("imlib-web request ->",e,t,r,n),cn.request(e,t,r,n)),oc=()=>Za.getServerTime(),sc=(e,t,r)=>{Za.on(e,t,r)};function ic(e,t,r){Za.once(e,t,r)}const ac=(e,t,r)=>{Za?.off(e,t,r)},cc=async e=>{ks.debug("get conversation list ->");const{code:n,data:o}=await Za.getConversationList(e?.count??20,null,e?.startTime??0,e?.order??0);return n!==t.SUCCESS&&ks.warn("get conversation list fail ->"+n+":"+r(n)),{code:n,msg:r(n),data:o}},lc=async e=>{Bs("options",e,js,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get conversation ->"+n);const{code:o,data:s}=await Za.getConversation(e);return o!==t.SUCCESS?(ks.warn("get conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o,data:s}},uc=async e=>{Bs("options",e,js,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("remove conversation ->"+n);const o=await Za.removeConversation(e);return o!==t.SUCCESS?(ks.warn("remove conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o}},dc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get draft ->"+r);const n=Za.getConversationMessageDraft(e);return Promise.resolve({code:t.SUCCESS,data:n})},pc=(e,r)=>{Bs("options",e,js,!0),Bs("draft",r,As,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("set draft ->"+n),Za.saveConversationMessageDraft(e,r),Promise.resolve({code:t.SUCCESS})},gc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("delete draft ->"+r),Za.clearConversationMessageDraft(e),Promise.resolve({code:t.SUCCESS})},fc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:t.SUCCESS,data:Za.getUnreadMentionedCount(e)})},hc=()=>{ks.debug("getAllUnreadMentionedCount");const e=Za.getAllUnreadMentionedCount();return Promise.resolve({code:t.SUCCESS,data:e})},yc=e=>(ks.debug("getConversationState"),Za.getConversationState(e)),mc=()=>{ks.debug("getAllConversationState");const e=Za.getAllConversationState();return Promise.resolve({code:t.SUCCESS,data:e})},vc=(e,r)=>{if(ks.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+e),Bs("includeMuted",e,Ns,!1),Bs("conversationTypes",r,Ls,!1),r)for(const e of r)Bs("conversationType",e,Ds,!0);const n=Za.getAllConversationUnreadCount(r??[],e??!1);return Promise.resolve({code:t.SUCCESS,data:n})},bc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get unreadCount ->"+r);const n=Za.getConversationUnreadCount(e);return Promise.resolve({code:t.SUCCESS,data:n})},Oc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("clear unreadMsgNum ->"+r),Za.clearConversationUnreadCount(e),Promise.resolve({code:t.SUCCESS})},Cc=()=>(ks.debug("clear allMessagesUnreadStatus"),Za.clearAllConversationsUnreadCount(),Promise.resolve({code:t.SUCCESS})),Ic=e=>{Bs("options",e,js,!0),ks.info("getConversationNotificationLevel ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Za.getConversationNotificationLevel(e);return Promise.resolve({code:t.SUCCESS,data:r})},wc=async(e,n)=>{Bs("options",e,js,!0),Bs("notificationStatus",n,e=>1===e||2===e,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("set conversation status ->"+o);const s=await Za.setConversationNotificationStatus(e,n);return s!==t.SUCCESS?(ks.warn("set conversation status fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:s}},Sc=e=>{Bs("options",e,js,!0),ks.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Za.getConversationNotificationStatus(e);return Promise.resolve({code:t.SUCCESS,data:r})},Rc=()=>Za.getBlockConversationList(),Ec=async(e,n=!0)=>{Bs("options",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("set conversation status ->"+o);const s=await Za.setConversationToTop(e,n);return s!==t.SUCCESS?(ks.warn("set conversation status fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:s}},Tc=()=>Za.getTopConversationList(),_c=(e,t,r,n)=>{let o=function(o){return new Qo(e,o,t,r,n)};return co(e,o),o},kc=async(e,t,r)=>Za.insertMessage(e,t,r),Ac=async(e,r,n)=>{if(r instanceof Qo==!1)return ks.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:t.PARAMETER_ERROR};Bs("conversation",e,js,!0),$c(e);const o=await Za.sendMessage(e,r,n);return Wc(e,o.code),o},Mc=(e,t,r)=>{const n=new ts(t);return Ac(e,n,r)},Nc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&e.type.startsWith("image/"),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendImageMessage(e,t,r,n);return Wc(e,s.code),s},Pc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&e.type.endsWith("image/gif"),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendGIFMessage(e,t,r,n);return Wc(e,s.code),s},Lc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob,!0),$c(e);const o=await Za.sendHQVoiceMessage(e,t,r,n);return Wc(e,o.code),o},Dc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendFileMessage(e,t,r,n);return Wc(e,s.code),s},jc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&"video/mp4"===e.type,!0),$c(e);const o=await Za.sendSightMessage(e,t,r,n);return Wc(e,o.code),o},Uc=async(e,n)=>{Bs("options.messageUId",n.messageUId,As,!0),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+n.messageUId;ks.debug("recall message ->"+o);const s=await Za.recallMsg(e,n);return s.code!==t.SUCCESS&&ks.warn("recall message fail ->"+s.code+":"+r(s.code)+","+o),s},Bc=async(e,n)=>{Bs("options.count",n.count??0,Ms),Bs("options.order",n.order??0,e=>0===e||1===e),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;let s;return ks.debug("get remote history message ->"+o),tt(n.timestamp)&&(n.timestamp=n.timestamp.toString()),s=n.order?await Za.getRemoteHistoryMessages(e,n):await Za.getPreviousHistoryMessages(e,n.timestamp,n.count),s.code!==t.SUCCESS&&ks.warn("get remote history message fail ->"+s.code+":"+r(s.code)+","+o),s},Fc=async(e,n)=>{Bs("messages",n,e=>at(e)&&!!e.length,!0),n.forEach(e=>{Bs("messages.messageUId",e.messageUId,As,!0),Bs("messages.sentTime",e.sentTime,Ms,!1),Bs("messages.messageDirection",e.messageDirection,e=>1===e||2===e,!1)}),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("delete messages ->"+o);const s=await Za.deleteRemoteMessage(e,n);return s!==t.SUCCESS?(ks.warn("delete message fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:t.SUCCESS}},xc=async e=>{Bs("conversation",e,js);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("clear message ->"+n);const o=await Za.deleteHistoryMessages(e);return o!==t.SUCCESS?(ks.warn("clear message ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:t.SUCCESS}},Gc=(e,t)=>Bo.decodeChatRecordMsgDetails2ReceivedMessages(e,t),qc=e=>Bo.encodeReceivedMessage2ChatRecordMsgDetail(e),Vc=async e=>{try{return await Za.sendReadReceipts(e),{code:t.SUCCESS}}catch(e){return{code:t.UNKNOWN}}},Kc=e=>(e=>cn.request(805376017,{langCode:e.langCode,phoneNum:e.phone,password:Qe.SHA256(e.password).toString(),deviceType:7,imei:"59bc678b-fe6d-4e67-87c6-b0692205134b",brand:"Chrome",model:"Mozilla",appVersion:"1.0.0",osVersion:"1.0.0"},{encoder:Ka,decoder:Ha}))(e),Hc=e=>(e=>cn.request(805404721,{langCode:e.langCode,account:e.phone},{encoder:za,decoder:$a}))(e),zc=e=>(e=>cn.request(805404723,{langCode:e.country,account:e.phone,code:e.code},{encoder:Wa,decoder:Ja}))(e),$c=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+t)},Wc=(e,n)=>{if(n!==t.SUCCESS){const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.warn("send message fail ->"+n+":"+r(n)+","+t)}},Jc=async e=>{Bs("conversation",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("clear burn after reading expired messages ->"+r);const n=await Za.clearBurnAfterReadingExpiredMessages(e);return n.length>0&&ks.debug(`已清除会话 ${r} 中的 ${n.length} 条阅后即焚过期消息`),Promise.resolve({code:t.SUCCESS,data:n})},Zc=async(e,t,r)=>await Za.sendQuoteReplyMessage(e,t,r),Xc=async e=>{const r=await Za.getMessageById(e);return{code:t.SUCCESS,data:r}},Yc=async e=>{const r=await Za.getMessageByUId(e);return{code:t.SUCCESS,data:r}};export{cs as ChatRecordMessage,e as ConnectionStatus,ls as ContactMessage,n as ConversationType,t as ErrorCode,r as ErrorDesc,d as Events,ss as FileMessage,ns as GIFMessage,Cs as GroupCloseBurnAfterReadingMessage,Os as GroupOpenBurnAfterReadingMessage,os as HQVoiceMessage,rs as ImageMessage,us as InvitationMessage,gs as LinkMessage,as as LocationMessage,u as LogLevel,o as MentionedType,i as MessageDirection,vo as MessageTypes,bo as NotiMessageTypes,l as NotificationLevel,s as NotificationStatus,bs as PrivateCloseBurnAfterReadingMessage,vs as PrivateOpenBurnAfterReadingMessage,Is as RecallCommandMessage,c as ReceivedStatus,ds as RedEnvelopeMessage,a as SentStatus,ts as TextMessage,ps as TransferMessage,is as VideoMessage,sc as addEventListener,Cc as clearAllMessagesUnreadStatus,Jc as clearBurnAfterReadingExpiredMessages,xc as clearHistoryMessages,Oc as clearMessagesUnreadStatus,gc as clearTextMessageDraft,Ya as connect,Fc as deleteMessages,Qa as disconnect,qc as encodeReceivedMessage2ChatRecordMsgDetail,mc as getAllConversationState,hc as getAllUnreadMentionedCount,Rc as getBlockedConversationList,rc as getConnectionStatus,lc as getConversation,cc as getConversationList,Ic as getConversationNotificationLevel,Sc as getConversationNotificationStatus,yc as getConversationState,Xc as getMessageById,Yc as getMessageByUId,Bc as getRemoteHistoryMessages,oc as getServerTime,dc as getTextMessageDraft,Tc as getTopConversationList,vc as getTotalUnreadCount,bc as getUnreadCount,fc as getUnreadMentionedCount,Xa as init,kc as insertMessage,tc as logOut,Hc as mockGetLoginCode,Kc as mockLogin,zc as mockVerifyLoginCode,ic as onceEventListener,Gc as parseChatRecordMsgDetails,Uc as recallMessage,_c as registerMessageType,uc as removeConversation,ac as removeEventListener,nc as request,pc as saveTextMessageDraft,Dc as sendFileMessage,Pc as sendGIFMessage,Lc as sendHQVoiceMessage,Nc as sendImageMessage,Ac as sendMessage,Zc as sendQuoteReplyMessage,Vc as sendReadReceipts,jc as sendSightMessage,Mc as sendTextMessage,wc as setConversationNotificationStatus,Ec as setConversationToTop,ec as setUserLogged};
37
+ */var Mr=null;try{Mr=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Nr(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function Pr(e){return!0===(e&&e.__isLong__)}function Lr(e){var t=Math.clz32(e&-e);return e?31-t:t}Nr.prototype.__isLong__,Object.defineProperty(Nr.prototype,"__isLong__",{value:!0}),Nr.isLong=Pr;var Dr={},jr={};function Ur(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=jr[e])?n:(r=Fr(e,0,!0),o&&(jr[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=Dr[e])?n:(r=Fr(e,e<0?-1:0,!1),o&&(Dr[e]=r),r)}function Br(e,t){if(isNaN(e))return t?Wr:$r;if(t){if(e<0)return Wr;if(e>=Kr)return Qr}else{if(e<=-Hr)return en;if(e+1>=Hr)return Yr}return e<0?Br(-e,t).neg():Fr(e%Vr|0,e/Vr|0,t)}function Fr(e,t,r){return new Nr(e,t,r)}Nr.fromInt=Ur,Nr.fromNumber=Br,Nr.fromBits=Fr;var xr=Math.pow;function Gr(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?Wr:$r;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return Gr(e.substring(1),t,r).neg();for(var o=Br(xr(r,8)),s=$r,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),c=parseInt(e.substring(i,i+a),r);if(a<8){var l=Br(xr(r,a));s=s.mul(l).add(Br(c))}else s=(s=s.mul(o)).add(Br(c))}return s.unsigned=t,s}function qr(e,t){return"number"==typeof e?Br(e,t):"string"==typeof e?Gr(e,t):Fr(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}Nr.fromString=Gr,Nr.fromValue=qr;var Vr=4294967296,Kr=Vr*Vr,Hr=Kr/2,zr=Ur(1<<24),$r=Ur(0);Nr.ZERO=$r;var Wr=Ur(0,!0);Nr.UZERO=Wr;var Jr=Ur(1);Nr.ONE=Jr;var Zr=Ur(1,!0);Nr.UONE=Zr;var Xr=Ur(-1);Nr.NEG_ONE=Xr;var Yr=Fr(-1,2147483647,!1);Nr.MAX_VALUE=Yr;var Qr=Fr(-1,-1,!0);Nr.MAX_UNSIGNED_VALUE=Qr;var en=Fr(0,-2147483648,!1);Nr.MIN_VALUE=en;var tn=Nr.prototype;tn.toInt=function(){return this.unsigned?this.low>>>0:this.low},tn.toNumber=function(){return this.unsigned?(this.high>>>0)*Vr+(this.low>>>0):this.high*Vr+(this.low>>>0)},tn.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(en)){var t=Br(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=Br(xr(e,6),this.unsigned),s=this,i="";;){var a=s.div(o),c=(s.sub(a.mul(o)).toInt()>>>0).toString(e);if((s=a).isZero())return c+i;for(;c.length<6;)c="0"+c;i=""+c+i}},tn.getHighBits=function(){return this.high},tn.getHighBitsUnsigned=function(){return this.high>>>0},tn.getLowBits=function(){return this.low},tn.getLowBitsUnsigned=function(){return this.low>>>0},tn.getNumBitsAbs=function(){if(this.isNegative())return this.eq(en)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},tn.isZero=function(){return 0===this.high&&0===this.low},tn.eqz=tn.isZero,tn.isNegative=function(){return!this.unsigned&&this.high<0},tn.isPositive=function(){return this.unsigned||this.high>=0},tn.isOdd=function(){return!(1&~this.low)},tn.isEven=function(){return!(1&this.low)},tn.equals=function(e){return Pr(e)||(e=qr(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},tn.eq=tn.equals,tn.notEquals=function(e){return!this.eq(e)},tn.neq=tn.notEquals,tn.ne=tn.notEquals,tn.lessThan=function(e){return this.comp(e)<0},tn.lt=tn.lessThan,tn.lessThanOrEqual=function(e){return this.comp(e)<=0},tn.lte=tn.lessThanOrEqual,tn.le=tn.lessThanOrEqual,tn.greaterThan=function(e){return this.comp(e)>0},tn.gt=tn.greaterThan,tn.greaterThanOrEqual=function(e){return this.comp(e)>=0},tn.gte=tn.greaterThanOrEqual,tn.ge=tn.greaterThanOrEqual,tn.compare=function(e){if(Pr(e)||(e=qr(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&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},tn.comp=tn.compare,tn.negate=function(){return!this.unsigned&&this.eq(en)?en:this.not().add(Jr)},tn.neg=tn.negate,tn.add=function(e){Pr(e)||(e=qr(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,c=0,l=0,u=0,d=0;return u+=(d+=o+(65535&e.low))>>>16,l+=(u+=n+a)>>>16,c+=(l+=r+i)>>>16,c+=t+s,Fr((u&=65535)<<16|(d&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},tn.subtract=function(e){return Pr(e)||(e=qr(e)),this.add(e.neg())},tn.sub=tn.subtract,tn.multiply=function(e){if(this.isZero())return this;if(Pr(e)||(e=qr(e)),Mr)return Fr(Mr.mul(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned);if(e.isZero())return this.unsigned?Wr:$r;if(this.eq(en))return e.isOdd()?en:$r;if(e.eq(en))return this.isOdd()?en:$r;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(zr)&&e.lt(zr))return Br(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,c=65535&e.low,l=0,u=0,d=0,p=0;return d+=(p+=o*c)>>>16,u+=(d+=n*c)>>>16,d&=65535,u+=(d+=o*a)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=n*a)>>>16,u&=65535,l+=(u+=o*i)>>>16,l+=t*c+r*a+n*i+o*s,Fr((d&=65535)<<16|(p&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},tn.mul=tn.multiply,tn.divide=function(e){if(Pr(e)||(e=qr(e)),e.isZero())throw Error("division by zero");var t,r,n;if(Mr)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?Fr((this.unsigned?Mr.div_u:Mr.div_s)(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Wr:$r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Wr;if(e.gt(this.shru(1)))return Zr;n=Wr}else{if(this.eq(en))return e.eq(Jr)||e.eq(Xr)?en:e.eq(en)?Jr:(t=this.shr(1).div(e).shl(1)).eq($r)?e.isNegative()?Jr:Xr:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(en))return this.unsigned?Wr:$r;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();n=$r}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),s=o<=48?1:xr(2,o-48),i=Br(t),a=i.mul(e);a.isNegative()||a.gt(r);)a=(i=Br(t-=s,this.unsigned)).mul(e);i.isZero()&&(i=Jr),n=n.add(i),r=r.sub(a)}return n},tn.div=tn.divide,tn.modulo=function(e){return Pr(e)||(e=qr(e)),Mr?Fr((this.unsigned?Mr.rem_u:Mr.rem_s)(this.low,this.high,e.low,e.high),Mr.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},tn.mod=tn.modulo,tn.rem=tn.modulo,tn.not=function(){return Fr(~this.low,~this.high,this.unsigned)},tn.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},tn.clz=tn.countLeadingZeros,tn.countTrailingZeros=function(){return this.low?Lr(this.low):Lr(this.high)+32},tn.ctz=tn.countTrailingZeros,tn.and=function(e){return Pr(e)||(e=qr(e)),Fr(this.low&e.low,this.high&e.high,this.unsigned)},tn.or=function(e){return Pr(e)||(e=qr(e)),Fr(this.low|e.low,this.high|e.high,this.unsigned)},tn.xor=function(e){return Pr(e)||(e=qr(e)),Fr(this.low^e.low,this.high^e.high,this.unsigned)},tn.shiftLeft=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Fr(0,this.low<<e-32,this.unsigned)},tn.shl=tn.shiftLeft,tn.shiftRight=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Fr(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},tn.shr=tn.shiftRight,tn.shiftRightUnsigned=function(e){return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Fr(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):Fr(32===e?this.high:this.high>>>e-32,0,this.unsigned)},tn.shru=tn.shiftRightUnsigned,tn.shr_u=tn.shiftRightUnsigned,tn.rotateLeft=function(e){var t;return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?Fr(this.high,this.low,this.unsigned):e<32?(t=32-e,Fr(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),Fr(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},tn.rotl=tn.rotateLeft,tn.rotateRight=function(e){var t;return Pr(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?Fr(this.high,this.low,this.unsigned):e<32?(t=32-e,Fr(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),Fr(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},tn.rotr=tn.rotateRight,tn.toSigned=function(){return this.unsigned?Fr(this.low,this.high,!1):this},tn.toUnsigned=function(){return this.unsigned?this:Fr(this.low,this.high,!0)},tn.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},tn.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},tn.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Nr.fromBytes=function(e,t,r){return r?Nr.fromBytesLE(e,t):Nr.fromBytesBE(e,t)},Nr.fromBytesLE=function(e,t){return new Nr(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Nr.fromBytesBE=function(e,t){return new Nr(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var rn=new class{_user;constructor(){this._user=this.createDefaultUser()}get uid(){return this.user.uid}get isActive(){return this.user.active}get user(){return this._user}setLogged(e){this._user={active:!0,uid:Nr.isLong(e.uid)?e.uid.toString():e.uid,deviceId:Nr.isLong(e.deviceId)?e.deviceId.toString():e.deviceId,sessionId:Nr.isLong(e.sessionId)?e.sessionId.toString():e.sessionId}}logOut(){this._user=this.createDefaultUser()}createDefaultUser(){return{active:!1,uid:"0",deviceId:"0",sessionId:"0",token:""}}};const nn={webSocketTimeout:5e3,signalTimeout:3e4,pingInterval:15e3,pingTimeout:5e3,pingFailedTimes:2,reconnectIntervalMin:250,reconnectIntervalMax:64e3,reconnectRaisingBase:2};const on=t=>e[t],sn=e=>{const t=new _r;return t.writeIn8(67),t.writeIn8(255),t.writeInt32(e.length+7),t.writeArr(Array.from(e)),t.writeIn8(0),new Int8Array(t.getBytesArray()).buffer},an=e=>{const t=new kr(new Uint8Array(e));t.readInt8(),t.readInt8();const r=t.readInt32(),n=t.readArr(r-7);if(t.readInt8(),e.byteLength!==r)throw new Error("packet resolve failed");return n};var cn=new class{url="";watcher;options;socket;status=e.DISCONNECTED;autoReconnect=!1;isConnected=!1;responseCallbacks=new Map;failedCount=0;reconnectTimer;connectResolve;pendingMessages=[];constructor(e){this.options=Object.assign(nn,e)}setServerInfo(e){this.url=e}setCallback(e){this.watcher=e}async connect(){return this.autoReconnect=!0,new Promise(r=>{this.connectResolve=r,this.open().then(n=>{r(n),n===t.SUCCESS?(this.isConnected=!0,this.onConnect()):this.onDisconnect(n===t.TIMEOUT?e.NETWORK_UNAVAILABLE:e.WEBSOCKET_UNAVAILABLE)})})}async request(e,r,n,o=this.options.signalTimeout){const{code:s,data:i}=await this.sendRawData(e,tt(r)&&tt(n.encoder)?n.encoder.encode(r).finish():new Uint8Array,o);if(0!==s)return{code:s,msg:"time out",data:null};if(!tt(i)||!tt(n.decoder))return{code:t.SUCCESS,msg:""};const a=n.decoder?.decode(i);return a.errorCode?{code:a.errorCode,msg:a.errorMessage,data:null}:{data:a,code:t.SUCCESS,msg:""}}async send(e,r,n,o=this.options.signalTimeout){const s=await this.request(e,r,n,o);return s.code!==t.SUCCESS?{code:Ar(s.code),msg:s.msg,data:null}:{data:s.data,code:t.SUCCESS,msg:s.msg}}async sendRawData(e,r,n=this.options.signalTimeout){if(!this.socket)return{code:t.RC_NET_CHANNEL_INVALID};const o=this.generateMessageSeq();this.isConnected?this.doSendRawData(e,r,o):this.pendingMessages.push({cmdId:e,body:r,messageSeq:o});const s=await new Promise(e=>{this.responseCallbacks.set(o,e),setTimeout(()=>{this.responseCallbacks.get(o)&&this.responseCallbacks.delete(o),e(null)},n)});return s?{code:0,data:s}:(ks.warn(`send timeout -> cmd: 0x${e.toString(16)}, messageSeq: ${o}, timeout: ${n}`),{code:t.TIMEOUT})}doSendRawData(e,t,r){const n={cmdId:e,messageSeq:Nr.fromNumber(r),deviceId:Nr.fromString(rn.user.deviceId),sessionId:Nr.fromString(rn.user.sessionId),uid:Nr.fromString(rn.user.uid),protocolVersion:0,destId:"",body:t,deviceCode:Rt.getDeviceCode()??"",deviceType:Rt.getDeviceType()};e!==Et.Heartbean&&ks.info(`websocket send -> cmd: 0x${e.toString(16)}, messageSeq: ${r}`),this.socket?.send(sn(Cr.encode(n).finish()))}close(){this.autoReconnect=!1,this.doClose(),this.setStatus(e.DISCONNECTED),this.connectResolve?.(t.RC_SOCKET_DISCONNECTED)}async open(){const r=this.url;ks.info(`connect start -> ${r}`),this.setStatus(e.CONNECTING);const n=function(e,t){const r=new WebSocket(e,t);return r.binaryType="arraybuffer",{onClose(e){r.onclose=t=>{const{code:r,reason:n}=t;e?.(r,n)}},onError(e){r.onerror=t=>{e(t)}},onMessage(e){r.onmessage=t=>{e(t.data)}},onOpen(e){r.onopen=e},send(e){r.send(e)},close(e,t){r.close(e,t)}}}(this.url);this.socket=n;return await new Promise(o=>{n.onMessage(e=>{"ArrayBuffer"===et(e)?this.onReceiveMessage(e):ks.error("Socket received invalid data:",e)}),n.onClose((r,n)=>{ks.warn("websocket closed -> code:",r,"reason:",n),this.onDisconnect(e.CONNECTION_CLOSED),o(t.RC_SOCKET_DISCONNECTED)}),n.onError(r=>{ks.warn("websocket error -> ",r),this.onDisconnect(e.WEBSOCKET_ERROR),o(t.RC_SOCKET_NOT_CREATED)}),n.onOpen(()=>{ks.info("websocket open -> ",r),o(t.SUCCESS)}),setTimeout(()=>{o(t.TIMEOUT)},this.options.webSocketTimeout)})}async checkAlive(){if(!this.socket||!this.isConnected)return;ks.debug("send ping ->");const r={pingId:Nr.ZERO,disconnectDelay:Nr.ZERO},{code:n}=await this.send(Et.Heartbean,r,{encoder:Sr},this.options.pingTimeout);n===t.SUCCESS?(ks.debug("recv pong <-"),this.failedCount=0,setTimeout(()=>this.checkAlive(),this.options.pingInterval)):(this.failedCount+=1,ks.warn(`ping failed count: ${this.failedCount}, code: ${n}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,ks.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=an(t);r=wr.decode(e)}catch(t){return ks.error("unpack payload error -> ",t),void this.onDisconnect(e.DISCONNECT_BY_SERVER)}if(r.code)return ks.error("on received message error -> ",r.code),void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===Et.SessionKilledPush)return void this.onDisconnect(e.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===Et.SignOutPish||r.cmdId===Et.SignOutPish2)return ks.warn("on received signoutpush -> ",r.cmdId),void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===Et.UserFrozenToLogin||r.cmdId===Et.UserFrozenToLogin2)return void this.onDisconnect(e.BLOCKED);const n=Nr.isLong(r.messageSeq)?r.messageSeq.toNumber():0,o=n>0?this.responseCallbacks.get(n):null;tt(o)?(r.cmdId!==Et.HeartbeanResp&&ks.info(`websocket recv ack -> messageSeq: ${n}`),o(r.body),this.responseCallbacks.delete(n)):(ks.info(`websocket recv -> cmd: 0x${r.cmdId.toString(16)}`),this.watcher?.message(r.cmdId,r.body))}async try2Reconnect(){this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},5e3)}async onConnect(){for(this.setStatus(e.CONNECTED),this.checkAlive(),tt(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);this.pendingMessages.length>0;){let{cmdId:e,body:t,messageSeq:r}=this.pendingMessages.shift();this.doSendRawData(e,t,r),await new Promise(e=>setTimeout(e,200))}}onDisconnect(e){tt(this.socket)&&(this.doClose(),this.isConnectionAvailable()&&(this.setStatus(e),this.autoReconnect&&this.isConnectionAvailable()&&this.try2Reconnect()))}doClose(){if(tt(this.socket)){this.pendingMessages.length=0;const e=this.socket;this.socket=null,e.onClose(null),e.close()}tt(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.isConnected=!1;for(const e of this.responseCallbacks.values())e(null);this.responseCallbacks.clear()}isConnectionAvailable(){return this.status!==e.DISCONNECTED&&this.status!==e.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.BLOCKED&&this.status!==e.DISCONNECT_BY_SERVER}setStatus(e){ks.info(`socketServer is changing status from ${on(this.status)} to ${on(e)}`),this.status=e,this.watcher?.status(e)}idCount=0;generateMessageSeq(){return++this.idCount}};const ln=mr.Reader,un=mr.Writer,dn=mr.util,pn=mr.roots.default||(mr.roots.default={}),gn=pn.SendPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageReq"},e})(),fn=pn.SendPrivateChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageResp"},e})(),hn=pn.DeletePrivateChatDialogReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeletePrivateChatDialogReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.destId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatDialogReq"},e})(),yn=pn.GetNewMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=un.create()),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(16).int32(e.rows),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetNewMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.offset=e.int64();break;case 2:n.rows=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageReq"},e})(),mn=pn.GetNewMessageResp=(()=>{function e(e){if(this.msg={},this.reference={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msg=dn.emptyObject,e.prototype.reference=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(24).int64(e.offset),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(32).int64(e.seqno),null!=e.msg&&Object.hasOwnProperty.call(e,"msg"))for(let r=Object.keys(e.msg),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.DialogMessageList.encode(e.msg[r[n]],t.uint32(18).fork()).ldelim().ldelim();if(null!=e.reference&&Object.hasOwnProperty.call(e,"reference"))for(let r=Object.keys(e.reference),n=0;n<r.length;++n)t.uint32(50).fork().uint32(10).string(r[n]),pn.ReferenceDialogMessage.encode(e.reference[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetNewMessageResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.offset=e.int64();break;case 4:s.seqno=e.int64();break;case 5:{s.msg===dn.emptyObject&&(s.msg={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.DialogMessageList.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.msg[r]=n;break}case 6:{s.reference===dn.emptyObject&&(s.reference={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.ReferenceDialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.reference[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageResp"},e})();pn.DialogMessageList=(()=>{function e(e){if(this.dialogMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.dialogMessage&&e.dialogMessage.length)for(let r=0;r<e.dialogMessage.length;++r)pn.DialogMessage.encode(e.dialogMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DialogMessageList;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.dialogMessage&&n.dialogMessage.length||(n.dialogMessage=[]),n.dialogMessage.push(pn.DialogMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessageList"},e})(),pn.DialogMessage=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgStatus=0,e.prototype.srcId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.isOut=!1,e.prototype.senderCategory=0,e.prototype.msgCategory=0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.burnAfterReadingFlag=!1,e.prototype.atFlag=!1,e.prototype.replyFlag=!1,e.prototype.referenceFlag=!1,e.prototype.msgIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.uploadFlag=!1,e.prototype.burnAfterReadingTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.sharingGroupFlag=!1,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.replyMarkup="",e.prototype.extra="",e.prototype.msgArrival=!1,e.prototype.msgRead=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(8).int64(e.msgId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgStatus&&Object.hasOwnProperty.call(e,"msgStatus")&&t.uint32(24).int32(e.msgStatus),null!=e.srcId&&Object.hasOwnProperty.call(e,"srcId")&&t.uint32(32).int64(e.srcId),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(40).int64(e.destId),null!=e.isOut&&Object.hasOwnProperty.call(e,"isOut")&&t.uint32(48).bool(e.isOut),null!=e.senderCategory&&Object.hasOwnProperty.call(e,"senderCategory")&&t.uint32(56).int32(e.senderCategory),null!=e.msgCategory&&Object.hasOwnProperty.call(e,"msgCategory")&&t.uint32(64).int32(e.msgCategory),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(74).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(82).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(88).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(96).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(106).string(e.mediaAttribute),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(112).int64(e.msgSendTime),null!=e.burnAfterReadingFlag&&Object.hasOwnProperty.call(e,"burnAfterReadingFlag")&&t.uint32(120).bool(e.burnAfterReadingFlag),null!=e.atFlag&&Object.hasOwnProperty.call(e,"atFlag")&&t.uint32(128).bool(e.atFlag),null!=e.replyFlag&&Object.hasOwnProperty.call(e,"replyFlag")&&t.uint32(136).bool(e.replyFlag),null!=e.referenceFlag&&Object.hasOwnProperty.call(e,"referenceFlag")&&t.uint32(144).bool(e.referenceFlag),null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(152).int64(e.msgIdReferenced),null!=e.uploadFlag&&Object.hasOwnProperty.call(e,"uploadFlag")&&t.uint32(160).bool(e.uploadFlag),null!=e.burnAfterReadingTime&&Object.hasOwnProperty.call(e,"burnAfterReadingTime")&&t.uint32(168).int64(e.burnAfterReadingTime),null!=e.sharingGroupFlag&&Object.hasOwnProperty.call(e,"sharingGroupFlag")&&t.uint32(176).bool(e.sharingGroupFlag),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(184).int64(e.seqno),null!=e.replyMarkup&&Object.hasOwnProperty.call(e,"replyMarkup")&&t.uint32(194).string(e.replyMarkup),null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(202).string(e.extra),null!=e.msgArrival&&Object.hasOwnProperty.call(e,"msgArrival")&&t.uint32(208).bool(e.msgArrival),null!=e.msgRead&&Object.hasOwnProperty.call(e,"msgRead")&&t.uint32(216).bool(e.msgRead),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DialogMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.msgId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgStatus=e.int32();break;case 4:n.srcId=e.int64();break;case 5:n.destId=e.int64();break;case 6:n.isOut=e.bool();break;case 7:n.senderCategory=e.int32();break;case 8:n.msgCategory=e.int32();break;case 9:n.msgPreContent=e.string();break;case 10:n.msgPostContent=e.string();break;case 11:n.mediaFlag=e.bool();break;case 12:n.mediaConstructor=e.int32();break;case 13:n.mediaAttribute=e.string();break;case 14:n.msgSendTime=e.int64();break;case 15:n.burnAfterReadingFlag=e.bool();break;case 16:n.atFlag=e.bool();break;case 17:n.replyFlag=e.bool();break;case 18:n.referenceFlag=e.bool();break;case 19:n.msgIdReferenced=e.int64();break;case 20:n.uploadFlag=e.bool();break;case 21:n.burnAfterReadingTime=e.int64();break;case 22:n.sharingGroupFlag=e.bool();break;case 23:n.seqno=e.int64();break;case 24:n.replyMarkup=e.string();break;case 25:n.extra=e.string();break;case 26:n.msgArrival=e.bool();break;case 27:n.msgRead=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessage"},e})(),pn.ReferenceDialogMessage=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.srcId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.srcName="",e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.destName="",e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(8).int64(e.msgId),null!=e.srcId&&Object.hasOwnProperty.call(e,"srcId")&&t.uint32(16).int64(e.srcId),null!=e.srcName&&Object.hasOwnProperty.call(e,"srcName")&&t.uint32(26).string(e.srcName),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(32).int64(e.destId),null!=e.destName&&Object.hasOwnProperty.call(e,"destName")&&t.uint32(42).string(e.destName),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(50).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(58).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(64).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(72).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(82).string(e.mediaAttribute),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(88).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReferenceDialogMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.msgId=e.int64();break;case 2:n.srcId=e.int64();break;case 3:n.srcName=e.string();break;case 4:n.destId=e.int64();break;case 5:n.destName=e.string();break;case 6:n.msgPreContent=e.string();break;case 7:n.msgPostContent=e.string();break;case 8:n.mediaFlag=e.bool();break;case 9:n.mediaConstructor=e.int32();break;case 10:n.mediaAttribute=e.string();break;case 11:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReferenceDialogMessage"},e})();const vn=pn.UpdatePrivateChatDialogStickyConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.UpdatePrivateChatDialogStickyConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.stickyFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogStickyConfigReq"},e})(),bn=pn.UpdatePrivateChatDialogMuteConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.UpdatePrivateChatDialogMuteConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.muteFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogMuteConfigReq"},e})(),On=pn.DeleteChatMessageReq=(()=>{function e(e){if(this.msgIdList=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(let r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeleteChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;case 3:if(n.msgIdList&&n.msgIdList.length||(n.msgIdList=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgIdList.push(e.int64())}else n.msgIdList.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteChatMessageReq"},e})();pn.DeletePrivateChatHistoryReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.DeletePrivateChatHistoryReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatHistoryReq"},e})();const In=pn.CleanHistoryMessageReq=(()=>{function e(e){if(this.msgIdList=[],this.destIdList=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=dn.emptyArray,e.prototype.destIdList=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(let r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}if(null!=e.destIdList&&e.destIdList.length)for(let r=0;r<e.destIdList.length;++r)t.uint32(34).string(e.destIdList[r]);return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.CleanHistoryMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.string();break;case 2:n.msgId=e.int64();break;case 3:if(n.msgIdList&&n.msgIdList.length||(n.msgIdList=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgIdList.push(e.int64())}else n.msgIdList.push(e.int64());break;case 4:n.destIdList&&n.destIdList.length||(n.destIdList=[]),n.destIdList.push(e.string());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/CleanHistoryMessageReq"},e})(),Cn=pn.GetBriefDialogListReq=(()=>{function e(e){if(this.destId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&e.destId.length){t.uint32(10).fork();for(let r=0;r<e.destId.length;++r)t.int64(e.destId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetBriefDialogListReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)if(n.destId&&n.destId.length||(n.destId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.destId.push(e.int64())}else n.destId.push(e.int64());else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListReq"},e})(),wn=pn.GetBriefDialogListResp=(()=>{function e(e){if(this.notExistDestId=[],this.briefDialog={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.notExistDestId=dn.emptyArray,e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.briefDialog=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.notExistDestId&&e.notExistDestId.length){t.uint32(26).fork();for(let r=0;r<e.notExistDestId.length;++r)t.int64(e.notExistDestId[r]);t.ldelim()}if(null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(32).int64(e.seqno),null!=e.briefDialog&&Object.hasOwnProperty.call(e,"briefDialog"))for(let r=Object.keys(e.briefDialog),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.BriefDialog.encode(e.briefDialog[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetBriefDialogListResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:if(s.notExistDestId&&s.notExistDestId.length||(s.notExistDestId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)s.notExistDestId.push(e.int64())}else s.notExistDestId.push(e.int64());break;case 4:s.seqno=e.int64();break;case 5:{s.briefDialog===dn.emptyObject&&(s.briefDialog={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.briefDialog[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListResp"},e})();pn.BriefDialog=(()=>{function e(e){if(this.groupMemberSmallAvatarUrl=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.dialogTitle="",e.prototype.smallAvatarUrl="",e.prototype.backgroundImage="",e.prototype.stickyFlag=!1,e.prototype.muteFlag=!1,e.prototype.blockFlag=!1,e.prototype.burnAfterReadingFlag=!1,e.prototype.takeScreenshotFlag=!1,e.prototype.groupFlag=!1,e.prototype.totalMemberNumber=0,e.prototype.groupMemberSmallAvatarUrl=dn.emptyArray,e.prototype.burnAfterReadingTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.dialogMenuContent="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.dialogTitle&&Object.hasOwnProperty.call(e,"dialogTitle")&&t.uint32(18).string(e.dialogTitle),null!=e.smallAvatarUrl&&Object.hasOwnProperty.call(e,"smallAvatarUrl")&&t.uint32(26).string(e.smallAvatarUrl),null!=e.backgroundImage&&Object.hasOwnProperty.call(e,"backgroundImage")&&t.uint32(34).string(e.backgroundImage),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(40).bool(e.stickyFlag),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(48).bool(e.muteFlag),null!=e.blockFlag&&Object.hasOwnProperty.call(e,"blockFlag")&&t.uint32(56).bool(e.blockFlag),null!=e.burnAfterReadingFlag&&Object.hasOwnProperty.call(e,"burnAfterReadingFlag")&&t.uint32(64).bool(e.burnAfterReadingFlag),null!=e.takeScreenshotFlag&&Object.hasOwnProperty.call(e,"takeScreenshotFlag")&&t.uint32(72).bool(e.takeScreenshotFlag),null!=e.groupFlag&&Object.hasOwnProperty.call(e,"groupFlag")&&t.uint32(80).bool(e.groupFlag),null!=e.totalMemberNumber&&Object.hasOwnProperty.call(e,"totalMemberNumber")&&t.uint32(88).int32(e.totalMemberNumber),null!=e.groupMemberSmallAvatarUrl&&e.groupMemberSmallAvatarUrl.length)for(let r=0;r<e.groupMemberSmallAvatarUrl.length;++r)t.uint32(98).string(e.groupMemberSmallAvatarUrl[r]);return null!=e.burnAfterReadingTime&&Object.hasOwnProperty.call(e,"burnAfterReadingTime")&&t.uint32(104).int64(e.burnAfterReadingTime),null!=e.dialogMenuContent&&Object.hasOwnProperty.call(e,"dialogMenuContent")&&t.uint32(114).string(e.dialogMenuContent),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.BriefDialog;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.dialogTitle=e.string();break;case 3:n.smallAvatarUrl=e.string();break;case 4:n.backgroundImage=e.string();break;case 5:n.stickyFlag=e.bool();break;case 6:n.muteFlag=e.bool();break;case 7:n.blockFlag=e.bool();break;case 8:n.burnAfterReadingFlag=e.bool();break;case 9:n.takeScreenshotFlag=e.bool();break;case 10:n.groupFlag=e.bool();break;case 11:n.totalMemberNumber=e.int32();break;case 12:n.groupMemberSmallAvatarUrl&&n.groupMemberSmallAvatarUrl.length||(n.groupMemberSmallAvatarUrl=[]),n.groupMemberSmallAvatarUrl.push(e.string());break;case 13:n.burnAfterReadingTime=e.int64();break;case 14:n.dialogMenuContent=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BriefDialog"},e})();const Sn=pn.GetDialogKeyReq=(()=>{function e(e){if(this.destId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&e.destId.length){t.uint32(10).fork();for(let r=0;r<e.destId.length;++r)t.int64(e.destId[r]);t.ldelim()}return null!=e.clientSign&&Object.hasOwnProperty.call(e,"clientSign")&&t.uint32(18).string(e.clientSign),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetDialogKeyReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:if(n.destId&&n.destId.length||(n.destId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.destId.push(e.int64())}else n.destId.push(e.int64());break;case 2:n.clientSign=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyReq"},e})(),Rn=pn.GetDialogKeyResp=(()=>{function e(e){if(this.retryUid=[],this.entry={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.dialogKeyVersion=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.retryUid=dn.emptyArray,e.prototype.entry=dn.emptyObject,e.prototype.serverSign="",e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.dialogKeyVersion&&Object.hasOwnProperty.call(e,"dialogKeyVersion")&&t.uint32(24).int64(e.dialogKeyVersion),null!=e.retryUid&&e.retryUid.length){t.uint32(34).fork();for(let r=0;r<e.retryUid.length;++r)t.int64(e.retryUid[r]);t.ldelim()}if(null!=e.entry&&Object.hasOwnProperty.call(e,"entry"))for(let r=Object.keys(e.entry),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.AesKeyAndIV.encode(e.entry[r[n]],t.uint32(18).fork()).ldelim().ldelim();return null!=e.serverSign&&Object.hasOwnProperty.call(e,"serverSign")&&t.uint32(50).string(e.serverSign),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetDialogKeyResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.dialogKeyVersion=e.int64();break;case 4:if(s.retryUid&&s.retryUid.length||(s.retryUid=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)s.retryUid.push(e.int64())}else s.retryUid.push(e.int64());break;case 5:{s.entry===dn.emptyObject&&(s.entry={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.AesKeyAndIV.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.entry[r]=n;break}case 6:s.serverSign=e.string();break;default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyResp"},e})();pn.AesKeyAndIV=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.encode=function(e,t){return t||(t=un.create()),null!=e.aesKey&&Object.hasOwnProperty.call(e,"aesKey")&&t.uint32(10).string(e.aesKey),null!=e.aesIV&&Object.hasOwnProperty.call(e,"aesIV")&&t.uint32(18).string(e.aesIV),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.AesKeyAndIV;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AesKeyAndIV"},e})();const En=pn.RecallPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.RecallPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallPrivateChatMessageReq"},e})(),Tn=pn.GetHistoryMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogKeys="",e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.dialogKeys&&Object.hasOwnProperty.call(e,"dialogKeys")&&t.uint32(10).string(e.dialogKeys),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.oldOffset&&Object.hasOwnProperty.call(e,"oldOffset")&&t.uint32(24).int64(e.oldOffset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(32).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(40).bool(e.newToOld),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetHistoryMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.dialogKeys=e.string();break;case 2:n.offset=e.int64();break;case 3:n.oldOffset=e.int64();break;case 4:n.rows=e.int32();break;case 5:n.newToOld=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageReq"},e})(),_n=pn.GetHistoryMessageResp=(()=>{function e(e){if(this.reference={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.msg=null,e.prototype.isEnd=!1,e.prototype.reference=dn.emptyObject,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.msg&&Object.hasOwnProperty.call(e,"msg")&&pn.DialogMessageList.encode(e.msg,t.uint32(26).fork()).ldelim(),null!=e.isEnd&&Object.hasOwnProperty.call(e,"isEnd")&&t.uint32(32).bool(e.isEnd),null!=e.reference&&Object.hasOwnProperty.call(e,"reference"))for(let r=Object.keys(e.reference),n=0;n<r.length;++n)t.uint32(42).fork().uint32(10).string(r[n]),pn.ReferenceDialogMessage.encode(e.reference[r[n]],t.uint32(18).fork()).ldelim().ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetHistoryMessageResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:s.msg=pn.DialogMessageList.decode(e,e.uint32());break;case 4:s.isEnd=e.bool();break;case 5:{s.reference===dn.emptyObject&&(s.reference={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.ReferenceDialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.reference[r]=n;break}default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageResp"},e})(),kn=pn.GetWebDialogListReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type=0,e.prototype.offset=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=un.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(24).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(32).bool(e.newToOld),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetWebDialogListReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.type=e.int32();break;case 2:n.offset=e.int64();break;case 3:n.rows=e.int32();break;case 4:n.newToOld=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListReq"},e})(),An=pn.GetWebDialogListResp=(()=>{function e(e){if(this.fullDialog=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.fullDialog=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.fullDialog&&e.fullDialog.length)for(let r=0;r<e.fullDialog.length;++r)pn.WebFullDialog.encode(e.fullDialog[r],t.uint32(26).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetWebDialogListResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.fullDialog&&n.fullDialog.length||(n.fullDialog=[]),n.fullDialog.push(pn.WebFullDialog.decode(e,e.uint32()));break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListResp"},e})();pn.WebFullDialog=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialog=null,e.prototype.msg=null,e.encode=function(e,t){return t||(t=un.create()),null!=e.dialog&&Object.hasOwnProperty.call(e,"dialog")&&pn.BriefDialog.encode(e.dialog,t.uint32(10).fork()).ldelim(),null!=e.msg&&Object.hasOwnProperty.call(e,"msg")&&pn.DialogMessage.encode(e.msg,t.uint32(18).fork()).ldelim(),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.WebFullDialog;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.dialog=pn.BriefDialog.decode(e,e.uint32());break;case 2:n.msg=pn.DialogMessage.decode(e,e.uint32());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebFullDialog"},e})();const Mn=pn.GetNewSettingDialogListReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.time=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.time&&Object.hasOwnProperty.call(e,"time")&&t.uint32(8).int64(e.time),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.GetNewSettingDialogListReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.time=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListReq"},e})(),Nn=pn.GetNewSettingDialogListResp=(()=>{function e(e){if(this.briefDialog={},e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.briefDialog=dn.emptyObject,e.prototype.setTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){if(t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.briefDialog&&Object.hasOwnProperty.call(e,"briefDialog"))for(let r=Object.keys(e.briefDialog),n=0;n<r.length;++n)t.uint32(26).fork().uint32(10).string(r[n]),pn.BriefDialog.encode(e.briefDialog[r[n]],t.uint32(18).fork()).ldelim().ldelim();return null!=e.setTime&&Object.hasOwnProperty.call(e,"setTime")&&t.uint32(32).int64(e.setTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r,n,o=void 0===t?e.len:e.pos+t,s=new pn.GetNewSettingDialogListResp;for(;e.pos<o;){let t=e.uint32();switch(t>>>3){case 1:s.errorCode=e.int32();break;case 2:s.errorMessage=e.string();break;case 3:{s.briefDialog===dn.emptyObject&&(s.briefDialog={});let t=e.uint32()+e.pos;for(r="",n=null;e.pos<t;){let t=e.uint32();switch(t>>>3){case 1:r=e.string();break;case 2:n=pn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&t)}}s.briefDialog[r]=n;break}case 4:s.setTime=e.int64();break;default:e.skipType(7&t)}}return s},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListResp"},e})(),Pn=pn.NewMessageNotificationResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.seqno=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(24).int64(e.seqno),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.NewMessageNotificationResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NewMessageNotificationResp"},e})();pn.ChatMessage=(()=>{function e(e){if(this.msgId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.msgId&&e.msgId.length){t.uint32(18).fork();for(let r=0;r<e.msgId.length;++r)t.int64(e.msgId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ChatMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:if(n.msgId&&n.msgId.length||(n.msgId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgId.push(e.int64())}else n.msgId.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ChatMessage"},e})();const Ln=pn.SendPrivateChatArrivalAckReq=(()=>{function e(e){if(this.chatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.chatMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.chatMessage&&e.chatMessage.length)for(let r=0;r<e.chatMessage.length;++r)pn.ChatMessage.encode(e.chatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatArrivalAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.chatMessage&&n.chatMessage.length||(n.chatMessage=[]),n.chatMessage.push(pn.ChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatArrivalAckReq"},e})(),Dn=pn.SendPrivateChatReadAckReq=(()=>{function e(e){if(this.chatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.chatMessage=dn.emptyArray,e.encode=function(e,t){if(t||(t=un.create()),null!=e.chatMessage&&e.chatMessage.length)for(let r=0;r<e.chatMessage.length;++r)pn.ChatMessage.encode(e.chatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.SendPrivateChatReadAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.chatMessage&&n.chatMessage.length||(n.chatMessage=[]),n.chatMessage.push(pn.ChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatReadAckReq"},e})(),jn=pn.ReplyPrivateChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSrcIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgDestIdReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContentReferenced="",e.prototype.msgPostContentReferenced="",e.prototype.mediaFlagReferenced=!1,e.prototype.mediaConstructorReferenced=0,e.prototype.mediaAttributeReferenced="",e.prototype.msgSendTimeReferenced=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(8).int64(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(64).int64(e.msgIdReferenced),null!=e.msgSrcIdReferenced&&Object.hasOwnProperty.call(e,"msgSrcIdReferenced")&&t.uint32(72).int64(e.msgSrcIdReferenced),null!=e.msgDestIdReferenced&&Object.hasOwnProperty.call(e,"msgDestIdReferenced")&&t.uint32(80).int64(e.msgDestIdReferenced),null!=e.msgPreContentReferenced&&Object.hasOwnProperty.call(e,"msgPreContentReferenced")&&t.uint32(90).string(e.msgPreContentReferenced),null!=e.msgPostContentReferenced&&Object.hasOwnProperty.call(e,"msgPostContentReferenced")&&t.uint32(98).string(e.msgPostContentReferenced),null!=e.mediaFlagReferenced&&Object.hasOwnProperty.call(e,"mediaFlagReferenced")&&t.uint32(104).bool(e.mediaFlagReferenced),null!=e.mediaConstructorReferenced&&Object.hasOwnProperty.call(e,"mediaConstructorReferenced")&&t.uint32(112).int32(e.mediaConstructorReferenced),null!=e.mediaAttributeReferenced&&Object.hasOwnProperty.call(e,"mediaAttributeReferenced")&&t.uint32(122).string(e.mediaAttributeReferenced),null!=e.msgSendTimeReferenced&&Object.hasOwnProperty.call(e,"msgSendTimeReferenced")&&t.uint32(128).int64(e.msgSendTimeReferenced),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReplyPrivateChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.destId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:n.msgIdReferenced=e.int64();break;case 9:n.msgSrcIdReferenced=e.int64();break;case 10:n.msgDestIdReferenced=e.int64();break;case 11:n.msgPreContentReferenced=e.string();break;case 12:n.msgPostContentReferenced=e.string();break;case 13:n.mediaFlagReferenced=e.bool();break;case 14:n.mediaConstructorReferenced=e.int32();break;case 15:n.mediaAttributeReferenced=e.string();break;case 16:n.msgSendTimeReferenced=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyPrivateChatMessageReq"},e})(),Un=pn.ReplyPrivateChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgId=dn.Long?dn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=dn.Long?dn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=un.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof ln||(e=ln.create(e));let r=void 0===t?e.len:e.pos+t,n=new pn.ReplyPrivateChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyPrivateChatMessageResp"},e})(),Bn=mr.Reader,Fn=mr.Writer,xn=mr.util,Gn=mr.roots.default||(mr.roots.default={}),qn=Gn.SendGroupChatMessageReq=(()=>{function e(e){if(this.at=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(let r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:if(n.at&&n.at.length||(n.at=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.at.push(e.int64())}else n.at.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageReq"},e})(),Vn=Gn.SendGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.seqno=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(48).int64(e.seqno),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageResp"},e})();Gn.DeleteGroupChatHistoryReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.DeleteGroupChatHistoryReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatHistoryReq"},e})();const Kn=Gn.UpdateGroupChatDialogStickyConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.UpdateGroupChatDialogStickyConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.stickyFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogStickyConfigReq"},e})(),Hn=Gn.UpdateGroupChatDialogMuteConfigReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.UpdateGroupChatDialogMuteConfigReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.muteFlag=e.bool();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogMuteConfigReq"},e})(),zn=Gn.RecallGroupChatMessageReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.RecallGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.msgId=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallGroupChatMessageReq"},e})();Gn.DeleteGroupChatDialogReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.DeleteGroupChatDialogReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupId=e.int64();else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatDialogReq"},e})(),Gn.GroupChatMessage=(()=>{function e(e){if(this.msgId=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.userId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.userId&&Object.hasOwnProperty.call(e,"userId")&&t.uint32(16).int64(e.userId),null!=e.msgId&&e.msgId.length){t.uint32(26).fork();for(let r=0;r<e.msgId.length;++r)t.int64(e.msgId[r]);t.ldelim()}return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.GroupChatMessage;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.userId=e.int64();break;case 3:if(n.msgId&&n.msgId.length||(n.msgId=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.msgId.push(e.int64())}else n.msgId.push(e.int64());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GroupChatMessage"},e})();const $n=Gn.SendGroupChatArrivalAckReq=(()=>{function e(e){if(this.groupChatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupChatMessage=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupChatMessage&&e.groupChatMessage.length)for(let r=0;r<e.groupChatMessage.length;++r)Gn.GroupChatMessage.encode(e.groupChatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatArrivalAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupChatMessage&&n.groupChatMessage.length||(n.groupChatMessage=[]),n.groupChatMessage.push(Gn.GroupChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatArrivalAckReq"},e})(),Wn=Gn.SendGroupChatReadAckReq=(()=>{function e(e){if(this.groupChatMessage=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupChatMessage=xn.emptyArray,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupChatMessage&&e.groupChatMessage.length)for(let r=0;r<e.groupChatMessage.length;++r)Gn.GroupChatMessage.encode(e.groupChatMessage[r],t.uint32(10).fork()).ldelim();return t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.SendGroupChatReadAckReq;for(;e.pos<r;){let t=e.uint32();if(t>>>3==1)n.groupChatMessage&&n.groupChatMessage.length||(n.groupChatMessage=[]),n.groupChatMessage.push(Gn.GroupChatMessage.decode(e,e.uint32()));else e.skipType(7&t)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatReadAckReq"},e})(),Jn=Gn.ReplyGroupChatMessageReq=(()=>{function e(e){if(this.at=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=xn.emptyArray,e.prototype.msgIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSrcIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgDestIdReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContentReferenced="",e.prototype.msgPostContentReferenced="",e.prototype.mediaFlagReferenced=!1,e.prototype.mediaConstructorReferenced=0,e.prototype.mediaAttributeReferenced="",e.prototype.msgSendTimeReferenced=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){if(t||(t=Fn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(8).int64(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(let r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return null!=e.msgIdReferenced&&Object.hasOwnProperty.call(e,"msgIdReferenced")&&t.uint32(72).int64(e.msgIdReferenced),null!=e.msgSrcIdReferenced&&Object.hasOwnProperty.call(e,"msgSrcIdReferenced")&&t.uint32(80).int64(e.msgSrcIdReferenced),null!=e.msgDestIdReferenced&&Object.hasOwnProperty.call(e,"msgDestIdReferenced")&&t.uint32(88).int64(e.msgDestIdReferenced),null!=e.msgPreContentReferenced&&Object.hasOwnProperty.call(e,"msgPreContentReferenced")&&t.uint32(98).string(e.msgPreContentReferenced),null!=e.msgPostContentReferenced&&Object.hasOwnProperty.call(e,"msgPostContentReferenced")&&t.uint32(106).string(e.msgPostContentReferenced),null!=e.mediaFlagReferenced&&Object.hasOwnProperty.call(e,"mediaFlagReferenced")&&t.uint32(112).bool(e.mediaFlagReferenced),null!=e.mediaConstructorReferenced&&Object.hasOwnProperty.call(e,"mediaConstructorReferenced")&&t.uint32(120).int32(e.mediaConstructorReferenced),null!=e.mediaAttributeReferenced&&Object.hasOwnProperty.call(e,"mediaAttributeReferenced")&&t.uint32(130).string(e.mediaAttributeReferenced),null!=e.msgSendTimeReferenced&&Object.hasOwnProperty.call(e,"msgSendTimeReferenced")&&t.uint32(136).int64(e.msgSendTimeReferenced),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.ReplyGroupChatMessageReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.groupId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgPreContent=e.string();break;case 4:n.msgPostContent=e.string();break;case 5:n.mediaFlag=e.bool();break;case 6:n.mediaConstructor=e.int32();break;case 7:n.mediaAttribute=e.string();break;case 8:if(n.at&&n.at.length||(n.at=[]),2==(7&t)){let t=e.uint32()+e.pos;for(;e.pos<t;)n.at.push(e.int64())}else n.at.push(e.int64());break;case 9:n.msgIdReferenced=e.int64();break;case 10:n.msgSrcIdReferenced=e.int64();break;case 11:n.msgDestIdReferenced=e.int64();break;case 12:n.msgPreContentReferenced=e.string();break;case 13:n.msgPostContentReferenced=e.string();break;case 14:n.mediaFlagReferenced=e.bool();break;case 15:n.mediaConstructorReferenced=e.int32();break;case 16:n.mediaAttributeReferenced=e.string();break;case 17:n.msgSendTimeReferenced=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyGroupChatMessageReq"},e})(),Zn=Gn.ReplyGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgId=xn.Long?xn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=xn.Long?xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Fn.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(24).int64(e.localId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(32).int64(e.msgId),null!=e.msgSendTime&&Object.hasOwnProperty.call(e,"msgSendTime")&&t.uint32(40).int64(e.msgSendTime),t},e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));let r=void 0===t?e.len:e.pos+t,n=new Gn.ReplyGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ReplyGroupChatMessageResp"},e})();function Xn(e){return(ct(e)?Nr.fromString(e):e).greaterThan(Nr.fromNumber(9e10))?n.GROUP:n.PRIVATE}const Yn=e=>e.targetId,Qn=e=>({conversationType:Xn(e),targetId:Nr.isLong(e)?e.toString():e});let eo=0;const to=async()=>{const e=(new Date).getTime(),{code:r,data:n}=await cn.send(Et.GetServerTime,null,{decoder:Rr});if(r===t.SUCCESS){const{currentTimeMillis:t}=n;eo=t.toNumber()-e}},ro=()=>(new Date).getTime()+eo,no=new Set;var oo={addMessage(e){no.add(e)},remove(e){no.delete(e)},has:e=>no.has(e),reset(){no.clear()}};const so=new Set;var io={addMessage(e){so.add(e)},remove(e){so.delete(e)},has:e=>so.has(e),reset(){so.clear()}};const ao=new Map;function co(e,t){ao.set(e,t)}function lo(e,t){const r=ao.get(e);if(!r)return console.warn(`No message constructor found for type: ${e}`),null;try{return new r(t)}catch(t){return console.error(`Failed to decode message type ${e}:`,t),null}}var uo=new class{aesKeyRecord=new Map;async getDialogAesKey(e){return lt(e)?this.aesKeyRecord.has(e)?this.aesKeyRecord.get(e):new Promise(t=>{this.getDialogAesKeyListFromRemote([e]).then(r=>{t(r.get(e))}),setTimeout(()=>{t(null)},8e3)}):null}getDialogAesKeyList(e){return new Promise(t=>{const r=new Map;this.getDialogAesKeyListInBatches(e,(n,o)=>{if(o.size)for(const[e,t]of o)r.set(e,t);(r.size===e.length||n)&&t(r)})})}getDialogAesKeyListInBatches(e,t){const r=new Map,n=[];e.forEach(e=>{if(!lt(e))return;const t=this.getDialogAesKeyFromLocal(e);t?r.set(e,t):n.push(e)}),t(!1,r),n.length&&this.getDialogAesKeyListFromRemote(n).then(e=>{t(!0,e)})}reset(){this.aesKeyRecord.clear()}async getDialogAesKeyListFromRemote(e){if(!e.length)return new Map;try{const{code:n,data:o}=await(r=e.map(e=>Nr.fromString(e)),cn.send(Et.GetDialogKey,{destId:r,clientSign:""},{encoder:Sn,decoder:Rn}));if(n===t.SUCCESS){const e=new Map;for(const t in o.entry){const r=o.entry[t];if(r.aesKey?.length&&r.aesIV?.length){const n={key:r.aesKey,iv:r.aesIV};e.set(t,n),this.aesKeyRecord.set(t,n)}}return e}}catch(e){ks.error("getDialogAesKeyListFromRemote error",e)}var r;return new Map}getDialogAesKeyFromLocal(e){return lt(e)?this.aesKeyRecord.get(e):null}};const po="time",go=(e,t)=>[e,t,po].join("_");class fo{appkey;userId;inBoxOffset=Nr.ZERO;constructor(e,t){this.appkey=e,this.userId=t}setInboxOffset(e){if(this.inBoxOffset>e)return;this.inBoxOffset=e;const t=go(this.appkey,this.userId);bt.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=go(this.appkey,this.userId);this.inBoxOffset=Nr.fromString(bt.get(e)??"0")}return this.inBoxOffset}}const ho=(e,t)=>{if(!lt(e))return"";const r=Qe.AES.encrypt(e,Qe.enc.Utf8.parse(t.key),{iv:tt(t.iv)?Qe.enc.Utf8.parse(t.iv):void 0});return Array.from(mo(r.ciphertext.words)).map(e=>e.toString(16).padStart(2,"0")).join("")},yo=(e,t)=>{const r=new Uint8Array(e.match(/.{1,2}/g)?.map(e=>parseInt(e,16))||[]),n=window.btoa(String.fromCharCode(...r));return Qe.AES.decrypt(n,Qe.enc.Utf8.parse(t.key),{iv:tt(t.iv)?Qe.enc.Utf8.parse(t.iv):void 0}).toString(Qe.enc.Utf8)},mo=e=>{const t=[];let r,n,o;for(n=0;n<e.length;++n)for(r=e[n],o=3;o>=0;--o)t.push(r>>8*o&255);return new Uint8Array(t)},vo={TEXT:0,IMAGE:805310464,GIF:805310475,FILE:805310490,AUDIO:805310481,VIDEO:805310470,RECALL:1610678301,LOCATION:805310469,CHAT_RECORD:805310489,CONTACT:268439554,GROUP_INVITATION:805310467,REDPACKET:268439616,TRANSFER:268439600,LINK:268439556},bo={GROUP_ARRIVAL_RECEIPT:1610743844,GROUP_READ_RECEIPT:1610743845,PRIVATE_ARRIVAL_RECEIPT:1610678284,PRIVATE_READ_RECEIPT:1610678285,PRIVATE_OPEN_BURNAFTERREADING:1610678274,PRIVATE_CLOSE_BURNAFTERREADING:1610678275,GROUP_OPEN_BURNAFTERREADING:1610743816,GROUP_CLOSE_BURNAFTERREADING:1610743817};function Oo(e){if(!tt(e))return e;if(Array.isArray(e))return e.map(e=>Oo(e));if(it(e)){const t={};return Object.keys(e).forEach(r=>{t[r]=Oo(e[r])}),t}return e}const Io={unreadMessageCount:{keyName:"c",defaultVal:0},lastUnreadTime:{keyName:"lt",defaultVal:0},notificationStatus:{keyName:"nc",defaultVal:2},notificationLevel:{keyName:"nl",defaultVal:0},isTop:{keyName:"it",defaultVal:!1},mentionedUIds:{keyName:"mu",defaultVal:null},dialogTitle:{keyName:"dt",defaultVal:null},smallAvatarUrl:{keyName:"sa",defaultVal:null},burnAfterReadingFlag:{keyName:"brf",defaultVal:!1},burnAfterReadingTime:{keyName:"brt",defaultVal:0},updateTime:{keyName:"ut",defaultVal:0}};class Co{localStore;constructor(e,t){const r=`con-${e}-${t}`;this.localStore=new It(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}\n }`}getConOptionByKey(e){const t=(e=e||"").split("_");if(t.length>=2){const e=t.shift(),r=t.shift();return{conversationType:Number(e),targetId:r}}return{conversationType:n.PRIVATE,targetId:"0"}}updateUnreadCount(e){const{conversationType:t,targetId:r,content:n,messageType:o,sentTime:s,isCounted:a,messageDirection:c}=e,l=c===i.SEND,u=o===vo.RECALL,d=it(n),p={conversationType:t,targetId:r},g=this.get(p)||{},f=g.lastUnreadTime||Nr.ZERO,h=g.unreadMessageCount||0;if(!(s<=f)&&!l){if(a&&(g.unreadMessageCount=h+1,f||(g.lastUnreadTime=s)),u&&d){n.sentTime>=f&&h&&(g.unreadMessageCount=h-1)}this.set(p,g)}}updateMentionedData(e){const{conversationType:t,targetId:r,messageUId:o,messageType:s,isMentioned:a,messageDirection:c,content:l}=e;if(!o||c===i.SEND||!a&&s!==vo.RECALL)return;const u=this.getStoreKey({conversationType:t,targetId:r}),d=this.localStore.get(u)||{},p=Io.mentionedUIds.keyName,g=d[p]||[];if(a&&t===n.GROUP&&(g.includes(o.toString())||g.push(o.toString())),s===vo.RECALL&&t===n.GROUP){const e=l,t=g.indexOf(e.messageUId?.toString()??"");t>=0&&g.splice(t,1)}g.length?d[p]=g:delete d[p],ut(d)?this.localStore.set(u,d):this.localStore.remove(u)}updateUpdateTime(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};n[Io.updateTime.keyName]=t,this.localStore.set(r,n)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of pt(t)){const r=Io[e],o=t[e];if(ot(r?.keyName)||ot(o))continue;o===r.defaultVal?delete n[r.keyName]:n[r.keyName]=o,n[Io.unreadMessageCount.keyName]||(delete n[Io.lastUnreadTime.keyName],delete n[Io.mentionedUIds.keyName])}ut(n)?this.localStore.set(r,n):this.localStore.remove(r)}remove(e){const t=this.getStoreKey(e);this.localStore.remove(t)}get(e){const t=this.getStoreKey(e),r=this.localStore.get(t)||{},n={};for(const e of pt(Io)){const{keyName:t,defaultVal:o}=Io[e];"mentionedUIds"===e?(n.unreadMentionedCount=r[t]?.length??0,n.hasMentioned=!!n.unreadMentionedCount):n[e]=r[t]||Oo(o)}return n}getAll(){const e=this.localStore.getCache()||{},t=[];for(const r in e){const n=this.getConOptionByKey(r),o=e[r];for(const e of pt(Io)){const{keyName:t,defaultVal:r}=Io[e];"mentionedUIds"!==e&&(n[e]=o[t]||Oo(r))}t.push(n)}return t}}const wo=e=>{const t=e.destId??"",r=Qn(t);if(!r)return;e.dialogTitle,e.smallAvatarUrl;return{...r,unreadMessageCount:0,notificationStatus:e.muteFlag?s.OPEN:s.CLOSE,notificationLevel:e.muteFlag?l.NOT_MESSAGE_NOTIFICATION:l.ALL_MESSAGE,isTop:!!e.stickyFlag,dialogTitle:e.dialogTitle,smallAvatarUrl:e.smallAvatarUrl,lastUnreadTime:"0",burnAfterReadingFlag:!!e.burnAfterReadingFlag,burnAfterReadingTime:e.burnAfterReadingTime&&e.burnAfterReadingTime.toNumber()}};class So{events={};on(e,t,r){const n=this.events[e]||(this.events[e]=[]);n.some(e=>e.listener===t&&e.target===r)||n.push({listener:t,target:r})}emit(e,...t){const r=this.events[e];r?.length&&r.map(e=>{const{target:r,listener:n}=e;try{n.call(r,...t)}catch(e){}})}off(e,t,r){let n=this.events[e];n?.length&&(n=n.filter(e=>e.listener!==t||e.target!==r),n.length?this.events[e]=n:delete this.events[e])}once(e,t,r){const n=(...o)=>{t.call(r,...o),this.off(e,n,r)};return this.on(e,n,r),this}}const Ro="STATUS_CHANGED";class Eo{storageKey;eventEmitter;isPulling=!1;constructor(e,t){this.storageKey=`con-s-${e}-${t}`,this.eventEmitter=new So}async pull(){if(this.isPulling)return;let e;this.isPulling=!0;const r=bt.get(this.storageKey);e=rt(r)&&r>0?r:ro()-1e4;let{code:n,data:o}=await(e=>cn.send(Et.GetDialogChangedStatus,{time:Nr.fromNumber(e)},{encoder:Mn,decoder:Nn}))(e);n===t.SUCCESS&&(Nr.isLong(o.setTime)&&o.setTime.toNumber()>0&&bt.set(this.storageKey,o.setTime.toNumber()),o.briefDialog&&pt(o.briefDialog).forEach(e=>{const t=o.briefDialog[e],r=wo(t);r&&this.eventEmitter.emit(Ro,r)})),this.isPulling=!1}watch(e){this.eventEmitter.on(Ro,t=>{e(t)})}}class To{updatedConversationFunc;store;draftMap=new Map;localConversationSet=new Set;updatedConversations=[];notify;statusManager;constructor(e,t,r){this.updatedConversationFunc=r,this.store=new Co(e,t),this.notify=ft(this.notifyConversationChanged.bind(this),0),this.statusManager=new Eo(e,t),this.statusManager.watch(e=>{this.addStatus(e,!0)})}getConversationKey(e){return`${e.conversationType}_${e.targetId}\n }`}setUpdatedConversation(e){const t=this.updatedConversations.findIndex(t=>this.getConversationKey(e.conversation)===this.getConversationKey(t.conversation));t>=0?(e={conversation:Object.assign(this.updatedConversations[t].conversation,e.conversation),updatedItems:Object.assign(this.updatedConversations[t].updatedItems,e.updatedItems)},this.updatedConversations[t]=e):this.updatedConversations.push(e),this.notify()}notifyConversationChanged(){const e=this.updatedConversations.map(e=>({conversation:{...e.conversation,...this.store.get(e.conversation)},updatedItems:e.updatedItems}));this.updatedConversations=[],this.updatedConversationFunc?.(e)}syncConversationStatus(){this.statusManager.pull()}async loadConvsationsIfNotExist(e){if(!e?.length)return;const r=e.filter(e=>!this.localConversationSet.has(this.getConversationKey(e)));if(!r.length)return;const n=r.map(Yn);if(!n.length)return;const{code:o,data:s}=await(e=>cn.send(Et.GetBriefDialogList,{destId:e.map(e=>Nr.fromString(e))},{encoder:Cn,decoder:wn}))(n);o===t.SUCCESS&&pt(s.briefDialog).forEach(e=>{const t=s.briefDialog[e],r=wo(t);r&&(this.localConversationSet.add(this.getConversationKey(r)),this.addStatus(r,!0))})}addLocalConversation(e){const{conversationType:t,targetId:r,isTop:n,notificationStatus:o,notificationLevel:s,dialogTitle:i,smallAvatarUrl:a,burnAfterReadingFlag:c,burnAfterReadingTime:l,updateTime:u}=e;this.localConversationSet.add(this.getConversationKey(e)),this.addStatus({conversationType:t,targetId:r,isTop:n,notificationStatus:o,notificationLevel:s,dialogTitle:i,smallAvatarUrl:a,burnAfterReadingFlag:c,burnAfterReadingTime:l,updateTime:u},!1)}addStatus(e,t=!1){const{conversationType:r,targetId:n,notificationStatus:o,notificationLevel:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,burnAfterReadingFlag:l,burnAfterReadingTime:u,updateTime:d}=e,p={conversationType:r,targetId:n},g=ro(),f=this.store.get(p),h={};tt(s)&&f.notificationLevel!==s&&(h.notificationLevel={time:g,val:s}),tt(o)&&f.notificationStatus!==o&&(h.notificationStatus={time:g,val:o}),tt(i)&&f.isTop!==i&&(h.isTop={time:g,val:i}),tt(a)&&f.dialogTitle!==a&&(h.dialogTitle={time:g,val:a}),tt(c)&&f.smallAvatarUrl!==c&&(h.smallAvatarUrl={time:g,val:c}),tt(l)&&f.burnAfterReadingFlag!==l&&(h.burnAfterReadingFlag={time:g,val:l}),tt(u)&&f.burnAfterReadingTime!==u&&(h.burnAfterReadingTime={time:g,val:u}),this.store.set(p,{notificationStatus:o,isTop:i,notificationLevel:s,dialogTitle:a,smallAvatarUrl:c,burnAfterReadingFlag:l,burnAfterReadingTime:u,updateTime:d}),Object.keys(h).length&&t&&this.setUpdatedConversation({conversation:p,updatedItems:h})}setConversationCacheByMessage(e){const{conversationType:t,isPersited:r,targetId:n}=e;if(!r)return;const o={conversationType:t,targetId:n},s={conversation:o,updatedItems:{}},i=Oo(this.get(o));this.store.updateUnreadCount(e),this.store.updateMentionedData(e),this.store.updateUpdateTime(o,parseInt(e.sentTime));const a=this.get(o);i.unreadMessageCount!==a.unreadMessageCount&&(s.updatedItems.unreadMessageCount={time:parseInt(e.sentTime),val:a.unreadMessageCount}),i.hasMentioned!==a.hasMentioned&&(s.updatedItems.hasMentioned={time:parseInt(e.sentTime),val:a.hasMentioned}),i.unreadMentionedCount!==a.unreadMentionedCount&&(s.updatedItems.unreadMentionedCount={time:parseInt(e.sentTime),val:a.unreadMentionedCount}),Object.keys(s.updatedItems).length&&this.setUpdatedConversation(s)}get(e){return this.store.get(e)}getAllUnreadCount(e,t){const r=this.store.getAll();let n=0;return r.forEach(({unreadMessageCount:r,notificationStatus:o,notificationLevel:i,conversationType:a})=>{r=r||0;const c=o===s.OPEN||i>0;!t&&c||(e.length>0?e.includes(+a)&&(n+=+r):n+=+r)}),n}getUnreadCount(e){return this.store.get(e).unreadMessageCount||0}clearUnreadCount(e){const t=this.store.get(e),{unreadMessageCount:r,unreadMentionedCount:n}=t;(r||n)&&(t.unreadMessageCount=0,t.hasMentioned=!1,t.unreadMentionedCount=0),this.store.set(e,t);const o={};r&&(o.unreadMessageCount={val:0,time:ro()}),n&&(o.hasMentioned={val:!1,time:ro()},o.unreadMentionedCount={val:0,time:ro()}),Object.keys(o).length&&this.setUpdatedConversation({conversation:e,updatedItems:o})}clearAllUnreadCount(){this.store.getAll().forEach(e=>this.clearUnreadCount(e))}getNotificationLevel(e){return this.store.get(e).notificationLevel}getNotificationStatus(e){return this.store.get(e).notificationStatus||2}setDraft(e,t){this.draftMap.set(this.getConversationKey(e),t)}getDraft(e){return this.draftMap.get(this.getConversationKey(e))??""}clearDraft(e){this.draftMap.delete(this.getConversationKey(e))}getBlockConversationList(){return this.store.getAll().filter(e=>e.notificationStatus===s.OPEN||e.notificationLevel>0).map(e=>({conversationType:e.conversationType,targetId:e.targetId}))}getTopConversationList(){return(this.store.getAll()||{}).filter(e=>e.isTop).map(e=>({conversationType:e.conversationType,targetId:e.targetId}))}getUnreadMentionedCount(e){return this.get(e).unreadMentionedCount||0}getAllUnreadMentionedCount(){const e=this.store.getAll();let t=0;return e.forEach(({unreadMentionedCount:e})=>{e=e||0,t+=Number(e)}),t}getConversationState(e){let t=this.get(e);if(t){let{unreadMessageCount:r,unreadMentionedCount:n,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}=t;return{...e,unreadCount:r,unreadMentionedCount:n??0,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}}return null}getAllConversationState(){return this.store.getAll().map(({conversationType:e,targetId:t,unreadMessageCount:r,unreadMentionedCount:n,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l})=>({conversationType:e,targetId:t,unreadCount:r,unreadMentionedCount:n??0,notificationLevel:o,notificationStatus:s,isTop:i,dialogTitle:a,smallAvatarUrl:c,updateTime:l}))}remove(e){this.store.remove(e),this.localConversationSet.delete(this.getConversationKey(e))}clearHistoryMessages(e){this.clearUnreadCount(e);const t={conversation:e,updatedItems:{}};t.conversation.latestMessage=void 0,t.updatedItems.latestMessage={val:null,time:ro()},this.setUpdatedConversation(t)}updateLatestMessage(e,t){tt(t)&&this.store.set(e,{updateTime:parseInt(t.sentTime)});const r={conversation:e,updatedItems:{}};tt(t)&&(r.conversation.updateTime=parseInt(t.sentTime)),r.conversation.latestMessage=t,r.updatedItems.latestMessage={val:t,time:ro()},this.setUpdatedConversation(r)}destroyed(){this.updatedConversationFunc=void 0}}const _o={addStatus:function(e,t){},setConversationCacheByMessage:function(e){},updateLatestMessage:function(e,t){},get:function(e){return null},getAllUnreadCount:function(e,t){return 0},getUnreadCount:function(e){return 0},clearUnreadCount:function(e){},clearAllUnreadCount(){},getNotificationLevel:function(e){return l.NOT_SET},getNotificationStatus:function(e){return s.CLOSE},setDraft:function(e,t){},getDraft:function(e){return""},clearDraft:function(e){},getBlockConversationList:function(){return[]},getTopConversationList:function(){return[]},getUnreadMentionedCount:function(e){return 0},getAllUnreadMentionedCount:function(){return 0},getConversationState:e=>null,getAllConversationState:function(){return[]},addLocalConversation:function(e){},loadConvsationsIfNotExist:function(e){return Promise.resolve()},destroyed(){},syncConversationStatus:function(){},remove:function(e){},clearHistoryMessages:function(e){}};let ko;var Ao={create(e,t,r){ko=new To(e,t,r)},get:()=>ko??_o};const Mo=(e,t,r=a.SENDING)=>{const n=Ao.get().get(t.conversation);return{conversationType:t.conversation.conversationType,targetId:t.conversation.targetId,senderUserId:t.senderUserId,messageDirection:i.SEND,isCounted:e.isCounted,isMentioned:!1,content:Oo(e.content),messageType:e.messageType,isOffLineMessage:!1,isPersited:e.isPersited,messageId:t.messageId,messageUId:"local"+t.sentTime,sentTime:t.sentTime,sentStatus:r,receivedTime:t.sentTime,isStatusMessage:e.isStatusMessage,receivedStatus:c.IDLE,disableNotification:!0,burnAfterReadingFlag:n?.burnAfterReadingFlag??!1,burnAfterReadingTime:n?.burnAfterReadingTime??0}};function No(e){const t={...e};return"content"in t&&delete t.content,"quotedReply"in t&&delete t.quotedReply,"msgPreContent"in t&&delete t.msgPreContent,"msgPostContent"in t&&delete t.msgPostContent,t}const Po=(e,t,r,n)=>{const o=new Map;return e.forEach(e=>{const s=Lo(e,t.get(e),r.get(e),n);s.length&&o.set(e,s)}),o},Lo=(e,t,r,n)=>{const o=Qn(e);if(!o)return[];const l=Ao.get().get(o);let u=[];return t.forEach(e=>{const t=e;let d=t.mediaConstructor,p=Do(t,r);if(!p)return;if(1610678290===d||1610743841===d){const{msgId:e}=p;d=vo.RECALL,p={messageUId:e}}const g=lo(d,p);if(tt(g)){const d={...o,senderUserId:t.srcId.toString(),messageDirection:t.isOut?i.SEND:i.RECEIVE,isCounted:g.isCounted,isMentioned:t.atFlag,content:g.content,messageType:g.messageType,isOffLineMessage:!1,isPersited:g.isPersited,messageId:Nr.isLong(t.localId)?t.localId.toNumber():0,messageUId:t.msgId.toString(),sentTime:t.seqno.toString(),sentStatus:a.SENT,receivedTime:ro().toString(),isStatusMessage:g.isStatusMessage,receivedStatus:t.msgRead?c.READ:t.msgArrival?c.RECEIVED:c.IDLE,disableNotification:l?.notificationStatus===s.OPEN||t.srcId.toString()==rn.uid,burnAfterReadingFlag:t.burnAfterReadingFlag,burnAfterReadingTime:t.burnAfterReadingTime&&t.burnAfterReadingTime.toNumber()};if(d.isStatusMessage&&Nr.fromNumber(ro()).subtract(d.sentTime).greaterThan(6e3))return;if(t.msgIdReferenced&&Nr.isLong(t.msgIdReferenced)){const e=n[t.msgIdReferenced.toString()];if(e){let t=Do({mediaAttribute:e.mediaAttribute,msgPreContent:e.msgPreContent,msgPostContent:e.msgPostContent,mediaConstructor:e.mediaConstructor??0,msgId:e.msgId??Nr.fromNumber(0)},r);if(t){const r=lo(e.mediaConstructor??0,t);tt(r)&&(d.quotedReply=((e,t,r)=>({conversationType:r.conversationType,targetId:e.destId.toString(),senderUserId:e.srcId.toString(),messageDirection:e.srcId.toString()===rn.uid?i.SEND:i.RECEIVE,isCounted:t.isCounted,isMentioned:!1,content:Oo(t.content),messageType:t.messageType,isOffLineMessage:!1,isPersited:t.isPersited,messageId:1,messageUId:e.msgId.toString(),sentTime:e.msgSendTime.toString(),sentStatus:a.SENT,receivedTime:e.msgSendTime.toString(),isStatusMessage:t.isStatusMessage,receivedStatus:c.RECEIVED,disableNotification:!0,burnAfterReadingFlag:!1,burnAfterReadingTime:0,senderUserName:e.srcName}))(e,r,o))}}}lt(d.messageUId)?u.push(d):ks.error("message is invalid",No(e))}}),u},Do=(e,t)=>{try{let r,n;return r=e.mediaAttribute?.length?yo(e.mediaAttribute,t):e.msgPreContent??"",e.msgPostContent?.length&&(n=yo(e.msgPostContent,t)),jo(e.mediaConstructor,r,n)}catch(t){return ks.error("decode message content fail",e,t),null}},jo=(e,t,r)=>{let n={};if(e==vo.TEXT&&r)n.content=r;else if(t?.length){const e=Uo(t);n=JSON.parse(e)}return n},Uo=e=>{let t=e.replace(/("[\w\d_]+"\s*:\s*)(?<!\d\.)(\d{15,})(?!\.\d*)([\s,}\]])/g,'$1"$2"$3');return t=t.replace(/(\[\s*|,\s*)(?<!\d\.)(\d{15,})(?!\.\d*)([\s,\]])/g,'$1"$2"$3'),t};var Bo={parse:function(e,t,r){const n=new Map;if(Object.keys(e).forEach(t=>{const r=e[t].dialogMessage?.filter(e=>!e.sharingGroupFlag);r?.length&&n.set(t,r)}),!n.size)return void r(!0,new Map);const o=new Set([...n.keys()]);uo.getDialogAesKeyListInBatches([...n.keys()],(e,s)=>{try{if(s.size){const e=[...s.keys()];for(const t of e)o.delete(t);r(!o.size,Po(e,n,s,t))}o.size&&e&&r(!0,new Map)}catch(t){ks.error("parseDialogsMessages error",t),o.size&&e&&r(!0,new Map)}})},parseSingleDialogMessages:Lo,decodeChatRecordMsgDetails2ReceivedMessages:(e,t)=>{let r=[];return t.forEach(t=>{const n=jo(t.mediaConstructor,t.mediaAttribute,t.msgPostContent);if(!n)return;const o=lo(t.mediaConstructor,n);if(tt(o)){const n={...e,senderUserId:t.srcId.toString(),messageDirection:t.srcId==rn.uid?i.SEND:i.RECEIVE,isCounted:o.isCounted,isMentioned:!1,content:o.content,messageType:o.messageType,isOffLineMessage:!1,isPersited:o.isPersited,messageId:0,messageUId:t.msgId+"",sentTime:t.msgSendTime+"",sentStatus:a.SENT,receivedTime:t.msgSendTime+"",isStatusMessage:o.isStatusMessage,receivedStatus:c.READ,disableNotification:!1};r.push(n)}}),r},encodeReceivedMessage2ChatRecordMsgDetail:e=>{const t=lo(e.messageType,e.content);if(!t)return null;const r=JSON.stringify(t.content),n=e.messageType===vo.TEXT?t.content.content:void 0;return{senderNickname:e.senderNickname,senderAvatar:e.senderAvatar||void 0,msgId:e.messageUId,srcId:e.senderUserId,destId:e.targetId,mediaConstructor:e.messageType,mediaAttribute:r,msgPostContent:n,msgSendTime:e.sentTime}}};const Fo="unreadMessageUids";class xo{localStore;constructor(e,t){const r=`receipt-v2-${e}-${t}`;this.localStore=new It(r)}storeUnreadMessageUids(e){const t=e.filter(e=>e.isCounted&&e.messageDirection!==i.SEND).map(e=>({uid:e.messageUId,timestamp:Date.now()})),r=[...this.localStore.get(Fo)||[],...t];this.localStore.set(Fo,r)}cleanExpiredMessages(){const e=this.localStore.get(Fo)||[],t=Date.now(),r=e.filter(e=>t-e.timestamp<=1728e5);this.localStore.set(Fo,r)}formatReceiptMessages(e){const t=[],r=[];e.forEach(e=>{e.conversationType===n.PRIVATE?t.push(e):r.push(e)});return{privateReceiptMessages:Object.entries(t.reduce((e,t)=>(e[t.targetId]||(e[t.targetId]=[]),e[t.targetId].push(t.messageUId),e),{})).map(([e,t])=>({destId:Nr.fromString(e),msgId:t.map(e=>Nr.fromString(e))})),groupReceiptMessages:r.reduce((e,t)=>{const r=e.find(e=>e.groupId.equals(Nr.fromString(t.targetId))&&e.userId.equals(Nr.fromString(t.senderUserId)));return r?r.msgId.push(Nr.fromString(t.messageUId)):e.push({groupId:Nr.fromString(t.targetId),userId:Nr.fromString(t.senderUserId),msgId:[Nr.fromString(t.messageUId)]}),e},[])}}filterValidMessages(e){return e.filter(e=>e.isCounted&&e.messageDirection!==i.SEND)}async sendArrivalReceipts(e){this.storeUnreadMessageUids(e);const t=this.filterValidMessages(e),{privateReceiptMessages:r,groupReceiptMessages:n}=this.formatReceiptMessages(t);var o;r.length&&await(o={chatMessage:r},cn.send(Et.SendPrivateChatArrivalAck,o,{encoder:Ln,decoder:Er})),n.length&&await(e=>cn.send(Et.SendGroupChatReadAck,e,{encoder:Wn,decoder:Er}))({groupChatMessage:n})}async sendReadReceipts(e){const t=this.localStore.get(Fo)||[],r=this.filterValidMessages(e).filter(e=>t.some(t=>t.uid===e.messageUId));try{const{privateReceiptMessages:e,groupReceiptMessages:t}=this.formatReceiptMessages(r);e.length&&await(n={chatMessage:e},cn.send(Et.SendPrivateChatReadAck,n,{encoder:Dn,decoder:Er})),t.length&&await(e=>cn.send(Et.SendGroupChatArrivalAck,e,{encoder:$n,decoder:Er}))({groupChatMessage:t});const o=this.localStore.get(Fo)||[],s=r.map(e=>e.messageUId),i=o.filter(e=>!s.includes(e.uid));this.localStore.set(Fo,i)}catch(e){throw console.error("发送已读回执失败:",e),e}var n}}let Go;var qo={create(e,t){Go=new xo(e,t),Go.cleanExpiredMessages()},get:()=>Go};let Vo=0,Ko=0;function Ho(e,t){Vo=e+100,Ko=t+100}function zo(){return Ko++,Ko}function $o(){return Vo--,Vo}function Wo(){return Ko}class Jo{loadedEndMap=new Map;db=null;currentAppKey="";currentUserId="";APP_INFO_KEY="im_app_info";DB_NAME_PREFIX="im_message_cache_1";DB_VERSION=2;STORE_NAME="messages_new";DIALOG_STATE_STORE="dialogStates_new";encryptKey={key:""};SALT_PREFIX="im_message_cache_salt_prefix";SALT_SUFFIX="im_message_cache_salt_suffix";constructor(e,t){this.generateEncryptKey(e,t),this.currentAppKey=e,this.currentUserId=t}generateEncryptKey(e,t){const r=`${this.SALT_PREFIX}${e}_${t}${this.SALT_SUFFIX}`,n=Qe.SHA256(r).toString(),o=n.substring(0,16),s=n.substring(16,48),i=Qe.SHA256(`${o}:${this.SALT_PREFIX}:${t}:${e}`).toString().substring(0,8),a=Qe.PBKDF2(s,i,{keySize:8,iterations:1e3,hasher:Qe.algo.SHA256}).toString();this.encryptKey={key:a.substring(0,32),iv:o}}async initDB(){await this.checkAndResetDatabase(),await this.initDatabase()}async checkAndResetDatabase(){const e=vt.get(this.APP_INFO_KEY);if(e)try{const t=JSON.parse(e);t.appKey===this.currentAppKey&&t.userId===this.currentUserId||await this.deleteDatabase()}catch(e){ks.error("Failed to parse stored AppKey and UserId",e),await this.deleteDatabase()}vt.set(this.APP_INFO_KEY,JSON.stringify({appKey:this.currentAppKey,userId:this.currentUserId,timestamp:Date.now()}))}async deleteDatabase(){return this.db&&(this.db.close(),this.db=null),this.loadedEndMap.clear(),new Promise((e,t)=>{const r=this.getDBName(),n=indexedDB.deleteDatabase(r);n.onsuccess=()=>{ks.info(`Database ${r} successfully deleted`),e()},n.onerror=t=>{ks.error(`Failed to delete database ${r}`,t),e()}})}getDBName(){return`${this.DB_NAME_PREFIX}_${this.currentAppKey}_${this.currentUserId}`}initDatabase(){return new Promise((e,t)=>{const r=this.getDBName(),n=indexedDB.open(r,this.DB_VERSION);n.onerror=e=>{ks.error("Failed to open database",e),t(new Error("Failed to open database"))},n.onsuccess=t=>{this.db=t.target.result,this.loadAllDialogStates().then(()=>{e()}).catch(t=>{ks.error("Failed to load conversation states",t),e()})},n.onupgradeneeded=e=>{const t=e.target.result;if(!t.objectStoreNames.contains(this.STORE_NAME)){const e=t.createObjectStore(this.STORE_NAME,{keyPath:"messageId"});e.createIndex("messageUId","messageUId",{unique:!0}),e.createIndex("dialogId","dialogId",{unique:!1}),e.createIndex("dialogId_sentTime",["dialogId","sentTime"],{unique:!1}),e.createIndex("receivedStatus","receivedStatus",{unique:!1}),e.createIndex("burnAfterReadingFlag","burnAfterReadingFlag",{unique:!1}),e.createIndex("dialogId_receivedStatus",["dialogId","receivedStatus"],{unique:!1})}t.objectStoreNames.contains(this.DIALOG_STATE_STORE)||t.createObjectStore(this.DIALOG_STATE_STORE,{keyPath:"dialogId"})}})}async loadAllDialogStates(){if(this.db)return new Promise((e,t)=>{const r=this.db.transaction(this.DIALOG_STATE_STORE,"readonly").objectStore(this.DIALOG_STATE_STORE).getAll();r.onsuccess=()=>{const t=r.result;this.loadedEndMap.clear(),t.forEach(e=>{this.loadedEndMap.set(e.dialogId,e.isEnd)}),e()},r.onerror=e=>{t(new Error("Failed to load conversation states"))}})}async updateDialogState(e,t){if(this.db)return this.loadedEndMap.set(e,t),new Promise((r,n)=>{const o=this.db.transaction(this.DIALOG_STATE_STORE,"readwrite").objectStore(this.DIALOG_STATE_STORE).put({dialogId:e,isEnd:t,updateTime:Date.now()});o.onsuccess=()=>{r()},o.onerror=e=>{ks.error("Failed to update conversation state",e),n(new Error("Failed to update conversation state"))}})}encryptContent(e){if(!e)return"";try{const t=JSON.stringify(e);return ho(t,this.encryptKey)}catch(e){return ks.error("Failed to encrypt message content",e),""}}decryptContent(e){if(!e)return null;try{const t=yo(e,this.encryptKey);return JSON.parse(t)}catch(e){return ks.error("Failed to decrypt message content",e),null}}decryptMessage(e){const t={...e};if("string"==typeof t.content&&t.content)try{t.content=this.decryptContent(t.content)}catch(e){ks.error("Failed to decrypt message content",e),t.content=null}if(t.quotedReply&&"string"==typeof t.quotedReply.content&&t.quotedReply.content)try{t.quotedReply.content=this.decryptContent(t.quotedReply.content)}catch(e){ks.error("Failed to decrypt quoted message content",e),t.quotedReply.content=null}return t}async addMessages(e,t,r=void 0){let n=e?.filter(e=>e.isPersited);if(!n||0===n.length||!this.db){if(tt(r)){const e=Yn(t);await this.updateDialogState(e,r)}return}const o=Yn(t);return new Promise(e=>{try{const t=this.db.transaction(this.STORE_NAME,"readwrite"),s=t.objectStore(this.STORE_NAME);t.oncomplete=async()=>{if(tt(r))try{await this.updateDialogState(o,r)}catch(e){ks.error("Failed to update dialog state:",e)}e()},t.onerror=s=>{ks.error("Transaction failed in addMessages:",function(e){return e.map(No)}(n),t.error),tt(r)?this.updateDialogState(o,r).catch(e=>ks.error("Failed to update dialog state after transaction error:",e)).finally(()=>e()):e()};for(const e of n)try{const t={...Oo(e),dialogId:o};t.content&&(t.content=this.encryptContent(t.content)),t.quotedReply?.content&&(t.quotedReply.content=this.encryptContent(t.quotedReply.content)),s.put(t)}catch(t){ks.error("Error processing message:",No(e),t)}}catch(t){ks.error("Failed to start transaction:",t),tt(r)?this.updateDialogState(o,r).catch(e=>ks.error("Failed to update dialog state:",e)).finally(()=>e()):e()}})}async getPreviousMessages(e,t="0",r=20){const n=Yn(e);if(!this.db)return{messages:[],hasMore:!1};const o=await this.getDialogLoadedState(n);return new Promise((e,s)=>{const i=this.db.transaction(this.STORE_NAME,"readonly"),a=i.objectStore(this.STORE_NAME).index("dialogId_sentTime");let c;c="0"===t?IDBKeyRange.bound([n,""],[n,"￿"]):IDBKeyRange.bound([n,""],[n,t]);const l=[];let u=!1,d=0;const p=a.count(c);p.onsuccess=()=>{const t=p.result;a.openCursor(c,"prev").onsuccess=e=>{const t=e.target.result;if(t)if(d<r){const e=this.decryptMessage(t.value);l.push(e),d++,t.continue()}else u=!0,n();else n()};const n=()=>{l.sort((e,t)=>Nr.fromString(e.sentTime).compare(Nr.fromString(t.sentTime))),e({messages:l,hasMore:u||t>r||!o})}},i.onerror=e=>{ks.error("Failed to query message",e),s(new Error("Failed to query message"))}})}async clearConversationCache(e){const t=Yn(e);if(!this.db)return void this.loadedEndMap.set(t,!0);const r=new Promise((e,r)=>{const n=this.db.transaction(this.STORE_NAME,"readwrite");n.objectStore(this.STORE_NAME).index("dialogId").openCursor(IDBKeyRange.only(t)).onsuccess=e=>{const t=e.target.result;t&&(t.delete(),t.continue())},n.oncomplete=()=>{e()},n.onerror=e=>{ks.error("Failed to clear conversation messages"),r(new Error("Failed to clear conversation messages"))}});await Promise.all([r,this.updateDialogState(t,!0)])}async clearAllCache(){if(!this.db)return void this.loadedEndMap.clear();const e=new Promise((e,t)=>{const r=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME).clear();r.onsuccess=()=>{e()},r.onerror=e=>{ks.error("Failed to clear all messages"),t(new Error("Failed to clear all messages"))}}),t=new Promise((e,t)=>{const r=this.db.transaction(this.DIALOG_STATE_STORE,"readwrite").objectStore(this.DIALOG_STATE_STORE).clear();r.onsuccess=()=>{this.loadedEndMap.clear(),e()},r.onerror=e=>{ks.error("Failed to clear all conversation states"),t(new Error("Failed to clear all conversation states"))}});await Promise.all([e,t])}async getDialogLoadedState(e){return this.loadedEndMap.has(e)?this.loadedEndMap.get(e):!!this.db&&new Promise((t,r)=>{const n=this.db.transaction(this.DIALOG_STATE_STORE,"readonly").objectStore(this.DIALOG_STATE_STORE).get(e);n.onsuccess=()=>{const r=n.result;r?(this.loadedEndMap.set(e,r.isEnd),t(r.isEnd)):t(!1)},n.onerror=e=>{t(!1)}})}async removeMessagesByUId(e){if(!e||0===e.length||!this.db)return;const t=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME),r=t.index("messageUId");e.forEach(e=>{const n=r.get(e);n.onsuccess=()=>{const e=n.result;e&&t.delete(e.messageId)}})}async updateMessageReceiptStatus(e,t){if(!e||!e.messageUIdList||0===e.messageUIdList.length||!this.db)return;const r=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME),n=r.index("messageUId");e.messageUIdList.forEach(e=>{const o=n.get(e);o.onsuccess=()=>{const e=o.result;if(e){let n=!1;0===t&&e.receivedStatus<c.RECEIVED?(e.receivedStatus=c.RECEIVED,n=!0):1===t&&e.receivedStatus<c.READ&&(e.receivedStatus=c.READ,n=!0),n&&r.put(e)}}})}async clearBurnAfterReadingExpiredMessages(e){const t=Yn(e);if(!this.db)return[];const r=Date.now();return new Promise((e,n)=>{const o=this.db.transaction(this.STORE_NAME,"readwrite").objectStore(this.STORE_NAME).index("dialogId"),s=[],i=o.openCursor(IDBKeyRange.only(t));i.onsuccess=t=>{const n=t.target.result;if(n){const e=n.value;if(e.burnAfterReadingFlag){const t=e.burnAfterReadingTime||0;let o=0===t;if(!o&&t>0){const n=Nr.fromString(e.sentTime),s=Nr.fromNumber(r),i=Nr.fromNumber(t),a=n.add(i);o=s.greaterThan(a)}o&&(s.push(e.messageUId),n.delete())}n.continue()}else e(s)},i.onerror=e=>{ks.error("Failed to clear expired messages",e),n(new Error("Failed to clear expired messages"))}})}async getLatestMessage(e){const t=Yn(e);return this.db?new Promise((e,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).index("dialogId_sentTime"),o=IDBKeyRange.bound([t,""],[t,"￿"]),s=n.openCursor(o,"prev");s.onsuccess=t=>{const r=t.target.result;if(r){const t=this.decryptMessage(r.value);e(t)}else e(null)},s.onerror=t=>{ks.error("Failed to get latest message",t),e(null)}}):null}async upsertMessage(e){this.addMessages([e],e)}async getMessageById(e){return this.db?new Promise((t,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).get(e);n.onsuccess=()=>{const e=n.result;if(e){const r=this.decryptMessage(e);t(r)}else t(null)},n.onerror=e=>{ks.error("Failed to query message",e),t(null)}}):null}async getMessageIdRange(){return this.db?new Promise((e,t)=>{const r=this.db.transaction(this.STORE_NAME,"readonly"),n=r.objectStore(this.STORE_NAME);let o=null,s=null;n.openCursor().onsuccess=t=>{const r=t.target.result;if(r){s=r.value.messageId;n.openCursor(null,"prev").onsuccess=t=>{const r=t.target.result;r?(o=r.value.messageId,e(o&&s?{newest:o,oldest:s}:null)):e(null)}}else e(null)},r.onerror=t=>{e(null)}}):null}async convertToRecallMessages(e){if(e&&0!==e.length&&this.db)return new Promise(t=>{const r=this.db.transaction(this.STORE_NAME,"readwrite"),n=r.objectStore(this.STORE_NAME),o=n.index("messageUId");let s=e.length;for(const t of e){if(!t){i();continue}const e=o.get(t);e.onsuccess=()=>{const r=e.result;if(r){const e={messageUId:t},o={...r,messageType:vo.RECALL,content:this.encryptContent(e),isPersited:!0,isCounted:!1,isMentioned:!1,disableNotification:!0},s=n.put(o);s.onerror=()=>{i()},s.onsuccess=()=>{i()}}else i()},e.onerror=()=>{i()}}function i(){s--,0===s&&t()}r.oncomplete=()=>{t()},r.onerror=()=>{t()}})}async getMessageByUId(e){return this.db?new Promise((t,r)=>{const n=this.db.transaction(this.STORE_NAME,"readonly").objectStore(this.STORE_NAME).index("messageUId").get(e);n.onsuccess=()=>{const e=n.result;if(e){const r=this.decryptMessage(e);t(r)}else t(null)},n.onerror=e=>{ks.error("Failed to query message",e),t(null)}}):null}}let Zo=null;var Xo={create(e,t){Zo=new Jo(e,t)},get:()=>Zo};class Yo{watcher;pullingMsg=!1;letterbox;serverMsgSeqno=Nr.ZERO;pullOfflineFinished=!1;intervalTimer;retryTimer;latestSyncTimestamp=0;started=!1;constructor(e,t){this.watcher=e,this.letterbox=new fo(t.appkey,rn.uid.toString())}start(){this.started=!0,this.pullOfflineFinished=!1,this.startPullInterval()}stop(){this.started=!1,this.stopPullInterval(),this.cancelRetryTask()}syncMsg(e){this.serverMsgSeqno=e,this.pullMsg()}startPullInterval(){this.stopPullInterval();this.intervalTimer=setInterval(()=>{Date.now()-this.latestSyncTimestamp>=18e4&&this.pullMsg()},3e4),this.latestSyncTimestamp=Date.now(),this.pullMsg()}stopPullInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}try2RePullMsg(){this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.pullMsg()},1e3)}cancelRetryTask(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async pullMsg(){if(this.pullingMsg)return;if(!this.started)return;this.cancelRetryTask(),this.pullingMsg=!0;const r=this.letterbox.getInboxOffset();ks.info(`pullMsg -> time: ${r}`),this.latestSyncTimestamp=Date.now();const{code:n,data:o}=await((e,t)=>cn.send(Et.GetNewMessage,{offset:e,rows:t},{encoder:yn,decoder:mn}))(r,60);if(n!==t.SUCCESS)return ks.warn("pullMsg failed -> code:",n),this.pullingMsg=!1,void(ws.loader?.getConnectionStatus()==e.CONNECTED&&this.try2RePullMsg());const{offset:s,seqno:i,msg:a,reference:c}=o,l=Object.keys(a).map(e=>({conversationType:Xn(Nr.fromString(e)),targetId:e}));await Ao.get().loadConvsationsIfNotExist(l),Bo.parse(a,c,async(e,t)=>{try{for(const[e,r]of t.entries()){if(0===r.length)return;await this.processMessages(r,!this.pullOfflineFinished)}}catch(e){ks.error("processMessages error -> ",e)}if(e)try{let e;i&&(Nr.isLong(i)?e=i:"string"==typeof i?e=Nr.fromString(i):"number"==typeof i&&(e=Nr.fromNumber(i))),e&&Nr.isLong(e)&&e.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=e);const t=this.serverMsgSeqno.lessThanOrEqual(s);ks.info(`pullMsg success -> syncTime: ${s}, finished: ${t}`),this.letterbox?.setInboxOffset(s),this.pullingMsg=!1,t&&!this.pullOfflineFinished&&(this.pullOfflineFinished=!0,this.watcher.pullFinished&&this.watcher.pullFinished()),t||this.pullMsg()}catch(e){ks.error("setPullMsgDone error",e),this.pullingMsg=!1}})}async processMessages(e,t){const r={conversationType:e[0].conversationType,targetId:e[0].targetId};let n=[];const o=[];let s=[];e.forEach(e=>{e.messageType===vo.RECALL&&io.has(e.content.messageUId)?e.content.messageUId?(io.remove(e.content.messageUId),s.push(e.content.messageUId)):ks.error("recallMessage's messageUId is undefined",No(e)):e.messageUId?(e.isOffLineMessage=t,(!e.messageId||e.messageId>Wo())&&(e.messageId=zo()),Ao.get().setConversationCacheByMessage(e),n.push(e),e.messageType===vo.RECALL&&o.push(n.length-1),[bo.PRIVATE_OPEN_BURNAFTERREADING,bo.GROUP_OPEN_BURNAFTERREADING,bo.PRIVATE_CLOSE_BURNAFTERREADING,bo.GROUP_CLOSE_BURNAFTERREADING].includes(e.messageType)&&this.handleBurnAfterReadingMessage(e)):ks.error("message's messageUId is undefined",No(e))});let i=[];for(let e=o.length-1;e>=0;e--){const t=o[e],r=n[t],a=r.content,c=n.findIndex(e=>e.messageUId===a.messageUId);if(-1!==c){const e=n[c];r.messageId=e.messageId,r.sentTime=e.sentTime,n[c]=r,n[t]=e,i.push(t)}else s.push(a.messageUId),i.push(t)}if(i.length){let e=[];n.forEach((t,r)=>{i.includes(r)||e.push(t)}),n=e}let a=this.handleReceiptMessages(n);a.length&&(await(Xo.get()?.addMessages(a,{conversationType:a[0].conversationType,targetId:a[0].targetId})),this.handleBatchMessages(a),qo.get()?.sendArrivalReceipts(a)),s.length&&(await(Xo.get()?.convertToRecallMessages(s)),this.watcher.onRecall?.(s));if(n.some(e=>e.isPersited)){const e=await(Xo.get()?.getLatestMessage(r));Ao.get().updateLatestMessage(r,e)}}handleBurnAfterReadingMessage(e){const t=e.content,r=e.conversationType,n=e.targetId,{templateId:o,burnAfterReadingTime:s}=t,i=60010010===o||60010011===o;Ao.get().addStatus({conversationType:r,targetId:n,burnAfterReadingFlag:i,burnAfterReadingTime:i?s:null},!0)}handleReceiptMessages(e){try{const t=[],r=[];e.forEach(e=>{e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.GROUP_READ_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_READ_RECEIPT?r.push(e):t.push(e)});const n=t.filter(e=>e.messageDirection===i.SEND);return r.forEach(e=>{const t=e.content,r=e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT;n.forEach(e=>{t.msgIdList.includes(e.messageUId)&&(e.receivedStatus=r?c.RECEIVED:c.READ)}),this.watcher.onReceiptReceived?.({conversation:{conversationType:e.conversationType,targetId:e.targetId},messageUIdList:t.msgIdList.map(e=>e.toString())},e.messageType===bo.GROUP_ARRIVAL_RECEIPT||e.messageType===bo.PRIVATE_ARRIVAL_RECEIPT?0:1)}),t}catch(e){return ks.error("handleReceiptMessages error",e),[]}}async handleBatchMessages(e){const t=e.filter(e=>e.messageDirection!==i.SEND||!e.messageId||!oo.has(e.messageId)||(oo.remove(e.messageId),!1));t.length&&this.watcher.batchMessage?.(t)}}class Qo{messageType;content;isPersited;isCounted;isStatusMessage;constructor(e,t,r=!0,n=!0,o=!1){this.messageType=e,this.content=t,o?(this.isPersited=!1,this.isCounted=!1):(this.isPersited=r,this.isCounted=n),this.isStatusMessage=o}}const es=(e,t,r,n)=>function(o){return new Qo(e,o,t,r,n)},ts=es(vo.TEXT,!0,!0,!1),rs=es(vo.IMAGE,!0,!0,!1),ns=es(vo.GIF,!0,!0,!1),os=es(vo.AUDIO,!0,!0,!1),ss=es(vo.FILE,!0,!0,!1),is=es(vo.VIDEO,!0,!0,!1);let as=es(vo.LOCATION,!0,!0,!1),cs=es(vo.CHAT_RECORD,!0,!0,!1),ls=es(vo.CONTACT,!0,!0,!1),us=es(vo.GROUP_INVITATION,!0,!0,!1),ds=es(vo.REDPACKET,!0,!0,!1),ps=es(vo.TRANSFER,!0,!0,!1),gs=es(vo.LINK,!0,!0,!1);const fs=es(bo.GROUP_ARRIVAL_RECEIPT,!1,!1,!1),hs=es(bo.GROUP_READ_RECEIPT,!1,!1,!1),ys=es(bo.PRIVATE_ARRIVAL_RECEIPT,!1,!1,!1),ms=es(bo.PRIVATE_READ_RECEIPT,!1,!1,!1),vs=es(bo.PRIVATE_OPEN_BURNAFTERREADING,!1,!1,!1),bs=es(bo.PRIVATE_CLOSE_BURNAFTERREADING,!1,!1,!1),Os=es(bo.GROUP_OPEN_BURNAFTERREADING,!1,!1,!1),Is=es(bo.GROUP_CLOSE_BURNAFTERREADING,!1,!1,!1),Cs=es(vo.RECALL,!0,!1,!1);class ws{options;connectionStatus=e.DISCONNECTED;isInternalConnected=!1;watcher;messageLoader;static _loader;static init(e){return this._loader||(this._loader=new ws(e)),this._loader}static get loader(){return this._loader}constructor(e){this.options=e,this.watcher={onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,pullFinished:void 0,batchMessage:void 0,conversationState:void 0,onPush:void 0,onRecall:void 0,onReceiptReceived:void 0},cn.setServerInfo(this.getWebSocketUrl()),cn.setCallback({status:this.connectionStatusListener.bind(this),message:this.messageListener.bind(this)}),this.registerMessage()}getWebSocketUrl(){const e=this.options?.serverInfo;return lt(e)?ct(t=e)&&/wss?:\/\//.test(t)?e:"ws://"+e:"wss://test.gametalk.ai";var t}registerMessage(){co(vo.TEXT,ts),co(vo.IMAGE,rs),co(vo.GIF,ns),co(vo.AUDIO,os),co(vo.FILE,ss),co(vo.VIDEO,is),co(vo.RECALL,Cs),co(vo.LOCATION,as),co(vo.CHAT_RECORD,cs),co(vo.CONTACT,ls),co(vo.GROUP_INVITATION,us),co(vo.REDPACKET,ds),co(vo.TRANSFER,ps),co(vo.LINK,gs),co(bo.GROUP_ARRIVAL_RECEIPT,fs),co(bo.GROUP_READ_RECEIPT,hs),co(bo.PRIVATE_ARRIVAL_RECEIPT,ys),co(bo.PRIVATE_READ_RECEIPT,ms),co(bo.PRIVATE_OPEN_BURNAFTERREADING,vs),co(bo.PRIVATE_CLOSE_BURNAFTERREADING,bs),co(bo.GROUP_OPEN_BURNAFTERREADING,Os),co(bo.GROUP_CLOSE_BURNAFTERREADING,Is)}async connect(){if(this.connectionStatus===e.CONNECTED)return{code:t.SUCCESS};if(this.connectionStatus===e.CONNECTING)return{code:t.BIZ_ERROR_CONNECTING};cn.close();const r=await cn.connect();return this.isInternalConnected=!0,{code:r}}reconnect(){return this.isInternalConnected?Promise.resolve({code:t.CAN_NOT_RECONNECT}):this.connect()}disconnect(){return this.isInternalConnected=!1,cn.close(),Promise.resolve()}async setUserLogged(){Rs.setUserId(rn.uid.toString()),Ao.get().destroyed(),Ao.create(this.options.appkey,rn.uid.toString(),this.watcher.conversationState),qo.create(this.options.appkey,rn.uid.toString()),this.messageLoader?.stop(),this.messageLoader=new Yo(this.watcher,this.options),oo.reset(),io.reset(),uo.reset(),Xo.create(this.options.appkey,rn.uid.toString()),Xo.get().initDB().then(()=>Xo.get().getMessageIdRange()).then(e=>{if(e){const{oldest:t,newest:r}=e;Ho(t,r)}else Ho(1e4,1e4)}),this.getConnectionStatus()===e.CONNECTED&&this.handleUserConnected()}setUserLogout(){this.messageLoader?.stop()}getConnectionStatus(){return this.connectionStatus}assignWatcher(e){pt(this.watcher).forEach(t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];this.watcher[t]=st(r)?r:void 0}})}resetWatcher(){pt(this.watcher).forEach(e=>{this.watcher[e]=void 0})}async connectionStatusListener(t){switch(this.connectionStatus=t,t){case e.BLOCKED:case e.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.CONNECTING:this.handleConnecting();break;case e.CONNECTED:this.handleConnected();break;case e.DISCONNECTED:this.handleDisconnect()}}handleConnecting(){this.watcher.onConnecting?.()}handleConnected(){rn.isActive&&(this.handleUserConnected(),to()),this.watcher.onConnected?.(),ks.cleanupOldLogs()}handleDisconnect(){this.watcher.onDisconnect?.(),this.messageLoader?.stop()}handleSuspend(){this.watcher.onSuspend?.()}handleUserConnected(){ks.info("user connected -> ",rn.uid.toString()),this.messageLoader||(this.messageLoader=new Yo(this.watcher,this.options)),this.messageLoader?.start(),setTimeout(()=>{this.connectionStatus===e.CONNECTED&&Ao.get().syncConversationStatus()},2e3)}messageListener(e,t){if(e===Et.NewMessagePush){const e=Pn.decode(t);this.messageLoader?.syncMsg(e.seqno)}else e===Et.DialogChangedPush?Ao.get().syncConversationStatus():this.watcher.onPush?.(e,t)}}class Ss{static instance;messageQueue;config;flushTimer=null;userId=null;isFlushing=!1;constructor(e){this.config=e,this.messageQueue=new wt,this.startFlushTimer()}static getInstance(e){return Ss.instance||(Ss.instance=new Ss(e)),Ss.instance}trackEvent(e,t){const r={type:e,...this.collectAutomaticProperties(),content:t};this.messageQueue.enqueue(r),this.config.debugMode&&this.flush()}collectAutomaticProperties(){return{user_id:this.userId,os:"web",appVersion:Rt.appVersion,eventTime:Date.now()}}async flush(){if(!this.shouldFlush()||this.isFlushing)return;this.isFlushing=!0;let e=[];try{if(e=await this.messageQueue.dequeue(this.config.flushBulkSize),0===e.length)return;const t=await async function(e){const t=JSON.stringify(e),r=(new TextEncoder).encode(t);if("CompressionStream"in window){const e=new Response(r).body?.pipeThrough(new CompressionStream("gzip"));if(e){const t=await new Response(e).arrayBuffer();return btoa(String.fromCharCode(...new Uint8Array(t)))}}return btoa(t)}(e);await this.sendData(t)}catch(t){console.error("Failed to flush analytics data:",t),await this.messageQueue.requeueToEnd(e)}finally{this.isFlushing=!1}}shouldFlush(){return ws.loader?.getConnectionStatus()==e.CONNECTED}async sendData(e){try{const r=await(e=>cn.send(Et.PostAnalyticsLogs,{data:e},{encoder:Tr,decoder:Er}))(e);if(r.code!==t.SUCCESS)throw new Error(`Socket error! status: ${r.code}`)}catch(e){throw e}}startFlushTimer(){this.config.flushInterval>0&&(this.flushTimer=setInterval(()=>{this.flush()},this.config.flushInterval))}setUserId(e){this.userId=e}destroy(){this.flushTimer&&clearInterval(this.flushTimer),this.messageQueue.clear()}}var Rs=Ss.getInstance({flushInterval:6e4,flushBulkSize:100,debugMode:!1});const Es=bt.get("ACIM-slf")===(new Date).getDate();const Ts={[u.DEBUG]:console.debug.bind(console),[u.INFO]:console.info.bind(console),[u.WARN]:console.warn.bind(console),[u.ERROR]:console.error.bind(console),[u.FATAL]:console.log.bind(console),[u.NONE]:null},_s=e=>ct(e)||rt(e)||ot(e)||nt(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e);var ks=new class{debug;info;warn;error;fatal;outLevel=u.WARN;tag;logStdout;constructor(e){this.tag=e,this.debug=this.log.bind(this,u.DEBUG),this.info=this.log.bind(this,u.INFO),this.warn=this.log.bind(this,u.WARN),this.error=this.log.bind(this,u.ERROR),this.fatal=this.log.bind(this,u.FATAL)}async addLog(e,t){const r={timestamp:(new Date).toISOString(),level:e,content:t};try{e===u.ERROR&&Rs.trackEvent("error_log",{timestamp:r.timestamp,content:r.content})}catch(e){console.error("Failed to add log:",e)}}defaultStdout(e,t,...r){const n=Ts[e];tt(n)&&n(`${t}:`,...r)}reqInfo(...e){this.info(...e)}setLogLevel(e){this.outLevel=e}setLogStdout(e){this.logStdout=e}log(e,...t){if(Es){const r=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`;return this.defaultStdout(e,r,...t),void this.addLog(e,t.map(_s).join(" "))}if(e<this.outLevel)return;const r=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`,n=`${r} - ${t.map(_s).join(" ")}`;if(this.logStdout)return this.logStdout(e,n),void this.addLog(e,t.map(_s).join(" "));this.defaultStdout(e,r,...t),this.addLog(e,t.map(_s).join(" "))}async exportLogs(){return[]}async clearLogs(){}async cleanupOldLogs(){}}("ACLog");const As=lt,Ms=rt,Ns=nt,Ps=it,Ls=at,Ds=e=>rt(e)&&Object.prototype.hasOwnProperty.call(n,e),js=e=>{if(!it(e))return!1;const{conversationType:t,targetId:r,channelId:o}=e;return rt(t)&&Object.prototype.hasOwnProperty.call(n,t)&&(rt(r)||lt(r)||Nr.isLong(r)&&!r.isZero())&&(!tt(o)||ct(o)&&!/_/g.test(o)&&o.length<=20)};class Us extends Error{constructor(e){super(e),this.name="ACAssertError"}}const Bs=(e,t,r,n=!1)=>{if(!Fs(e,t,r,n))throw new Us(`'${e}' is invalid: ${JSON.stringify(t)}`)},Fs=(e,t,r,n=!1)=>{const o=n&&!r(t)||!n&&tt(t)&&!r(t);return o&&ks.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};var xs,Gs,qs,Vs,Ks={exports:{}},Hs={exports:{}},zs={exports:{}};var $s,Ws={};var Js,Zs,Xs,Ys,Qs,ei,ti,ri,ni,oi,si,ii,ai,ci,li,ui,di,pi,gi,fi={};function hi(){return Js||(Js=1,function(e){var t=e,r=ea(),n=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,o={};for(t|=0;r<e.length;)o[n[r+t]]=e[r++];return o}t.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),t.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),t.long=o([0,0,0,1,1],7),t.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),t.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])}(fi)),fi}function yi(){if(Xs)return Zs;Xs=1,Zs=i;var e=ta();((i.prototype=Object.create(e.prototype)).constructor=i).className="Field";var t,r=ra(),n=hi(),o=ea(),s=/^required|optional|repeated$/;function i(t,r,i,a,c,l,u){if(o.isObject(a)?(u=c,l=a,a=c=void 0):o.isObject(c)&&(u=l,l=c,c=void 0),e.call(this,t,l),!o.isInteger(r)||r<0)throw TypeError("id must be a non-negative integer");if(!o.isString(i))throw TypeError("type must be a string");if(void 0!==a&&!s.test(a=a.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==c&&!o.isString(c))throw TypeError("extend must be a string");"proto3_optional"===a&&(a="optional"),this.rule=a&&"optional"!==a?a:void 0,this.type=i,this.id=r,this.extend=c||void 0,this.required="required"===a,this.optional=!this.required,this.repeated="repeated"===a,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!o.Long&&void 0!==n.long[i],this.bytes="bytes"===i,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}return i.fromJSON=function(e,t){return new i(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(i.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),i.prototype.setOption=function(t,r,n){return"packed"===t&&(this._packed=null),e.prototype.setOption.call(this,t,r,n)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},i.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=n.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof t?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof r&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof r)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=o.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var s;o.base64.test(this.typeDefault)?o.base64.decode(this.typeDefault,s=o.newBuffer(o.base64.length(this.typeDefault)),0):o.utf8.write(this.typeDefault,s=o.newBuffer(o.utf8.length(this.typeDefault)),0),this.typeDefault=s}return this.map?this.defaultValue=o.emptyObject:this.repeated?this.defaultValue=o.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof t&&(this.parent.ctor.prototype[this.name]=this.defaultValue),e.prototype.resolve.call(this)},i.d=function(e,t,r,n){return"function"==typeof t?t=o.decorateType(t).name:t&&"object"==typeof t&&(t=o.decorateEnum(t).name),function(s,a){o.decorateType(s.constructor).add(new i(a,e,t,r,{default:n}))}},i._configure=function(e){t=e},Zs}function mi(){if(Qs)return Ys;Qs=1,Ys=n;var e=ta();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=yi(),r=ea();function n(t,r,n,o){if(Array.isArray(r)||(n=r,r=void 0),e.call(this,t,n),void 0!==r&&!Array.isArray(r))throw TypeError("fieldNames must be an Array");this.oneof=r||[],this.fieldsArray=[],this.comment=o}function o(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}return n.fromJSON=function(e,t){return new n(e,t.oneof,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},n.prototype.add=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,o(this),this},n.prototype.remove=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),(r=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(r,1),e.partOf=null,this},n.prototype.onAdd=function(t){e.prototype.onAdd.call(this,t);for(var r=0;r<this.oneof.length;++r){var n=t.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}o(this)},n.prototype.onRemove=function(t){for(var r,n=0;n<this.fieldsArray.length;++n)(r=this.fieldsArray[n]).parent&&r.parent.remove(r);e.prototype.onRemove.call(this,t)},n.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,o){r.decorateType(t.constructor).add(new n(o,e)),Object.defineProperty(t,o,{get:r.oneOfGetter(e),set:r.oneOfSetter(e)})}},Ys}function vi(){if(ti)return ei;ti=1,ei=c;var e=ta();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=yi(),s=ea(),i=mi();function a(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function c(t,r){e.call(this,t,r),this.nested=void 0,this._nestedArray=null}function l(e){return e._nestedArray=null,e}return c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=a,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=s.toArray(this.nested))}}),c.prototype.toJSON=function(e){return s.toObject(["options",this.options,"nested",a(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var s,i=Object.keys(e),a=0;a<i.length;++a)s=e[i[a]],this.add((void 0!==s.fields?t.fromJSON:void 0!==s.values?n.fromJSON:void 0!==s.methods?r.fromJSON:void 0!==s.id?o.fromJSON:c.fromJSON)(i[a],s));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof t||e instanceof i||e instanceof n||e instanceof r||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var s=this.get(e.name);if(s){if(!(s instanceof c&&e instanceof c)||s instanceof t||s instanceof r)throw Error("duplicate name '"+e.name+"' in "+this);for(var a=s.nestedArray,u=0;u<a.length;++u)e.add(a[u]);this.remove(s),this.nested||(this.nested={}),e.setOptions(s.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),l(this)},c.prototype.remove=function(t){if(!(t instanceof e))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),l(this)},c.prototype.define=function(e,t){if(s.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(n))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),s.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof c&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof c&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var r=this.lookup(e,[t]);if(!r)throw Error("no such type: "+e);return r},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[t,n]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r},c.prototype.lookupService=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,o,s){t=e,r=o,n=s},ei}function bi(){if(ni)return ri;ni=1,ri=n;var e=yi();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=hi(),r=ea();function n(t,n,o,s,i,a){if(e.call(this,t,n,s,void 0,void 0,i,a),!r.isString(o))throw TypeError("keyType must be a string");this.keyType=o,this.resolvedKeyType=null,this.map=!0}return n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===t.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return e.prototype.resolve.call(this)},n.d=function(e,t,o){return"function"==typeof o?o=r.decorateType(o).name:o&&"object"==typeof o&&(o=r.decorateEnum(o).name),function(s,i){r.decorateType(s.constructor).add(new n(i,e,t,o))}},ri}function Oi(){if(si)return oi;si=1,oi=r;var e=ta();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=ea();function r(r,n,o,s,i,a,c,l,u){if(t.isObject(i)?(c=i,i=a=void 0):t.isObject(a)&&(c=a,a=void 0),void 0!==n&&!t.isString(n))throw TypeError("type must be a string");if(!t.isString(o))throw TypeError("requestType must be a string");if(!t.isString(s))throw TypeError("responseType must be a string");e.call(this,r,c),this.type=n||"rpc",this.requestType=o,this.requestStream=!!i||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}return r.fromJSON=function(e,t){return new r(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},r.prototype.toJSON=function(e){var r=!!e&&Boolean(e.keepComments);return t.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])},r.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),e.prototype.resolve.call(this))},oi}function Ii(){if(ai)return ii;ai=1,ii=o;var e=vi();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=Oi(),r=ea(),n=fr();function o(t,r){e.call(this,t,r),this.methods={},this._methodsArray=null}function s(e){return e._methodsArray=null,e}return o.fromJSON=function(e,r){var n=new o(e,r.options);if(r.methods)for(var s=Object.keys(r.methods),i=0;i<s.length;++i)n.add(t.fromJSON(s[i],r.methods[s[i]]));return r.nested&&n.addJSON(r.nested),n.comment=r.comment,n},o.prototype.toJSON=function(t){var n=e.prototype.toJSON.call(this,t),o=!!t&&Boolean(t.keepComments);return r.toObject(["options",n&&n.options||void 0,"methods",e.arrayToJSON(this.methodsArray,t)||{},"nested",n&&n.nested||void 0,"comment",o?this.comment:void 0])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=r.toArray(this.methods))}}),o.prototype.get=function(t){return this.methods[t]||e.prototype.get.call(this,t)},o.prototype.resolveAll=function(){for(var t=this.methodsArray,r=0;r<t.length;++r)t[r].resolve();return e.prototype.resolve.call(this)},o.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof t?(this.methods[r.name]=r,r.parent=this,s(this)):e.prototype.add.call(this,r)},o.prototype.remove=function(r){if(r instanceof t){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,s(this)}return e.prototype.remove.call(this,r)},o.prototype.create=function(e,t,o){for(var s,i=new n.Service(e,t,o),a=0;a<this.methodsArray.length;++a){var c=r.lcFirst((s=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=r.codegen(["r","c"],r.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:s,q:s.resolvedRequestType.ctor,s:s.resolvedResponseType.ctor})}return i},ii}function Ci(){if(li)return ci;li=1,ci=t;var e=rr();function t(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}return t.create=function(e){return this.$type.create(e)},t.encode=function(e,t){return this.$type.encode(e,t)},t.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},t.decode=function(e){return this.$type.decode(e)},t.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},t.verify=function(e){return this.$type.verify(e)},t.fromObject=function(e){return this.$type.fromObject(e)},t.toObject=function(e,t){return this.$type.toObject(e,t)},t.prototype.toJSON=function(){return this.$type.toObject(this,e.toJSONOptions)},ci}function wi(){if(di)return ui;di=1,ui=function(o){var s=r.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter(function(e){return e.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&s("if((t&7)===4)")("break");s("switch(t>>>3){");for(var i=0;i<o.fieldsArray.length;++i){var a=o._fieldsArray[i].resolve(),c=a.resolvedType instanceof e?"int32":a.type,l="m"+r.safeProp(a.name);s("case %i: {",a.id),a.map?(s("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==t.defaults[a.keyType]?s("k=%j",t.defaults[a.keyType]):s("k=null"),void 0!==t.defaults[c]?s("value=%j",t.defaults[c]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===t.basic[c]?s("value=types[%i].decode(r,r.uint32())",i):s("value=r.%s()",c),s("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==t.long[a.keyType]?s('%s[typeof k==="object"?util.longToHash(k):k]=value',l):s("%s[k]=value",l)):a.repeated?(s("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==t.packed[c]&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===t.basic[c]?s(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,i):s("%s.push(r.%s())",l,c)):void 0===t.basic[c]?s(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,i):s("%s=r.%s()",l,c),s("break")("}")}for(s("default:")("r.skipType(t&7)")("break")("}")("}"),i=0;i<o._fieldsArray.length;++i){var u=o._fieldsArray[i];u.required&&s("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",n(u))}return s("return m")};var e=ra(),t=hi(),r=ea();function n(e){return"missing required '"+e.name+"'"}return ui}function Si(){if(gi)return pi;gi=1,pi=function(e){var s=t.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,a={};i.length&&s("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+t.safeProp(l.name);if(l.optional&&s("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)s("if(!util.isObject(%s))",u)("return%j",r(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),o(s,l,"k[i]"),n(s,l,c,u+"[k[i]]")("}");else if(l.repeated)s("if(!Array.isArray(%s))",u)("return%j",r(l,"array"))("for(var i=0;i<%s.length;++i){",u),n(s,l,c,u+"[i]")("}");else{if(l.partOf){var d=t.safeProp(l.partOf.name);1===a[l.partOf.name]&&s("if(p%s===1)",d)("return%j",l.partOf.name+": multiple values"),a[l.partOf.name]=1,s("p%s=1",d)}n(s,l,c,u)}l.optional&&s("}")}return s("return null")};var e=ra(),t=ea();function r(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function n(t,n,o,s){if(n.resolvedType)if(n.resolvedType instanceof e){t("switch(%s){",s)("default:")("return%j",r(n,"enum value"));for(var i=Object.keys(n.resolvedType.values),a=0;a<i.length;++a)t("case %i:",n.resolvedType.values[i[a]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s);",o,s)("if(e)")("return%j+e",n.name+".")("}");else switch(n.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",s)("return%j",r(n,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",s,s,s,s)("return%j",r(n,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',s)("return%j",r(n,"number"));break;case"bool":t('if(typeof %s!=="boolean")',s)("return%j",r(n,"boolean"));break;case"string":t("if(!util.isString(%s))",s)("return%j",r(n,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',s,s,s)("return%j",r(n,"buffer"))}return t}function o(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",r(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",r(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",r(t,"boolean key"))}return e}return pi}var Ri,Ei={};function Ti(){return Ri||(Ri=1,function(e){var t=e,r=ra(),n=ea();function o(e,t,n,o){var s=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",o);for(var i=t.resolvedType.values,a=Object.keys(i),c=0;c<a.length;++c)i[a[c]]!==t.typeDefault||s||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',o,o,o),t.repeated||e("break"),s=!0),e("case%j:",a[c])("case %i:",i[a[c]])("m%s=%j",o,i[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',o)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",o,n,o);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",o,o);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,l)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length >= 0)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function s(e,t,n,o){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",o,n,o,o,n,o,o):e("d%s=types[%i].toObject(m%s,o)",o,n,o);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,s?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,s=n.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return s("return new this.ctor");s("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),c=n.safeProp(a.name);a.map?(s("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(s,a,i,c+"[ks[i]]")("}")("}")):a.repeated?(s("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(s,a,i,c+"[i]")("}")("}")):(a.resolvedType instanceof r||s("if(d%s!=null){",c),o(s,a,i,c),a.resolvedType instanceof r||s("}"))}return s("return m")},t.toObject=function(e){var t=e.fieldsArray.slice().sort(n.compareFieldsById);if(!t.length)return n.codegen()("return {}");for(var o=n.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],a=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?i:t[l].map?a:c).push(t[l]);if(i.length){for(o("if(o.arrays||o.defaults){"),l=0;l<i.length;++l)o("d%s=[]",n.safeProp(i[l].name));o("}")}if(a.length){for(o("if(o.objects||o.defaults){"),l=0;l<a.length;++l)o("d%s={}",n.safeProp(a[l].name));o("}")}if(c.length){for(o("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],d=n.safeProp(u.name);if(u.resolvedType instanceof r)o("d%s=o.enums===String?%j:%j",d,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)o("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",d)("}else")("d%s=o.longs===String?%j:%i",d,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var p="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";o("if(o.bytes===String)d%s=%j",d,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",d,p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",d,d)("}")}else o("d%s=%j",d,u.typeDefault)}o("}")}var g=!1;for(l=0;l<t.length;++l){u=t[l];var f=e._fieldsArray.indexOf(u);d=n.safeProp(u.name);u.map?(g||(g=!0,o("var ks2")),o("if(m%s&&(ks2=Object.keys(m%s)).length){",d,d)("d%s={}",d)("for(var j=0;j<ks2.length;++j){"),s(o,u,f,d+"[ks2[j]]")("}")):u.repeated?(o("if(m%s&&m%s.length){",d,d)("d%s=[]",d)("for(var j=0;j<m%s.length;++j){",d),s(o,u,f,d+"[j]")("}")):(o("if(m%s!=null&&m.hasOwnProperty(%j)){",d,u.name),s(o,u,f,d),u.partOf&&o("if(o.oneofs)")("d%s=%j",n.safeProp(u.partOf.name),u.name)),o("}")}return o("return d")}}(Ei)),Ei}var _i,ki,Ai,Mi,Ni,Pi,Li,Di,ji,Ui,Bi,Fi,xi,Gi,qi,Vi,Ki,Hi,zi,$i,Wi,Ji,Zi={};function Xi(){return _i||(_i=1,function(e){var t=e,r=Ci();t[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var n="",o="";if(t&&t.json&&e.type_url&&e.value){o=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(o);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof r){var i=e.$type.toObject(e,t);return""===n&&(n="type.googleapis.com/"),o=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),i["@type"]=o,i}return this.toObject(e,t)}}}(Zi)),Zi}function Yi(){if(Ai)return ki;Ai=1,ki=h;var e=vi();((h.prototype=Object.create(e.prototype)).constructor=h).className="Type";var t=ra(),r=mi(),n=yi(),o=bi(),s=Ii(),i=Ci(),a=or(),c=nr(),l=ea(),u=na(),d=wi(),p=Si(),g=Ti(),f=Xi();function h(t,r){e.call(this,t,r),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}return Object.defineProperties(h.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=l.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=l.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=h.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof i||((e.prototype=new i).constructor=e,l.merge(e.prototype,t)),e.$type=e.prototype.$type=this,l.merge(e,i,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:l.oneOfGetter(this._oneofsArray[r].oneof),set:l.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),h.generateConstructor=function(e){for(var t,r=l.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",l.safeProp(t.name)):t.repeated&&r("this%s=[]",l.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},h.fromJSON=function(i,a){var c=new h(i,a.options);c.extensions=a.extensions,c.reserved=a.reserved;for(var l=Object.keys(a.fields),u=0;u<l.length;++u)c.add((void 0!==a.fields[l[u]].keyType?o.fromJSON:n.fromJSON)(l[u],a.fields[l[u]]));if(a.oneofs)for(l=Object.keys(a.oneofs),u=0;u<l.length;++u)c.add(r.fromJSON(l[u],a.oneofs[l[u]]));if(a.nested)for(l=Object.keys(a.nested),u=0;u<l.length;++u){var d=a.nested[l[u]];c.add((void 0!==d.id?n.fromJSON:void 0!==d.fields?h.fromJSON:void 0!==d.values?t.fromJSON:void 0!==d.methods?s.fromJSON:e.fromJSON)(l[u],d))}return a.extensions&&a.extensions.length&&(c.extensions=a.extensions),a.reserved&&a.reserved.length&&(c.reserved=a.reserved),a.group&&(c.group=!0),a.comment&&(c.comment=a.comment),c},h.prototype.toJSON=function(t){var r=e.prototype.toJSON.call(this,t),n=!!t&&Boolean(t.keepComments);return l.toObject(["options",r&&r.options||void 0,"oneofs",e.arrayToJSON(this.oneofsArray,t),"fields",e.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),t)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])},h.prototype.resolveAll=function(){for(var t=this.fieldsArray,r=0;r<t.length;)t[r++].resolve();var n=this.oneofsArray;for(r=0;r<n.length;)n[r++].resolve();return e.prototype.resolveAll.call(this)},h.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},h.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof n&&void 0===t.extend){if(this._fieldsById?this._fieldsById[t.id]:this.fieldsById[t.id])throw Error("duplicate id "+t.id+" in "+this);if(this.isReservedId(t.id))throw Error("id "+t.id+" is reserved in "+this);if(this.isReservedName(t.name))throw Error("name '"+t.name+"' is reserved in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),y(this)}return t instanceof r?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),y(this)):e.prototype.add.call(this,t)},h.prototype.remove=function(t){if(t instanceof n&&void 0===t.extend){if(!this.fields||this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.parent=null,t.onRemove(this),y(this)}if(t instanceof r){if(!this.oneofs||this.oneofs[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.oneofs[t.name],t.parent=null,t.onRemove(this),y(this)}return e.prototype.remove.call(this,t)},h.prototype.isReservedId=function(t){return e.isReservedId(this.reserved,t)},h.prototype.isReservedName=function(t){return e.isReservedName(this.reserved,t)},h.prototype.create=function(e){return new this.ctor(e)},h.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=u(this)({Writer:c,types:t,util:l}),this.decode=d(this)({Reader:a,types:t,util:l}),this.verify=p(this)({types:t,util:l}),this.fromObject=g.fromObject(this)({types:t,util:l}),this.toObject=g.toObject(this)({types:t,util:l});var n=f[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},h.prototype.encode=function(e,t){return this.setup().encode(e,t)},h.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},h.prototype.decode=function(e,t){return this.setup().decode(e,t)},h.prototype.decodeDelimited=function(e){return e instanceof a||(e=a.create(e)),this.decode(e,e.uint32())},h.prototype.verify=function(e){return this.setup().verify(e)},h.prototype.fromObject=function(e){return this.setup().fromObject(e)},h.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},h.d=function(e){return function(t){l.decorateType(t,e)}},ki}function Qi(){if(Ni)return Mi;Ni=1,Mi=c;var e=vi();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=yi(),s=ra(),i=mi(),a=ea();function c(t){e.call(this,"",t),this.deferred=[],this.files=[]}function l(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=a.path.resolve,c.prototype.fetch=a.fetch,c.prototype.load=function e(t,o,s){"function"==typeof o&&(s=o,o=void 0);var i=this;if(!s)return a.asPromise(e,i,t,o);var c=s===l;function u(e,t){if(s){if(c)throw e;var r=s;s=null,r(e,t)}}function d(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in n)return r}return null}function p(e,t){try{if(a.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),a.isString(t)){r.filename=e;var n,s=r(t,i,o),l=0;if(s.imports)for(;l<s.imports.length;++l)(n=d(s.imports[l])||i.resolvePath(e,s.imports[l]))&&g(n);if(s.weakImports)for(l=0;l<s.weakImports.length;++l)(n=d(s.weakImports[l])||i.resolvePath(e,s.weakImports[l]))&&g(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}c||f||u(null,i)}function g(e,t){if(e=d(e)||e,!(i.files.indexOf(e)>-1))if(i.files.push(e),e in n)c?p(e,n[e]):(++f,setTimeout(function(){--f,p(e,n[e])}));else if(c){var r;try{r=a.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}p(e,r)}else++f,i.fetch(e,function(r,n){--f,s&&(r?t?f||u(null,i):u(r):p(e,n))})}var f=0;a.isString(t)&&(t=[t]);for(var h,y=0;y<t.length;++y)(h=i.resolvePath("",t[y]))&&g(h);if(c)return i;f||u(null,i)},c.prototype.loadSync=function(e,t){if(!a.isNode)throw Error("not supported");return this.load(e,t,l)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return e.prototype.resolveAll.call(this)};var u=/^[A-Z]/;function d(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new o(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}return c.prototype._handleAdd=function(e){if(e instanceof o)void 0===e.extend||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof s)u.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof i)){if(e instanceof t)for(var r=0;r<this.deferred.length;)d(0,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);u.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(t){if(t instanceof o){if(void 0!==t.extend)if(t.extensionField)t.extensionField.parent.remove(t.extensionField),t.extensionField=null;else{var r=this.deferred.indexOf(t);r>-1&&this.deferred.splice(r,1)}}else if(t instanceof s)u.test(t.name)&&delete t.parent[t.name];else if(t instanceof e){for(var n=0;n<t.nestedArray.length;++n)this._handleRemove(t._nestedArray[n]);u.test(t.name)&&delete t.parent[t.name]}},c._configure=function(e,o,s){t=e,r=o,n=s},Mi}function ea(){if(Pi)return zs.exports;Pi=1;var e,t,r=zs.exports=rr(),n=hr();r.codegen=function(){if(Gs)return xs;function e(t,r){"string"==typeof t&&(r=t,t=void 0);var n=[];function o(t){if("string"!=typeof t){var r=s();if(e.verbose&&console.log("codegen: "+r),r="return "+r,t){for(var i=Object.keys(t),a=new Array(i.length+1),c=new Array(i.length),l=0;l<i.length;)a[l]=i[l],c[l]=t[i[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),d=0;d<u.length;)u[d]=arguments[++d];if(d=0,t=t.replace(/%([%dfijs])/g,function(e,t){var r=u[d++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"}),d!==u.length)throw Error("parameter count mismatch");return n.push(t),o}function s(e){return"function "+(e||r||"")+"("+(t&&t.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return o.toString=s,o}return Gs=1,xs=e,e.verbose=!1,xs}(),r.fetch=function(){if(Vs)return qs;Vs=1,qs=r;var e=Mt(),t=xt()("fs");function r(n,o,s){return"function"==typeof o?(s=o,o={}):o||(o={}),s?!o.xhr&&t&&t.readFile?t.readFile(n,function(e,t){return e&&"undefined"!=typeof XMLHttpRequest?r.xhr(n,o,s):e?s(e):s(null,o.binary?t:t.toString("utf8"))}):r.xhr(n,o,s):e(r,this,n,o)}return r.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o<n.responseText.length;++o)e.push(255&n.responseText.charCodeAt(o))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()},qs}(),r.path=($s||($s=1,function(e){var t=e,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):n?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}}(Ws)),Ws),r.fs=r.inquire("fs"),r.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},r.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t};var o=/\\/g,s=/"/g;r.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},r.safeProp=function(e){return!/^[$\w_]+$/.test(e)||r.isReserved(e)?'["'+e.replace(o,"\\\\").replace(s,'\\"')+'"]':"."+e},r.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var i=/_([a-z])/g;r.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(i,function(e,t){return t.toUpperCase()})},r.compareFieldsById=function(e,t){return e.id-t.id},r.decorateType=function(t,n){if(t.$type)return n&&t.$type.name!==n&&(r.decorateRoot.remove(t.$type),t.$type.name=n,r.decorateRoot.add(t.$type)),t.$type;e||(e=Yi());var o=new e(n||t.name);return r.decorateRoot.add(o),o.ctor=t,Object.defineProperty(t,"$type",{value:o,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:o,enumerable:!1}),o};var a=0;return r.decorateEnum=function(e){if(e.$type)return e.$type;t||(t=ra());var n=new t("Enum"+a++,e);return r.decorateRoot.add(n),Object.defineProperty(e,"$type",{value:n,enumerable:!1}),n},r.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var o=r.shift();if("__proto__"===o||"prototype"===o)return t;if(r.length>0)t[o]=e(t[o]||{},r,n);else{var s=t[o];s&&(n=[].concat(s).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(r,"decorateRoot",{get:function(){return n.decorated||(n.decorated=new(Qi()))}}),zs.exports}function ta(){if(Di)return Li;Di=1,Li=r,r.className="ReflectionObject";var e,t=ea();function r(e,r){if(!t.isString(e))throw TypeError("name must be a string");if(r&&!t.isObject(r))throw TypeError("options must be an object");this.options=r,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(r.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),r.prototype.toJSON=function(){throw Error()},r.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;r instanceof e&&r._handleAdd(this)},r.prototype.onRemove=function(t){var r=t.root;r instanceof e&&r._handleRemove(this),this.parent=null,this.resolved=!1},r.prototype.resolve=function(){return this.resolved||this.root instanceof e&&(this.resolved=!0),this},r.prototype.getOption=function(e){if(this.options)return this.options[e]},r.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},r.prototype.setParsedOption=function(e,r,n){this.parsedOptions||(this.parsedOptions=[]);var o=this.parsedOptions;if(n){var s=o.find(function(t){return Object.prototype.hasOwnProperty.call(t,e)});if(s){var i=s[e];t.setProperty(i,n,r)}else(s={})[e]=t.setProperty({},n,r),o.push(s)}else{var a={};a[e]=r,o.push(a)}return this},r.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},r.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},r._configure=function(t){e=t},Li}function ra(){if(Ui)return ji;Ui=1,ji=n;var e=ta();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=vi(),r=ea();function n(t,r,n,o,s,i){if(e.call(this,t,n),r&&"object"!=typeof r)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=s||{},this.valuesOptions=i,this.reserved=void 0,r)for(var a=Object.keys(r),c=0;c<a.length;++c)"number"==typeof r[a[c]]&&(this.valuesById[this.values[a[c]]=r[a[c]]]=a[c])}return n.fromJSON=function(e,t){var r=new n(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},n.prototype.add=function(e,t,n,o){if(!r.isString(e))throw TypeError("name must be a string");if(!r.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return o&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=o||null),this.comments[e]=n||null,this},n.prototype.remove=function(e){if(!r.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},n.prototype.isReservedId=function(e){return t.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return t.isReservedName(this.reserved,e)},ji}function na(){if(Fi)return Bi;Fi=1,Bi=function(o){for(var s,i=r.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),a=o.fieldsArray.slice().sort(r.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=o._fieldsArray.indexOf(l),d=l.resolvedType instanceof e?"int32":l.type,p=t.basic[d];s="m"+r.safeProp(l.name),l.map?(i("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",s,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",s)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|t.mapKey[l.keyType],l.keyType),void 0===p?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,s):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,d,s),i("}")("}")):l.repeated?(i("if(%s!=null&&%s.length){",s,s),l.packed&&void 0!==t.packed[d]?i("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",s)("w.%s(%s[i])",d,s)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",s),void 0===p?n(i,l,u,s+"[i]"):i("w.uint32(%i).%s(%s[i])",(l.id<<3|p)>>>0,d,s)),i("}")):(l.optional&&i("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",s,l.name),void 0===p?n(i,l,u,s):i("w.uint32(%i).%s(%s)",(l.id<<3|p)>>>0,d,s))}return i("return w")};var e=ra(),t=hi(),r=ea();function n(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}return Bi}function oa(){if(qi)return Gi;qi=1,Gi=u;var e=/[\s{}=;:[\],'"()<>]/g,t=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,r=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,n=/^ *[*/]+ */,o=/^\s*\*?\/*/,s=/\n/g,i=/\s/,a=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function l(e){return e.replace(a,function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}})}function u(a,c){a=a.toString();var u=0,d=a.length,p=1,g=0,f={},h=[],y=null;function m(e){return Error("illegal "+e+" (line "+p+")")}function v(e){return a.charAt(e)}function b(e,t,r){var i,l={type:a.charAt(e++),lineEmpty:!1,leading:r},u=e-(c?2:3);do{if(--u<0||"\n"===(i=a.charAt(u))){l.lineEmpty=!0;break}}while(" "===i||"\t"===i);for(var d=a.substring(e,t).split(s),h=0;h<d.length;++h)d[h]=d[h].replace(c?o:n,"").trim();l.text=d.join("\n").trim(),f[p]=l,g=p}function O(e){var t=I(e),r=a.substring(e,t);return/^\s*\/\//.test(r)}function I(e){for(var t=e;t<d&&"\n"!==v(t);)t++;return t}function C(){if(h.length>0)return h.shift();if(y)return function(){var e="'"===y?r:t;e.lastIndex=u-1;var n=e.exec(a);if(!n)throw m("string");return u=e.lastIndex,w(y),y=null,l(n[1])}();var n,o,s,g,f,C=0===u;do{if(u===d)return null;for(n=!1;i.test(s=v(u));)if("\n"===s&&(C=!0,++p),++u===d)return null;if("/"===v(u)){if(++u===d)throw m("comment");if("/"===v(u))if(c){if(g=u,f=!1,O(u-1)){f=!0;do{if((u=I(u))===d)break;if(u++,!C)break}while(O(u))}else u=Math.min(d,I(u)+1);f&&(b(g,u,C),C=!0),p++,n=!0}else{for(f="/"===v(g=u+1);"\n"!==v(++u);)if(u===d)return null;++u,f&&(b(g,u-1,C),C=!0),++p,n=!0}else{if("*"!==(s=v(u)))return"/";g=u+1,f=c||"*"===v(g);do{if("\n"===s&&++p,++u===d)throw m("comment");o=s,s=v(u)}while("*"!==o||"/"!==s);++u,f&&(b(g,u-2,C),C=!0),n=!0}}}while(n);var S=u;if(e.lastIndex=0,!e.test(v(S++)))for(;S<d&&!e.test(v(S));)++S;var R=a.substring(u,u=S);return'"'!==R&&"'"!==R||(y=R),R}function w(e){h.push(e)}function S(){if(!h.length){var e=C();if(null===e)return null;w(e)}return h[0]}return Object.defineProperty({next:C,peek:S,push:w,skip:function(e,t){var r=S();if(r===e)return C(),!0;if(!t)throw m("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t,r=null;return void 0===e?(t=f[p-1],delete f[p-1],t&&(c||"*"===t.type||t.lineEmpty)&&(r=t.leading?t.text:null)):(g<e&&S(),t=f[e],delete f[e],!t||t.lineEmpty||!c&&"/"!==t.type||(r=t.leading?null:t.text)),r}},"line",{get:function(){return p}})}return u.unescape=l,Gi}function sa(){if(Ki)return Vi;Ki=1,Vi=I,I.filename=null,I.defaults={keepCase:!1};var e=oa(),t=Qi(),r=Yi(),n=yi(),o=bi(),s=mi(),i=ra(),a=Ii(),c=Oi(),l=hi(),u=ea(),d=/^[1-9][0-9]*$/,p=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,f=/^-?0[x][0-9a-fA-F]+$/,h=/^0[0-7]+$/,y=/^-?0[0-7]+$/,m=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,v=/^[a-zA-Z_][a-zA-Z_0-9]*$/,b=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,O=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function I(C,w,S){w instanceof t||(S=w,w=new t),S||(S=I.defaults);var R,E,T,_,k,A=S.preferTrailingComment||!1,M=e(C,S.alternateCommentMode||!1),N=M.next,P=M.push,L=M.peek,D=M.skip,j=M.cmnt,U=!0,B=!1,F=w,x=S.keepCase?function(e){return e}:u.camelCase;function G(e,t,r){var n=I.filename;return r||(I.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+M.line+")")}function q(){var e,t=[];do{if('"'!==(e=N())&&"'"!==e)throw G(e);t.push(N()),D(e),e=L()}while('"'===e||"'"===e);return t.join("")}function V(e){var t=N();switch(t){case"'":case'"':return P(t),q();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(d.test(e))return r*parseInt(e,10);if(g.test(e))return r*parseInt(e,16);if(h.test(e))return r*parseInt(e,8);if(m.test(e))return r*parseFloat(e);throw G(e,"number",t)}(t,!0)}catch(r){if(e&&b.test(t))return t;throw G(t,"value")}}function K(e,t){var r,n;do{!t||'"'!==(r=L())&&"'"!==r?e.push([n=H(N()),D("to",!0)?H(N()):n]):e.push(q())}while(D(",",!0));var o={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Z(o,function(e){if("option"!==e)throw G(e);ee(o,e),D(";")},function(){ne(o)})}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw G(e,"id");if(p.test(e))return parseInt(e,10);if(f.test(e))return parseInt(e,16);if(y.test(e))return parseInt(e,8);throw G(e,"id")}function z(){if(void 0!==R)throw G("package");if(R=N(),!b.test(R))throw G(R,"name");F=F.define(R),D(";")}function $(){var e,t=L();switch(t){case"weak":e=T||(T=[]),N();break;case"public":N();default:e=E||(E=[])}t=q(),D(";"),e.push(t)}function W(){if(D("="),_=q(),!(B="proto3"===_)&&"proto2"!==_)throw G(_,"syntax");w.setOption("syntax",_),D(";")}function J(e,t){switch(t){case"option":return ee(e,t),D(";"),!0;case"message":return X(e,t),!0;case"enum":return Q(e,t),!0;case"service":return function(e,t){if(!v.test(t=N()))throw G(t,"service name");var r=new a(t);Z(r,function(e){if(!J(r,e)){if("rpc"!==e)throw G(e);!function(e,t){var r=j(),n=t;if(!v.test(t=N()))throw G(t,"name");var o,s,i,a,l=t;D("("),D("stream",!0)&&(s=!0);if(!b.test(t=N()))throw G(t);o=t,D(")"),D("returns"),D("("),D("stream",!0)&&(a=!0);if(!b.test(t=N()))throw G(t);i=t,D(")");var u=new c(l,n,o,i,s,a);u.comment=r,Z(u,function(e){if("option"!==e)throw G(e);ee(u,e),D(";")}),e.add(u)}(r,e)}}),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!b.test(t=N()))throw G(t,"reference");var r=t;Z(null,function(t){switch(t){case"required":case"repeated":Y(e,t,r);break;case"optional":Y(e,B?"proto3_optional":"optional",r);break;default:if(!B||!b.test(t))throw G(t);P(t),Y(e,"optional",r)}})}(e,t),!0}return!1}function Z(e,t,r){var n=M.line;if(e&&("string"!=typeof e.comment&&(e.comment=j()),e.filename=I.filename),D("{",!0)){for(var o;"}"!==(o=N());)t(o);D(";",!0)}else r&&r(),D(";"),e&&("string"!=typeof e.comment||A)&&(e.comment=j(n)||e.comment)}function X(e,t){if(!v.test(t=N()))throw G(t,"type name");var n=new r(t);Z(n,function(e){if(!J(n,e))switch(e){case"map":!function(e){D("<");var t=N();if(void 0===l.mapKey[t])throw G(t,"type");D(",");var r=N();if(!b.test(r))throw G(r,"type");D(">");var n=N();if(!v.test(n))throw G(n,"name");D("=");var s=new o(x(n),H(N()),t,r);Z(s,function(e){if("option"!==e)throw G(e);ee(s,e),D(";")},function(){ne(s)}),e.add(s)}(n);break;case"required":case"repeated":Y(n,e);break;case"optional":Y(n,B?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!v.test(t=N()))throw G(t,"name");var r=new s(x(t));Z(r,function(e){"option"===e?(ee(r,e),D(";")):(P(e),Y(r,"optional"))}),e.add(r)}(n,e);break;case"extensions":K(n.extensions||(n.extensions=[]));break;case"reserved":K(n.reserved||(n.reserved=[]),!0);break;default:if(!B||!b.test(e))throw G(e);P(e),Y(n,"optional")}}),e.add(n)}function Y(e,t,o){var i=N();if("group"!==i){for(;i.endsWith(".")||L().startsWith(".");)i+=N();if(!b.test(i))throw G(i,"type");var a=N();if(!v.test(a))throw G(a,"name");a=x(a),D("=");var c=new n(a,H(N()),i,t,o);if(Z(c,function(e){if("option"!==e)throw G(e);ee(c,e),D(";")},function(){ne(c)}),"proto3_optional"===t){var d=new s("_"+a);c.setOption("proto3_optional",!0),d.add(c),e.add(d)}else e.add(c);B||!c.repeated||void 0===l.packed[i]&&void 0!==l.basic[i]||c.setOption("packed",!1,!0)}else!function(e,t){var o=N();if(!v.test(o))throw G(o,"name");var s=u.lcFirst(o);o===s&&(o=u.ucFirst(o));D("=");var i=H(N()),a=new r(o);a.group=!0;var c=new n(s,i,o,t);c.filename=I.filename,Z(a,function(e){switch(e){case"option":ee(a,e),D(";");break;case"required":case"repeated":Y(a,e);break;case"optional":Y(a,B?"proto3_optional":"optional");break;case"message":X(a,e);break;case"enum":Q(a,e);break;default:throw G(e)}}),e.add(a).add(c)}(e,t)}function Q(e,t){if(!v.test(t=N()))throw G(t,"name");var r=new i(t);Z(r,function(e){switch(e){case"option":ee(r,e),D(";");break;case"reserved":K(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!v.test(t))throw G(t,"name");D("=");var r=H(N(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};Z(n,function(e){if("option"!==e)throw G(e);ee(n,e),D(";")},function(){ne(n)}),e.add(t,r,n.comment,n.options)}(r,e)}}),e.add(r)}function ee(e,t){var r=D("(",!0);if(!b.test(t=N()))throw G(t,"name");var n,o=t,s=o;r&&(D(")"),s=o="("+o+")",t=L(),O.test(t)&&(n=t.slice(1),o+=t,N())),D("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,s,te(e,o),n)}function te(e,t){if(D("{",!0)){for(var r={};!D("}",!0);){if(!v.test(k=N()))throw G(k,"name");if(null===k)throw G(k,"end of input");var n,o=k;if(D(":",!0),"{"===L())n=te(e,t+"."+k);else if("["===L()){var s;if(n=[],D("[",!0)){do{s=V(!0),n.push(s)}while(D(",",!0));D("]"),void 0!==s&&re(e,t+"."+k,s)}}else n=V(!0),re(e,t+"."+k,n);var i=r[o];i&&(n=[].concat(i).concat(n)),r[o]=n,D(",",!0),D(";",!0)}return r}var a=V(!0);return re(e,t,a),a}function re(e,t,r){e.setOption&&e.setOption(t,r)}function ne(e){if(D("[",!0)){do{ee(e,"option")}while(D(",",!0));D("]")}return e}for(;null!==(k=N());)switch(k){case"package":if(!U)throw G(k);z();break;case"import":if(!U)throw G(k);$();break;case"syntax":if(!U)throw G(k);W();break;case"option":ee(F,k),D(";");break;default:if(J(F,k)){U=!1;continue}throw G(k)}return I.filename=null,{package:R,imports:E,weakImports:T,syntax:_,root:w}}return Vi}function ia(){if($i)return Ks.exports;$i=1;var e=Ks.exports=function(){if(xi)return Hs.exports;xi=1;var e=Hs.exports=yr();return e.build="light",e.load=function(t,r,n){return"function"==typeof r?(n=r,r=new e.Root):r||(r=new e.Root),r.load(t,n)},e.loadSync=function(t,r){return r||(r=new e.Root),r.loadSync(t)},e.encoder=na(),e.decoder=wi(),e.verifier=Si(),e.converter=Ti(),e.ReflectionObject=ta(),e.Namespace=vi(),e.Root=Qi(),e.Enum=ra(),e.Type=Yi(),e.Field=yi(),e.OneOf=mi(),e.MapField=bi(),e.Service=Ii(),e.Method=Oi(),e.Message=Ci(),e.wrappers=Xi(),e.types=hi(),e.util=ea(),e.ReflectionObject._configure(e.Root),e.Namespace._configure(e.Type,e.Service,e.Enum),e.Root._configure(e.Type),e.Field._configure(e.Type),Hs.exports}();return e.build="full",e.tokenize=oa(),e.parse=sa(),e.common=function(){if(zi)return Hi;zi=1,Hi=r;var e,t=/\/|\./;function r(e,n){t.test(e)||(e="google/protobuf/"+e+".proto",n={nested:{google:{nested:{protobuf:{nested:n}}}}}),r[e]=n}return r("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),r("duration",{Duration:e={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),r("timestamp",{Timestamp:e}),r("empty",{Empty:{fields:{}}}),r("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),r("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),r("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),r.get=function(e){return r[e]||null},Hi}(),e.Root._configure(e.Type,e.parse,e.common),Ks.exports}var aa=g(Ji?Wi:(Ji=1,Wi=ia()));const ca=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},la=e=>{const t=e.name;return lt(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},ua=e=>{(window.URL||window.webkitURL).revokeObjectURL(e)},da=e=>{const t=e.match(/data:([^;]+)/)[1],r=e.replace(/^[^,]+,/,""),n=window.atob(r);let o=n.length;const s=new Uint8Array(n.length);for(;o--;)s[o]=n.charCodeAt(o);return new Blob([s],{type:t})},pa=1680,ga=160,fa=e=>new Promise((t,r)=>{const n=e=>{0!==e.width||0!==e.height?t(e):r()},o=new Image;if(o.addEventListener("load",e=>n(e.target)),o.addEventListener("error",r),o.src=e,o.complete)return void n(o);const s=setInterval(()=>{o.complete&&(n(o),clearInterval(s))},40)}),ha=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d"),o=function(e,t,r){let n=e,o=t,s=0,i=0;const a=e*t,c=r.maxWidth*r.maxHeight;if(a<=c)return s=(r.maxWidth-n)/2,i=(r.maxHeight-o)/2,{w:n,h:o,x:s,y:i};const l=Math.sqrt(c/a);return n=e*l,o=t*l,s=(r.maxWidth-n)/2,i=(r.maxHeight-o)/2,{w:n,h:o,x:s,y:i}}(e.width,e.height,t);r.width=o.w,r.height=o.h,n.fillStyle="#FFFFFF",n.fillRect(0,0,r.width,r.height),n?.drawImage(e,0,0,o.w,o.h);try{let e=r.toDataURL("image/jpeg",t.quality);return da(e)}catch(e){throw new Error(e)}};function ya(e){const t=Math.max(0,e),r=t%60,n=Math.floor(t/60%60),o=Math.floor(t/3600);return o>0?`${o}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${n}:${r.toString().padStart(2,"0")}`}const ma={maxHeight:500,maxWidth:500,quality:.6,scale:2.4};class va{async create(e,t){try{const r=ca(e),n=await fa(r);let o,s,i;if(ua(r),t?.full)o=e,s=n.width,i=n.height;else{const t=((e,t=1,r="image/jpeg")=>{t=Math.min(1,t);const n=e.width,o=e.height;let s=n,i=o;if(t<1){const e=n<o,t=e?o/pa:n/pa;n>pa&&o>pa?e?(i=pa,s/=t):(s=pa,i/=t):n>pa&&o>ga?(s=pa,i/=t,i<ga&&(i=ga,s=n/(o/ga))):o>pa&&n>ga&&(i=pa,s/=t,s<ga&&(s=ga,i=o/(n/ga)))}s=Math.floor(s),i=Math.floor(i);const a=document.createElement("canvas");a.width=s,a.height=i;const c=a.getContext("2d");return c.fillStyle="#FFF",c.fillRect(0,0,s,i),c.drawImage(e,0,0,n,o,0,0,s,i),r&&"image/png"!=r||(r="image/jpeg"),{imageFile:da(a.toDataURL(r,Math.min(.92,t))),compressWidth:s,compressHeight:i}})(n,.85,e.type);o=t.imageFile,s=t.compressWidth,i=t.compressHeight}const a=ha(n,ma);return{success:!0,message:new rs({thumbnailObjectKey:ca(a),originalObjectKey:ca(o),width:s,height:i}),files:[a,o]}}catch(e){return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n,o],encryptedKey:s}=t;return r.originalObjectKey=o,r.thumbnailObjectKey=n,r.encryptKey=s,r}}class ba{async create(e){if(e.size>2097152)return{success:!1};try{const t=ca(e),r=await fa(t);return{success:!0,message:new ns({originalObjectKey:t,extension:la(e),width:r.width,height:r.height}),files:[e]}}catch{return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.originalObjectKey=n,r.encryptKey=o,r}}let Oa;class Ia{create(e){return(t=e,dt(t.arrayBuffer)?t.arrayBuffer():new Promise((e,r)=>{const n=new FileReader;n.addEventListener("load",t=>{t.target?e(t.target.result):r("null")}),n.addEventListener("error",e=>r(e)),n.readAsArrayBuffer(t)})).then(this.getAudioInfo).then(t=>({success:!0,message:new os({audioObjectKey:ca(e),length:t.duration,extension:la(e)}),files:[e]})).catch(()=>({success:!1}));var t}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.audioObjectKey=n,r.encryptKey=o,r}getAudioInfo(e){const t=Oa||new AudioContext;return Oa=t,new Promise((r,n)=>{t.decodeAudioData(e,function(e){r({duration:e.duration,length:e.length})},n)})}}class Ca{async create(e){return e.size>104857600?{success:!1}:{success:!0,message:new ss({fileKey:"",title:e.name,extension:la(e),size:e.size}),files:[e]}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n],encryptedKey:o}=t;return r.fileKey=n,r.encryptKey=o,r}}class wa{async create(e){try{if(e.size>104857600)return{success:!1};const t=ca(e),r=document.createElement("video");r.src=t,await new Promise((e,t)=>{r.onloadedmetadata=e,r.onerror=t}),r.currentTime=.001,await new Promise(e=>{r.onseeked=e});const n=r.duration,o=r.videoWidth,s=r.videoHeight,i=Math.min(ma.maxWidth/o,ma.maxHeight/s,ma.scale),a=Math.floor(o*i),c=Math.floor(s*i),l=document.createElement("canvas");l.width=a,l.height=c;const u=l.getContext("2d");u?.drawImage(r,0,0,a,c);const d=await new Promise(e=>{l.toBlob(t=>e(t),"image/jpeg",ma.quality)});return ua(t),{success:!0,message:new is({videoObjectKey:"",thumbnailObjectKey:"",during:ya(n),width:o,height:s,extension:la(e)}),files:[e,d]}}catch(e){return{success:!1}}}updateMessageRemoteUrlProperty(e,t){let r=Oo(e);const{urls:[n,o],encryptedKey:s}=t;return r.videoObjectKey=n,r.thumbnailObjectKey=o,r.encryptKey=s,r}}var Sa;!function(e){e[e.IMAGE=1]="IMAGE",e[e.GIF=2]="GIF",e[e.AUDIO=3]="AUDIO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT"}(Sa||(Sa={}));async function Ra(e,t,r){return La(e,t,r)}const Ea=Na.bind(null,Sa.IMAGE),Ta=Na.bind(null,Sa.GIF),_a=Na.bind(null,Sa.AUDIO),ka=Na.bind(null,Sa.SIGHT),Aa=Na.bind(null,Sa.FILE),Ma=async(e,r)=>{const o=Yn(e);io.addMessage(r.messageUId);const s=await((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.RecallGroupMessage,{groupId:Nr.fromString(e),msgId:Nr.fromString(t)},{encoder:zn,decoder:Er}):cn.send(Et.RecallPrivateMessage,{destId:Nr.fromString(e),msgId:Nr.fromString(t)},{encoder:En,decoder:Er}),r})(o,r.messageUId);if(s.code!==t.SUCCESS)return{code:s.code};const i=new Cs({messageUId:r.messageUId}),c={conversation:e,senderUserId:rn.uid,messageId:0,sentTime:ro().toString()},l=Mo(i,c,a.SENT);return l.burnAfterReadingFlag=!1,l.burnAfterReadingTime=0,Ao.get().setConversationCacheByMessage(l),{code:t.SUCCESS,data:l}};async function Na(e,r,n,o,s){const i=(e=>{let t;switch(e){case Sa.IMAGE:t=new va;break;case Sa.AUDIO:t=new Ia;break;case Sa.GIF:t=new ba;break;case Sa.FILE:t=new Ca;break;case Sa.SIGHT:t=new wa}return t})(e);if(!i)return{code:t.NOT_SUPPORT};const{success:a,message:c,files:l}=await i.create(n.file,s);if(!a||!c||!l)return{code:t.MEDIA_EXCEPTION};c.content.user=n.user,c.content.extra=n.extra;const u=Rt.getUploader();try{const e=await u.prepare(l);return c.content=i.updateMessageRemoteUrlProperty(c.content,{urls:e.items.map(e=>e.url),encryptedKey:e.encryptKey}),La(r,c,s,{uploadItems:e,task:(e,t)=>new Promise(r=>{u.upload(t,{onProgress:e=>o?.onProgress?.(e),onError:()=>{r({finished:!1,message:e})},onCompleted:t=>{r({finished:!0,message:o?.onComplete?.(t)??e})}})})})}catch(e){return{code:t.UPLOAD_FILE_FAILED}}}const Pa=async(e,r,o)=>{const s=await Da({conversationType:r.conversationType,targetId:r.targetId},e,r,o);if(s.code!==t.SUCCESS||!s.message||!s.sentArgs)return{code:s.code};const c=Mo(s.message,s.sentArgs);c.quotedReply=r,await Ba(c,s.sentArgs);const l=Yn(r),u=await uo.getDialogAesKey(l.toString());if(!u)return c.sentStatus=a.FAILED,await Ba(c,s.sentArgs),{code:t.MSG_ENCRYPT_ERROR,data:c};let d,p,g,f;if(e.messageType===vo.TEXT){let t=Oo(e.content),r=t.content;delete t.content,d=ho(r,u),p=JSON.stringify(gt(t))}else p=JSON.stringify(gt(e.content));const h=ho(p,u);if(r){if(r.messageType===vo.TEXT){let e=Oo(r.content),t=e.content;delete e.content,g=ho(t,u),f=JSON.stringify(gt(e))}else f=JSON.stringify(gt(r.content));f=ho(f,u)}oo.addMessage(s.sentArgs.messageId);const y={localId:Nr.fromNumber(s.sentArgs.messageId),mediaFlag:e.messageType!==vo.TEXT,mediaConstructor:e.messageType,msgPreContent:"",msgPostContent:d,mediaAttribute:h,msgIdReferenced:Nr.fromString(r.messageUId),msgSrcIdReferenced:Nr.fromString(r.senderUserId),msgDestIdReferenced:r.messageDirection==i.RECEIVE?Nr.fromString(rn.uid):Nr.fromString(r.targetId),msgPostContentReferenced:g,mediaFlagReferenced:r.messageType!==vo.TEXT,mediaConstructorReferenced:r.messageType,mediaAttributeReferenced:f,msgSendTimeReferenced:Nr.fromString(r.sentTime)};let m;if(r.conversationType===n.GROUP){const t={...y,groupId:Nr.fromString(l)};if(tt(e.content.mentionedInfo)){const r=e.content.mentionedInfo;if(r.userList?.length){t.at=r.userList.map(e=>Nr.fromString(e.uin));const e=JSON.stringify({atInfo:JSON.stringify(r.userList)});t.msgPreContent=e}}m=await(v=t,cn.send(Et.SendQuoteGroupChatMessage,v,{encoder:Jn,decoder:Zn}))}else{const e={...y,destId:Nr.fromString(l)};m=await(e=>cn.send(Et.SendQuotePrivateChatMessage,e,{encoder:jn,decoder:Un}))(e)}var v;const b=Oo(c);return m.code===t.SUCCESS?(b.sentTime=m.data.msgSendTime.toString(),b.messageUId=m.data.msgId.toString(),b.sentStatus=a.SENT,await Ba(b,s.sentArgs)):(b.sentStatus=a.FAILED,await Ba(b,s.sentArgs)),{code:m.code,data:b}};async function La(e,r,o,s){const i=await Da(e,r,null,o,s?.uploadItems);if(i.code!==t.SUCCESS||!i.message||!i.sentArgs)return{code:i.code};{const e=Mo(i.message,i.sentArgs);await Ba(e,i.sentArgs)}let{message:c,sentArgs:l}=i;if(tt(s)){const e=await s.task(c,s.uploadItems);if(c=e.message,!e.finished){const e=Mo(i.message,i.sentArgs,a.FAILED);return await Ba(e,l),{code:t.UPLOAD_FILE_FAILED,data:e}}}return async function(e,r){const o=Yn(r.conversation),s=Mo(e,r),i=await uo.getDialogAesKey(o.toString());if(!i)return s.sentStatus=a.FAILED,await Ba(s,r),{code:t.MSG_ENCRYPT_ERROR,data:s};let c,l;if(e.messageType===vo.TEXT){let t=Oo(e.content),r=t.content;delete t.content,c=ho(r,i),l=JSON.stringify(gt(t))}else l=JSON.stringify(gt(e.content));const u=ho(l,i);oo.addMessage(r.messageId);const d={localId:Nr.fromNumber(r.messageId),mediaFlag:e.messageType!==vo.TEXT,mediaConstructor:e.messageType,msgPreContent:"",msgPostContent:c,mediaAttribute:u};let p;if(r.conversation.conversationType===n.GROUP){const t={...d,groupId:Nr.fromString(o)};if(tt(e.content.mentionedInfo)){const r=e.content.mentionedInfo;if(r.userList?.length){t.at=r.userList.map(e=>Nr.fromString(e.uin));const e=JSON.stringify({atInfo:JSON.stringify(r.userList)});t.msgPreContent=e}}p=await(g=t,cn.send(Et.SendGroupChatMessage,g,{encoder:qn,decoder:Vn}))}else{const e={...d,destId:Nr.fromString(o)};p=await(e=>cn.send(Et.SendPrivateChatMessage,e,{encoder:gn,decoder:fn}))(e)}var g;p.code===t.SUCCESS?(s.sentTime=p.data.msgSendTime.toString(),s.messageUId=p.data.msgId.toString(),s.sentStatus=a.SENT,await Ba(s,r)):(s.sentStatus=a.FAILED,await Ba(s,r));return{code:p.code,data:s}}(c,l)}async function Da(e,r,n,o,s){if(((e,t="utf-8")=>{let r=0;if("utf-16"===t)for(let t=0,n=e.length;t<n;t++)r+=e.charCodeAt(t)<=65535?2:4;else for(let t=0,n=e.length;t<n;t++){const n=e.charCodeAt(t);r+=n<127?1:n<=2047?2:n<=65535?3:4}return r})(JSON.stringify(gt(r.content)))>81920)return{code:t.RC_MSG_CONTENT_EXCEED_LIMIT};r.isPersited&&await Ao.get().loadConvsationsIfNotExist([e]);const i={conversation:e,senderUserId:rn.uid,messageId:zo(),sentTime:Ua().toString(),pushConfig:o?.pushConfig};if(o?.onSendBefore){const e=Mo(r,i);n&&(e.quotedReply=n),o.onSendBefore(e,s)}return{code:t.SUCCESS,message:r,sentArgs:i}}let ja=1;function Ua(){ja++;const e=ro();return ja<e&&(ja=e),ja}async function Ba(e,t){try{const r=Xo.get();if(e.isPersited&&r){await r.upsertMessage(e);const n=await r.getLatestMessage(t.conversation);let o=e;n&&Nr.fromString(n.sentTime).greaterThan(Nr.fromString(e.sentTime))&&(o=n),Ao.get().updateLatestMessage(t.conversation,o)}}catch(e){ks.error("saveSentMessage -> ",e)}}class Fa extends So{options;static imClient;libLoader;constructor(e){if(Fa.imClient)return ks.warn("Please do not perform the init method repeatedly"),Fa.imClient;super(),this.options=e,this.fixedProtobuf(),tt(e.logLevel)&&ks.setLogLevel(e.logLevel),tt(e.logStdout)&&ks.setLogStdout(e.logStdout),ks.debug("IMClient.init -> "),tt(e.uploader)&&Rt.setUploader(e.uploader),Rt.setDeviceCode(e.deviceCode),Rt.setDeviceType(e.deviceType),this.libLoader=ws.init(e),this.watch(),Fa.imClient=this}fixedProtobuf(){aa.util.Long=Nr,aa.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(d.CONNECTING)},onConnected:()=>{this.emit(d.CONNECTED)},onDisconnect:()=>{this.emit(d.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(d.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:e=>{this.emit(d.MESSAGES,{messages:e})},pullFinished:()=>{this.emit(d.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:e=>{this.emit(d.CONVERSATION,{conversations:e})},onPush:(e,t)=>{this.emit(d.PUSH,{cmdId:e,body:t})},onRecall:e=>{e.forEach(e=>{this.emit(d.RECALL,e)})},onReceiptReceived:(e,t)=>{Xo.get()?.updateMessageReceiptStatus(e,t),0===t?this.emit(d.ARRIVAL_RECEIPT_RECEIVED,e):this.emit(d.READ_RECEIPT_RECEIVED,e)}})}connect(){return this.libLoader.connect()}disconnect(){return this.libLoader.disconnect()}setUserLogged(e){e.uid!==rn.uid.toString()&&(rn.setLogged(e),this.libLoader.setUserLogged())}logOut(){rn.logOut(),this.libLoader.setUserLogout()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}getServerTime=ro;async insertMessage(e,r,n){(!r.messageId||r.messageId>Wo())&&(r.messageId=zo(),r.messageUId="local_"+r.messageId),Ao.get().setConversationCacheByMessage(r);try{const e=Xo.get();if(r.isPersited&&e){await e.upsertMessage(r);const t=await e.getLatestMessage(r);let n=r;t&&Nr.fromString(t.sentTime).greaterThan(Nr.fromString(r.sentTime))&&(n=t),Ao.get().updateLatestMessage(r,n)}}catch(e){ks.error("insertMessage -> ",e)}return{code:t.SUCCESS,data:r}}sendMessage=Ra;sendImageMessage=Ea;sendGIFMessage=Ta;sendHQVoiceMessage=_a;sendFileMessage=Aa;sendSightMessage=ka;async recallMsg(e,t){return await Ma(e,t)}sendQuoteReplyMessage=Pa;async getRemoteHistoryMessages(e,n){const o=n.timestamp??"0",s=n.count??20,i=Yn(e);return(e=>{const t={dialogKeys:e.dialogId,newToOld:e.newToOld,rows:e.count};return e.newToOld?t.offset=Nr.fromString(e.offset):t.oldOffset=Nr.fromString(e.offset),cn.send(Et.GetRemoteMessages,t,{encoder:Tn,decoder:_n})})({dialogId:i,offset:o,count:s,newToOld:0===n.order}).then(({code:e,data:n})=>new Promise(o=>{e===t.SUCCESS?Bo.parse({[i]:n.msg??{}},{[i]:n.reference??{}},(e,r)=>{const s=r.get(i)??[];s.sort((e,t)=>Nr.fromString(e.sentTime).lessThan(Nr.fromString(t.sentTime))?-1:1),o({code:t.SUCCESS,data:{list:s,hasMore:!n.isEnd}})}):o({code:e,msg:r(e)})}))}async getPreviousHistoryMessages(e,r,n=20){const o=await Xo.get().getPreviousMessages(e,r??"0",n);if(!r&&o.messages.length&&Ao.get().updateLatestMessage(e,o.messages[o.messages.length-1]),o.messages.length>=n||!o.hasMore)return{code:t.SUCCESS,data:{list:o.messages,hasMore:o.hasMore}};const s=o.messages[0]?.sentTime??r,i=await this.getRemoteHistoryMessages(e,{timestamp:s,count:n-o.messages.length,order:0});if(i.code!==t.SUCCESS)return i;const a=i.data.list;for(let e=a.length-1;e>=0;e--){const t=a[e];(!t.messageId||t.messageId>Wo())&&(t.messageId=$o())}return s&&"0"!=s||Ao.get().updateLatestMessage(e,a[a.length-1]),Xo.get().addMessages(a,e,!i.data.hasMore),{code:t.SUCCESS,data:{list:[...i.data.list,...o.messages],hasMore:i.data.hasMore}}}async deleteRemoteMessage(e,r){const n=await(o=Yn(e),s=r.map(e=>e.messageUId),cn.send(Et.DeleteChatMessages,{destId:Nr.fromString(o),msgIdList:s.map(e=>Nr.fromString(e))},{encoder:On,decoder:Er})).then(e=>e.code);var o,s;if(n===t.SUCCESS){const t=await(Xo.get()?.getLatestMessage(e));if(await(Xo.get()?.removeMessagesByUId(r.map(e=>e.messageUId))),t&&r.some(e=>e.messageUId===t.messageUId)){const t=await(Xo.get()?.getLatestMessage(e));Ao.get().updateLatestMessage(e,t)}}return n}async deleteHistoryMessages(e){return Xo.get()?.clearConversationCache(e),Ao.get().clearHistoryMessages(e),(t=Yn(e),cn.send(Et.ClearChatHistoryMessage,{destId:t},{encoder:In,decoder:Er})).then(e=>e.code);var t}async getConversationList(e,r,n,o){const s={rows:e,type:r??0,offset:Nr.fromNumber(n),newToOld:0===o},{code:i,data:a}=await(e=>cn.send(Et.GetDialogList,e,{encoder:kn,decoder:An}))(s);if(i!==t.SUCCESS)return{code:i};const c=a.fullDialog.map(e=>e.dialog?.destId).filter(tt);await uo.getDialogAesKeyList(c.map(e=>e.toString()));let l=1e4;const u=[];for(const e of a.fullDialog){const t=this.formatConversation(e);if(!t)continue;const r={conversationType:t.conversationType,targetId:t.targetId},n=t.latestMessage;t.latestMessage=await(Xo.get()?.getLatestMessage(r));const o=Ao.get().get(r);o||Object.assign(t,o),tt(t.latestMessage)&&!t.updateTime&&(t.updateTime=parseInt(t.latestMessage.sentTime)),t.updateTime||(n?t.updateTime=parseInt(n.sentTime):(t.updateTime=l,l++)),Ao.get().addLocalConversation(t),u.push(t)}return u.sort((e,t)=>(e.updateTime??0)-(t.updateTime??0)),{code:t.SUCCESS,data:u}}getBlockConversationList(){const e=Ao.get().getBlockConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}getTopConversationList(){const e=Ao.get().getTopConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}async getConversation(e){const r=Ao.get().get(e);if(!r)return{code:t.CONVER_GET_ERROR};const n=await(Xo.get()?.getLatestMessage(e)),o={...e,...r,updateTime:tt(n?.sentTime)?parseInt(n.sentTime):void 0,latestMessage:n};return{code:t.SUCCESS,data:o}}removeConversation(e){return Ao.get().remove(e),(t=Yn(e),cn.send(Et.DeletePrivateDialog,{destId:Nr.fromString(t)},{encoder:hn,decoder:Er})).then(e=>e.code);var t}getUnreadMentionedCount(e){return Ao.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return Ao.get().getAllUnreadMentionedCount()}getConversationState(e){return Ao.get().getConversationState(e)}getAllConversationState(){return Ao.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return Ao.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return Ao.get().getUnreadCount(e)}clearConversationUnreadCount(e){Ao.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){Ao.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return Ao.get().getNotificationLevel(e)}setConversationNotificationStatus(e,t){return((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.UpdateGroupChatMuteConfig,{groupId:Nr.fromString(e),muteFlag:t},{encoder:Hn,decoder:Er}):cn.send(Et.UpdatePrivateChatMuteConfig,{destId:Nr.fromString(e),muteFlag:t},{encoder:bn,decoder:Er}),r})(Yn(e),t===s.OPEN).then(r=>(!r.code&&Ao.get().addStatus({...e,notificationStatus:t,notificationLevel:t==s.OPEN?l.AT_USER_NOTIFICATION:l.NOT_SET},!0),r.code))}getConversationNotificationStatus(e){return Ao.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=Xn(e)==n.GROUP?cn.send(Et.UpdateGroupChatStickyConfig,{groupId:Nr.fromString(e),stickyFlag:t},{encoder:Kn,decoder:Er}):cn.send(Et.UpdatePrivateChatStickyConfig,{destId:Nr.fromString(e),stickyFlag:t},{encoder:vn,decoder:Er}),r})(Yn(e),t).then(r=>(!r.code&&Ao.get().addStatus({...e,isTop:t},!0),r.code))}saveConversationMessageDraft(e,t){Ao.get().setDraft(e,t)}getConversationMessageDraft(e){return Ao.get().getDraft(e)}clearConversationMessageDraft(e){Ao.get().clearDraft(e)}async sendReadReceipts(e){await(qo.get()?.sendReadReceipts(e))}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId;if(!tt(n))return;const o=wo(t);if(!o)return;const s=uo.getDialogAesKeyFromLocal(n.toString());if(s){if(tt(r)){const e=Bo.parseSingleDialogMessages(n.toString(),[r],s,{})[0];o.latestMessage=e}return o}}async clearBurnAfterReadingExpiredMessages(e){const t=Xo.get();if(!t)return Promise.resolve([]);const r=await t.getLatestMessage(e),n=await t.clearBurnAfterReadingExpiredMessages(e);if(r&&n.includes(r.messageUId)){const r=await t.getLatestMessage(e);Ao.get().updateLatestMessage(e,r)}return n}async getMessageById(e){return Xo.get()?.getMessageById(e)}async getMessageByUId(e){return Xo.get()?.getMessageByUId(e)}}const xa=mr.Reader,Ga=mr.Writer,qa=mr.util,Va=mr.roots.default||(mr.roots.default={}),Ka=Va.AuthSignIn2Req=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.langCode="",e.prototype.phoneNum="",e.prototype.password="",e.prototype.appVersionCode=0,e.prototype.deviceType=0,e.prototype.imei="",e.prototype.brand="",e.prototype.model="",e.prototype.apnsToken="",e.prototype.bandId="",e.prototype.appVersion="",e.prototype.osVersion="",e.prototype.version=0,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(10).string(e.langCode),null!=e.phoneNum&&Object.hasOwnProperty.call(e,"phoneNum")&&t.uint32(18).string(e.phoneNum),null!=e.password&&Object.hasOwnProperty.call(e,"password")&&t.uint32(26).string(e.password),null!=e.appVersionCode&&Object.hasOwnProperty.call(e,"appVersionCode")&&t.uint32(32).int32(e.appVersionCode),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(40).int32(e.deviceType),null!=e.imei&&Object.hasOwnProperty.call(e,"imei")&&t.uint32(50).string(e.imei),null!=e.brand&&Object.hasOwnProperty.call(e,"brand")&&t.uint32(58).string(e.brand),null!=e.model&&Object.hasOwnProperty.call(e,"model")&&t.uint32(66).string(e.model),null!=e.apnsToken&&Object.hasOwnProperty.call(e,"apnsToken")&&t.uint32(74).string(e.apnsToken),null!=e.bandId&&Object.hasOwnProperty.call(e,"bandId")&&t.uint32(82).string(e.bandId),null!=e.appVersion&&Object.hasOwnProperty.call(e,"appVersion")&&t.uint32(90).string(e.appVersion),null!=e.osVersion&&Object.hasOwnProperty.call(e,"osVersion")&&t.uint32(98).string(e.osVersion),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(104).int32(e.version),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.AuthSignIn2Req;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.langCode=e.string();break;case 2:n.phoneNum=e.string();break;case 3:n.password=e.string();break;case 4:n.appVersionCode=e.int32();break;case 5:n.deviceType=e.int32();break;case 6:n.imei=e.string();break;case 7:n.brand=e.string();break;case 8:n.model=e.string();break;case 9:n.apnsToken=e.string();break;case 10:n.bandId=e.string();break;case 11:n.appVersion=e.string();break;case 12:n.osVersion=e.string();break;case 13:n.version=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2Req"},e})(),Ha=Va.AuthSignIn2Resp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.sessionId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.prototype.frozenDays=0,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.noNickName&&Object.hasOwnProperty.call(e,"noNickName")&&t.uint32(40).bool(e.noNickName),null!=e.noEmail&&Object.hasOwnProperty.call(e,"noEmail")&&t.uint32(48).bool(e.noEmail),null!=e.cert&&Object.hasOwnProperty.call(e,"cert")&&t.uint32(58).string(e.cert),null!=e.userFileDomain&&Object.hasOwnProperty.call(e,"userFileDomain")&&t.uint32(74).string(e.userFileDomain),null!=e.dialogFileDomain&&Object.hasOwnProperty.call(e,"dialogFileDomain")&&t.uint32(82).string(e.dialogFileDomain),null!=e.user&&Object.hasOwnProperty.call(e,"user")&&Va.User.encode(e.user,t.uint32(90).fork()).ldelim(),null!=e.frozenDays&&Object.hasOwnProperty.call(e,"frozenDays")&&t.uint32(104).int32(e.frozenDays),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.AuthSignIn2Resp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Va.User.decode(e,e.uint32());break;case 13:n.frozenDays=e.int32();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2Resp"},e})();Va.User=(()=>{function e(e){if(this.aliasMobile=[],e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.uid=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.nickName="",e.prototype.langCode="",e.prototype.phone="",e.prototype.numberInPhoneBook="",e.prototype.smallAvatarUrl="",e.prototype.originalAvatarUrl="",e.prototype.email="",e.prototype.qrcodeString="",e.prototype.gender=0,e.prototype.contactStatus=0,e.prototype.alias="",e.prototype.aliasMobile=qa.emptyArray,e.prototype.aliasDesp="",e.encode=function(e,t){if(t||(t=Ga.create()),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(8).int64(e.uid),null!=e.nickName&&Object.hasOwnProperty.call(e,"nickName")&&t.uint32(18).string(e.nickName),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(26).string(e.langCode),null!=e.phone&&Object.hasOwnProperty.call(e,"phone")&&t.uint32(34).string(e.phone),null!=e.numberInPhoneBook&&Object.hasOwnProperty.call(e,"numberInPhoneBook")&&t.uint32(42).string(e.numberInPhoneBook),null!=e.smallAvatarUrl&&Object.hasOwnProperty.call(e,"smallAvatarUrl")&&t.uint32(50).string(e.smallAvatarUrl),null!=e.originalAvatarUrl&&Object.hasOwnProperty.call(e,"originalAvatarUrl")&&t.uint32(58).string(e.originalAvatarUrl),null!=e.email&&Object.hasOwnProperty.call(e,"email")&&t.uint32(66).string(e.email),null!=e.qrcodeString&&Object.hasOwnProperty.call(e,"qrcodeString")&&t.uint32(74).string(e.qrcodeString),null!=e.gender&&Object.hasOwnProperty.call(e,"gender")&&t.uint32(80).int32(e.gender),null!=e.contactStatus&&Object.hasOwnProperty.call(e,"contactStatus")&&t.uint32(88).int32(e.contactStatus),null!=e.alias&&Object.hasOwnProperty.call(e,"alias")&&t.uint32(98).string(e.alias),null!=e.aliasMobile&&e.aliasMobile.length)for(let r=0;r<e.aliasMobile.length;++r)t.uint32(106).string(e.aliasMobile[r]);return null!=e.aliasDesp&&Object.hasOwnProperty.call(e,"aliasDesp")&&t.uint32(114).string(e.aliasDesp),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.User;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.uid=e.int64();break;case 2:n.nickName=e.string();break;case 3:n.langCode=e.string();break;case 4:n.phone=e.string();break;case 5:n.numberInPhoneBook=e.string();break;case 6:n.smallAvatarUrl=e.string();break;case 7:n.originalAvatarUrl=e.string();break;case 8:n.email=e.string();break;case 9:n.qrcodeString=e.string();break;case 10:n.gender=e.int32();break;case 11:n.contactStatus=e.int32();break;case 12:n.alias=e.string();break;case 13:n.aliasMobile&&n.aliasMobile.length||(n.aliasMobile=[]),n.aliasMobile.push(e.string());break;case 14:n.aliasDesp=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/User"},e})();const za=Va.WebGetLoginCodeReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.account="",e.prototype.langCode="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.account&&Object.hasOwnProperty.call(e,"account")&&t.uint32(10).string(e.account),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(18).string(e.langCode),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.account=e.string();break;case 2:n.langCode=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeReq"},e})(),$a=Va.WebGetLoginCodeResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeResp"},e})(),Wa=Va.WebGetLoginCodeVerifyReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.account="",e.prototype.langCode="",e.prototype.code="",e.encode=function(e,t){return t||(t=Ga.create()),null!=e.account&&Object.hasOwnProperty.call(e,"account")&&t.uint32(10).string(e.account),null!=e.langCode&&Object.hasOwnProperty.call(e,"langCode")&&t.uint32(18).string(e.langCode),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(26).string(e.code),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.WebGetLoginCodeVerifyReq;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.account=e.string();break;case 2:n.langCode=e.string();break;case 3:n.code=e.string();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebGetLoginCodeVerifyReq"},e})(),Ja=Va.ClickOKToWebResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.sessionId=qa.Long?qa.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.encode=function(e,t){return t||(t=Ga.create()),null!=e.errorCode&&Object.hasOwnProperty.call(e,"errorCode")&&t.uint32(8).int32(e.errorCode),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.noNickName&&Object.hasOwnProperty.call(e,"noNickName")&&t.uint32(40).bool(e.noNickName),null!=e.noEmail&&Object.hasOwnProperty.call(e,"noEmail")&&t.uint32(48).bool(e.noEmail),null!=e.cert&&Object.hasOwnProperty.call(e,"cert")&&t.uint32(58).string(e.cert),null!=e.userFileDomain&&Object.hasOwnProperty.call(e,"userFileDomain")&&t.uint32(74).string(e.userFileDomain),null!=e.dialogFileDomain&&Object.hasOwnProperty.call(e,"dialogFileDomain")&&t.uint32(82).string(e.dialogFileDomain),null!=e.user&&Object.hasOwnProperty.call(e,"user")&&Va.User.encode(e.user,t.uint32(90).fork()).ldelim(),t},e.decode=function(e,t){e instanceof xa||(e=xa.create(e));let r=void 0===t?e.len:e.pos+t,n=new Va.ClickOKToWebResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Va.User.decode(e,e.uint32());break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/ClickOKToWebResp"},e})();let Za;const Xa=e=>{Za=Za||new Fa(e)},Ya=async()=>{const e=await Za.connect();return e.code===t.SUCCESS?{code:e.code}:{code:e.code,msg:r(e.code)}},Qa=()=>Za.disconnect(),ec=e=>{Za.setUserLogged(e)},tc=()=>{Za.logOut()},rc=()=>Za.getConnectionStatus(),nc=(e,t,r,n=3e4)=>cn.request(e,t,r,n),oc=()=>Za.getServerTime(),sc=(e,t,r)=>{Za.on(e,t,r)};function ic(e,t,r){Za.once(e,t,r)}const ac=(e,t,r)=>{Za?.off(e,t,r)},cc=async e=>{ks.debug("get conversation list ->");const{code:n,data:o}=await Za.getConversationList(e?.count??20,null,e?.startTime??0,e?.order??0);return n!==t.SUCCESS&&ks.warn("get conversation list fail ->"+n+":"+r(n)),{code:n,msg:r(n),data:o}},lc=async e=>{Bs("options",e,js,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get conversation ->"+n);const{code:o,data:s}=await Za.getConversation(e);return o!==t.SUCCESS?(ks.warn("get conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o,data:s}},uc=async e=>{Bs("options",e,js,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("remove conversation ->"+n);const o=await Za.removeConversation(e);return o!==t.SUCCESS?(ks.warn("remove conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o}},dc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get draft ->"+r);const n=Za.getConversationMessageDraft(e);return Promise.resolve({code:t.SUCCESS,data:n})},pc=(e,r)=>{Bs("options",e,js,!0),Bs("draft",r,As,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("set draft ->"+n),Za.saveConversationMessageDraft(e,r),Promise.resolve({code:t.SUCCESS})},gc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("delete draft ->"+r),Za.clearConversationMessageDraft(e),Promise.resolve({code:t.SUCCESS})},fc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:t.SUCCESS,data:Za.getUnreadMentionedCount(e)})},hc=()=>{ks.debug("getAllUnreadMentionedCount");const e=Za.getAllUnreadMentionedCount();return Promise.resolve({code:t.SUCCESS,data:e})},yc=e=>(ks.debug("getConversationState"),Za.getConversationState(e)),mc=()=>{ks.debug("getAllConversationState");const e=Za.getAllConversationState();return Promise.resolve({code:t.SUCCESS,data:e})},vc=(e,r)=>{if(ks.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+e),Bs("includeMuted",e,Ns,!1),Bs("conversationTypes",r,Ls,!1),r)for(const e of r)Bs("conversationType",e,Ds,!0);const n=Za.getAllConversationUnreadCount(r??[],e??!1);return Promise.resolve({code:t.SUCCESS,data:n})},bc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("get unreadCount ->"+r);const n=Za.getConversationUnreadCount(e);return Promise.resolve({code:t.SUCCESS,data:n})},Oc=e=>{Bs("options",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return ks.debug("clear unreadMsgNum ->"+r),Za.clearConversationUnreadCount(e),Promise.resolve({code:t.SUCCESS})},Ic=()=>(ks.debug("clear allMessagesUnreadStatus"),Za.clearAllConversationsUnreadCount(),Promise.resolve({code:t.SUCCESS})),Cc=e=>{Bs("options",e,js,!0),ks.info("getConversationNotificationLevel ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Za.getConversationNotificationLevel(e);return Promise.resolve({code:t.SUCCESS,data:r})},wc=async(e,n)=>{Bs("options",e,js,!0),Bs("notificationStatus",n,e=>1===e||2===e,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("set conversation status ->"+o);const s=await Za.setConversationNotificationStatus(e,n);return s!==t.SUCCESS?(ks.warn("set conversation status fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:s}},Sc=e=>{Bs("options",e,js,!0),ks.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Za.getConversationNotificationStatus(e);return Promise.resolve({code:t.SUCCESS,data:r})},Rc=()=>Za.getBlockConversationList(),Ec=async(e,n=!0)=>{Bs("options",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("set conversation status ->"+o);const s=await Za.setConversationToTop(e,n);return s!==t.SUCCESS?(ks.warn("set conversation status fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:s}},Tc=()=>Za.getTopConversationList(),_c=(e,t,r,n)=>{let o=function(o){return new Qo(e,o,t,r,n)};return co(e,o),o},kc=async(e,t,r)=>Za.insertMessage(e,t,r),Ac=async(e,r,n)=>{if(r instanceof Qo==!1)return ks.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:t.PARAMETER_ERROR};Bs("conversation",e,js,!0),$c(e);const o=await Za.sendMessage(e,r,n);return Wc(e,o.code),o},Mc=(e,t,r)=>{const n=new ts(t);return Ac(e,n,r)},Nc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&e.type.startsWith("image/"),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendImageMessage(e,t,r,n);return Wc(e,s.code),s},Pc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&e.type.endsWith("image/gif"),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendGIFMessage(e,t,r,n);return Wc(e,s.code),s},Lc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob,!0),$c(e);const o=await Za.sendHQVoiceMessage(e,t,r,n);return Wc(e,o.code),o},Dc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+o),$c(e);const s=await Za.sendFileMessage(e,t,r,n);return Wc(e,s.code),s},jc=async(e,t,r,n)=>{Bs("conversation",e,js,!0),Bs("uploader",Rt.getUploader(),Ps,!0),Bs("msgBody.file",t.file,e=>e instanceof Blob&&"video/mp4"===e.type,!0),$c(e);const o=await Za.sendSightMessage(e,t,r,n);return Wc(e,o.code),o},Uc=async(e,n)=>{Bs("options.messageUId",n.messageUId,As,!0),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+n.messageUId;ks.debug("recall message ->"+o);const s=await Za.recallMsg(e,n);return s.code!==t.SUCCESS&&ks.warn("recall message fail ->"+s.code+":"+r(s.code)+","+o),s},Bc=async(e,n)=>{Bs("options.count",n.count??0,Ms),Bs("options.order",n.order??0,e=>0===e||1===e),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;let s;return ks.debug("get remote history message ->"+o),tt(n.timestamp)&&(n.timestamp=n.timestamp.toString()),s=n.order?await Za.getRemoteHistoryMessages(e,n):await Za.getPreviousHistoryMessages(e,n.timestamp,n.count),s.code!==t.SUCCESS&&ks.warn("get remote history message fail ->"+s.code+":"+r(s.code)+","+o),s},Fc=async(e,n)=>{Bs("messages",n,e=>at(e)&&!!e.length,!0),n.forEach(e=>{Bs("messages.messageUId",e.messageUId,As,!0),Bs("messages.sentTime",e.sentTime,Ms,!1),Bs("messages.messageDirection",e.messageDirection,e=>1===e||2===e,!1)}),Bs("conversation",e,js,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("delete messages ->"+o);const s=await Za.deleteRemoteMessage(e,n);return s!==t.SUCCESS?(ks.warn("delete message fail ->"+s+":"+r(s)+","+o),{code:s,msg:r(s)}):{code:t.SUCCESS}},xc=async e=>{Bs("conversation",e,js);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("clear message ->"+n);const o=await Za.deleteHistoryMessages(e);return o!==t.SUCCESS?(ks.warn("clear message ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:t.SUCCESS}},Gc=(e,t)=>Bo.decodeChatRecordMsgDetails2ReceivedMessages(e,t),qc=e=>Bo.encodeReceivedMessage2ChatRecordMsgDetail(e),Vc=async e=>{try{return await Za.sendReadReceipts(e),{code:t.SUCCESS}}catch(e){return{code:t.UNKNOWN}}},Kc=e=>(e=>cn.request(805376017,{langCode:e.langCode,phoneNum:e.phone,password:Qe.SHA256(e.password).toString(),deviceType:7,imei:"59bc678b-fe6d-4e67-87c6-b0692205134b",brand:"Chrome",model:"Mozilla",appVersion:"1.0.0",osVersion:"1.0.0"},{encoder:Ka,decoder:Ha}))(e),Hc=e=>(e=>cn.request(805404721,{langCode:e.langCode,account:e.phone},{encoder:za,decoder:$a}))(e),zc=e=>(e=>cn.request(805404723,{langCode:e.country,account:e.phone,code:e.code},{encoder:Wa,decoder:Ja}))(e),$c=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("send message ->"+t)},Wc=(e,n)=>{if(n!==t.SUCCESS){const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.warn("send message fail ->"+n+":"+r(n)+","+t)}},Jc=async e=>{Bs("conversation",e,js,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;ks.debug("clear burn after reading expired messages ->"+r);const n=await Za.clearBurnAfterReadingExpiredMessages(e);return n.length>0&&ks.debug(`已清除会话 ${r} 中的 ${n.length} 条阅后即焚过期消息`),Promise.resolve({code:t.SUCCESS,data:n})},Zc=async(e,t,r)=>await Za.sendQuoteReplyMessage(e,t,r),Xc=async e=>{const r=await Za.getMessageById(e);return{code:t.SUCCESS,data:r}},Yc=async e=>{const r=await Za.getMessageByUId(e);return{code:t.SUCCESS,data:r}};export{cs as ChatRecordMessage,e as ConnectionStatus,ls as ContactMessage,n as ConversationType,t as ErrorCode,r as ErrorDesc,d as Events,ss as FileMessage,ns as GIFMessage,Is as GroupCloseBurnAfterReadingMessage,Os as GroupOpenBurnAfterReadingMessage,os as HQVoiceMessage,rs as ImageMessage,us as InvitationMessage,gs as LinkMessage,as as LocationMessage,u as LogLevel,o as MentionedType,i as MessageDirection,vo as MessageTypes,bo as NotiMessageTypes,l as NotificationLevel,s as NotificationStatus,bs as PrivateCloseBurnAfterReadingMessage,vs as PrivateOpenBurnAfterReadingMessage,Cs as RecallCommandMessage,c as ReceivedStatus,ds as RedEnvelopeMessage,a as SentStatus,ts as TextMessage,ps as TransferMessage,is as VideoMessage,sc as addEventListener,Ic as clearAllMessagesUnreadStatus,Jc as clearBurnAfterReadingExpiredMessages,xc as clearHistoryMessages,Oc as clearMessagesUnreadStatus,gc as clearTextMessageDraft,Ya as connect,Fc as deleteMessages,Qa as disconnect,qc as encodeReceivedMessage2ChatRecordMsgDetail,mc as getAllConversationState,hc as getAllUnreadMentionedCount,Rc as getBlockedConversationList,rc as getConnectionStatus,lc as getConversation,cc as getConversationList,Cc as getConversationNotificationLevel,Sc as getConversationNotificationStatus,yc as getConversationState,Xc as getMessageById,Yc as getMessageByUId,Bc as getRemoteHistoryMessages,oc as getServerTime,dc as getTextMessageDraft,Tc as getTopConversationList,vc as getTotalUnreadCount,bc as getUnreadCount,fc as getUnreadMentionedCount,Xa as init,kc as insertMessage,tc as logOut,Hc as mockGetLoginCode,Kc as mockLogin,zc as mockVerifyLoginCode,ic as onceEventListener,Gc as parseChatRecordMsgDetails,Uc as recallMessage,_c as registerMessageType,uc as removeConversation,ac as removeEventListener,nc as request,pc as saveTextMessageDraft,Dc as sendFileMessage,Pc as sendGIFMessage,Lc as sendHQVoiceMessage,Nc as sendImageMessage,Ac as sendMessage,Zc as sendQuoteReplyMessage,Vc as sendReadReceipts,jc as sendSightMessage,Mc as sendTextMessage,wc as setConversationNotificationStatus,Ec as setConversationToTop,ec as setUserLogged};