text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).QNWeappIM={})}(this,(function(e){"use strict";var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var r=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=47)}([function(e,t,r){e.exports=function(){var e={};function t(){e.converter._configure(),e.decoder._configure(),e.encoder._configure(),e.Field._configure(),e.MapField._configure(),e.Message._configure(),e.Namespace._configure(),e.Method._configure(),e.ReflectionObject._configure(),e.OneOf._configure(),e.parse._configure(),e.Reader._configure(),e.Root._configure(),e.Service._configure(),e.verifier._configure(),e.Type._configure(),e.types._configure(),e.wrappers._configure(),e.Writer._configure()}if(e.build="minimal",e.Writer=r(19),e.encoder=r(28),e.Reader=r(26),e.util=r(1),e.rpc=r(24),e.roots=r(20),e.verifier=r(27),e.tokenize=r(23),e.parse=r(22),e.common=r(25),e.ReflectionObject=r(7),e.Namespace=r(9),e.Root=r(12),e.Enum=r(4),e.Type=r(6),e.Field=r(5),e.OneOf=r(10),e.MapField=r(16),e.Service=r(13),e.Method=r(17),e.converter=r(31),e.decoder=r(29),e.Message=r(18),e.wrappers=r(30),e.types=r(8),e.util=r(1),e.configure=t,e.load=function(t,r,n){return(r="function"==typeof r?(n=r,new e.Root):r||new e.Root).load(t,n)},e.loadSync=function(t,r){return(r=r||new e.Root).loadSync(t)},e.parseFromPbString=function(t,r,n){return(r="function"==typeof r?(n=r,new e.Root):r||new e.Root).parseFromPbString(t,n)},t(),arguments&&arguments.length)for(var n=0;n<arguments.length;n++){var o=arguments[n];if(o.hasOwnProperty("exports"))return void(o.exports=e)}return e}()},function(e,t,r){var n=e.exports,o=r(20);n.LongBits=r(15),n.Long=r(41),n.pool=r(42),n.float=r(43),n.asPromise=r(44),n.EventEmitter=r(45),n.path=r(46),n.base64=r(21),n.utf8=r(11),n.compareFieldsById=function(e,t){return e.id-t.id},n.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[]},n.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},n.isString=function(e){return"string"==typeof e||e instanceof String},n.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)},n.isObject=function(e){return e&&"object"==typeof e},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.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;-1<r;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.merge=function(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},n.decorateType=function(e,t){return e.$type?(t&&e.$type.name!==t&&(n.decorateRoot.remove(e.$type),e.$type.name=t,n.decorateRoot.add(e.$type)),e.$type):(Type=Type||r(6),t=new Type(t||e.name),n.decorateRoot.add(t),t.ctor=e,Object.defineProperty(e,"$type",{value:t,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:t,enumerable:!1}),t)},n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.copy=function(e){if("object"!=typeof e)return e;var t,r={};for(t in e)r[t]=e[t];return r},n.deepCopy=function e(t){if("object"!=typeof t)return t;var r,n={};for(r in t)n[r]=e(t[r]);return n},n.ProtocolError=function(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&merge(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n.Buffer=null,n.newBuffer=function(e){return"number"==typeof e?new n.Array(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.stringToBytes=function(e){for(var t,r=[],n=e.length,o=0;o<n;o++)65536<=(t=e.charCodeAt(o))&&t<=1114111?(r.push(t>>18&7|240),r.push(t>>12&63|128),r.push(t>>6&63|128),r.push(63&t|128)):2048<=t&&t<=65535?(r.push(t>>12&15|224),r.push(t>>6&63|128),r.push(63&t|128)):128<=t&&t<=2047?(r.push(t>>6&31|192),r.push(63&t|128)):r.push(255&t);return r},n.byteToString=function(e){if("string"==typeof e)return e;for(var t="",r=e,n=0;n<r.length;n++){var o=r[n].toString(2),i=o.match(/^1+?(?=0)/);if(i&&8==o.length){for(var s=i[0].length,a=r[n].toString(2).slice(7-s),u=1;u<s;u++)a+=r[u+n].toString(2).slice(2);t+=String.fromCharCode(parseInt(a,2)),n+=s-1}else t+=String.fromCharCode(r[n])}return t},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},Object.defineProperty(n,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(12)))}})},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.xsync||(e.roots.xsync=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{Frame:{fields:{vsn:{type:"VSN",id:1},compress_method:{type:"CompressMethod",id:2},command:{type:"Command",id:3},payload:{type:"bytes",id:4},encrypt_method:{type:"EncryptMethod",id:5},encrypt_key:{type:"bytes",id:6},check_sum:{type:"uint32",id:7},tag:{type:"string",id:8}},nested:{VSN:{values:{XSYNC_V1:0,XSYNC_V2:1}},Command:{values:{UNREAD:0,SYNC:1,NOTICE:2,PROVISION:3}},CompressMethod:{values:{NONE:0,ZLIB:1}},EncryptMethod:{values:{ENCRYPT_NONE:0,AES_CBC_128:1,AES_CBC_256:2,CUSTOM:3}}}},Status:{fields:{code:{type:"ErrorCode",id:1},reason:{type:"string",id:2}},nested:{ErrorCode:{values:{UNKNOWN:0,OK:1,FAIL:2,UNKNOWN_COMMAND:3,PB_PARSER_ERROR:4,DECRYPT_FAILURE:5,PUBLIC_KEY_CHANGED:6,INVALID_TOKEN:7,INVALID_PARAMETER:8,UNAUTHORIZED:9,USER_FROZEN:10,USER_BANNED:11,WORD_CENSORED:12,TOO_MANY_DEVICES:13,ENCRYPT_METHOD_UNSUPPORTED:14,DEVICE_GUID_CONFLICT:15,CHECK_SUM_FAILURE:16,INVALID_LICENSE:17,LICENSE_LIMIT:18,APP_FROZEN:19}}}},ConversationUnread:{fields:{xid:{type:"XID",id:1},n:{type:"uint32",id:2},type:{type:"ConvType",id:3}},nested:{ConvType:{values:{UNKNOWN:0,CHAT:1,GROUPCHAT:2}}}},UnreadUL:{fields:{}},UnreadDL:{fields:{status:{type:"Status",id:1},unread:{rule:"repeated",type:"ConversationUnread",id:2}}},SyncUL:{fields:{xid:{type:"XID",id:1},key:{type:"uint64",id:2},meta:{type:"Meta",id:3},is_full_sync:{type:"bool",id:4},full_sync_num:{type:"sint32",id:5}}},SyncDL:{fields:{status:{type:"Status",id:1},metas:{rule:"repeated",type:"Meta",id:2},next_key:{type:"uint64",id:3},xid:{type:"XID",id:4},client_mid:{type:"uint64",id:5},server_mid:{type:"uint64",id:6},server_time:{type:"uint64",id:7},is_full_sync:{type:"bool",id:8},prev_mid:{type:"uint64",id:9},is_eager_sync:{type:"bool",id:10}}},Notice:{fields:{xid:{type:"XID",id:1}}},Provision:{fields:{status:{type:"Status",id:1},xid:{type:"XID",id:2},password:{type:"string",id:5},token:{type:"string",id:6},os_type:{type:"OsType",id:7},sdk_vsn:{type:"string",id:8},is_manual_login:{type:"bool",id:9},device_guid:{type:"string",id:10},device_notifier:{type:"string",id:11},device_token:{type:"string",id:12},device_info:{type:"string",id:13},last_login_time:{type:"uint64",id:14}},nested:{OsType:{values:{UNKNOWN:0,IOS:1,ANDR:2,WIN:3,OSX:4,LINUX:5,WEB:6}}}},Meta:{fields:{id:{type:"uint64",id:1},from:{type:"XID",id:2},to:{type:"XID",id:3},timestamp:{type:"uint64",id:4},ns:{type:"NameSpace",id:5},payload:{type:"bytes",id:6}},nested:{NameSpace:{values:{UNKNOWN:0,MESSAGE:1,GROUP_NOTICE:2,ROSTER_NOTICE:3,USER_NOTICE:4,INFO:5,CONVERSATION:6,PUSH:7}}}},XID:{fields:{uid:{type:"uint64",id:1},deviceSN:{type:"uint32",id:2}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t){e.exports=n;var r=null;try{r=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 n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function o(e){return!0===(e&&e.__isLong__)}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=o;var i={},s={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=d(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=d(e,e<0?-1:0,!1),o&&(i[e]=r),r)}function u(e,t){if(isNaN(e))return t?v:m;if(t){if(e<0)return v;if(h<=e)return A}else{if(e<=-g)return O;if(g<=e+1)return b}return e<0?u(-e,t).neg():d(e%f|0,e/f|0,t)}function d(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=d;var c=Math.pow;function p(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if(t="number"==typeof t?(r=t,!1):!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return p(e.substring(1),t,r).neg();for(var o=u(c(r,8)),i=m,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),d=parseInt(e.substring(s,s+a),r);i=a<8?(a=u(c(r,a)),i.mul(a).add(u(d))):(i=i.mul(o)).add(u(d))}return i.unsigned=t,i}function l(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?p(e,t):d(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=p,n.fromValue=l;var f=4294967296,h=f*f,g=h/2,y=a(1<<24),m=a(0);n.ZERO=m;var v=a(0,!0);n.UZERO=v;var _=a(1);n.ONE=_;var E=a(1,!0);n.UONE=E;var N=a(-1);n.NEG_ONE=N;var b=d(-1,2147483647,!1);n.MAX_VALUE=b;var A=d(-1,-1,!0);n.MAX_UNSIGNED_VALUE=A;var O=d(0,-2147483648,!1);n.MIN_VALUE=O;var w=n.prototype;w.toInt=function(){return this.unsigned?this.low>>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=u(e),r=this.div(t);t=r.mul(t).sub(this);return r.toString(e)+t.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=u(c(e,6),this.unsigned),o=this,i="";;){var s=o.div(n),a=(o.sub(s.mul(n)).toInt()>>>0).toString(e);if((o=s).isZero())return a+i;for(;a.length<6;)a="0"+a;i=""+a+i}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},w.isZero=function(){return 0===this.high&&0===this.low},w.eqz=w.isZero,w.isNegative=function(){return!this.unsigned&&this.high<0},w.isPositive=function(){return this.unsigned||0<=this.high},w.isOdd=function(){return 1==(1&this.low)},w.isEven=function(){return 0==(1&this.low)},w.equals=function(e){return o(e)||(e=l(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.ne=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.le=w.lessThanOrEqual,w.greaterThan=function(e){return 0<this.comp(e)},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return 0<=this.comp(e)},w.gte=w.greaterThanOrEqual,w.ge=w.greaterThanOrEqual,w.compare=function(e){if(o(e)||(e=l(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},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(_)},w.neg=w.negate,w.add=function(e){o(e)||(e=l(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,p=0,f=0,h=0;return f+=(h+=i+(65535&e.low))>>>16,p+=(f+=n+u)>>>16,c+=(p+=r+a)>>>16,c+=t+s,d((f&=65535)<<16|(h&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},w.subtract=function(e){return o(e)||(e=l(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return m;if(o(e)||(e=l(e)),r)return d(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(O))return e.isOdd()?O:m;if(e.eq(O))return this.isOdd()?O:m;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(y)&&e.lt(y))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,a=e.high>>>16,c=65535&e.high,p=e.low>>>16,f=65535&e.low,h=0,g=0,v=0;e=0;return v+=(e+=s*f)>>>16,g+=(v+=i*f)>>>16,v&=65535,g+=(v+=s*p)>>>16,h+=(g+=n*f)>>>16,g&=65535,h+=(g+=i*p)>>>16,g&=65535,h+=(g+=s*c)>>>16,h+=t*f+n*p+i*c+s*a,d((v&=65535)<<16|(e&=65535),(h&=65535)<<16|(g&=65535),this.unsigned)},w.mul=w.multiply,w.divide=function(e){if((e=o(e)?e:l(e)).isZero())throw Error("division by zero");var t,n;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?d((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:m;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return v;if(e.gt(this.shru(1)))return E;n=v}else{if(this.eq(O))return e.eq(_)||e.eq(N)?O:e.eq(O)?_:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?_:N:(t=this.sub(e.mul(i)),i.add(t.div(e)));if(e.eq(O))return this.unsigned?v:m;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=m}for(t=this;t.gte(e);){for(var i=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),s=Math.ceil(Math.log(i)/Math.LN2),a=s<=48?1:c(2,s-48),p=u(i),f=p.mul(e);f.isNegative()||f.gt(t);)f=(p=u(i-=a,this.unsigned)).mul(e);p.isZero()&&(p=_),n=n.add(p),t=t.sub(f)}return n},w.div=w.divide,w.modulo=function(e){return o(e)||(e=l(e)),r?d((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.rem=w.modulo,w.not=function(){return d(~this.low,~this.high,this.unsigned)},w.and=function(e){return o(e)||(e=l(e)),d(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return o(e)||(e=l(e)),d(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return o(e)||(e=l(e)),d(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):d(0,this.low<<e-32,this.unsigned)},w.shl=w.shiftLeft,w.shiftRight=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):d(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(o(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?d(this.low>>>e|t<<32-e,t>>>e,this.unsigned):d(32===e?t:t>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.shr_u=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.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]},w.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]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,r){e.exports=i;var n=r(7);((i.prototype=Object.create(n.prototype)).constructor=i).className="Enum";var o=r(9);function i(e,t,r,o,i){if(n.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.reserved=void 0,t)for(var s=Object.keys(t),a=0;a<s.length;++a)"number"==typeof t[s[a]]&&(this.valuesById[this.values[s[a]]=t[s[a]]]=s[a])}i.fromJSON=function(e,t){return(e=new i(e,t.values,t.options,t.comment,t.comments)).reserved=t.reserved,e},i.prototype.toJSON=function(e){return e=!!e&&Boolean(e.keepComments),util.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",e?this.comment:void 0,"comments",e?this.comments:void 0])},i.prototype.add=function(e,t,r){if(!util.isString(e))throw TypeError("name must be a string");if(!util.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 this.comments[e]=r||null,this},i.prototype.remove=function(e){if(!util.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},i.prototype.isReservedId=function(e){return o.isReservedId(this.reserved,e)},i.prototype.isReservedName=function(e){return o.isReservedName(this.reserved,e)}},function(e,t,r){e.exports=d;var n,o,i,s,a=r(7);((d.prototype=Object.create(a.prototype)).constructor=d).className="Field";var u=/^required|optional|repeated$/;function d(e,t,r,n,s,d,c){if(i.isObject(n)?(c=s,d=n,n=s=void 0):i.isObject(s)&&(c=d,d=s,s=void 0),a.call(this,e,d),!i.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!i.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!u.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!i.isString(s))throw TypeError("extend must be a string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!i.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=c}d.fromJSON=function(e,t){return new d(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(d.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),d.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),a.prototype.setOption.call(this,e,t,r)},d.prototype.toJSON=function(e){return e=!!e&&Boolean(e.keepComments),i.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])},d.prototype.resolve=function(){return this.resolved?this:(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField||this).parent.lookupTypeOrEnum(this.type),this.resolvedType instanceof s?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof n&&"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 n)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long?(this.typeDefault=i.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&"string"==typeof this.typeDefault&&(i.utf8.write(this.typeDefault,e=i.newBuffer(i.utf8.length(this.typeDefault)),0),this.typeDefault=e),this.map?this.defaultValue=i.emptyObject:this.repeated?this.defaultValue=i.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof s&&(this.parent.ctor.prototype[this.name]=this.defaultValue),a.prototype.resolve.call(this));var e},d.d=function(e,t,r,n){return"function"==typeof t?t=i.decorateType(t).name:t&&"object"==typeof t&&(t=i.decorateEnum(t).name),function(o,s){i.decorateType(o.constructor).add(new d(s,e,t,r,{default:n}))}},d._configure=function(){s=r(6),n=r(4),o=r(8),i=r(1)}},function(e,t,r){e.exports=v;var n,o,i,s,a,u,d,c,p,l,f,h,g,y,m=r(9);function v(e,t){m.call(this,e,t),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 _(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}((v.prototype=Object.create(m.prototype)).constructor=v).className="Type",Object.defineProperties(v.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=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this))},set:function(e){var t=e.prototype;t instanceof i||((e.prototype=new i).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,i,!0),d.merge(e.prototype,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){var o=this._oneofsArray[r].resolve().name,s=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=0;return{setter:function(r){if(!(e.indexOf(r)<0)){t[r]=1;for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}},getter:function(){for(var e=Object.keys(this),r=e.length-1;-1<r;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}}}(this._oneofsArray[r].oneof);n[o]={get:s.getter,set:s.setter}}r&&Object.defineProperties(e.prototype,n)}}}),v.generateConstructor=function(e){return function(t){for(var r,n=0;n<e.fieldsArray.length;n++)(r=e._fieldsArray[n]).map?this[r.name]={}:r.repeated&&(this[r.name]=[]);if(t)for(var o=Object.keys(t),i=0;i<o.length;++i)null!=t[o[i]]&&(this[o[i]]=t[o[i]])}},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var i=Object.keys(t.fields),a=0;a<i.length;++a)r.add((void 0!==t.fields[i[a]].keyType?y:o).fromJSON(i[a],t.fields[i[a]]));if(t.oneofs)for(i=Object.keys(t.oneofs),a=0;a<i.length;++a)r.add(s.fromJSON(i[a],t.oneofs[i[a]]));if(t.nested)for(i=Object.keys(t.nested),a=0;a<i.length;++a){var u=t.nested[i[a]];r.add((void 0!==u.id?o:void 0!==u.fields?v:void 0!==u.values?n:void 0!==u.methods?f:m).fromJSON(i[a],u))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=m.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return{options:t&&t.options||void 0,oneofs:m.arrayToJSON(this.oneofsArray,e),fields:m.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},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:t&&t.nested||void 0,comment:r?this.comment:void 0}},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return m.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById&&this._fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),(this.fields[e.name]=e).message=this,e.onAdd(this),_(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),(this.oneofs[e.name]=e).onAdd(this),_(this)):m.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),_(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),_(this)}return m.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return m.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return m.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.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=p(this)({Writer:a,types:t,util:d}),this.decode=l(this)({Reader:u,types:t,util:d}),this.verify=c(this)({types:t,util:d}),this.fromObject=g.fromObject(this)({types:t,util:d}),this.toObject=g.toObject(this)({types:t,util:d});var n=h[e];return n&&((e=Object.create(this)).fromObject=this.fromObject,this.fromObject=n.fromObject.bind(e),e.toObject=this.toObject,this.toObject=n.toObject.bind(e)),this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof u||(e=u.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){d.decorateType(t,e)}},v._configure=function(){n=r(4),o=r(5),i=r(18),s=r(10),a=r(19),u=r(26),d=r(1),c=r(27),p=r(28),l=r(29),f=r(13),h=r(30),g=r(31),y=r(16)}},function(e,t,r){var n,o;function i(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}(e.exports=i).className="ReflectionObject",Object.defineProperties(i.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(".")}}}),i.prototype.toJSON=function(){throw Error()},i.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1,(e=e.root)instanceof o&&e._handleAdd(this)},i.prototype.onRemove=function(e){(e=e.root)instanceof o&&e._handleRemove(this),this.parent=null,this.resolved=!1},i.prototype.resolve=function(){return this.resolved||this.root instanceof o&&(this.resolved=!0),this},i.prototype.getOption=function(e){if(this.options)return this.options[e]},i.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},i.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},i.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},i._configure=function(e){o=r(12),n=r(1)}},function(e,t,r){e=e.exports;var n=r(1),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function i(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}e.basic=i([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),e.defaults=i([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n.emptyArray,null]),e.long=i([0,0,0,1,1],7),e.mapKey=i([0,0,0,5,5,0,0,0,1,1,0,2],2),e.packed=i([1,5,0,0,0,5,5,0,0,0,1,1,0]),e._configure=function(){r(1)}},function(e,t,r){e.exports=c;var n,o,i,s,a,u=r(7);function d(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(e,t){u.call(this,e,t),this.nested=void 0,this._nestedArray=null}function p(e){return e._nestedArray=null,e}((c.prototype=Object.create(u.prototype)).constructor=c).className="Namespace",c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=d,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=i.toArray(this.nested))}}),c.prototype.toJSON=function(e){return i.toObject(["options",this.options,"nested",d(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?s:void 0!==t.values?n:void 0!==t.methods?a:void 0!==t.id?o:c).fromJSON(r[i],t));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 s||e instanceof n||e instanceof a||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof c&&e instanceof c)||t instanceof s||t instanceof a)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return(this.nested[e.name]=e).onAdd(this),p(this)},c.prototype.remove=function(e){if(!(e instanceof u))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),p(this)},c.prototype.define=function(e,t){if(i.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;0<e.length;){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]),i.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||-1<t.indexOf(n.constructor))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 t=this.lookup(e,[s]);if(!t)throw Error("no such type: "+e);return t},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 t=this.lookup(e,[s,n]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},c.prototype.lookupService=function(e){var t=this.lookup(e,[a]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(){n=r(4),o=r(5),i=r(1),s=r(6),a=r(13)}},function(e,t,r){e.exports=s;var n,o,i=r(7);function s(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}((s.prototype=Object.create(i.prototype)).constructor=s).className="OneOf",s.fromJSON=function(e,t){return new s(e,t.oneof,t.options,t.comment)},s.prototype.toJSON=function(e){return e=!!e&&Boolean(e.keepComments),o.toObject(["options",this.options,"oneof",this.oneof,"comment",e?this.comment:void 0])},s.prototype.add=function(e){if(!(e instanceof n))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),a(e.partOf=this),this},s.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),-1<(t=this.oneof.indexOf(e.name))&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this).fieldsArray.push(r)}a(this)},s.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},s.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){o.decorateType(t.constructor).add(new s(r,e)),Object.defineProperty(t,r,{get:o.oneOfGetter(e),set:o.oneOfSetter(e)})}},s._configure=function(){n=r(5),o=r(1)}},function(e,t,r){(e=e.exports).length=function(e){for(var t,r=0,n=0;n<e.length;++n)(t=e.charCodeAt(n))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(n+1))?(++n,r+=4):r+=3;return r},e.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],s=0;t<r;)(n=e[t++])<128?i[s++]=n:191<n&&n<224?i[s++]=(31&n)<<6|63&e[t++]:239<n&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],8191<s&&((o=o||[]).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},e.write=function(e,t,r){for(var n,o,i=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(++s,t[r++]=(n=65536+((1023&n)<<10)+(1023&o))>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-i}},function(e,t,r){e.exports=p;var n=r(9);((p.prototype=Object.create(n.prototype)).constructor=p).className="Root";var o,i,s,a=r(5),u=r(4),d=r(10),c=r(1);function p(e){n.call(this,"",e),this.deferred=[],this.files=[],this.names=[]}function l(){}p.fromJSON=function(e,t){return e="string"==typeof e?JSON.parse(e):e,t=t||new p,e.options&&t.setOptions(e.options),t.addJSON(e.nested)},p.prototype.resolvePath=c.path.resolve,p.prototype.parseFromPbString=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return c.asPromise(e,o,t,r);var a=null;if("string"==typeof t)a=JSON.parse(t);else{if("object"!=typeof t)return;a=t}function u(e,t){var r;n&&(r=n,n=null,r(e,t))}function d(e,t){try{if(c.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),c.isString(t)){i.filename=e;var n,s=i(t,o,r),a=0;if(s.imports)for(;a<s.imports.length;++a)p(n=s.imports[a]);if(s.weakImports){for(a=0;a<s.weakImports.length;++a)n=s.weakImports[a];p(n)}}else o.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}u(null,o)}function p(e){-1<o.names.indexOf(e)||(o.names.push(e),e in s&&d(e,s[e]))}d(a.name,a.pbJsonStr)},p.prototype.load=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return c.asPromise(e,o,t,r);var a=n===l;function u(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function d(e,t){try{if(c.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),c.isString(t)){i.filename=e;var n,s=i(t,o,r),d=0;if(s.imports)for(;d<s.imports.length;++d)(n=o.resolvePath(e,s.imports[d]))&&p(n);if(s.weakImports)for(d=0;d<s.weakImports.length;++d)(n=o.resolvePath(e,s.weakImports[d]))&&p(n,!0)}else o.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}a||f||u(null,o)}function p(e,t){var r,i=e.lastIndexOf("google/protobuf/");if(-1<i&&(i=e.substring(i))in s&&(e=i),!(-1<o.files.indexOf(e)))if(o.files.push(e),e in s)a?d(e,s[e]):(++f,setTimeout((function(){--f,d(e,s[e])})));else if(a){try{r=c.fs.readFileSync(e).toString("utf8")}catch(e){return t||u(e),0}d(e,r)}else++f,c.fetch(e,(function(r,i){--f,n&&(r?t?f||u(null,o):u(r):d(e,i))}))}var f=0;c.isString(t)&&(t=[t]);for(var h,g=0;g<t.length;++g)(h=o.resolvePath("",t[g]))&&p(h);if(a)return o;f||u(null,o)},p.prototype.loadSync=function(e,t){if(!c.isNode)throw Error("not supported");return this.load(e,t,l)},p.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 n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function h(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return(n.declaringField=t).extensionField=n,r.add(n),1}}p.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||h(0,e)||this.deferred.push(e);else if(e instanceof u)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof d)){if(e instanceof o)for(var t=0;t<this.deferred.length;)h(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},p.prototype._handleRemove=function(e){var t;if(e instanceof a)void 0!==e.extend&&(e.extensionField?(e.extensionField.parent.remove(e.extensionField),e.extensionField=null):-1<(t=this.deferred.indexOf(e))&&this.deferred.splice(t,1));else if(e instanceof u)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},p._configure=function(){o=r(6),i=r(22),s=r(25),a=r(5),u=r(4),d=r(10),c=r(1)}},function(e,t,r){e.exports=a;var n,o,i,s=r(9);function a(e,t){s.call(this,e,t),this.methods={},this._methodsArray=null}function u(e){return e._methodsArray=null,e}((a.prototype=Object.create(s.prototype)).constructor=a).className="Service",a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var o=Object.keys(t.methods),i=0;i<o.length;++i)r.add(n.fromJSON(o[i],t.methods[o[i]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=s.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return o.toObject(["options",t&&t.options||void 0,"methods",s.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=o.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||s.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return s.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?u((this.methods[e.name]=e).parent=this):s.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,u(this)}return s.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var n,s=new i.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var u=o.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");s[u]=o.codegen(["r","c"],o.isReserved(u)?u+"_":u)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return s},a._configure=function(){n=r(17),o=r(1),i=r(24)}},function(e,t,r){const n=r(38),o=r(39),i=r(40);function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function a(e,t){return t.encode?(t.strict?n:encodeURIComponent)(e):e}function u(e,t){return t.decode?o(e):e}function d(e){var t=e.indexOf("#");return-1!==t?e.slice(0,t):e}function c(e){var t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function l(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{r="string"==typeof r&&-1<r.split("").indexOf(e.arrayFormatSeparator)?r.split(e.arrayFormatSeparator).map((t=>u(t,e))):null===r?r:u(r,e),n[t]=r};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),n=Object.create(null);if("string"!=typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const o of e.split("&")){let[e,s]=i(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:u(s,t),r(u(e,t),s,n)}for(const e of Object.keys(n)){const r=n[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=p(r[e],t);else n[e]=p(r,t)}return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce(((e,t)=>{var r=n[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort(((e,t)=>Number(e)-Number(t))).map((e=>t[e])):t}(r):e[t]=r,e}),Object.create(null))}t.extract=c,t.parse=l,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[",o,"]"].join("")]:[...r,[a(t,e),"[",a(o,e),"]=",a(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[a(t,e),"[]"].join("")]:[...r,[a(t,e),"[]=",a(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[a(t,e),"=",a(n,e)].join("")]:[[r,a(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,a(t,e)]:[...r,[a(t,e),"=",a(n,e)].join("")]}}(t),o={};for(const t of Object.keys(e))r(t)||(o[t]=e[t]);const i=Object.keys(o);return!1!==t.sort&&i.sort(t.sort),i.map((r=>{const o=e[r];return void 0===o?"":null===o?a(r,t):Array.isArray(o)?o.reduce(n(r),[]).join("&"):a(r,t)+"="+a(o,t)})).filter((e=>0<e.length)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,n]=i(e,"#");return Object.assign({url:r.split("?")[0]||"",query:l(c(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);var n=d(e.url).split("?")[0]||"",o=t.extract(e.url);o=t.parse(o,{sort:!1}),o=Object.assign(o,e.query);let i=t.stringify(o,r);i=i&&"?"+i;let s=function(e){let t="";var r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(s="#"+a(e.fragmentIdentifier,r)),`${n}${i}${s}`}},function(e,t){function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var n=(e.exports=r).zero=new r(0,0);n.toNumber=function(){return 0},n.zzEncode=n.zzDecode=function(){return this},n.length=function(){return 1},r.zeroHash="\0\0\0\0\0\0\0\0",r.fromNumber=function(e){if(0===e)return n;var t=e<0,o=(e=t?-e:e)>>>0;e=(e-o)/4294967296>>>0;return t&&(e=~e>>>0,o=~o>>>0,4294967295<++o&&(o=0,4294967295<++e&&(e=0))),new r(o,e)},r.from=function(e){return"number"==typeof e?r.fromNumber(e):"string"==typeof e||e instanceof String?r.fromNumber(parseInt(e,10)):e.low||e.high?new r(e.low>>>0,e.high>>>0):n},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0;e=~this.hi>>>0;return-(t+4294967296*(e=t?e:e+1>>>0))}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var o=String.prototype.charCodeAt;r.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?n:new r((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)},r.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)},r.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},r.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},r.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}},function(e,t,r){e.exports=s;var n,o,i=r(5);function s(e,t,r,n,s,a){if(i.call(this,e,t,n,void 0,void 0,s,a),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}((s.prototype=Object.create(i.prototype)).constructor=s).className="MapField",s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){return e=!!e&&Boolean(e.keepComments),o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"==typeof r?r=o.decorateType(r).name:r&&"object"==typeof r&&(r=o.decorateEnum(r).name),function(n,i){o.decorateType(n.constructor).add(new s(i,e,t,r))}},s._configure=function(){n=r(8),o=r(1)}},function(e,t,r){e.exports=i;var n,o=r(7);function i(e,t,r,i,s,a,u,d){if(n.isObject(s)?(u=s,s=a=void 0):n.isObject(a)&&(u=a,a=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(i))throw TypeError("responseType must be a string");o.call(this,e,u),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=i,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=d}((i.prototype=Object.create(o.prototype)).constructor=i).className="Method",i.fromJSON=function(e,t){return new i(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment)},i.prototype.toJSON=function(e){return e=!!e&&Boolean(e.keepComments),n.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",e?this.comment:void 0])},i.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),o.prototype.resolve.call(this))},i._configure=function(){n=r(1)}},function(e,t,r){var n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}(e.exports=o).create=function(e){return this.$type.create(e)},o.encode=function(e,t){return arguments.length?1==arguments.length?this.$type.encode(e):this.$type.encode(e,t):this.$type.encode(this)},o.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},o.decode=function(e){return this.$type.decode(e)},o.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},o.verify=function(e){return this.$type.verify(e)},o.fromObject=function(e){return this.$type.fromObject(e)},o.toObject=function(e,t){return this.$type.toObject(e=e||this,t)},o.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)},o.set=function(e,t){o[e]=t},o.get=function(e){return o[e]},o._configure=function(){n=r(1)}},function(e,t,r){e.exports=d;var n,o=r(1),i=r(11);function s(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function a(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new s(a,0,0),this.tail=this.head,this.states=null}function c(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function l(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(;127<e.lo;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function f(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}d.create=o.Buffer?function(){return(d.create=function(){return new(void 0)})()}:function(){return new d},d.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(d.alloc=o.pool(d.alloc,o.Array.prototype.subarray)),d.prototype._push=function(e,t,r){return this.tail=this.tail.next=new s(e,t,r),this.len+=t,this},(p.prototype=Object.create(s.prototype)).fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(l,10,n.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){return e=n.from(e),this._push(l,e.length(),e)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){return e=n.from(e).zzEncode(),this._push(l,e.length(),e)},d.prototype.bool=function(e){return this._push(c,1,e?1:0)},d.prototype.sfixed32=d.prototype.fixed32=function(e){return this._push(f,4,e>>>0)},d.prototype.fixed64=function(e){return e=n.from(e),this._push(f,4,e.lo)._push(f,4,e.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var h=o.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]};d.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(o.isString(e)&&(t=d.alloc(r=i.length(e)),i.write(e,t,0),e=t),this.uint32(r)._push(h,r,e)):this._push(c,1,0)},d.prototype.string=function(e){var t=i.length(e);return t?this.uint32(t)._push(i.write,t,e):this._push(c,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new s(a,0,0),this.len=0,this},d.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(a,0,0),this.len=0),this},d.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},d.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},d._configure=function(){n=r(15),r(21),i=r(11)}},function(e,t){e.exports={}},function(e,t,r){(e=e.exports).length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),o=new Array(123),i=0;i<64;)o[n[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;e.encode=function(e,t,r){for(var o,i=null,s=[],a=0,u=0;t<r;){var d=e[t++];switch(u){case 0:s[a++]=n[d>>2],o=(3&d)<<4,u=1;break;case 1:s[a++]=n[o|d>>4],o=(15&d)<<2,u=2;break;case 2:s[a++]=n[o|d>>6],s[a++]=n[63&d],u=0}8191<a&&((i=i||[]).push(String.fromCharCode.apply(String,s)),a=0)}return u&&(s[a++]=n[o],s[a++]=61,1===u&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))},e.decode=function(e,t,r){for(var n,i=r,s=0,a=0;a<e.length;){var u=e.charCodeAt(a++);if(61===u&&1<s)break;if(void 0===(u=o[u]))throw Error("invalid encoding");switch(s){case 0:n=u,s=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,s=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,s=3;break;case 3:t[r++]=(3&n)<<6|u,s=0}}if(1===s)throw Error("invalid encoding");return r-i},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},function(e,t,r){var n,o,i,s,a,u,d,c,p,l,f;(e.exports=O).filename=null,O.defaults={keepCase:!1};var h=/^[1-9][0-9]*$/,g=/^-?[1-9][0-9]*$/,y=/^0[x][0-9a-fA-F]+$/,m=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,_=/^-?0[0-7]+$/,E=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,N=/^[a-zA-Z_][a-zA-Z_0-9]*$/,b=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)+$/,A=/^(?:\.[a-zA-Z][a-zA-Z_0-9]*)+$/;function O(e,t,r){t instanceof o||(r=t,t=new o),r=r||O.defaults;var w,S,I,k,R,T=n(e,r.alternateCommentMode||!1),D=T.next,M=T.push,C=T.peek,U=T.skip,x=T.cmnt,G=!0,L=!1,P=t,j=r.keepCase?function(e){return e}:f.camelCase;function B(e,t,r){var n=O.filename;return r||(O.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+T.line+")")}function F(){var e,t=[];do{if('"'!==(e=D())&&"'"!==e)throw B(e)}while(t.push(D()),U(e),'"'===(e=C())||"'"===e);return t.join("")}function V(e){var t=D();switch(t){case"'":case'"':return M(t),F();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e){var t=1;switch("-"===e.charAt(0)&&(t=-1,e=e.substring(1)),e){case"inf":case"INF":case"Inf":return t*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(h.test(e))return t*parseInt(e,10);if(y.test(e))return t*parseInt(e,16);if(v.test(e))return t*parseInt(e,8);if(E.test(e))return t*parseFloat(e);throw B(e,"number",!0)}(t)}catch(r){if(e&&b.test(t))return t;throw B(t,"value")}}function q(e,t){for(var r;!t||'"'!==(r=C())&&"'"!==r?e.push([r=K(D()),U("to",!0)?K(D()):r]):e.push(F()),U(",",!0););U(";")}function K(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw B(e,"id");if(g.test(e))return parseInt(e,10);if(m.test(e))return parseInt(e,16);if(_.test(e))return parseInt(e,8);throw B(e,"id")}function J(e,t){switch(t){case"option":return H(e,t),U(";"),1;case"message":return function(e,t){if(!N.test(t=D()))throw B(t,"type name");var r=new i(t);Y(r,(function(e){if(!J(r,e))switch(e){case"map":!function(e){U("<");var t=D();if(void 0===l.mapKey[t])throw B(t,"type");U(",");var r=D();if(!b.test(r))throw B(r,"type");U(">");var n=D();if(!N.test(n))throw B(n,"name");U("=");var o=new a(j(n),K(D()),t,r);Y(o,(function(e){if("option"!==e)throw B(e);H(o,e),U(";")}),(function(){$(o)})),e.add(o)}(r);break;case"required":case"optional":case"repeated":W(r,e);break;case"oneof":!function(e,t){if(!N.test(t=D()))throw B(t,"name");var r=new u(j(t));Y(r,(function(e){"option"===e?(H(r,e),U(";")):(M(e),W(r,"optional"))})),e.add(r)}(r);break;case"extensions":q(r.extensions||(r.extensions=[]));break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:if(!L||!b.test(e))throw B(e);M(e),W(r,"optional")}})),e.add(r)}(e,t),1;case"enum":return function(e,t){if(!N.test(t=D()))throw B(t,"name");var r=new d(t);Y(r,(function(e){switch(e){case"option":H(r,e),U(";");break;case"reserved":q(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!N.test(t))throw B(t,"name");U("=");var r=K(D(),!0),n={};Y(n,(function(e){if("option"!==e)throw B(e);H(n,e),U(";")}),(function(){$(n)})),e.add(t,r,n.comment)}(r,e)}})),e.add(r)}(e,t),1;case"service":return function(e,t){if(!N.test(t=D()))throw B(t,"service name");var r=new c(t);Y(r,(function(e){if(!J(r,e)){if("rpc"!==e)throw B(e);!function(e,t){var r=t;if(!N.test(t=D()))throw B(t,"name");var n,o,i,s=t;if(U("("),U("stream",!0)&&(o=!0),!b.test(t=D()))throw B(t);if(n=t,U(")"),U("returns"),U("("),U("stream",!0)&&(i=!0),!b.test(t=D()))throw B(t);t=t,U(")");var a=new p(s,r,n,t,o,i);Y(a,(function(e){if("option"!==e)throw B(e);H(a,e),U(";")})),e.add(a)}(r,e)}})),e.add(r)}(e,t),1;case"extend":return function(e,t){if(!b.test(t=D()))throw B(t,"reference");var r=t;Y(null,(function(t){switch(t){case"required":case"repeated":case"optional":W(e,t,r);break;default:if(!L||!b.test(t))throw B(t);M(t),W(e,"optional",r)}}))}(e,t),1}}function Y(e,t,r){var n,o=T.line;if(e&&(e.comment=x(),e.filename=O.filename),U("{",!0)){for(;"}"!==(n=D());)t(n);U(";",!0)}else r&&r(),U(";"),e&&"string"!=typeof e.comment&&(e.comment=x(o))}function W(e,t,r){var n=D();if("group"!==n){if(!b.test(n))throw B(n,"type");var o=D();if(!N.test(o))throw B(o,"name");o=j(o),U("=");var a=new s(o,K(D()),n,t,r);Y(a,(function(e){if("option"!==e)throw B(e);H(a,e),U(";")}),(function(){$(a)})),e.add(a),L||!a.repeated||void 0===l.packed[n]&&void 0!==l.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=D();if(!N.test(r))throw B(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r)),U("=");var o=K(D()),a=new i(r);a.group=!0,(t=new s(n,o,r,t)).filename=O.filename,Y(a,(function(e){switch(e){case"option":H(a,e),U(";");break;case"required":case"optional":case"repeated":W(a,e);break;default:throw B(e)}})),e.add(a).add(t)}(e,t)}function H(e,t){var r=U("(",!0);if(!b.test(t=D()))throw B(t,"name");var n=t;r&&(U(")"),n="("+n+")",t=C(),A.test(t)&&(n+=t,D())),U("="),function e(t,r){if(U("{",!0))do{if(!N.test(R=D()))throw B(R,"name");"{"===C()?e(t,r+"."+R):(U(":"),"{"===C()?e(t,r+"."+R):Z(t,r+"."+R,V(!0)))}while(!U("}",!0));else Z(t,r,V(!0))}(e,n)}function Z(e,t,r){e.setOption&&e.setOption(t,r)}function $(e){if(U("[",!0)){for(;H(e,"option"),U(",",!0););U("]")}return e}for(;null!==(R=D());)switch(R){case"package":if(!G)throw B(R);!function(){if(void 0!==w)throw B("package");if(w=D(),!b.test(w))throw B(w,"name");P=P.define(w),U(";")}();break;case"import":if(!G)throw B(R);!function(){var e,t;switch(C()){case"weak":e=I=I||[],D();break;case"public":D();default:e=S=S||[]}t=F(),U(";"),e.push(t)}();break;case"syntax":if(!G)throw B(R);!function(){if(U("="),k=F(),!(L="proto3"===k)&&"proto2"!==k)throw B(k,"syntax");U(";")}();break;case"option":if(!G)throw B(R);H(P,R),U(";");break;default:if(J(P,R)){G=!1;continue}throw B(R)}return O.filename=null,{package:w,imports:S,weakImports:I,syntax:k,root:t}}O._configure=function(){n=r(23),o=r(12),i=r(6),s=r(5),a=r(16),u=r(10),d=r(4),c=r(13),p=r(17),l=r(8),f=r(1)}},function(e,t){e.exports=l;var r=/[\s{}=;:[\],'"()<>]/g,n=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,o=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,s=/^\s*\*?\/*/,a=/\n/g,u=/\s/,d=/\\(.?)/g,c={0:"\0",r:"\r",n:"\n",t:"\t"};function p(e){return e.replace(d,(function(e,t){switch(t){case"\\":case"":return t;default:return c[t]||""}}))}function l(e,t){e=e.toString();var d=0,c=e.length,l=1,f=null,h=null,g=0,y=!1,m=[],v=null;function _(e){return Error("illegal "+e+" (line "+l+")")}function E(t){return e.charAt(t)}function N(r,n){f=e.charAt(r++),g=l,y=!1;var o,u=r-(t?2:3);do{if(--u<0||"\n"===(o=e.charAt(u))){y=!0;break}}while(" "===o||"\t"===o);for(var d=e.substring(r,n).split(a),c=0;c<d.length;++c)d[c]=d[c].replace(t?s:i,"").trim();h=d.join("\n").trim()}function b(t){var r=A(t);r=e.substring(t,r);return/^\s*\/{1,2}/.test(r)}function A(e){for(var t=e;t<c&&"\n"!==E(t);)t++;return t}function O(){if(0<m.length)return m.shift();if(v)return function(){var t="'"===v?o:n;t.lastIndex=d-1;var r=t.exec(e);if(!r)throw _("string");return d=t.lastIndex,w(v),v=null,p(r[1])}();var i,s,a,f,h;do{if(d===c)return null;for(i=!1;u.test(a=E(d));)if("\n"===a&&++l,++d===c)return null;if("/"===E(d)){if(++d===c)throw _("comment");if("/"===E(d))if(t){if(h=!1,b(f=d))for(h=!0;(d=A(d))!==c&&b(++d););else d=Math.min(c,A(d)+1);h&&N(f,d),l++,i=!0}else{for(h="/"===E(f=d+1);"\n"!==E(++d);)if(d===c)return null;++d,h&&N(f,d-1),++l,i=!0}else{if("*"!==(a=E(d)))return"/";f=d+1,h=t||"*"===E(f);do{if("\n"===a&&++l,++d===c)throw _("comment")}while(s=a,a=E(d),"*"!==s||"/"!==a);++d,h&&N(f,d-2),i=!0}}}while(i);var g=d;if(r.lastIndex=0,!r.test(E(g++)))for(;g<c&&!r.test(E(g));)++g;var y=e.substring(d,d=g);return'"'!==y&&"'"!==y||(v=y),y}function w(e){m.push(e)}function S(){if(!m.length){var e=O();if(null===e)return null;w(e)}return m[0]}return Object.defineProperty({next:O,peek:S,push:w,skip:function(e,t){var r=S();if(r===e)return O(),!0;if(!t)throw _("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var r=null;return void 0===e?g===l-1&&(t||"*"===f||y)&&(r=h):(g<e&&S(),g!==e||y||!t&&"/"!==f||(r=h)),r}},"line",{get:function(){return l}})}l.unescape=p},function(e,t,r){e.exports=o;var n=r(1);function o(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((o.prototype=Object.create(n.EventEmitter.prototype)).constructor=o).prototype.rpcCall=function e(t,r,o,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,o,i);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof o))try{r=o[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t){e.exports=n;var r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:e={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:e}),n("empty",{Empty:{fields:{}}}),n("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}}}}),n("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}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},function(e,t,r){e.exports=a;var n,o,i=r(1);function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function a(e){this.buf=e,this.pos=0,this.len=e.length}var u,d="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new a(e);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer)return new a(new Uint8Array(e));throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new a(e);throw Error("illegal buffer")};function c(){var e=new n(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw s(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,4<this.len-this.pos){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 s(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 p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function l(){if(this.pos+8>this.len)throw s(this,8);return new n(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}a.create=i.Buffer?function(e){return(a.create=function(e){return i.Buffer.isBuffer(e)?new(void 0)(e):d(e)})(e)}:d,a.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,a.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return u}),a.prototype.int32=function(){return 0|this.uint32()},a.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},a.prototype.bool=function(){return 0!==this.uint32()},a.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return p(this.buf,this.pos+=4)},a.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|p(this.buf,this.pos+=4)},a.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},a.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},a.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw s(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},a.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},a.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},a.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},a._configure=function(){n=r(15),o=r(11);var e=i.Long?"toLong":"toNumber";i.merge(a.prototype,{int64:function(){return c.call(this)[e](!1)},uint64:function(){return c.call(this)[e](!0)},sint64:function(){return c.call(this).zzDecode()[e](!1)},fixed64:function(){return l.call(this)[e](!0)},sfixed64:function(){return l.call(this)[e](!1)}})}},function(e,t,r){var n,o;function i(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function s(e,t,r,s){if(s=s.types,e.resolvedType){if(e.resolvedType instanceof n){if(Object.keys(e.resolvedType.values).indexOf(r)<0)return i(e,"enum value")}else if(t=s[t].verify(r))return e.name+"."+t}else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.isInteger(r))return i(e,"integer");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!(o.isInteger(r)||r&&o.isInteger(r.low)&&o.isInteger(r.high)))return i(e,"integer|Long");break;case"float":case"double":if("number"!=typeof r)return i(e,"number");break;case"bool":if("boolean"!=typeof r)return i(e,"boolean");break;case"string":if(!o.isString(r))return i(e,"string");break;case"bytes":if(!(r&&"number"==typeof r.length||o.isString(r)))return i(e,"buffer")}}(e.exports=function(e){return function(t){return function(r){var n;if("object"!=typeof r||null===r)return"object expected";var a,u={};e.oneofsArray.length&&(a={});for(var d=0;d<e.fieldsArray.length;++d){var c=e._fieldsArray[d].resolve(),p=r[c.name];if(!c.optional||null!=p&&r.hasOwnProperty(c.name))if(c.map){if(!o.isObject(p))return i(c,"object");for(var l=Object.keys(p),f=0;f<l.length;++f){if(n=function(e,t){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":if(!o.key32Re.test(t))return i(e,"integer key");break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":if(!o.key64Re.test(t))return i(e,"integer|Long key");break;case"bool":if(!o.key2Re.test(t))return i(e,"boolean key")}}(c,l[f]))return n;if(n=s(c,d,p[l[f]],t))return n}}else if(c.repeated){if(!Array.isArray(p))return i(c,"array");for(f=0;f<p.length;++f)if(n=s(c,d,p[f],t))return n}else{if(c.partOf){var h=c.partOf.name;if(1===u[c.partOf.name]&&1===a[h])return c.partOf.name+": multiple values";a[h]=1}if(n=s(c,d,p,t))return n}}}}})._configure=function(){n=r(4),o=r(1)}},function(e,t,r){var n,o;(e.exports=function(e){return function(t){var r=t.Writer,i=t.types,s=t.util;return function(t,a){a=a||r.create();for(var u=e.fieldsArray.slice().sort(s.compareFieldsById),d=0;d<u.length;d++){var c=u[d],p=e._fieldsArray.indexOf(c),l=c.resolvedType instanceof n?"uint32":c.type,f=o.basic[l],h=t[c.name];if(c.resolvedType instanceof n&&"string"==typeof h&&(h=i[p].values[h]),c.map){if(null!=h&&t.hasOwnProperty(c.name))for(var g=Object.keys(h),y=0;y<g.length;++y)a.uint32((c.id<<3|2)>>>0).fork().uint32(8|o.mapKey[c.keyType])[c.keyType](g[y]),(void 0===f?i[p].encode(h[g[y]],a.uint32(18).fork()).ldelim():a.uint32(16|f)[l](h[g[y]])).ldelim()}else if(c.repeated){if(h&&h.length)if(c.packed&&void 0!==o.packed[l]){a.uint32((c.id<<3|2)>>>0).fork();for(var m=0;m<h.length;m++)a[l](h[m]);a.ldelim()}else for(var v=0;v<h.length;v++)void 0===f?c.resolvedType.group?i[p].encode(h[v],a.uint32((c.id<<3|3)>>>0)).uint32((c.id<<3|4)>>>0):i[p].encode(h[v],a.uint32((c.id<<3|2)>>>0).fork()).ldelim():a.uint32((c.id<<3|f)>>>0)[l](h[v])}else(!c.optional||null!=h&&t.hasOwnProperty(c.name))&&(c.optional||null!=h&&t.hasOwnProperty(c.name)||console.warn("注意啦!!!很大概率会报错 类型:",t.$type?t.$type.name:"不晓得","没有设置对应的属性:",c.name,"检查是不是proto文件属性设置为了required"),void 0===f?c.resolvedType.group?i[p].encode(h,a.uint32((c.id<<3|3)>>>0)).uint32((c.id<<3|4)>>>0):i[p].encode(h,a.uint32((c.id<<3|2)>>>0).fork()).ldelim():a.uint32((c.id<<3|f)>>>0)[l](h))}return a}}})._configure=function(){n=r(4),o=r(8)}},function(e,t,r){var n,o,i;(e.exports=function(e){return function(t){var r=t.Reader,s=t.types,a=t.util;return function(t,u){t instanceof r||(t=r.create(t));for(var d,c=void 0===u?t.len:t.pos+u,p=new this.ctor;t.pos<c;){var l=t.uint32();if(e.group&&4==(7&l))break;for(var f=l>>>3,h=0,g=!1;h<e.fieldsArray.length;++h){var y=e._fieldsArray[h].resolve(),m=y.name,v=y.resolvedType instanceof n?"int32":y.type;if(f==y.id){if(g=!0,y.map)t.skip().pos++,p[m]===a.emptyObject&&(p[m]={}),d=t[y.keyType](),t.pos++,null!=o.long[y.keyType]?null==o.basic[v]?p[m]["object"==typeof d?a.longToHash(d):d]=s[h].decode(t,t.uint32()):p[m]["object"==typeof d?a.longToHash(d):d]=t[v]():null==o.basic[v]?p[m]=s[h].decode(t,t.uint32()):p[m]=t[v]();else if(y.repeated)if(p[m]&&p[m].length||(p[m]=[]),null!=o.packed[v]&&2==(7&l))for(var _=t.uint32()+t.pos;t.pos<_;)p[m].push(t[v]());else null==o.basic[v]?y.resolvedType.group?p[m].push(s[h].decode(t)):p[m].push(s[h].decode(t,t.uint32())):p[m].push(t[v]());else null==o.basic[v]?y.resolvedType.group?p[m]=s[h].decode(t):p[m]=s[h].decode(t,t.uint32()):p[m]=t[v]();break}}g||t.skipType(7&l)}for(h=0;h<e._fieldsArray.length;++h){var E=e._fieldsArray[h];if(E.required&&!p.hasOwnProperty(E.name))throw i.ProtocolError("missing required '"+E.name+"'",{instance:p})}return p}}})._configure=function(){n=r(4),o=r(8),i=r(1)}},function(e,t,r){var n;(t=t)[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=this.lookup(e["@type"]);if(t){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return this.create({type_url:"/"+r,value:t.encode(t.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r;return t&&t.json&&e.type_url&&e.value&&(r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),(r=this.lookup(r))&&(e=r.decode(e.value))),e instanceof this.ctor||!(e instanceof n)?this.toObject(e,t):((t=e.$type.toObject(e,t))["@type"]=e.$type.fullName,t)}},t._configure=function(){n=r(18)}},function(e,t,r){var n,o;function i(e,t,r,i){var s=i.m,a=i.d,u=i.types,d=i.ksi,c=void 0!==d;if(e.resolvedType)if(e.resolvedType instanceof n){for(var p=c?a[r][d]:a[r],l=e.resolvedType.values,f=Object.keys(l),h=0;h<f.length;h++)if(!(e.repeated&&l[f[h]]===e.typeDefault||f[h]!=p&&l[f[h]]!=p)){c?s[r][d]=l[f[h]]:s[r]=l[f[h]];break}}else{if("object"!=typeof(c?a[r][d]:a[r]))throw TypeError(e.fullName+": object expected");c?s[r][d]=u[t].fromObject(a[r][d]):s[r]=u[t].fromObject(a[r])}else{var g=!1;switch(e.type){case"double":case"float":c?s[r][d]=Number(a[r][d]):s[r]=Number(a[r]);break;case"uint32":case"fixed32":c?s[r][d]=a[r][d]>>>0:s[r]=a[r]>>>0;break;case"int32":case"sint32":case"sfixed32":c?s[r][d]=0|a[r][d]:s[r]=0|a[r];break;case"uint64":g=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":o.Long?c?s[r][d]=o.Long.fromValue(a[r][d]).unsigned=g:s[r]=o.Long.fromValue(a[r]).unsigned=g:"string"==typeof(c?a[r][d]:a[r])?c?s[r][d]=parseInt(a[r][d],10):s[r]=parseInt(a[r],10):"number"==typeof(c?a[r][d]:a[r])?c?s[r][d]=a[r][d]:s[r]=a[r]:"object"==typeof(c?a[r][d]:a[r])&&(c?s[r][d]=new o.LongBits(a[r][d].low>>>0,a[r][d].high>>>0).toNumber(g):s[r]=new o.LongBits(a[r].low>>>0,a[r].high>>>0).toNumber(g));break;case"bytes":"string"==typeof(c?a[r][d]:a[r])?c?o.base64.decode(a[r][d],s[r][d]=o.newBuffer(o.base64.length(a[r][d])),0):o.base64.decode(a[r],s[r]=o.newBuffer(o.base64.length(a[r])),0):(c?a[r][d]:a[r]).length&&(c?s[r][d]=a[r][d]:s[r]=a[r]);break;case"string":c?s[r][d]=String(a[r][d]):s[r]=String(a[r]);break;case"bool":c?s[r][d]=Boolean(a[r][d]):s[r]=Boolean(a[r])}}}function s(e,t,r,i){var s=i.m,a=i.d,u=i.types,d=i.ksi,c=i.o,p=void 0!==d;if(e.resolvedType)e.resolvedType instanceof n?p?a[r][d]=c.enums===String?u[t].values[s[r][d]]:s[r][d]:a[r]=c.enums===String?u[t].values[s[r]]:s[r]:p?a[r][d]=u[t].toObject(s[r][d],c):a[r]=u[t].toObject(s[r],c);else{var l=!1;switch(e.type){case"double":case"float":p?a[r][d]=c.json&&!isFinite(s[r][d])?String(s[r][d]):s[r][d]:a[r]=c.json&&!isFinite(s[r])?String(s[r]):s[r];break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":"number"==typeof s[r][d]?p?a[r][d]=c.longs===String?String(s[r][d]):s[r][d]:a[r]=c.longs===String?String(s[r]):s[r]:p?a[r][d]=c.longs===String?o.Long.prototype.toString.call(s[r][d]):c.longs===Number?new o.LongBits(s[r][d].low>>>0,s[r][d].high>>>0).toNumber(l):s[r][d]:a[r]=c.longs===String?o.Long.prototype.toString.call(s[r]):c.longs===Number?new o.LongBits(s[r].low>>>0,s[r].high>>>0).toNumber(l):s[r];break;case"bytes":p?a[r][d]=c.bytes===String?o.base64.encode(s[r][d],0,s[r][d].length):c.bytes===Array?Array.prototype.slice.call(s[r][d]):s[r][d]:a[r]=c.bytes===String?o.base64.encode(s[r],0,s[r].length):c.bytes===Array?Array.prototype.slice.call(s[r]):s[r];break;default:p?a[r][d]=s[r][d]:a[r]=s[r]}}}(e=e.exports)._configure=function(){n=r(4),o=r(1)},e.fromObject=function(e){var t=e.fieldsArray;return function(e){return function(r){if(r instanceof this.ctor)return r;if(!t.length)return new this.ctor;for(var s=new this.ctor,a=0;a<t.length;++a){var u=t[a].resolve(),d=u.name;if(u.map){if(r[d]){if("object"!=typeof r[d])throw TypeError(u.fullName+": object expected");s[d]={}}for(var c=Object.keys(r[d]),p=0;p<c.length;++p)i(u,a,d,o.merge(o.copy(e),{m:s,d:r,ksi:c[p]}))}else if(u.repeated){if(r[d]){if(!Array.isArray(r[d]))throw TypeError(u.fullName+": array expected");for(s[d]=[],p=0;p<r[d].length;++p)i(u,a,d,o.merge(o.copy(e),{m:s,d:r,ksi:p}))}}else(u.resolvedType instanceof n||null!=r[d])&&i(u,a,d,o.merge(o.copy(e),{m:s,d:r}))}return s}}},e.toObject=function(e){var t=e.fieldsArray.slice().sort(o.compareFieldsById);return function(r){return t.length?function(i,a){a=a||{};for(var u,d,c={},p=[],l=[],f=[],h=0;h<t.length;++h)t[h].partOf||(t[h].resolve().repeated?p:t[h].map?l:f).push(t[h]);if(p.length&&(a.arrays||a.defaults))for(h=0;h<p.length;++h)c[p[h].name]=[];if(l.length&&(a.objects||a.defaults))for(h=0;h<l.length;++h)c[l[h].name]={};if(f.length&&a.defaults)for(h=0;h<f.length;++h)m=(u=f[h]).name,u.resolvedType instanceof n?c[m]=a.enums=String?u.resolvedType.valuesById[u.typeDefault]:u.typeDefault:u.long?o.Long?(d=new o.Long(u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned),c[m]=a.longs===String?d.toString():a.longs===Number?d.toNumber():d):c[m]=a.longs===String?u.typeDefault.toString():u.typeDefault.toNumber():u.bytes?c[m]=a.bytes===String?String.fromCharCode.apply(String,u.typeDefault):Array.prototype.slice.call(u.typeDefault).join("*..*").split("*..*"):c[m]=u.typeDefault;for(h=0;h<t.length;++h){var g,y,m=(u=t[h]).name,v=e._fieldsArray.indexOf(u);if(u.map){if(i[m]&&(g=Object.keys(i[m]).length))for(c[m]={},y=0;y<g.length;++y)s(u,v,m,o.merge(o.copy(r),{m:i,d:c,ksi:g[y],o:a}))}else if(u.repeated){if(i[m]&&i[m].length)for(c[m]=[],y=0;y<i[m].length;++y)s(u,v,m,o.merge(o.copy(r),{m:i,d:c,ksi:y,o:a}))}else null!=i[m]&&i.hasOwnProperty(m)&&s(u,v,m,o.merge(o.copy(r),{m:i,d:c,o:a})),u.partOf&&a.oneofs&&(c[u.partOf.name]=m)}return c}:function(){return{}}}}},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.messagebody||(e.roots.messagebody=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{MessageOperation:{fields:{type:{type:"OpType",id:1},mid:{type:"uint64",id:2},xid:{type:"XID",id:3}},nested:{OpType:{values:{UNKNOWN:0,READ_ACK:1,READ_ALL:2,READ_CANCEL:3,DELIVER_ACK:4,RECALL:5,DELETE:6,PLAY_ACK:7}}}},MessageBody:{fields:{type:{type:"Type",id:1},content:{type:"string",id:4},ctype:{type:"ContentType",id:5},operation:{type:"MessageOperation",id:6},config:{type:"string",id:7},attachment:{type:"string",id:8},ext:{type:"string",id:9},qos:{type:"QoS",id:10},sender_name:{type:"string",id:11},is_system:{type:"bool",id:12},priority:{type:"uint32",id:13},status:{type:"Status",id:14}},nested:{Type:{values:{NORMAL:0,OPER:1,CHAT:2,GROUPCHAT:3}},ContentType:{values:{TEXT:0,IMAGE:1,AUDIO:2,VIDEO:3,FILE:4,LOCATION:5,COMMAND:6,FORWARD:7}},QoS:{values:{AT_LEAST_ONCE:0,AT_MOST_ONCE:1,EXACTLY_ONCE:2}},Status:{values:{UNREAD:0,DELIVERED:1,READ:2}}}},XID:{fields:{uid:{type:"uint64",id:1},deviceSN:{type:"uint32",id:2}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.groupnotice||(e.roots.groupnotice=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{GroupNotice:{fields:{type:{type:"Type",id:1},gid:{type:"XID",id:2},from:{type:"XID",id:3},to:{rule:"repeated",type:"XID",id:4},content:{type:"string",id:5}},nested:{Type:{values:{UNKNOWN:0,PRESENCE:1,ABSENCE:2,CREATED:3,DESTROYED:4,JOINED:5,LEAVED:6,APPLYED:7,APPLY_ACCEPTED:8,APPLY_DECLINED:9,INVITED:10,INVITE_ACCEPTED:11,INVITE_DECLINED:12,KICKED:13,BLOCKED:14,UNBLOCKED:15,OWNER_ASSIGNED:16,ADMIN_GRANTED:17,ADMIN_REVOKED:18,MUTED:19,UNMUTED:20,BANNED:21,UNBANNED:22,INFO_UPDATED:23,ANNOUNCEMENT_UPDATED:24,MESSAGE_SETTING:25,FILE_UPLOADED:26,FILE_DELETED:27,FILE_UPDATED:28}}}},XID:{fields:{uid:{type:"uint64",id:1},deviceSN:{type:"uint32",id:2}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.rosternotice||(e.roots.rosternotice=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{RosterNotice:{fields:{type:{type:"Type",id:1},from:{type:"XID",id:2},to:{rule:"repeated",type:"XID",id:3},content:{type:"string",id:4},roster_vsn:{type:"string",id:5}},nested:{Type:{values:{UNKNOWN:0,ADDED:1,REMOVED:2,ACCEPTED:3,DECLINED:4,APPLIED:7,BLOCKED:5,UNBLOCKED:6,INFO_UPDATED:8,MUTED:9,UNMUTED:10}}}},XID:{fields:{uid:{type:"uint64",id:1},deviceSN:{type:"uint32",id:2}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.usernotice||(e.roots.usernotice=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{UserNotice:{fields:{type:{type:"Type",id:1},content:{type:"string",id:2}},nested:{Type:{values:{UNKNOWN:0,PASSWORD_CHANGED:1,FROZEN:2,REMOVED:3,KICK_BY_SAME_DEVICE:4,KICKED_BY_OTHER_DEVICE:5,INFO_UPDATED:6,DEVICE_LOGIN:7,DEVICE_LOGOUT:8,DEVICE_ADDED:9,DEVICE_REMOVED:10,CLUSTER_CHANGED:11}}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.info||(e.roots.info=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{Info:{fields:{sdk_vsn:{type:"string",id:1},network:{type:"Network",id:2},content:{type:"string",id:3}},nested:{Network:{values:{WIRE:0,WIFI:1,NET_2G:2,NET_3G:3,NET_4G:4,NET_5G:5,UNKNOWN:6}}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){var n=[r(0)];void 0===(r="function"==typeof(r=function(e){return(e.roots.conversation||(e.roots.conversation=new e.Root)).addJSON({im:{nested:{floo:{nested:{protobuf:{nested:{Conversation:{fields:{type:{type:"Type",id:1},operation:{type:"ConversationOperation",id:2}},nested:{Type:{values:{UNKNOWN:0,OPER:1}}}},ConversationOperation:{fields:{type:{type:"OpType",id:1},xid:{type:"XID",id:2}},nested:{OpType:{values:{UNKNOWN:0,DELETE:1,DELETE_EVERYWHERE:2}}}},XID:{fields:{uid:{type:"uint64",id:1},deviceSN:{type:"uint32",id:2}}}}}}}}}})})?r.apply(t,n):r)||(e.exports=r)},function(e,t,r){e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()))},function(e,t,r){var n=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n),r=1;r<t.length;r++)t=(e=function e(t,r){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;var n=t.slice(0,r=r||1);r=t.slice(r);return Array.prototype.concat.call([],e(n),e(r))}(t,r).join("")).match(n);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=o.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=i(r[0]);n!==r[0]&&(t[r[0]]=n)}r=o.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];e=e.replace(new RegExp(u,"g"),t[u])}return e}(e)}}},function(e,t,r){e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];var r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t){e.exports=n;var r=null;try{r=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 n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function o(e){return!0===(e&&e.__isLong__)}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=o;var i={},s={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=d(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=d(e,e<0?-1:0,!1),o&&(i[e]=r),r)}function u(e,t){if(isNaN(e))return t?v:m;if(t){if(e<0)return v;if(h<=e)return A}else{if(e<=-g)return O;if(g<=e+1)return b}return e<0?u(-e,t).neg():d(e%f|0,e/f|0,t)}function d(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=d;var c=Math.pow;function p(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return m;if(t="number"==typeof t?(r=t,!1):!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return p(e.substring(1),t,r).neg();for(var o=u(c(r,8)),i=m,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),d=parseInt(e.substring(s,s+a),r);i=a<8?(a=u(c(r,a)),i.mul(a).add(u(d))):(i=i.mul(o)).add(u(d))}return i.unsigned=t,i}function l(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?p(e,t):d(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=p,n.fromValue=l;var f=4294967296,h=f*f,g=h/2,y=a(1<<24),m=a(0);n.ZERO=m;var v=a(0,!0);n.UZERO=v;var _=a(1);n.ONE=_;var E=a(1,!0);n.UONE=E;var N=a(-1);n.NEG_ONE=N;var b=d(-1,2147483647,!1);n.MAX_VALUE=b;var A=d(-1,-1,!0);n.MAX_UNSIGNED_VALUE=A;var O=d(0,-2147483648,!1);n.MIN_VALUE=O;var w=n.prototype;w.toInt=function(){return this.unsigned?this.low>>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},w.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(O)){var t=u(e),r=this.div(t);t=r.mul(t).sub(this);return r.toString(e)+t.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=u(c(e,6),this.unsigned),o=this,i="";;){var s=o.div(n),a=(o.sub(s.mul(n)).toInt()>>>0).toString(e);if((o=s).isZero())return a+i;for(;a.length<6;)a="0"+a;i=""+a+i}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},w.isZero=function(){return 0===this.high&&0===this.low},w.eqz=w.isZero,w.isNegative=function(){return!this.unsigned&&this.high<0},w.isPositive=function(){return this.unsigned||0<=this.high},w.isOdd=function(){return 1==(1&this.low)},w.isEven=function(){return 0==(1&this.low)},w.equals=function(e){return o(e)||(e=l(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},w.eq=w.equals,w.notEquals=function(e){return!this.eq(e)},w.neq=w.notEquals,w.ne=w.notEquals,w.lessThan=function(e){return this.comp(e)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(e){return this.comp(e)<=0},w.lte=w.lessThanOrEqual,w.le=w.lessThanOrEqual,w.greaterThan=function(e){return 0<this.comp(e)},w.gt=w.greaterThan,w.greaterThanOrEqual=function(e){return 0<=this.comp(e)},w.gte=w.greaterThanOrEqual,w.ge=w.greaterThanOrEqual,w.compare=function(e){if(o(e)||(e=l(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},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(_)},w.neg=w.negate,w.add=function(e){o(e)||(e=l(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,p=0,f=0,h=0;return f+=(h+=i+(65535&e.low))>>>16,p+=(f+=n+u)>>>16,c+=(p+=r+a)>>>16,c+=t+s,d((f&=65535)<<16|(h&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},w.subtract=function(e){return o(e)||(e=l(e)),this.add(e.neg())},w.sub=w.subtract,w.multiply=function(e){if(this.isZero())return m;if(o(e)||(e=l(e)),r)return d(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(O))return e.isOdd()?O:m;if(e.eq(O))return this.isOdd()?O:m;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(y)&&e.lt(y))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,n=65535&this.high,i=this.low>>>16,s=65535&this.low,a=e.high>>>16,c=65535&e.high,p=e.low>>>16,f=65535&e.low,h=0,g=0,v=0;e=0;return v+=(e+=s*f)>>>16,g+=(v+=i*f)>>>16,v&=65535,g+=(v+=s*p)>>>16,h+=(g+=n*f)>>>16,g&=65535,h+=(g+=i*p)>>>16,g&=65535,h+=(g+=s*c)>>>16,h+=t*f+n*p+i*c+s*a,d((v&=65535)<<16|(e&=65535),(h&=65535)<<16|(g&=65535),this.unsigned)},w.mul=w.multiply,w.divide=function(e){if((e=o(e)?e:l(e)).isZero())throw Error("division by zero");var t,n;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?d((this.unsigned?r.div_u:r.div_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?v:m;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return v;if(e.gt(this.shru(1)))return E;n=v}else{if(this.eq(O))return e.eq(_)||e.eq(N)?O:e.eq(O)?_:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?_:N:(t=this.sub(e.mul(i)),i.add(t.div(e)));if(e.eq(O))return this.unsigned?v:m;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=m}for(t=this;t.gte(e);){for(var i=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),s=Math.ceil(Math.log(i)/Math.LN2),a=s<=48?1:c(2,s-48),p=u(i),f=p.mul(e);f.isNegative()||f.gt(t);)f=(p=u(i-=a,this.unsigned)).mul(e);p.isZero()&&(p=_),n=n.add(p),t=t.sub(f)}return n},w.div=w.divide,w.modulo=function(e){return o(e)||(e=l(e)),r?d((this.unsigned?r.rem_u:r.rem_s)(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},w.mod=w.modulo,w.rem=w.modulo,w.not=function(){return d(~this.low,~this.high,this.unsigned)},w.and=function(e){return o(e)||(e=l(e)),d(this.low&e.low,this.high&e.high,this.unsigned)},w.or=function(e){return o(e)||(e=l(e)),d(this.low|e.low,this.high|e.high,this.unsigned)},w.xor=function(e){return o(e)||(e=l(e)),d(this.low^e.low,this.high^e.high,this.unsigned)},w.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):d(0,this.low<<e-32,this.unsigned)},w.shl=w.shiftLeft,w.shiftRight=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):d(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(e){if(o(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?d(this.low>>>e|t<<32-e,t>>>e,this.unsigned):d(32===e?t:t>>>e-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.shr_u=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},w.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]},w.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]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t){e.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){return r<1||o<r?e(r):(n<s+r&&(i=e(n),s=0),r=t.call(i,s,s+=r),7&s&&(s=1+(7|s)),r)}}},function(e,t){function r(e){return"undefined"!=typeof Float32Array?(f=new Float32Array([-0]),g=128===(h=new Uint8Array(f.buffer))[3],e.writeFloatLE=g?v:_,e.writeFloatBE=g?_:v,e.readFloatLE=g?E:N,e.readFloatBE=g?N:E):(e.writeFloatLE=y.bind(null,n),e.writeFloatBE=y.bind(null,o),e.readFloatLE=m.bind(null,i),e.readFloatBE=m.bind(null,s)),"undefined"!=typeof Float64Array?(p=new Float64Array([-0]),g=128===(l=new Uint8Array(p.buffer))[7],e.writeDoubleLE=g?a:u,e.writeDoubleBE=g?u:a,e.readDoubleLE=g?d:c,e.readDoubleBE=g?c:d):(e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,o,4,0),e.readDoubleLE=r.bind(null,i,0,4),e.readDoubleBE=r.bind(null,s,4,0)),e;function t(e,t,r,n,o,i){var s,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,i+t),e(0<1/n?0:2147483648,o,i+r)):isNaN(n)?(e(0,o,i+t),e(2146959360,o,i+r)):17976931348623157e292<n?(e(0,o,i+t),e((u<<31|2146435072)>>>0,o,i+r)):n<22250738585072014e-324?(e((s=n/5e-324)>>>0,o,i+t),e((u<<31|s/4294967296)>>>0,o,i+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(s=n*Math.pow(2,-a))>>>0,o,i+t),e((u<<31|a+1023<<20|1048576*s&1048575)>>>0,o,i+r))}function r(e,t,r,n,o){return t=e(n,o+t),o=2*((n=e(n,o+r))>>31)+1,t=4294967296*(1048575&n)+t,2047==(r=n>>>20&2047)?t?NaN:1/0*o:0==r?5e-324*o*t:o*Math.pow(2,r-1075)*(t+4503599627370496)}function a(e,t,r){p[0]=e,t[r]=l[0],t[r+1]=l[1],t[r+2]=l[2],t[r+3]=l[3],t[r+4]=l[4],t[r+5]=l[5],t[r+6]=l[6],t[r+7]=l[7]}function u(e,t,r){p[0]=e,t[r]=l[7],t[r+1]=l[6],t[r+2]=l[5],t[r+3]=l[4],t[r+4]=l[3],t[r+5]=l[2],t[r+6]=l[1],t[r+7]=l[0]}function d(e,t){return l[0]=e[t],l[1]=e[t+1],l[2]=e[t+2],l[3]=e[t+3],l[4]=e[t+4],l[5]=e[t+5],l[6]=e[t+6],l[7]=e[t+7],p[0]}function c(e,t){return l[7]=e[t],l[6]=e[t+1],l[5]=e[t+2],l[4]=e[t+3],l[3]=e[t+4],l[2]=e[t+5],l[1]=e[t+6],l[0]=e[t+7],p[0]}var p,l,f,h,g;function y(e,t,r,n){var o=t<0?1:0;0===(t=o?-t:t)?e(0<1/t?0:2147483648,r,n):isNaN(t)?e(2143289344,r,n):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(o=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}function m(e,t,r){return t=2*((e=e(t,r))>>31)+1,r=e>>>23&255,e&=8388607,255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(8388608+e)}function v(e,t,r){f[0]=e,t[r]=h[0],t[r+1]=h[1],t[r+2]=h[2],t[r+3]=h[3]}function _(e,t,r){f[0]=e,t[r]=h[3],t[r+1]=h[2],t[r+2]=h[1],t[r+3]=h[0]}function E(e,t){return h[0]=e[t],h[1]=e[t+1],h[2]=e[t+2],h[3]=e[t+3],f[0]}function N(e,t){return h[3]=e[t],h[2]=e[t+1],h[1]=e[t+2],h[0]=e[t+3],f[0]}}function n(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 o(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 i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=r(r)},function(e,t,r){e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,i=!0;o<arguments.length;)r[n++]=arguments[o++];return new Promise((function(o,s){r[n]=function(e){if(i)if(i=!1,e)s(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){i&&(i=!1,s(e))}}))}},function(e,t,r){function n(){this._listeners={}}(e.exports=n).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},n.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},n.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}},function(e,t){var r=(e=e.exports).isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=e.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e);e="";n&&(e=t.shift()+"/");for(var o=0;o<t.length;)".."===t[o]?0<o&&".."!==t[o-1]?t.splice(--o,2):n?t.splice(o,1):++o:"."===t[o]?t.splice(o,1):++o;return e+t.join("/")};e.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(e=(e=o?e:n(e)).replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t}},function(e,t,r){r.r(t),r.d(t,"flooim",(function(){return po}));var n={};r.r(n),r.d(n,"STATIC_FRAME_VSN",(function(){return p})),r.d(n,"STATIC_FRAME_COMMAND",(function(){return l})),r.d(n,"STATIC_FRAME_COMPRESS_METHOD",(function(){return f})),r.d(n,"STATIC_FRAME_ERROR_STATUS",(function(){return h})),r.d(n,"STATIC_FRAME_OSTYPE",(function(){return g})),r.d(n,"STATIC_FRAME_ENCRYPTMETHOD",(function(){return y})),r.d(n,"STATIC_META_NAMESPACE",(function(){return m})),r.d(n,"STATIC_MESSAGE_OPTYPE",(function(){return _})),r.d(n,"STATIC_MESSAGE_TYPE",(function(){return v})),r.d(n,"STATIC_MESSAGE_CONTENT_TYPE",(function(){return E})),r.d(n,"STATIC_MESSAGE_QOS",(function(){return N})),r.d(n,"STATIC_GROUPNOTICE_TYPE",(function(){return b})),r.d(n,"STATIC_INFO_NETWORK",(function(){return A})),r.d(n,"STATIC_USERNOTICE_TYPE",(function(){return w})),r.d(n,"STATIC_ROSTERNONTICE_TYPE",(function(){return O})),r.d(n,"STATIC_CONVERSATION_TYPE",(function(){return S})),r.d(n,"STATIC_CONVERSATION_OPTYPE",(function(){return I})),r.d(n,"STATIC_MESSAGE_STATUS",(function(){return k}));var o={};r.r(o),r.d(o,"getServers",(function(){return ye})),r.d(o,"tokenUser",(function(){return me})),r.d(o,"tokenId",(function(){return ve})),r.d(o,"userRegister",(function(){return _e})),r.d(o,"userBindMobile",(function(){return Ee})),r.d(o,"userSendSms",(function(){return be})),r.d(o,"userNameCheck",(function(){return Ae})),r.d(o,"userMobileBind",(function(){return Oe})),r.d(o,"userMobileBindSign",(function(){return we})),r.d(o,"userMobileLogin",(function(){return Se})),r.d(o,"userUpdateMobile",(function(){return Ne})),r.d(o,"captchaImagePost",(function(){return Ie})),r.d(o,"captchaSms",(function(){return ke})),r.d(o,"rosterAccept",(function(){return Re})),r.d(o,"rosterApply",(function(){return Te})),r.d(o,"rosterDecline",(function(){return De})),r.d(o,"rosterDelete",(function(){return Me})),r.d(o,"rosterExt",(function(){return Ce})),r.d(o,"rosterId",(function(){return Ue})),r.d(o,"rosterList",(function(){return xe})),r.d(o,"rosterListPost",(function(){return Ge})),r.d(o,"rosterName",(function(){return Le})),r.d(o,"rosterApplylist",(function(){return Pe})),r.d(o,"rosterBlockedlist",(function(){return je})),r.d(o,"rosterBlockedAdd",(function(){return Be})),r.d(o,"rosterBlockeRemove",(function(){return Fe})),r.d(o,"groupAdminAdd",(function(){return Ve})),r.d(o,"groupAdminList",(function(){return qe})),r.d(o,"groupAdminRemove",(function(){return Ke})),r.d(o,"groupAnnouncement",(function(){return Je})),r.d(o,"groupAnnouncementDelete",(function(){return Ye})),r.d(o,"groupAnnouncementEdit",(function(){return We})),r.d(o,"groupAnnouncementList",(function(){return He})),r.d(o,"groupCreate",(function(){return Ze})),r.d(o,"groupDestroy",(function(){return $e})),r.d(o,"groupInfo",(function(){return Xe})),r.d(o,"groupInfoAvatar",(function(){return ze})),r.d(o,"groupInfoDdscription",(function(){return Qe})),r.d(o,"groupInfoName",(function(){return et})),r.d(o,"groupMemberlist",(function(){return tt})),r.d(o,"groupMsgMutemode",(function(){return rt})),r.d(o,"groupMsgNotdisturb",(function(){return nt})),r.d(o,"groupPubliclist",(function(){return ot})),r.d(o,"groupBannedList",(function(){return it})),r.d(o,"groupBab",(function(){return st})),r.d(o,"groupUnban",(function(){return at})),r.d(o,"groupSettings",(function(){return ut})),r.d(o,"groupSettingsAllowmemberinvitation",(function(){return dt})),r.d(o,"groupSettingsAllowmembermodify",(function(){return ct})),r.d(o,"groupSettingsEnablereadack",(function(){return pt})),r.d(o,"groupSettingsHistoryvisible",(function(){return lt})),r.d(o,"groupSettingsRequireadminapproval",(function(){return ft})),r.d(o,"groupTransfer",(function(){return ht})),r.d(o,"groupUserjoined",(function(){return gt})),r.d(o,"groupApply",(function(){return yt})),r.d(o,"groupApplicationlist",(function(){return kt})),r.d(o,"groupInvitationlist",(function(){return Rt})),r.d(o,"groupApplyHandle",(function(){return mt})),r.d(o,"groupBockedlist",(function(){return vt})),r.d(o,"groupBlock",(function(){return _t})),r.d(o,"groupUnblock",(function(){return Et})),r.d(o,"groupKick",(function(){return Nt})),r.d(o,"groupInvite",(function(){return bt})),r.d(o,"groupInviteHandle",(function(){return At})),r.d(o,"groupInfoBatch",(function(){return Ot})),r.d(o,"groupMembersDidpayname",(function(){return wt})),r.d(o,"groupLeave",(function(){return St})),r.d(o,"groupDisplayname",(function(){return It})),r.d(o,"groupFilelist",(function(){return Tt})),r.d(o,"groupFiledelete",(function(){return Dt})),r.d(o,"groupFileupload",(function(){return Mt})),r.d(o,"userAuthmode",(function(){return Ct})),r.d(o,"userAvatar",(function(){return Ut})),r.d(o,"userMobile",(function(){return xt})),r.d(o,"userNickname",(function(){return Gt})),r.d(o,"userProfile",(function(){return Lt})),r.d(o,"userProfilePost",(function(){return Pt})),r.d(o,"userPush",(function(){return jt})),r.d(o,"userPushDetail",(function(){return Bt})),r.d(o,"userPushLimit",(function(){return Ft})),r.d(o,"userPushNickname",(function(){return Vt})),r.d(o,"userSettings",(function(){return qt})),r.d(o,"userSettingsPost",(function(){return Kt})),r.d(o,"userSounds",(function(){return Jt})),r.d(o,"userVibratory",(function(){return Yt})),r.d(o,"bindDeviceToken",(function(){return Wt})),r.d(o,"unbindDeviceToken",(function(){return Ht})),r.d(o,"fileForward",(function(){return Zt})),r.d(o,"asyncFileUpload",(function(){return $t})),r.d(o,"fileUploadAvatarUrl",(function(){return Xt})),r.d(o,"fileUploadGroupAvatarUrl",(function(){return zt})),r.d(o,"fileUploadChatFileUrl",(function(){return Qt})),r.d(o,"fileDownloadChatFileUrl",(function(){return er})),r.d(o,"qrcode",(function(){return tr})),r.d(o,"qrlogin",(function(){return rr})),r.d(o,"qrcodeGroupsign",(function(){return nr})),r.d(o,"qrcodeGroupinvite",(function(){return or})),r.d(o,"wxbind",(function(){return ir})),r.d(o,"wxlogin",(function(){return sr})),r.d(o,"getStaticContact",(function(){return ar})),r.d(o,"wechatUnbind",(function(){return ur})),r.d(o,"wechatIsbind",(function(){return dr})),r.d(o,"wechatBind",(function(){return cr}));var i={};r.r(i),r.d(i,"decode",(function(){return Jr})),r.d(i,"encode",(function(){return Yr}));var s={};r.r(s),r.d(s,"decode",(function(){return nn})),r.d(s,"encode",(function(){return on}));var a={};r.r(a),r.d(a,"decode",(function(){return cn})),r.d(a,"encode",(function(){return pn}));var u={error:console.error,log:console.log,info:console.info,warn:console.warn,dir:console.dir,req:e=>{}},d=r(3),c=r.n(d);const p={XSYNC_V1:0,XSYNC_V2:1},l={UNREAD:0,SYNC:1,NOTICE:2,PROVISION:3},f={NONE:0,ZLIB:1},h={UNKNOWN:0,OK:1,FAIL:2,UNKNOWN_COMMAND:3,PB_PARSER_ERROR:4,DECRYPT_FAILURE:5,PUBLIC_KEY_CHANGED:6,INVALID_TOKEN:7,INVALID_PARAMETER:8,UNAUTHORIZED:9,USER_FROZEN:10,USER_BANNED:11,WORD_CENSORED:12,TOO_MANY_DEVICES:13,ENCRYPT_METHOD_UNSUPPORTED:14,DEVICE_GUID_CONFLICT:15,CHECK_SUM_FAILURE:16,INVALID_LICENSE:17,LICENSE_LIMIT:18,APP_FROZEN:19},g={UNKNOWN:0,IOS:1,ANDR:2,WIN:3,OSX:4,LINUX:5,WEB:6},y={ENCRYPT_NONE:0,AES_CBC_128:1,AES_CBC_256:2,CUSTOM:3},m={UNKNOWN:0,MESSAGE:1,GROUP_NOTICE:2,ROSTER_NOTICE:3,USER_NOTICE:4,INFO:5,CONVERSATION:6},v={NORMAL:0,OPER:1,CHAT:2,GROUPCHAT:3},_={UNKNOWN:0,READ_ACK:1,READ_ALL:2,READ_CANCEL:3,DELIVER_ACK:4,RECALL:5,DELETE:6},E={TEXT:0,IMAGE:1,AUDIO:2,VIDEO:3,FILE:4,LOCATION:5,COMMAND:6,FORWARD:7},N={AT_LEAST_ONCE:0,AT_MOST_ONCE:1,EXACTLY_ONCE:2},b={UNKNOWN:0,PRESENCE:1,ABSENCE:2,CREATED:3,DESTROYED:4,JOINED:5,LEAVED:6,APPLYED:7,APPLY_ACCEPTED:8,APPLY_DECLINED:9,INVITED:10,INVITE_ACCEPTED:11,INVITE_DECLINED:12,KICKED:13,BLOCKED:14,UNBLOCKED:15,OWNER_ASSIGNED:16,ADMIN_GRANTED:17,ADMIN_REVOKED:18,MUTED:19,UNMUTED:20,BANNED:21,UNBANNED:22,INFO_UPDATED:23,ANNOUNCEMENT_UPDATED:24,MESSAGE_SETTING:25,FILE_UPLOADED:26,FILE_DELETED:27,FILE_UPDATED:28},A={WIRE:0,WIFI:1,NET_2G:2,NET_3G:3,NET_4G:4,NET_5G:5,UNKNOWN:6},O={UNKNOWN:0,ADDED:1,REMOVED:2,ACCEPTED:3,DECLINED:4,BLOCKED:5,UNBLOCKED:6,APPLIED:7,INFO_UPDATED:8,MUTED:9,UNMUTED:10},w={UNKNOWN:0,PASSWORD_CHANGED:1,FROZEN:2,REMOVED:3,KICK_BY_SAME_DEVICE:4,KICKED_BY_OTHER_DEVICE:5,INFO_UPDATED:6,DEVICE_LOGIN:7,DEVICE_LOGOUT:8,DEVICE_ADDED:9,DEVICE_REMOVED:10,CLUSTER_CHANGED:11},S={UNKNOWN:0,OPER:1},I={UNKNOWN:0,DELETE:1,DELETE_EVERYWHERE:2},k={UNREAD:0,DELIVERED:1,READ:2},R=e=>{if(e instanceof c.a)return e.toString();const{low:t,high:r,unsigned:n=!0}=e;if(void 0!==t&&void 0!==r)return new c.a(t,r,n).toString();var o=typeof e;if("boolean"==o||"string"==o||"number"==o)return e;if(Array.isArray(e)){const t=[];return e.forEach((e=>{void 0!==e&&t.push(R(e))})),t}const i={};return Object.keys(e).forEach((t=>{void 0!==e[t]&&(i[t]=R(e[t]))})),i},T=e=>{const{low:t,high:r,unsigned:n}=e;if(void 0!==t&&void 0!==r)return new c.a(t,r,n);var o=typeof e;if("boolean"==o||"string"==o||"number"==o)return e;if(Array.isArray(e)){const t=[];return e.forEach((e=>{t.push(T(e))})),t}const i={};return Object.keys(e).forEach((t=>{i[t]=T(e[t])})),i},D=(e=0)=>{if("string"==typeof e)return+e;if("number"==typeof e)return e;var{low:t,high:r,unsigned:e=!0}=e;return void 0!==t&&"undefined"!==r?new c.a(t,r,e).toNumber():void 0},M=e=>{if("string"==typeof e)return c.a.fromString(e);var{low:t,high:r,unsigned:n=!0}=e;return void 0!==t&&"undefined"!==r?new c.a(t,r,n):"number"==typeof e?c.a.fromNumber(e):new c.a},C=e=>void 0===e?"":"string"==typeof e?e:"number"==typeof e?e+"":(void 0!==e.low&&void 0!==e.high?new c.a(e.low,e.high,!0):new c.a(e)).toString(),U=e=>{if(!e.payload)return e;var{payload:t,from:r={},to:n={},id:o={},status:i,timestamp:s}=e,{content:a="",attachment:u="",ctype:d=0,ext:c,config:p,type:l}=t;let f=null,h=null;try{f=JSON.parse(u)}catch(e){}try{h=JSON.parse(p)}catch(e){}let g=i||t.status,y={id:C(o),from:C(r.uid),to:C(n.uid),content:a,type:Object.keys(E)[d].toLowerCase(),ext:c,status:g||k.UNREAD,timestamp:C(s||0),toType:2==l?"roster":"group"};return f&&(y.attach=f),h&&(y.config=h),y},x=()=>{var e=wx.getStorageSync("key_user_id");if(e)return+e},G=(e,t,r=!0,n=0)=>{if(void 0!==t&&void 0!==e){var o=e;if(r&&(o=x()+"_"+e),0<n&&(o=o+"_"+n%31),"string"!=typeof t){n=Array.isArray(t)?{data:t}:t;try{const e=JSON.stringify(n);e&&wx.setStorageSync(o,e)}catch(e){u.error("stringify error:",e,o,t)}}else wx.setStorageSync(o,t)}else u.error("localstorage save error:",e,t)},L=(e,t=!0,r=0)=>{if(void 0!==e){var n=e;if(t&&(n=x()+"_"+e),0<r&&(n=n+"_"+r%31),n=wx.getStorageSync(n)){let t=n;try{t=JSON.parse(n)}catch(e){}return t=T(t),t.data||t}}else u.error("localstorage get error:",e)},P=(e,t=!0,r=-1)=>{let n=e;t&&(n=x()+"_"+e),0<=r&&(n=n+"_"+r%31),wx.removeStorageSync(n)},j=(e,t=!0)=>{for(var r=0;r<31;r++)P(e,t,r)},B={saveJoinedGroups:e=>{if(e){const t=(e=Array.isArray(e)?e:[e]).map((e=>e.group_id||e)),r=L("key_group_lists")||[],n=Array.from(new Set(t.concat(r)));G("key_group_lists",n)}},removeGroup:e=>{const t=L("key_group_lists")||[],r=t.findIndex((t=>t===e));0<=r&&(t.splice(r,1),G("key_group_lists",t))},getJoinedGroups:()=>L("key_group_lists"),saveGroupInfo:e=>{Array.isArray(e)||(e=[e]);const t=L("key_group_infos")||{};e.forEach((e=>{const r={},{group_id:n}=e;Object.keys(e).forEach((t=>{void 0!==e[t]&&(r[t]=e[t])})),t[n]=t[n]||{},Object.assign(t[n],r)})),G("key_group_infos",t)},getGroupInfo:e=>{var t=L("key_group_infos")[e]||{};return Object.assign(t,{group_id:e})},getGroupInfoList:()=>{const e=B.getJoinedGroups()||[],t=B.getAllGroupInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{group_id:e}))})),r},getAllGroupInfos:()=>L("key_group_infos")||{},saveGroupMembers:(e,t,r)=>{Array.isArray(t)||(t=[t]);const n=L("key_group_members")||{},o=n[e]||[];if(r)return n[e]=t,void G("key_group_members",n);t.forEach((e=>{o.findIndex((t=>t===e))<0&&o.push(e)})),n[e]=o},removeGroupMembers:(e,t)=>{const r=(L("key_group_members")||{})[e]||[];t.forEach((e=>{var t=r.findIndex((t=>t===e));0<=t&&r.splice(t,1)})),G("key_group_members",r)},getGroupMembers:e=>(L("key_group_members")||{})[e]||[],clear:()=>{P("key_group_infos"),P("key_group_members"),P("key_group_lists")}};var F=B;const V=()=>{var e=L("key_user_id",!1);if(e)return+e},q=()=>{P("key_user_id")},K=()=>{P("key_user_token")},J=()=>{P("key_user_aes_key")},Y=()=>{P("key_user_device_sn")};var W={saveToken:e=>G("key_user_token",e),getToken:()=>L("key_user_token"),deleteToken:K,getAesKey:()=>L("key_user_aes_key"),saveAesKey:e=>G("key_user_aes_key",e),deleteAesKey:J,saveDeviceSN:e=>G("key_user_device_sn",e),getDeviceSN:()=>{let e=L("key_user_device_sn");return e=e||999999999+Math.floor(214e4*Math.random())+"",+e},deleteDeviceSN:Y,saveUid:e=>{if(!e)throw u.error("uid error:",e),new Error("uid is error ...");G("key_user_id",e+"",!1)},getUid:V,removeUid:q,getDeviceGuid:()=>{if(!V())return"";let e=L("key_user_device_guid");return e||(e=V()+"_"+Math.floor(2147483648*Math.random()),G("key_user_device_guid",e)),e},saveProfile:e=>G("key_user_profile",e),getProfile:()=>L("key_user_profile"),clear:()=>{Y(),J(),K(),q()},saveAppid:e=>{if(!e)throw u.error("Invalid appid :",e),new Error("Invalid appid ...");G("key_app_id",e+"",!1)},getAppid:()=>L("key_app_id",!1)};const H={},Z=e=>(void 0===H[e]&&(H[e]=[]),H[e]),$=(e,t)=>{var r=Z(e).findIndex((e=>e.toString()===t.toString()));-1<r&&Z(e).splice(r,1),Z(e).push(t)},X=(e,t)=>{var r=Z(e).findIndex((e=>e.toString()===t.toString()));0<=r&&H[e].splice(r,1)},z=(e,t)=>{Z(e).forEach((e=>{e(t)}))},Q={saveRecent:e=>{if(!(()=>{var{ext:t}=e;let r={};try{r=JSON.parse(t)}catch(t){}return void 0!==r.input_status&&(r.input_status,!0)})()){const{from:r,to:n,type:o,toType:i,attach:s,ext:a,timestamp:u}=e;let d=e.content;if(d||s){"text"!=o&&(d=o);let e=D(n);var t=W.getUid();e===t&&(e=D(r));const s=L("key_recent_store")||[],c=s.findIndex((t=>t.type===i&&t.id===e));-1<c&&s.splice(c,1),s.unshift({type:i,id:e,content:d,ext:a,timestamp:u}),G("key_recent_store",s),z("recentlistUpdate")}else a&&a.typing&&z("onInputStatusMessage",{from:r,to:n,ext:a})}},saveUnreadRecent:(e,t)=>{e.forEach((e=>{const r=t,n=L("key_recent_store")||[];let o="",i="";var s=n.findIndex((t=>t.type===r&&t.id===e));-1<s&&(o=n[s].content,i=n[s].timestamp,n.splice(s,1)),n.unshift({type:r,id:e,content:o,timestamp:i}),G("key_recent_store",n)})),z("recentlistUpdate")},getRecents:()=>{const e=L("key_recent_store")||[],t=e.filter((e=>"roster"==e.type)).map((e=>e.id));return z("imGetRecent",t),e},getRecentById:e=>{const t=L("key_recent_store")||[],r=t.findIndex((t=>t.id+""==e+""));if(r<0)return{idx:r};var n=t[r].type;return{idx:r,id:e,type:n}},deleteRecentById(e){var{idx:e}=Q.getRecentById(e);if(!(e<0)){const t=L("key_recent_store")||[];t.splice(e,1),G("key_recent_store",t)}},clear:()=>{P("key_recent_store")}};var ee=Q;const te=e=>{var{payload:t}=e;if(!t)return!1;var{type:e,operation:t={}}=t;if(!t||e!==v.OPER)return!1;var{type:t}=t;return t===_.READ_ACK||t==_.READ_ALL},re=(e,t)=>{const r=M(t.id);if(0===e.length)e.push(t);else{var n=e[0],o=e[e.length-1];if(-1===r.comp(M(n.id)))e.unshift(t);else if(1===r.comp(M(o.id)))e.push(t);else{let n=0,o=0;for(;n<e.length;){const t=e[n],i=r.comp(M(t.id));if(0===i&&(o=1),1!==i)break;n++}e.splice(n,o,t)}}return e},ne={saveSendingRosterMessage:e=>{const t=L("key_roster_sending_message")||[];var r;t.push(e),100<(r=t.length)&&t.splice(0,r-100),G("key_roster_sending_message",t);var{to:r,id:e}=e;z("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedRosterMessage:e=>{const{client_mid:t,server_mid:r}=e,n=L("key_roster_sending_message")||[];if(r){var o=n.findIndex((e=>D(e.id)===D(t)));if(-1<o){const e=n[o];e.id=r;const i=U(e);i.status=k.UNREAD,ne.saveRosterMessage(i),i.toType="roster",ee.saveRecent(i),n.splice(o,1),G("key_roster_sending_message",n),z("onRosterMessage",i),te(i)||z("onSendingMessageStatusChanged",{status:"sent",mid:D(t)})}}else{u.log("===================== there is something error:=============="),u.log(e);const r=n.findIndex((e=>D(e.id)===D(t)));-1<r&&(L("key_roster_sending_message")||[]).splice(r,1)}},saveRosterMessage:e=>{var{from:t,to:r,type:n}=e;if("command"!=n&&"forward"!=n){n=D(t),t=D(W.getUid()),r=D(r);const o=L("key_roster_message_store",!0,n=n===t?r:n)||{},i=o[n]||[];re(i,e),100<i.length?o[n]=i.slice(i.length-100):o[n]=i,G("key_roster_message_store",o,!0,n)}},getRosterMessage:e=>(L("key_roster_message_store",!0,e)||{})[e]||[],saveFormatedRosterMessage:(e,t=[])=>{const r=L("key_roster_message_store",!0,e)||{};r[e]=t,G("key_roster_message_store",r,!0,e)},getRosterUnreadMessageIdsByRosterid:e=>{const t=(L("key_roster_message_store",!0,e)||{})[e]||[],r=[];return t.forEach((e=>{var{status:t=k.READ,id:e}=e;t==k.UNREAD&&r.push(e)})),r},deleteRosterMessageByRosterId:e=>{const t=L("key_roster_message_store",!0,e)||{};t[e]&&delete t[e],G("key_roster_message_store",t,!0,e)},deleteSingleRosterMessage:(e,t)=>{const r=L("key_roster_message_store",!0,e)||{},n=C(t),o=r[e]||[],i=o.findIndex((e=>C(e.id)===n));-1<i&&(o.splice(i,1),r[e]=o,G("key_roster_message_store",r,!0,e))},saveSendingGroupMessage:e=>{const t=L("key_group_sending_message")||[];var r;t.push(e),100<(r=t.length)&&t.splice(0,r-100),G("key_group_sending_message",t);var{to:r,id:e}=e;z("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedGroupMessage:e=>{const{client_mid:t,server_mid:r}=e,n=L("key_group_sending_message")||[],o=n.findIndex((e=>D(e.id)===D(t)));if(-1<o){const e=n[o];e.id=r;const i=U(e);i.status=k.UNREAD,ne.saveGroupMessage(i),i.toType="group",ee.saveRecent(i),n.splice(o,1),G("key_group_sending_message",n),z("onGroupMessage",i),te(i)||z("onSendingMessageStatusChanged",{status:"sent",mid:D(t)})}},saveGroupMessage:e=>{var{to:t,type:r}=e;if("command"!=r&&"forward"!=r){const r=D(t),n=L("key_group_message_store",!0,r)||{},o=n[r]||[];re(o,e),100<o.length?n[r]=o.slice(o.length-100):n[r]=o,G("key_group_message_store",n,!0,r)}},getGroupMessage:e=>(L("key_group_message_store",!0,e)||{})[e]||[],saveFormatedGroupMessage:(e,t=[])=>{const r=L("key_group_message_store",!0,e)||{};r[e]=t,G("key_group_message_store",r,!0,e)},getGroupUnreadMessageIdsByGid:e=>{const t=(L("key_group_message_store",!0,e)||{})[e]||[],r=[];return t.forEach((e=>{var{r:t=!1,id:e}=e;t||r.push(e)})),r},deleteGroupMessageByGid:e=>{const t=L("key_group_message_store",!0,e)||{};t[e]&&delete t[e],G("key_group_message_store",t,!0,e)},deleteSingleGroupMessage:(e,t)=>{const r=L("key_group_message_store",!0,e)||{};t=C(t);const n=r[e]||[],o=n.findIndex((e=>C(e.id)===t));-1<o&&(n.splice(o,1),r[e]=n,G("key_group_message_store",r,!0,e))},getUnreadByRosterId:e=>{const t=ne.getRosterMessage(e)||[];let r=0;const n=W.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=D(t))&&t!==n&&e!=k.READ&&r++})),r},getUnreadByGroupId:e=>{const t=ne.getGroupMessage(e)||[];let r=0;const n=W.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=D(t))&&t!==n&&e!=k.READ&&r++})),r},getRosterMessageById:(e,t)=>{const r=L("key_roster_message_store",!0,e)||{};for(var n in r){const e=r[n];if(e&&e.length){const r=e.find((e=>e.id==t));if(r)return r}}},getGroupMessageById:(e,t)=>{const r=L("key_group_message_store",!0,e)||{};for(var n in r){const e=r[n];if(e&&e.length){const r=e.find((e=>e.id==t));if(r)return r}}},clear:(e,t)=>{"group"==t?ne.deleteGroupMessageByGid(e):ne.deleteRosterMessageByRosterId(e)},clearAll:()=>{j("key_roster_message_store"),j("key_group_message_store")}};var oe=ne,ie=e=>{const t=L("key_notice_store")||[];t.push(e),50<(e=t.length)&&t.splice(0,e-50),G("key_notice_store",t)},se=()=>L("key_notice_store")||[];const ae={saveRosterList:(e=[])=>{const t=(e=Array.isArray(e)?e:[e]).map((e=>e.roster_user_id||e.user_id||e)),r=ae.getRosterList()||[];var n=Array.isArray(r)?Array.from(new Set(r.concat(t))):t;G("key_roster_lists",n),ae.saveRosterInfo(e)},getRosterList:()=>L("key_roster_lists"),getRosterInfoList:()=>{const e=ae.getRosterList()||[],t=ae.getAllRosterInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{user_id:e}))})),r},removeRoster:e=>{const t=ae.getRosterList(),r=t.indexOf(e);0<=r&&t.splice(r,1),G("key_roster_lists",t)},removeRosterList:()=>P("key_roster_lists"),saveRosterInfo:(e=[])=>{Array.isArray(e)||(e=[e]);const t=ae.getAllRosterInfos()||{};e.forEach((e=>{const{user_id:r}=e,n={};Object.keys(e).forEach((t=>{var r=e[t];void 0!==r&&(n[t]=r)})),r&&(t[r]=t[r]||{},Object.assign(t[r],n))})),G("key_roster_infos",t)},getRosterInfo:e=>{var t=(L("key_roster_infos")||{})[e];return t&&Object.assign(t,{user_id:e})},getAllRosterInfos:()=>L("key_roster_infos"),clear:()=>{P("key_roster_infos"),P("key_roster_lists")}};var ue=ae,de=(i=r(14),r.n(i));let ce={errTimer:null,errCount:0},pe="";$("refresh_ratel",(e=>{e&&(pe=e)}));const le=["app_dns","app/captcha/image","app/captcha/sms","app/captcha/sms_web","app/user/info_pwd","app/wechat_login","mobile_bind_with_sign","qr_code","qr_login","token/id","token/user","user/register"],fe=(e,t="get",r={},n=[],o=!1,i={})=>{u.log("========request=============",e,t,r,n,o);const s=((e={},t=[])=>{let r=[];return t.forEach((t=>{if("string"==typeof t&&void 0===e[t]&&r.push(t+" can not be null.."),Array.isArray(t)){let n=!1;t.forEach((t=>{void 0!==e[t]&&(n=!0)})),n||r.push(t.join("、")+" can not be all null")}})),r})(r,n);if(s.length){const e=s.join(",");return Promise.reject(new Error(e))}let a={};"get"===(n=t.toLowerCase())||"post"===n&&o?(0<e.indexOf("?")?e+="&":e+="?",e+=de.a.stringify(r)):((c=r).group_id&&(c.group_id=+c.group_id),c.user_id&&(c.user_id=+c.user_id),c.new_owner&&(c.new_owner=+c.new_owner),c.apply_approval&&(c.apply_approval=+c.apply_approval),c.duration&&(c.duration=+c.duration),c.limit&&(c.limit=+c.limit),c.version&&(c.version=+c.version),c.announcement_id&&(c.announcement_id=+c.announcement_id),c.user_list&&Array.isArray(c.user_list)&&(c.user_list=c.user_list.map((e=>+e))),c.user_list&&Array.isArray(c.user_list)&&(c.user_list=c.user_list.map((e=>+e))),c.file_list&&Array.isArray(c.file_list)&&(c.file_list=c.file_list.map((e=>+e))),a=c);let d=i.headers||(e=>{var t=W.getToken(),r=W.getAppid();if((e=>{let t=!0;return le.forEach((r=>{-1<e.indexOf(r)&&(t=!1)})),t})(e)&&!t)throw z("flooNotice",{category:"action",desc:"relogin"}),new Error("you should login ...");return{"access-token":t,app_id:r}})(e);if(e.indexOf("http")<0&&(e=pe+e),i.operation&&"upload_file"===i.operation)return new Promise(((t,n)=>{var o={url:e,header:d,filePath:r.filePath,formData:r.formData,name:r.name,success:function(e){he(),200===e.statusCode?t(e.tempFilePath):(console.error("Upload file error: ",e),n(e))},fail:function(e){ge(),n(e)}};wx.uploadFile(o)}));if(i.operation&&"download_file"===i.operation)return new Promise(((t,r)=>{var n={url:e,header:d,success:function(e){he(),200===e.statusCode?t(e.tempFilePath):(console.error("Download file error: ",e),r(e))},fail:function(e){ge(),r(e)}};wx.downloadFile(n)}));var c=i.content_type||"application/json";return d=Object.assign(d,{"Content-Type":c}),new Promise(((r,n)=>{var o={url:e,data:a,header:d,method:t,dataType:"json",success:function(t){he();var{data:o={}}=t;if(i.headers&&0!==Object.keys(i.headers).length)return"boolean"==typeof o.data&&o.data||"string"==typeof o.Status&&"OK"===o.Status?void 0:Promise.reject({config:i,url:e});var{data:s,code:a,message:t}=o;200===a?(u.log("======request success, ",e,s),r(s)):(402===a&&z("flooNotice",{category:"action",desc:"relogin"}),u.req(e+""==""+t),n({message:t,url:e,data:o}))},fail:function(e){ge(),n(e)},complete:function(){}};wx.request(o)}))};function he(){ce.errTimer&&clearTimeout(ce.errTimer),ce.errTimer=null,ce.errCount=0}function ge(){ce.errTimer&&clearTimeout(ce.errTimer),ce.errTimer=null,ce.errCount=ce.errCount+1,5<=ce.errCount?(ce.errCount=0,z("ratelError")):ce.errTimer=setTimeout((()=>{ce.errCount=0}),18e5)}const ye=(e,t)=>fe(e,"get",t,["app_id"],!0),me=e=>fe("/token/user","post",e,[["mobile","name"],"password"]),ve=e=>fe("/token/id","post",e,["user_id","password"]),_e=e=>fe("/user/register/v2","post",e,["username","password"]),Ee=e=>fe("/app/user/mobile_bind","post",e,["captcha","mobile"]),Ne=e=>fe("/app/user/mobile_update","post",e,["mobile"]),be=e=>fe("/app/captcha/sms","get",e,["mobile"],!0),Ae=e=>fe("/app/user/name_check","get",e,["username"],!0),Oe=e=>fe("/app/user/mobile_bind","post",e,["captcha","mobile"]),we=e=>fe("/app/user/mobile_bind_with_sign","post",e,["sign","mobile"]),Se=e=>fe("/app/user/info_pwd","get",e,["captcha","mobile"],!0),Ie=e=>fe("/app/captcha/image","post",e,[]),ke=e=>fe("/app/captcha/sms_web","get",e,["captcha","image_id","mobile"],!0),Re=e=>fe("/roster/accept","post",e,["user_id"],!0),Te=e=>fe("/roster/apply","post",e,["user_id","alias"]),De=e=>fe("/roster/decline","post",e,["user_id"]),Me=e=>fe("/roster/delete","post",e,["user_id"],!0),Ce=e=>fe("/roster/ext","post",e,["user_id","ext"]),Ue=e=>fe("/roster/id","get",e,["user_id"]),xe=e=>fe("/roster/list","get",e,[]),Ge=e=>fe("/roster/list","post",e,["list"]),Le=e=>fe("/roster/name","get",e,["username"]),Pe=e=>fe("/roster/apply/list","get",e,["cursor"],!0),je=e=>fe("/roster/blocked_list","get",e,[""],!0),Be=e=>fe("/roster/block","post",e,["user_id"],!0),Fe=e=>fe("/roster/unblock","post",e,["user_id"],!0),Ve=e=>fe("/group/admin/add","post",e,["group_id","user_list"]),qe=e=>fe("/group/admin_list","get",e,["group_id"],!0),Ke=e=>fe("/group/admin/remove","post",e,["group_id","user_list"]),Je=e=>fe("/group/announcement","get",e,["announcement_id","group_id"]),Ye=e=>fe("/group/announcement/delete","post",e,["announcement_id","group_id"],!0),We=e=>fe("/group/announcement/edit","post",e,["group_id","content","title"]),He=e=>fe("/group/announcement/list","get",e,["group_id"],!0),Ze=e=>fe("/group/create","post",e,["name"]),$e=e=>fe("/group/destroy","post",e,["group_id"],!0),Xe=e=>fe("/group/info","get",e,["group_id"]),ze=e=>fe("/group/info/avatar","post",e,["group_id","value"]),Qe=e=>fe("/group/info/description","post",e,["group_id","value"]),et=e=>fe("/group/info/name","post",e,["group_id","value"]),tt=e=>fe("/group/member_list","get",e,["group_id"]),rt=e=>fe("/group/msg/mute_mode","post",e,["group_id","msg_mute_mode"]),nt=e=>fe("/group/msg/not_disturb","post",e,["group_id","value"]),ot=()=>fe("/group/public_list","get",{},[]),it=e=>fe("/group/banned_list","get",e,["group_id"]),st=e=>fe("/group/ban","post",e,["group_id","duration","user_list"]),at=e=>fe("/group/unban","post",e,["group_id","user_list"]),ut=e=>fe("/group/settings","get",e,["group_id"]),dt=e=>fe("/group/settings/allow_member_invitation","post",e,["group_id","value"]),ct=e=>fe("/group/settings/allow_member_modify","post",e,["group_id","value"]),pt=e=>fe("/group/settings/enable_read_ack","post",e,["group_id","value"]),lt=e=>fe("/group/settings/history_visible","post",e,["group_id","value"]),ft=e=>fe("/group/settings/require_admin_approval","post",e,["group_id","apply_approval"]),ht=e=>fe("/group/transfer","post",e,["group_id","new_owner"]),gt=e=>fe("/group/user_joined","get",e),yt=e=>fe("/group/apply","post",e,["group_id"]),mt=e=>fe("/group/apply/handle","post",e,["approval","group_id","user_id"]),vt=e=>fe("/group/blocked_list","get",e,["group_id"]),_t=e=>fe("/group/block","post",e,["user_list","group_id"]),Et=e=>fe("/group/unblock","post",e,["user_list","group_id"]),Nt=e=>fe("/group/kick","post",e,["user_list","group_id"]),bt=e=>fe("/group/invite","post",e,["user_list","group_id"]),At=e=>fe("/group/invite/handle","post",e,["approval","user_id","group_id"]),Ot=e=>fe("/group/info/batch","post",e,["group_list"]),wt=e=>fe("/group/members/display_name","post",e,["group_id","user_list"]),St=e=>fe("/group/leave","post",e,["group_id"],!0),It=e=>fe("/group/display_name","post",e,["group_id","value"]),kt=e=>fe("/group/application_list","post",e,["group_list"]),Rt=()=>fe("/group/invitation_list","get",{},[]),Tt=e=>fe("/group/file/list","get",e,["group_id"],!0),Dt=e=>fe("/group/file/delete","post",e,["file_list","group_id"]),Mt=e=>fe("/group/file/upload","post",e,["name","size","url","group_id"]),Ct=e=>fe("/user/authmode","post",e,["value"],!0),Ut=e=>fe("/user/avatar","post",e,["avatar"]),xt=e=>fe("/user/mobile","post",e,["mobile"],!0),Gt=e=>fe("/user/nickname","post",e,["nick_name"],!0),Lt=()=>fe("/user/profile","get",{},[]),Pt=e=>fe("/user/profile","post",e,[]),jt=e=>fe("/user/push","post",e,["value"]),Bt=e=>fe("/user/push/detail","post",e,["value"]),Ft=e=>fe("/user/push/limit","post",e,["no_push_end_hour","no_push_start_hour"]),Vt=e=>fe("/user/push/nickname","post",e,["value"]),qt=()=>fe("/user/settings","get",{},[]),Kt=e=>fe("/user/settings","post",e,["user_id"]),Jt=e=>fe("/user/sounds","post",e,["value"]),Yt=e=>fe("/user/vibratory","post",e,["value"]),Wt=e=>fe("/user/token/bind","post",e,["device_sn","device_token","notifier_name"]),Ht=e=>fe("/user/token/unbind","post",e,[],!0),Zt=e=>fe("/file/upload/forward","get",e,["file_sign","access-token","to_id","to_type"],!0),$t=(e,t,r)=>fe(e,"post",t,[],!1,r),Xt=e=>fe("/file/upload/avatar/user","get",e,[],!0),zt=e=>fe("/file/upload/avatar/group","get",e,["group_id"],!0),Qt=e=>fe("/file/upload/chat","get",e,["file_type","to_id","to_type"],!0),er=(e,t,r)=>fe(e,"get",t,[],!0,r),tr=e=>fe("/app/qr_code","get",e,[]),rr=e=>fe("/app/qr_login","get",e,["qr_code"]),nr=e=>fe("/app/qrcode/group_sign","get",e,["group_id"],!0),or=e=>fe("/app/qrcode/group_invite","get",e,["qr_info"],!0),ir=e=>fe("/user/bind_openid","get",e,["open_id"],!0),sr=e=>fe("/app/wechat_login","get",e,["code"],!0),ar=e=>fe("/app/support_staff","get",e,[],!0),ur=()=>fe("/app/wechat/unbind","post"),dr=()=>fe("/app/wechat/is_bind","get"),cr=e=>fe("/app/wechat/bind","post",e,["open_id","type"]),pr=function(e={}){this.uid=e.uid||0,e=void 0===e.deviceSN?W.getDeviceSN():e.deviceSN,this.deviceSN=e};pr.prototype.setUid=function(e){this.uid=e},pr.prototype.setDeviceSN=function(e){this.deviceSN=e};var lr=pr;function fr(e){var{operation:t={type:_.UNKNOWN,mid:0}}=e;void 0!==(e=Object.assign({},{type:v.NORMAL,ctype:E.TEXT,content:"",operation:t},e)).type&&(this.type=e.type),void 0!==e.from&&(this.from=e.from),void 0!==e.to&&(this.to=e.to),void 0!==e.content&&(this.content=e.content),void 0!==e.ctype&&(this.ctype=e.ctype),void 0!==e.operation&&(this.operation=e.operation),void 0!==e.config&&(this.config=e.config),void 0!==e.attachment&&(this.attachment=e.attachment),void 0!==e.ext&&(this.ext=e.ext),void 0!==e.qos&&(this.qos=e.qos),void 0!==e.sender_name&&(this.sender_name=e.sender_name),void 0!==e.is_system&&(this.is_system=e.is_system),void 0!==e.priority&&(this.priority=e.priority)}fr.prototype={setType:function(e){this.type=e},setFrom:function(e){this.from=e},setTo:function(e){this.to=e},setContent:function(e){this.content=e},setCtype:function(e){this.ctype=e},setOperation:function(e){this.operation=e},setConfig:function(e){this.config=e},setAttachment:function(e){this.attachment=e},setExt:function(e){this.ext=e},setQos:function(e){this.qos=e},setSendername:function(e){this.sender_name=e},setIssystem:function(e){this.is_system=e},setPriority:function(e){this.priority=e}};var hr=fr;function gr(e){void 0!==(e=Object.assign({},{vsn:p.XSYNC_V1,compress_method:f.NONE},e)).vsn&&(this.vsn=e.vsn),void 0!==e.compress_method&&(this.compress_method=e.compress_method),void 0!==e.command&&(this.command=e.command),void 0!==e.payload&&(this.payload=e.payload),void 0!==e.encrypt_method&&(this.encrypt_method=e.encrypt_method),void 0!==e.encrypt_key&&(this.encrypt_key=e.encrypt_key),void 0!==e.check_sum&&(this.check_sum=e.check_sum),void 0!==e.tag&&(this.tag=e.tag)}gr.prototype={setVsn:function(e){this.vsn=e},setCompressmethod:function(e){this.compress_method=e},setCommond:function(e){this.command=e},setPayload:function(e){this.payload=e},setEncryptmethod:function(e){this.encrypt_method=e},setEncryptkey:function(e){this.encrypt_key=e},setChecksum:function(e){this.check_sum=e},setTag:function(e){this.tag=e}};var yr=gr;function mr(e){void 0!==(e=Object.assign({},{encrypt_method:y.ENCRYPT_NONE,os_type:g.WEB},e)).status&&(this.status=e.status),void 0!==e.xid&&(this.xid=e.xid),void 0!==e.encrypt_method&&(this.encrypt_method=e.encrypt_method),void 0!==e.encrypt_key&&(this.encrypt_key=e.encrypt_key),void 0!==e.password&&(this.password=e.password),void 0!==e.token&&(this.token=e.token),void 0!==e.os_type&&(this.os_type=e.os_type),void 0!==e.sdk_vsn&&(this.sdk_vsn=e.sdk_vsn),void 0!==e.is_manual_login&&(this.is_manual_login=e.is_manual_login),void 0!==e.device_guid&&(this.device_guid=e.device_guid),void 0!==e.device_notifier&&(this.device_notifier=e.device_notifier),void 0!==e.device_token&&(this.device_token=e.device_token),void 0!==e.device_info&&(this.device_info=e.device_info),void 0!==e.last_login_time&&(this.last_login_time=e.last_login_time)}mr.prototype={setStatus:function(e){this.status=e},setXid:function(e){this.xid=e},setEncryptmethod:function(e){this.encrypt_method=e},setEncryptkey:function(e){this.encrypt_key=e},setPassword:function(e){this.password=e},setToken:function(e){this.token=e},setOstype:function(e){this.os_type=e},setSdkvsn:function(e){this.sdk_vsn=e},setIsmanuallogin:function(e){this.is_manual_login=e},setDeviceguid:function(e){this.device_guid=e},setDevicenotifier:function(e){this.device_notifier=e},setDevicetoken:function(e){this.device_token=e},setDeviceinfo:function(e){this.device_info=e},setLastlogintime:function(e){this.last_login_time=e}};var vr=mr;function _r(e){void 0!==(e=Object.assign({},e)).xid&&(this.xid=e.xid),void 0!==e.key&&(this.key=e.key),void 0!==e.meta&&(this.meta=e.meta),void 0!==e.is_full_sync&&(this.is_full_sync=e.is_full_sync),void 0!==e.full_sync_num&&(this.full_sync_num=e.full_sync_num)}_r.prototype={setXid:function(e){this.xid=e},setKey:function(e){this.key=e},setMeta:function(e){this.meta=e},setIsfullsync:function(e){this.is_full_sync=e},setFullsyncnum:function(e){this.full_sync_num=e}};var Er=_r;function Nr(e){void 0!==(e=Object.assign({},e)).id&&(this.id=e.id),void 0!==e.from&&(this.from=e.from),void 0!==e.to&&(this.to=e.to),void 0!==e.timestamp&&(this.timestamp=e.timestamp),void 0!==e.ns&&(this.ns=e.ns),void 0!==e.payload&&(this.payload=e.payload)}Nr.prototype={setId:function(e){this.id=e},setFrom:function(e){this.from=e},setTo:function(e){this.to=e},setTimestamp:function(e){this.timestamp=e},setNs:function(e){this.ns=e},setPayload:function(e){this.payload=e}};var br=Nr;function Ar(e){void 0!==e.type&&(this.type=e.type),void 0!==e.operation&&(this.operation=e.operation)}Ar.prototype={setType:function(e){this.type=e},setOperation:function(e){this.operation=e}};var Or=Ar;let wr=W.getDeviceSN(),Sr=W.getDeviceGuid();$("userKicked",(()=>{u.log("user is kicked ... will new devicesn and guid, old Guid",Sr),wr=0,Sr=999999999+Math.floor(214e4*Math.random())+"",u.log("new Guid",Sr)})),$("temporary_deviceSN",(e=>{wr=e}));const Ir=e=>{const t=new yr;t.setCommond(l.SYNC);const r=new Er;return e.xid&&r.setXid(e.xid),e.next_key&&r.setKey(e.next_key),t.setPayload(r),t},kr=e=>{const{gid:t,content:r,type:n="text",attachment:o,ext:i,priority:s}=e;e=Object.keys(E).indexOf(n.toUpperCase());const a=new lr({uid:+W.getUid(),deviceSN:wr}),u=new lr({uid:t,deviceSN:0}),d=new yr;d.setCommond(l.SYNC);const c=new Er,p=new hr({from:a,to:u,content:r,ctype:e,type:v.GROUPCHAT,ext:i});return 0<s&&(p.priority=s),0<e&&o&&(p.attachment=JSON.stringify(o)),e=new br({id:(new Date).getTime(),from:a,to:u,payload:p,ns:m.MESSAGE,timestamp:(new Date).getTime()}),c.setMeta(e),d.setPayload(c),d},Rr=e=>{const{uid:t,content:r,type:n="text",ext:o,attachment:i}=e;z("imSendRosterMessage",e),e=Object.keys(E).indexOf(n.toUpperCase());const s=new lr({uid:+W.getUid(),deviceSN:wr}),a=new lr({uid:+t,deviceSN:0}),u=new yr;u.setCommond(l.SYNC);const d=new Er,c=new hr({from:s,to:a,content:r,ctype:e,type:v.CHAT,ext:o});return 0<e&&i&&(c.attachment=JSON.stringify(i)),e=new br({id:(new Date).getTime(),from:s,to:a,payload:c,ns:m.MESSAGE,timestamp:(new Date).getTime()}),d.setMeta(e),u.setPayload(d),u},Tr=(e,t)=>{t=M(t);const r=new yr;r.setCommond(l.SYNC);const n=new lr({uid:W.getUid(),deviceSN:wr}),o=new lr({uid:D(e),deviceSN:0}),i=new Er,s=new hr({from:n,to:o,ctype:E.COMMAND,type:v.OPER,operation:{type:_.READ_ACK,mid:t}}),a=new br({id:(new Date).getTime()+Math.floor(256*Math.random()),from:n,to:o,payload:s,ns:m.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Dr=(e,t)=>{t=M(t);const r=new yr;r.setCommond(l.SYNC);const n=new lr({uid:W.getUid(),deviceSN:wr}),o=new lr({uid:D(e),deviceSN:0}),i=new Er,s=new hr({ctype:E.COMMAND,type:v.OPER,operation:{type:_.RECALL,mid:t,xid:o}}),a=new br({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:o,payload:s,ns:m.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Mr=(e,t)=>{const r=new yr;r.setCommond(l.SYNC);const n=new lr({uid:W.getUid(),deviceSN:wr}),o=new lr({uid:D(e),deviceSN:0}),i=new Er,s=new hr({from:n,to:n,ctype:E.COMMAND,type:v.OPER,operation:{type:_.READ_ALL,xid:o,mid:t}}),a=new br({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:m.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Cr=(e,t,r)=>{var{content:n,attach:o,type:r}=r;return e?Rr({uid:e,content:n,type:r,attachment:o}):kr({gid:t,content:n,type:r,attachment:o})},Ur={};let xr=!1;const Gr=e=>{var{status:t={}}=e,{code:r,reason:n}=t;if(r===h.OK)return!0;if(void 0===t.code)return!0;r!==h.INVALID_TOKEN&&r!==h.UNAUTHORIZED||z("flooNotice",{category:"action",desc:"relogin"}),r!==h.USER_FROZEN&&r!==h.INVALID_LICENSE&&r!==h.LICENSE_LIMIT&&r!==h.APP_FROZEN||z("flooNotice",{category:"action",desc:"relogin_manually"}),r===h.USER_BANNED?z("flooError",{category:"USER_BANNED",desc:"用户被禁言"}):r===h.USER_FROZEN?z("flooError",{category:"USER_FROZEN",desc:"用户被冻结，请联系App管理员。"}):r===h.APP_FROZEN?z("flooError",{category:"APP_FROZEN",desc:"APP 被冻结，请登陆美信拓扑控制台查看详情。"}):r===h.INVALID_LICENSE?z("flooError",{category:"LICENSE",desc:"无效 LICENSE，请确认服务已按时付费。"}):r===h.LICENSE_LIMIT?z("flooError",{category:"LICENSE",desc:"超出 LICENSE 用户数限制，请购买更高规格服务。"}):z("flooError",{category:r,desc:n});var{client_mid:e}=e;return e&&z("onSendingMessageStatusChanged",{status:"failed",mid:D(e)}),u.error("ret error ......code:",r,"...reason:",n),!1},Lr=e=>{const{xid:t}=e,{uid:r=0}=t;Ur[r+""]?setTimeout((()=>{Ur[r]=!1,Lr(e)}),3e3):(Ur[r+""]=!0,z("sendMessage",(e=>{e.uid=e.uid||0;const t=new yr;t.setCommond(l.SYNC);const r=new Er;return r.setXid(e),t.setPayload(r),t})(t)))},Pr=(e=[])=>{e.forEach((e=>{var{ns:t}=e;t===m.UNKNOWN&&u.log("received unknown message ...",e),t===m.MESSAGE&&Br(e),t===m.GROUP_NOTICE&&Fr(e),t===m.ROSTER_NOTICE&&Vr(e),t===m.USER_NOTICE&&qr(e),t===m.CONVERSATION&&jr(e)}))},jr=e=>{var{payload:t={}}=e,{type:r,operation:t}=t;if(r===S.OPER)if(t.op_type==I.DELETE||t.op_type==I.DELETE_EVERYWHERE){const{xid:e}=t;z("deleteConveration",{id:e.uid,source:"other_operation"})}else u.log("received unknown conversation operation: ",t);else u.log("received unknown conversation: ",e)},Br=e=>{var{payload:t={}}=e,{type:r,operation:t}=t;r===v.NORMAL&&z("messageNormal",e),r===v.CHAT&&z("imRosterMessage",e),r===v.GROUPCHAT&&z("imGroupMessage",e),r===v.OPER&&(t.type===_.UNKNOWN&&u.log("received unknown operation: ",e),e.isReceived=!0,z("onActionMessage",e))},Fr=e=>{var{payload:t={}}=e,{type:t}=t;t===b.UNKNOWN&&u.log("received unknown groupnotice: ",e),t===b.PRESENCE&&z("imGroupPresence",e),t===b.ABSENCE&&z("imGroupAbesence",e),t===b.CREATED&&z("imGroupCreated",e),t===b.DESTROYED&&z("imGroupDestoryed",e),t===b.JOINED&&z("imGroupJoined",e),t===b.APPLYED&&z("imGroupApplyed",e),t===b.APPLY_ACCEPTED&&z("imGroupApplyAccepted",e),t===b.APPLY_DECLINED&&z("imGroupApplyDeclined",e),t===b.INVITED&&z("imGroupInvited",e),t===b.INVITE_ACCEPTED&&z("imGroupInvitedAccepted",e),t===b.INVITE_DECLINED&&z("imGroupInvitedDeclined",e),t===b.KICKED&&z("imGroupKicked",e),t===b.BANNED&&z("imGroupBaned",e),t===b.UNBANNED&&z("imGroupUnbaned",e),t===b.OWNER_ASSIGNED&&z("imGroupOwnerAssigned",e),t===b.ADMIN_GRANTED&&z("imGroupAdminGranted",e),t===b.ADMIN_REVOKED&&z("imGroupAdminRevoked",e),t===b.BLOCKED&&z("imGroupBlocked",e),t===b.UNBLOCKED&&z("imGroupUnblocked",e),t===b.MUTED&&z("imGroupMuted",e),t===b.UNMUTED&&z("imGroupUnmuted",e),t===b.INFO_UPDATED&&z("imGroupInfoUpdated",e),t===b.ANNOUNCEMENT_UPDATED&&z("imGroupAnnouncementUpdated",e)},Vr=e=>{var{payload:t={}}=e,{type:t}=t;t===O.UNKNOWN&&u.log("received unknown rosterNotice: ",e),t===O.ADDED&&z("imRosterAdded",e),t===O.REMOVED&&z("imRosterRemoved",e),t===O.ACCEPTED&&z("imRosterAccepted",e),t===O.DECLINED&&z("imRosterDeclined",e),t===O.BANNED&&z("imRosterBaned",e),t===O.UNBANNED&&z("imRosterUnbaned",e),t===O.INFO_UPDATED&&z("imRosterInfoUpdated",e)},qr=e=>{var{payload:t={}}=e,{type:t}=t;t!==w.UNKNOWN&&t!==w.PASSWORD_CHANGED&&t!==w.FROZEN&&t!==w.REMOVED&&t!==w.KICKED_BY_OTHER_DEVICE&&t!==w.DEVICE_REMOVED&&t!==w.CLUSTER_CHANGED||(W.deleteToken(),W.deleteDeviceSN(),z("flooNotice",{category:"action",desc:"relogin_manually"})),t===w.UNKNOWN&&u.log("received unknown userNotice: ",e),t===w.KICK_BY_SAME_DEVICE&&(xr=!0,z("userKicked")),z("flooNotice",{category:"userNotice",desc:Object.keys(w)[t]})};s=r(0),d=r.n(s),i=r(2),s=r.n(i);const Kr=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.Provision"),Jr=e=>Kr.decode(e),Yr=e=>Kr.encode(e).finish(),Wr=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.XID"),Hr=e=>Wr.encode(e).finish();i=r(32),i=r.n(i);const Zr=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.MessageBody");i=r(33),i=r.n(i);const $r=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.GroupNotice");i=r(34),i=r.n(i);const Xr=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.RosterNotice");i=r(35),i=r.n(i);const zr=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.UserNotice");i=r(36),i=r.n(i);const Qr=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Info");i=r(37),i=r.n(i);const en=d.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Conversation"),tn=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.Meta"),rn=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.SyncUL"),nn=e=>rn.decode(e),on=e=>(e.meta&&(e.meta=(e=>{var t,r,{ns:n,payload:o}=e;return n===m.MESSAGE&&(e.payload=(r=o,Zr.encode(r).finish())),n===m.GROUP_NOTICE&&(e.payload=(e=>{e.from=Hr(e.from);const t=[];return(e.to||[]).forEach((e=>{t.push(Hr(e))})),e.to=t,$r.encode(e).finish()})(o)),n===m.ROSTER_NOTICE&&(e.payload=(r=o,Xr.encode(r).finish())),n===m.USER_NOTICE&&(e.payload=(t=o,zr.encode(t).finish())),n===m.INFO&&(e.payload=(t=o,Qr.encode(t).finish())),n===m.CONVERSATION&&(e.payload=(o=o,en.encode(o).finish())),tn.create(e)})(e.meta)),rn.encode(e).finish()),sn=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.UnreadDL"),an=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.SyncDL"),un=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.Notice"),dn=d.a.Root.fromJSON(s.a).lookupType("im.floo.protobuf.Frame"),cn=e=>{e=new Uint8Array(e);const t=dn.decode(e),{command:r,payload:n}=t;return r===l.UNREAD?t.payload=(e=n,sn.decode(e)):r===l.SYNC?t.payload=(e=>{const t=an.decode(e),{metas:r=[]}=t,n=[];return r.forEach((e=>{var t,r,o,{ns:i,payload:s}=e;i===m.MESSAGE&&(e.payload=(o=s,Zr.decode(o))),i===m.GROUP_NOTICE&&(e.payload=(r=s,$r.decode(r))),i===m.ROSTER_NOTICE&&(e.payload=(r=s,Xr.decode(r))),i===m.USER_NOTICE&&(e.payload=(t=s,zr.decode(t))),i===m.INFO&&(e.payload=(t=s,Qr.decode(t))),i===m.CONVERSATION&&(e.payload=(s=s,en.decode(s))),n.push(e)})),t.metas=n,t})(n):r===l.NOTICE?t.payload={xid:(e=>Wr.decode(e))(n)}:r===l.PROVISION&&(t.payload=Jr(n)),t},pn=e=>{var t,{payload:r,command:n}=e;return r&&(n===l.UNREAD?e.payload=(t=r,sn.encode(t).finish()):n===l.SYNC?e.payload=on(r):n===l.NOTICE?e.payload=(t=r,un.encode(t).finish()):n===l.PROVISION&&(e.payload=Yr(r))),dn.encode(e).finish()};d.a.util.Long=c.a,d.a.configure();const{encode:ln,decode:fn}=a;let hn={},gn=0,yn=null,mn="normal",vn=null;$("refresh_fireplace",(e=>{hn=Object.assign({fireplace:e},hn)})),$("loginSuccess",(()=>{gn=0,yn&&clearInterval(yn),yn=setInterval((()=>{On({vsn:0,compress_method:0,command:0})}),5e4)})),$("sendMessage",(e=>{On(e)})),$("userKicked",(()=>{mn="kick"})),$("reconnect",(({reason:e})=>{u.warn("socket reconnect due to ",e," user status: ",mn),"normal"===mn&&En()}));const _n=()=>{const{fireplace:e}=hn;u.log("................................. will connect : ",e),z("flooNotice",{category:"loginMessage",desc:"socket connecting..."}),vn=wx.connectSocket({url:e,tcpNoDelay:!0,timeout:1e4+2e4*gn,success:()=>{u.info("================= Success connect to",e),z("flooNotice",{category:"loginMessage",desc:"socket connect success..."})},fail:t=>{u.error("================= Failed to connect ",e," error: ",t),z("reconnect",{reason:"ConnectFail"})}}),vn.onOpen((function(){u.log("=================  socket connected "),bn()})),vn.onMessage((e=>{An(e.data)})),vn.onError((e=>{u.error("=================  socket error: ",e),vn.close()})),vn.onClose((e=>{u.error("=================  socket disconnected due to ",e),z("reconnect",{reason:"closed_by_peer"})}))},En=()=>{5<=gn?(gn=0,z("fireplaceError")):gn++,Nn()},Nn=()=>{var e=Math.floor(9e3*Math.random())+1e3;u.error("================= socket will reconnect in ",e," ms (",gn,")"),setTimeout((()=>{_n()}),e)},bn=()=>{u.log("=============== sending proversion =========="),z("flooNotice",{category:"loginMessage",desc:"logining socket service..."}),z("sendMessage",(e=>{const t=new lr({uid:+e.uid,deviceSN:wr}),r=new vr;Sr=Sr||W.getDeviceGuid(),r.setXid(t),r.setToken(e.token),r.setDeviceguid(Sr),r.setSdkvsn("2.0.0"),r.setEncryptmethod(y.AES_CBC_128),r.setEncryptkey(W.getAesKey()),r.setDeviceinfo("Uniapp");const n=new yr;return n.setCommond(l.PROVISION),n.setPayload(r),n})({token:W.getToken(),uid:W.getUid()}))},An=e=>{e=fn(e=e),u.info("RECV :"+JSON.stringify(R(e))),(e=>{var{command:t=0,payload:e}=e;t===l.UNREAD&&(e=>{const{unread:t=[]}=e;z("imReceivedUnread",t),t.forEach((e=>{var{xid:t,n:e}=e;0<e&&z("sendMessage",Ir({xid:t,next_key:0}))}))})(e),t===l.SYNC&&(e=>{if(Gr(e)){var{metas:t=[],xid:r,is_full_sync:n,client_mid:o}=e;if(!n&&o&&M(o).gt(0))return z("receivedSendMessage",o),setTimeout((()=>{oe.dealSendedRosterMessage(e),oe.dealSendedGroupMessage(e)}),20);var{next_key:o=0}=e;if(0===o||M(o).eq(0)){const{uid:e=0}=r;delete Ur[e+""]}n?(t&&t.length&&Pr(t),z("onReceiveHistoryMsg",{next:o})):(t.length&&Pr(t),0===o||M(o).eq(0)||z("sendMessage",Ir({xid:r,next_key:o})))}})(e),t===l.NOTICE&&Lr(e),t===l.PROVISION&&(e=>{if(!Gr(e))return z("flooNotice",{category:"loginMessage",desc:"login socket failure ......"}),z("loginFail","socket_failure");var{xid:e={}}=e,{deviceSN:e}=e;z("temporary_deviceSN",e),xr||e&&W.saveDeviceSN(e),z("flooNotice",{category:"loginMessage",desc:"login socket success....."}),z("loginSuccess",{}),z("sendMessage",{vsn:0,compress_method:0,command:0})})(e)})(e)},On=e=>{u.info("SEND :"+JSON.stringify(R(e)));const t=ln(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);t.forEach(((e,t)=>{n[t]=e})),vn.send({data:r,fail:function(e){var{errMsg:e}=e;u.error("=============== fail to send message, err: ",e),vn.close(),z("reconnect",{reason:"SendFail"})}})};var wn=Object.assign(o,{connect:function(e){hn=e,gn=0,mn="normal",_n()},sendMessage:On,disConnect:()=>{mn="logout",vn&&vn.close()}}),Sn={asyncGetRosterIdList:e=>e?wn.rosterList({}).then((e=>(ue.saveRosterList(e),e.map((e=>e.user_id||e))))):Promise.resolve(ue.getRosterList()),asyncGetRosterInfo:(e,t)=>{var r=ue.getRosterInfo(e);return r&&r.username&&!t?Promise.resolve(r):wn.rosterListPost({list:[e]}).then((t=>(ue.saveRosterInfo(t),z("onRosterInfoUpdate",[e]),t.length&&t[0]||{})))},asyncRegester:e=>wn.userRegister(e),asnycGetRosterListDetailByIds:e=>{if(!e||!e.length)return Promise.resolve({});const t=ue.getAllRosterInfos(),r=[];e.forEach((e=>{var n=t[e];n&&n.username||r.push(e)}));const n=Array.from(new Set(r));return n.length?wn.rosterListPost({list:n}).then((e=>(ue.saveRosterInfo(e),z("onRosterInfoUpdate",n),e))):Promise.resolve()},asyncGetUserProfile:e=>{var t=W.getProfile();return t&&(t.name||t.mobile)&&!e?Promise.resolve(t):wn.userProfile().then((e=>(W.saveProfile(e),e)))},getRosterMessageByRid:e=>oe.getRosterMessage(e),readRosterMessage:(e,t)=>{z("imReadRosterMessage",{roster_id:e,mid:t})},asyncDeleteRoster:e=>wn.rosterDelete(e).then((t=>(ue.removeRoster(e.user_id),ee.deleteRecentById(e.user_id),z("onRosterListUpdate"),t))),getAllRosterDetail:()=>ue.getAllRosterInfos(),recallMessage:(e,t)=>{t=Dr(e,t),z("swapSendMessage",R(t)),z("sendMessage",t)},deleteMessage:(e,t)=>{t=((e,t)=>{t=M(t);const r=new yr;r.setCommond(l.SYNC);const n=new lr({uid:W.getUid(),deviceSN:wr}),o=new lr({uid:D(e),deviceSN:0}),i=new Er,s=new hr({ctype:E.COMMAND,type:v.OPER,operation:{type:_.DELETE,mid:t,xid:o}}),a=new br({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:m.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),z("swapSendMessage",R(t)),z("sendMessage",t)},getUnreadCount:e=>oe.getUnreadByRosterId(e),unreadMessage:(e,t)=>{t=((e,t)=>{t=M(t);const r=new yr;r.setCommond(l.SYNC);const n=new lr({uid:W.getUid(),deviceSN:wr}),o=new lr({uid:D(e),deviceSN:0}),i=new Er,s=new hr({ctype:E.COMMAND,type:v.OPER,operation:{type:_.READ_CANCEL,mid:t,xid:o}}),a=new br({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:m.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),z("swapSendMessage",R(t)),z("sendMessage",t)},getRosterInfo:e=>ue.getRosterInfo(e),asyncGetApplyList:wn.rosterApplylist,asyncGetBlockedlist:wn.rosterBlockedlist,asyncBlockeAdd:wn.rosterBlockedAdd,asyncBlockeRemove:wn.rosterBlockeRemove,asyncApply:wn.rosterApply,asyncAccept:wn.rosterAccept,asyncDecline:wn.rosterDecline,asyncUpdateRosterExt:wn.rosterExt,asyncSearchRosterByName:wn.rosterName,asyncSearchRosterById:wn.rosterId};$("imRostersGroupslistReady",(e=>{var{rosters:e}=e;ue.saveRosterList([].concat(e)),Tn(e)}));const In={},kn=e=>(new Date).getTime()-(In[e]||0)<1e3,Rn=e=>{var t=(new Date).getTime();In[e]=t},Tn=(e=[])=>{Array.isArray(e)||(e=[e]);const t=ue.getAllRosterInfos()||{},r=[];e.forEach((e=>{var n,o,i;0<(e=e.user_id||e)&&(({avatar:n,nick_name:o,username:i}=t[e]||{}),n||o||i||e&&!kn(e)&&r.push(e)&&Rn(e))})),r.length&&Cn(r)},Dn=(e=[],t=!1)=>{if(Array.isArray(e)||(e=[e]),t)Un(e);else{const t=F.getAllGroupInfos()||{},r=[];e.forEach((e=>{var n=e.group_id||e;if(0<e){const e=t[n]||{},{name:o}=e;o||r.push(n)}})),r.length&&Un(r)}},Mn=[],Cn=(e=[])=>{let t=e.filter((e=>Mn.indexOf(e)<0));t.length&&Ge({list:t}).then((e=>{t.forEach((t=>{e.findIndex((e=>e.user_id==t))<0&&Mn.push(t)})),ue.saveRosterInfo(e),z("onRosterInfoUpdate")}))},Un=(e=[])=>{e.length&&Ot({group_list:e}).then((e=>{F.saveGroupInfo(e),z("onGroupListUpdate")}))},xn=(e,t,r,n)=>{if(r){const t=F.getGroupMembers(e);if(!t||!t.length)return}void 0!==t&&(Array.isArray(t)||(t=[t]),wt({group_id:e,user_list:t}).then((t=>{if(t&&t.length){const r=[],o=ue.getAllRosterInfos();t.forEach((e=>{o[e.user_id]&&o[e.user_id].username?(e.display_name=e.display_name||o[e.user_id].username,e.avatar=o[e.user_id].avatar):r.push(e.user_id)})),r.length?Ge({list:r}).then((r=>{ue.saveRosterInfo(r);const o=ue.getAllRosterInfos();t=t.map((e=>(e.display_name||(e.display_name=e.display_name||o[e.user_id].username),e.avatar=o[e.user_id].avatar,e))),F.saveGroupMembers(e,t,n),z("onGroupMemberChanged",e)})):(F.saveGroupMembers(e,t,n),z("onGroupMemberChanged",e))}})))},Gn=(e,t)=>{const r=F.getGroupMembers(e);var n;!r||0===r.length||0<=(n=r.findIndex((e=>e.user_id===t)))&&(r.splice(n,1),F.saveGroupMembers(e,r,!0),z("onGroupMemberChanged",e))};$("imRostersGroupslistReady",(e=>{var{groups:e}=e;F.saveJoinedGroups([].concat(e)),Dn(e)})),$("imRosterMessage",(e=>{const t=U(e),{ext:r="",from:n,to:o}=t;let i={};try{i=JSON.parse(r)}catch(e){}if(void 0!==i.input_status&&n!=W.getUid())z("onInputStatusMessage",{ext:r,from:n,to:o});else{oe.saveRosterMessage(t),t.toType="roster",ee.saveRecent(t);const e=W.getUid()==n?o:n;Tn(e),z("onUnreadChange",e)}z("onRosterMessage",t)})),$("imSendRosterMessage",(e=>{Tn(e.uid)})),$("imGetRecent",(e=>{Tn(e)})),$("imGroupMessage",(e=>{const t=U(e);oe.saveGroupMessage(t),t.toType="group",ee.saveRecent(t);const r=W.getUid(),{config:n}=t;n&&n.mentionList&&0<=n.mentionList.indexOf(r)&&z("onMentionMessage",t),z("onGroupMessage",t)})),$("imReceivedUnread",(e=>{var t=e.filter((e=>1===e.type)).map((e=>D(e.xid.uid)));e=e.filter((e=>2===e.type)).map((e=>D(e.xid.uid)));Ln(t),Tn(t),Pn(e),Dn(e)}));const Ln=e=>{const t=ue.getAllRosterInfos()||{},r=[];e.forEach((e=>{var{avatar:n,nick_name:o,username:i}=t[e]||{};n||o||i||e&&!kn(e)&&r.push(e)&&Rn(e)})),r.length?Ge({list:r}).then((t=>{ue.saveRosterInfo(t),ee.saveUnreadRecent(e,"roster")})):ee.saveUnreadRecent(e,"roster")},Pn=e=>{const t=F.getAllGroupInfos()||{},r=[];e.forEach((e=>{var{name:n}=t[e]||{};n||e&&r.push(e)})),r.length?Ot({group_list:r}).then((t=>{F.saveGroupInfo(t),z("onGroupListUpdate"),ee.saveUnreadRecent(e,"group")})):ee.saveUnreadRecent(e,"group")};$("imRosterAdded",(e=>{var{payload:t}=e,{to:r=[],from:n}=t,t=W.getUid();1===r.length&&D(r[0].uid)===t&&(Tn([D(n.uid)]),ue.saveRosterList(D(n.uid)),z("onRosterListUpdate",e))})),$("imRosterRemoved",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=W.getUid();if(D(r.uid)===o&&1===n.length){const t=D(n[0].uid);ue.removeRoster(t),ie(e),ee.deleteRecentById(t),oe.deleteRosterMessageByRosterId(t),z("onRosterRemoved",e)}})),$("imRosterAccepted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=W.getUid(),i=D(r.uid);if(1===n.length){const t=D(n[0].uid);i===o?(ue.saveRosterList(t),Tn(t)):t===o&&(ue.saveRosterList(i),Tn(i)),z("onRosterAccepted",e)}})),$("imRosterDeclined",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=W.getUid(),i=D(r.uid);if(1===n.length){const t=D(n[0].uid);i!==o&&t!==o||ie(e),z("onRosterDeclined",e)}})),$("imRrosterBaned",(e=>{z("onRosterNotice",e)})),$("imRosterUnbaned",(e=>{z("onRosterNotice",e)})),$("imRosterInfoUpdated",(e=>{var{payload:t}=e,{from:r,content:t="{}"}=t,r=D(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},ue.getRosterInfo(r),n),ue.saveRosterInfo([r]),z("onRosterInfoUpdated"),z("onRosterListUpdate"))})),$("imGroupCreated",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=W.getUid(),r=D(r.uid),n=D(n.uid);F.saveJoinedGroups(r),n!==t&&Tn(n),Dn(r),z("onGroupListUpdate",e),z("onGroupCreated",e)})),$("imGroupDestoryed",(e=>{var t,{payload:r}=e,{gid:n,from:t}=r,o=W.getUid(),r=D(n.uid);(t=D(t.uid))!==o&&Tn(t),F.removeGroup(r),ie(e),ee.deleteRecentById(n),oe.deleteGroupMessageByGid(n),z("onGroupListUpdate"),z("onGroupDestoryed",e)})),$("imGroupJoined",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=D(n.uid),s=W.getUid(),a=D(r.uid),u=[];o.forEach((e=>{u.push(D(e.uid))})),i===s?(F.saveJoinedGroups(a),Dn(a),z("onGroupListUpdate")):(xn(a,i,!0),Tn(i),z("onGroupMemberChanged",a)),z("onGroupJoined",e)})),$("imGroupApplyed",(e=>{var t,{payload:t}=e,{from:t}=t;(t=D(t.uid))!==W.getUid()&&(Tn([t]),ie(e))})),$("imGroupApplyAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=D(n.uid),s=W.getUid(),a=D(r.uid),u=[];o.forEach((e=>{u.push(D(e.uid))})),i===s?(Tn(u),xn(a,u,!0),z("onGroupMemberChanged",a)):(F.saveJoinedGroups(a),Dn(a),Tn(i),z("onGroupListUpdate")),z("onGroupApplyAccepted",e)})),$("imGroupApplyDeclined",(e=>{const{payload:t}=e,{from:r,to:n}=t,o=D(r.uid),i=W.getUid(),s=[];n.forEach((e=>{s.push(D(e.uid))})),o===i?Tn(s):ie(e),z("onGroupApplyDeclined",e)})),$("imGroupInvited",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=D(n.uid),s=W.getUid(),a=D(r.uid),u=[];o.forEach((e=>{u.push(D(e.uid))})),i!==s&&-1<u.findIndex((e=>e===s))?(Tn(i),Dn(a),ie(e)):Tn(u),z("onGroupNotice",e)})),$("imGroupInvitedAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=D(n.uid),s=W.getUid(),a=D(r.uid),u=[];o.forEach((e=>{u.push(D(e.uid))})),i===s?(F.saveJoinedGroups(a),Dn(a),z("onGroupListUpdate")):(xn(a,i,!0),Tn(i),z("onGroupMemberChanged",a)),z("onGroupInvitedAccepted",e)})),$("imGroupInvitedDeclined",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=D(n.uid),n=W.getUid(),r=D(r.uid);t===n?(ie(e),Dn(r)):Tn(t),z("onGroupInvitedDeclined",e)})),$("imGroupKicked",(e=>{const{payload:t}=e=Object.assign({},e),{gid:r,to:n=[]}=t,o=W.getUid(),i=D(r.uid),s=[];n.forEach((e=>{s.push(D(e.uid))})),-1<s.findIndex((e=>e===o))?(F.removeGroup(i),ie(e),ee.deleteRecentById(r),oe.deleteGroupMessageByGid(r),z("onGroupListUpdate")):Gn(i,s)})),$("imGroupBlocked",(e=>{const{payload:t}=e,{gid:r,to:n=[]}=t,o=W.getUid(),i=D(r.uid),s=[];n.forEach((e=>{s.push(D(e.uid))})),-1<s.findIndex((e=>e===o))?(F.removeGroup(i),ie(e),ee.deleteRecentById(r),oe.deleteGroupMessageByGid(r),z("onGroupListUpdate")):(Tn(s),Gn(i,s))})),$("imGroupUnblocked",(e=>{const{payload:t}=e,{to:r=[]}=t,n=[];r.forEach((e=>{n.push(D(e.uid))})),Tn(n)})),$("imGroupOwnerAssigned",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=D(r.uid),i=W.getUid(),s=[];n.forEach((e=>{s.push(D(e.uid))})),o!==i&&s.push(o),Tn(s),z("onGroupOwnerAssigned",e)})),$("imGroupAdminGranted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=D(r.uid),i=W.getUid(),s=[];n.forEach((e=>{s.push(D(e.uid))})),o!==i&&s.push(o),Tn(s),z("onGroupAdminGranted",e)})),$("imGroupAdminRevoked",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=D(r.uid),i=W.getUid(),s=[];n.forEach((e=>{s.push(D(e.uid))})),o!==i&&s.push(o),Tn(s),z("onGroupAdminRevoked",e)})),$("imGroupMuted",(e=>{z("onGroupMuted",e)})),$("imGroupUnblocked",(e=>{z("onGroupUnblocked",e)})),$("imGroupBaned",(e=>{z("onGroupBaned",e)})),$("imGroupUnbaned",(e=>{z("onGroupUnbaned",e)})),$("imGroupInfoUpdated",(e=>{var{payload:t}=e,{gid:r,content:t="{}"}=t,r=D(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},F.getGroupInfo(r),n),F.saveGroupInfo([r]),z("onGroupListUpdate"))})),$("imGroupAnnouncementUpdated",(e=>{var{payload:t}=e,{gid:t}=t,t=D(t.uid);Dn(t,!0),z("onGroupAnnouncementUpdated",e)})),$("imReadRosterMessage",(e=>{const{roster_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=oe.getRosterMessageById(t,r);if(jn(e)&&!n){o=!0;const e=Tr(t,r);z("sendMessage",e)}}else{const e=oe.getRosterMessage(t);let r;if(e.forEach((e=>{if(jn(e)&&!n){o=!0;const r=Tr(t,e.id);z("sendMessage",r)}r=e.id})),oe.saveFormatedRosterMessage(t,e),!n&&o){const e=Mr(t,r);z("sendMessage",e)}}o&&z("onUnreadChange",t)}));const jn=e=>{let t=!1;const r=Bn(e,k.READ);if(e&&r){const r=W.getUid(),n=D(e.from);0<n&&n!=r&&(t=!0)}return t},Bn=(e,t)=>{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,oe.saveRosterMessage(U(n)),r=!0}return r};$("imReadGroupMessage",(e=>{const{group_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=oe.getGroupMessageById(t,r);if(Fn(e)&&!n){o=!0;const t=C(e.from),n=Tr(t,r);z("sendMessage",n)}}else{const e=oe.getGroupMessage(t);let r;if(e.forEach((e=>{if(Fn(e)&&!n){o=!0;const t=C(e.from),r=Tr(t,e.id);z("sendMessage",r)}r=e.id})),oe.saveFormatedGroupMessage(t,e),!n&&o){const e=Mr(t,r);z("sendMessage",e)}}o&&z("onUnreadChange",t)}));const Fn=e=>{let t=!1;const r=Vn(e,k.READ);if(e&&r){const r=W.getUid(),n=D(e.from);0<n&&n!=r&&e.config&&e.config.groupMemberList&&(t=!0)}return t},Vn=(e,t)=>{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,oe.saveGroupMessage(U(n)),r=!0}return r},qn=(e,t)=>{var r;0<(r=t?oe.getGroupMessage(e):oe.getRosterMessage(e)).length&&ee.saveRecent(r[r.length-1])};$("onActionMessage",(e=>{var t,{payload:r,from:n,to:t,isReceived:o}=e,{type:i,operation:s={}}=r,r=(e=W.getUid()+"",t?C(t.uid):0),n=e==(t=C(n.uid))+""?r:t;e=-1!=F.getJoinedGroups().indexOf(+r);i===v.OPER&&(({type:t,mid:r,xid:i}=s),s=e?oe.getGroupMessageById(n,r):oe.getRosterMessageById(n,r),t===_.READ_ACK?(e||jn(s),e&&Fn(s)):t===_.DELIVER_ACK?(e||Bn(s,k.DELIVERED),e&&Vn(s,k.DELIVERED)):t===_.RECALL?(e||oe.deleteSingleRosterMessage(n,r),e&&oe.deleteSingleGroupMessage(n,r),qn(n,e),z("onMessageRecalled",{uid:n,mid:r})):t===_.DELETE?(e||oe.deleteSingleRosterMessage(i.uid,r),e&&oe.deleteSingleGroupMessage(i.uid,r),qn(i.uid,e),z("onMessageDeleted",{uid:i.uid,mid:r})):t===_.READ_CANCEL?(e||Bn(s,k.UNREAD),e&&Vn(s,k.UNREAD),z("onMessageCanceled",{uid:n,mid:r})):t===_.READ_ALL&&(e?z("imReadGroupMessage",{group_id:i.uid,mid:r,isReceived:o}):z("imReadRosterMessage",{roster_id:i.uid,mid:r,isReceived:o})),n=C(i&&i.uid?i.uid:n),z("onMessageStatusChanged",{uid:n,mid:C(r)}),z("onUnreadChange",n))}));const Kn={};$("swapSendMessage",(e=>{var{payload:t}=e,{meta:t}=t,{id:t}=t;Kn[C(t)]=e})),$("receivedSendMessage",(e=>{if(e=C(e),e=Kn[e]){const t=e.payload,{meta:r}=t,{payload:n}=r,{type:o}=n;o===v.OPER&&z("onActionMessage",r)}})),$("deleteConversation",(({id:e,source:t})=>{z("flooNotice",{category:"conversation_deleted",desc:{id:e,source:t}});var{idx:r,type:t}=ee.getRecentById(e);r<0||("group"==t?oe.deleteGroupMessageByGid(e):oe.deleteRosterMessageByRosterId(e),ee.deleteRecentById(e))}));var Jn=xn,Yn={asyncGetGroupInfo:(e,t)=>{var r=F.getGroupInfo(e-=0)||{};return r.name&&!t?Promise.resolve(r):wn.groupInfo({group_id:e}).then((e=>(F.saveGroupInfo([e]),e)))},asyncGetJoinedGroups:e=>e?wn.groupUserjoined({}).then((e=>Array.isArray(e)?e:F.getGroupInfoList())):Promise.resolve(F.getGroupInfoList()),openGroup:e=>{wn.groupMemberlist({group_id:e}).then((t=>{F.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&Jn(e,t,!1,!0),z("onGroupMemberChanged",e)}))},getAllGroupDetail:()=>F.getAllGroupInfos(),asyncGetGroupMembers:e=>wn.groupMemberlist({group_id:e}).then((t=>(F.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&Jn(e,t,!1,!0),t))),getGroupMembers:e=>F.getGroupMembers(e)||[],asyncGetGroupListDetail:e=>e&&e.length?wn.groupInfoBatch({group_list:e}).then((e=>(F.saveGroupInfo(e),e))):Promise.resolve({}),getGruopMessage:e=>oe.getGroupMessage(e),readGroupMessage:(e,t)=>{z("imReadGroupMessage",{group_id:e,mid:t})},recallMessage:(e,t)=>{t=Dr(e,t),z("sendMessage",t),z("swapSendMessage",t)},getUnreadCount:e=>oe.getUnreadByGroupId(e),asyncGetAdminList:wn.groupAdminList,asyncAdminAdd:wn.groupAdminAdd,asyncAdminRemove:wn.groupAdminRemove,asyncGetAnouncementById:wn.groupAnnouncement,asyncAnouncementDelete:wn.groupAnnouncementDelete,asyncAnnouncementEdit:wn.groupAnnouncementEdit,asyncGetAnnouncementList:wn.groupAnnouncementList,asyncCreate:wn.groupCreate,asyncDestroy:wn.groupDestroy,asyncGetInfo:e=>(e.group_id||(e={group_id:e}),wn.groupInfo(e)),asyncUpdateAvatar:wn.groupInfoAvatar,asyncUpdateDescription:wn.groupInfoDdscription,asyncUpdateName:wn.groupInfoName,asyncGetMemberList:e=>(e.group_id||(e={group_id:e}),wn.groupMemberlist(e)),asyncGroupMsgMutemode:wn.groupMsgMutemode,asyncGetPublicList:wn.groupPubliclist,asyncUpdateMsgNotDisturb:wn.groupMsgNotdisturb,asyncGroupBannedList:wn.groupBannedList,asyncGroupBab:wn.groupBab,asyncGroupUnban:wn.groupUnban,asyncGetSettings:wn.groupSettings,asyncUpdateAllowMemberInvitation:wn.groupSettingsAllowmemberinvitation,asyncUpdateAllowMemberModify:wn.groupSettingsAllowmembermodify,asyncUpdateEnableReadack:wn.groupSettingsEnablereadack,asyncUpdateHistoryVisible:wn.groupSettingsHistoryvisible,asyncUpdateRequireadminapproval:wn.groupSettingsRequireadminapproval,asyncOwnerTransfer:wn.groupTransfer,asyncGetUserJoined:wn.groupUserjoined,asyncApply:wn.groupApply,asyncApplyHandle:wn.groupApplyHandle,asyncGroupBockedlist:wn.groupBockedlist,asyncGroupBlock:wn.groupBlock,asyncGroupUnblock:wn.groupUnblock,asyncKick:wn.groupKick,asyncGetInvitationList:wn.groupInvitationlist,asyncInvite:wn.groupInvite,asyncInviteHandle:wn.groupInviteHandle,asyncGetMemberDisplayName:wn.groupMembersDidpayname,asyncLeave:wn.groupLeave,asyncUpdateDisplayName:wn.groupDisplayname,asncGetApplicationList:wn.groupApplicationlist,asyncGetFileList:wn.groupFilelist,asyncFileDelete:wn.groupFiledelete,asyncFileUpload:wn.groupFileupload};o={getToken:()=>W.getToken(),getUid:()=>W.getUid(),getAppid:()=>W.getAppid(),getConversationList:()=>ee.getRecents(),deleteToken:W.deleteToken,getDeviceSN:()=>W.getDeviceSN(),asyncBindDeviceToken:wn.bindDeviceToken,asyncUnbindDeviceToken:wn.unbindDeviceToken,asyncTokenUser:wn.tokenUser,asyncTokenId:wn.tokenId,asyncRegister:wn.userRegister,asyncUserBindMobile:wn.userBindMobile,asyncUserUpdateMobile:wn.userUpdateMobile,asyncUserSendSms:wn.userSendSms,asyncCaptchaSms:wn.captchaSms,asyncUserNameCheck:wn.userNameCheck,asyncUserMobileBind:wn.userMobileBind,asyncUserMobileBindSign:wn.userMobileBindSign,asyncUserMobileLogin:wn.userMobileLogin,asyncCaptchaImagePost:wn.captchaImagePost,asyncUpdateAuthmode:wn.userAuthmode,asyncUpdateAvatar:wn.userAvatar,asyncUpdateMobile:wn.userMobile,asyncUpdateNickName:wn.userNickname,asyncGetProfile:wn.userProfile,asyncUpdateProfile:wn.userProfilePost,asyncGetSettings:wn.userSettings,asyncUpdateSettings:wn.userSettingsPost};const Wn=(e,t)=>t&&e?e+"_"+t:"",Hn=e=>{if(!e)return{};var t=zn("ws"),{clusters:r,clusterIndex:n,ratelIndex:o,fireIndex:e}=$n(e);return r&&r.length?(o=(n=r[n]).ratel[o],e=(n.webim||n.ws)[e],o&&e?{ratel:o.protocol+"://"+o.host,fireplace:(t?"https"===e.protocol?"wss":"ws":e.protocol)+"://"+e.host}:{}):{}};$("ratelError",(()=>{var e;u.log("Ratel error, should try next in list"),(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=$n(e);t[r].ratel.length>n+1?(n++,Xn(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):Zn(e)})(e=zn("app_id"));var{ratel:e}=Hn(e)||{};z("refresh_ratel",e)})),$("fireplaceError",(()=>{var e=zn("app_id");u.log("Fireplace error, should try next in list, appid: ",e),(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=$n(e),i=t[r];(i.webim||i.ws).length>o+1?(o++,Xn(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):Zn(e)})(e);var{fireplace:e}=Hn(e)||{};z("refresh_fireplace",e)}));const Zn=e=>{const t=$n(e);let{clusters:r,clusterIndex:n}=t;for(;r.length>n+1;){n++;const t=r[n];if(0<=(t.webim||t.ws).length)return void Xn(e,{clusters:r,clusterIndex:n,ratelIndex:0,fireIndex:0})}z("retrieve_dns")},$n=e=>L(Wn("key_dns_infos",e),!1)||{},Xn=(e,t)=>{G(Wn("key_dns_infos",e),t,!1)},zn=e=>e?L(Wn("key_dns_config",e),!1):"",Qn=(e,t)=>{e&&t&&G(Wn("key_dns_config",e),t,!1)};$("retrieve_dns",(()=>{var e=zn("dns_server"),t=zn("app_id"),r=zn("ws");u.warn("Retrieve DNS for appid: ",t),eo(e,t,r)}));const eo=(e,t,r)=>(Qn("dns_server",e),Qn("app_id",t),Qn("ws",r),(r=Hn(t)).ratel?Promise.resolve(r):ye(e,{app_id:t}).then((e=>(u.info("DNS SUCCESS: ",e),(t=>{if(!t)return;const{version:r,dns_list:n}=e,o=n.findIndex((e=>0==e.group_level));if(o<0)return u.error("DNS ERROR: no available clusters (version:",r,")");var i={clusters:n[o].clusters,clusterIndex:0,ratelIndex:0,fireIndex:0};Xn(t,i)})(t),Hn(t)))));var to={asyncGetDns:eo,getServers:Hn};const ro=({url:e="",params:t={}})=>{if(!e)return"";var r=W.getToken(),n=W.getAppid();return t=Object.assign(t,{"access-token":r,app_id:n}),0<e.indexOf("?")?e+="&":e+="?",e+de.a.stringify(t)};se={getStaticVars:()=>n,sendRosterMessage:e=>{var t=Rr(e);e=t.payload.meta;oe.saveSendingRosterMessage(e),wn.sendMessage(t)},sendGroupMessage:e=>{var t=kr(e);e=t.payload.meta;oe.saveSendingGroupMessage(e),wn.sendMessage(t)},sendMentionMessage:e=>{var t=(()=>{var{gid:t,txt:r,mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}=e,u=E.TEXT;const d=new lr({uid:+W.getUid(),deviceSN:wr}),c=new lr({uid:t,deviceSN:0}),p=new yr;p.setCommond(l.SYNC);const f=new Er,h=new hr({from:d,to:c,content:r,ctype:u,type:v.GROUPCHAT});return h.config=JSON.stringify({mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}),a=new br({id:(new Date).getTime(),from:d,to:c,payload:h,ns:m.MESSAGE}),f.setMeta(a),p.setPayload(f),p})(),r=t.payload.meta;oe.saveSendingGroupMessage(r),wn.sendMessage(t)},sendInputStatusMessage:(e,t)=>{t=((e,t)=>{var r=E.TEXT;const n=new lr({uid:+W.getUid(),deviceSN:wr}),o=new lr({uid:+e,deviceSN:0}),i=new yr;i.setCommond(l.SYNC);const s=new Er,a=new hr({from:n,to:o,ctype:r,type:v.CHAT,ext:JSON.stringify({input_status:t}),qos:N.AT_MOST_ONCE}),u=new br({id:(new Date).getTime(),from:n,to:o,payload:a,ns:m.MESSAGE});return s.setMeta(u),i.setPayload(s),i})(e,t),wn.sendMessage(t)},sendMessage:wn.sendMessage,getNoticeMessage:se(),getMessageStatus:(e,t,r=!1)=>{var n=r?oe.getGroupMessageById(e,t):oe.getRosterMessageById(e,t);const o=Object.keys(k)[n.status];return o?o.toLowerCase():void 0},forwardMessage:function(e){const{uid:t,mid:r,gid:n}=e;let o;o=t?oe.getRosterMessageById(t,r):oe.getGroupMessageById(n,r);const i=o.attach;if(i&&i.url){e=i.url.split("sign=")[1];const r=W.getToken();wn.fileForward({file_sign:e,"access-token":r,to_id:+(t||n),to_type:t?1:2}).then((e=>{o.attach.url=e;var r=Cr(t,n,o);e=r.payload.meta;t?oe.saveSendingRosterMessage(e):oe.saveSendingGroupMessage(e),wn.sendMessage(r)}))}else{const e=Cr(t,n,o),r=e.payload.meta;t?oe.saveSendingRosterMessage(r):oe.saveSendingGroupMessage(r),wn.sendMessage(e)}},asyncFileUpload:e=>new Promise(((t,r)=>{const{group_id:n,to_id:o,toType:i,file:s,fileType:a,chatType:d}=e;var c="rosterAvatar"===i?"fileUploadAvatarUrl":"chat"==i?"fileUploadChatFileUrl":"fileUploadGroupAvatarUrl";const p={},l=W.getToken();"groupAvatar"===i&&(p["access-token"]=l),a&&(p.file_type=["file","audio","image","video","audio-mp3"].indexOf(a)+100),p<100&&(p.file_type=["shareFile","shareAudio","shareImage","shareVideo"].indexOf(a)+200),n&&(p.group_id=n),"group"==d&&(p.to_type=2),"roster"==d&&(p.to_type=1),o&&(p.to_id=o),wn[c](p).then((e=>{let r={filePath:s,name:"file"};e.oss_body_param&&e.oss_body_param.key&&(r=Object.assign(r,{formData:{OSSAccessKeyId:e.oss_body_param.OSSAccessKeyId,policy:e.oss_body_param.policy,signature:e.oss_body_param.signature,callback:e.oss_body_param.callback,key:e.oss_body_param.key}})),wn.asyncFileUpload(e.upload_url,r,{operation:"upload_file"}).then((()=>{t({url:e.download_url})})).catch((e=>{u.error("Fail to upload file due to ",e)}))})).catch((e=>{r(e)}))})),requireHistoryMessage:(e,t,r)=>{r=((e,t,r)=>{t=M(t);const n=new yr;n.setCommond(l.SYNC);const o=new lr({uid:D(e),deviceSN:0}),i=new Er;return i.setXid(o),i.setKey(D(t)),i.setFullsyncnum(r),i.setIsfullsync(!0),n.setPayload(i),n})(e,t,r),wn.sendMessage(r)},makeSearch:e=>{const t=[],r=[];return(ue.getRosterInfoList()||[]).forEach((r=>{let n=!1;const{user_id:o,username:i,avatar:s}=r;(oe.getRosterMessage(o)||[]).forEach((r=>{if(n)return;const{payload:a={}}=r,{content:u=""}=a;0<=u.indexOf(e)&&(n=!0,t.push({user_id:o,username:i,avatar:s,content:u}))})),n||0<=i.indexOf(e)&&t.push({user_id:o,username:i,avatar:s})})),F.getGroupInfoList().forEach((t=>{let n=!1;const{group_id:o,name:i}=t;(oe.getGroupMessage(o)||[]).forEach((t=>{if(n)return;const{payload:s={}}=t,{content:a=""}=s;0<=a.indexOf(e)&&(n=!0,r.push({group_id:o,name:i,content:a}))})),n||0<=i.indexOf(e)&&r.push({group_id:o,name:i})})),{rosterArr:t,groupArr:r}},asyncGetUserAvatarUploadUrl:wn.fileUploadAvatarUrl,asyncGetGroupAvatarUploadUrl:wn.fileUploadGroupAvatarUrl,asyncGetFileUploadChatFileUrl:wn.fileUploadChatFileUrl,asyncQrcode:wn.qrcode,asyncQrlogin:wn.qrlogin,asyncQrcodeGroupsign:wn.qrcodeGroupsign,asyncQrcodeGroupinvite:wn.qrcodeGroupinvite,asyncWxlogin:wn.wxlogin,asyncWxbind:wn.wxbind,asyncGetStaticContact:wn.getStaticContact,getImage:({avatar:e="",type:t="roster",thumbnail:r=!0,sdefault:n=""})=>{if(/^\//.test(e))return e;if(!e)return"roster"===t?n||"/static/image/roster.png":n||"/static/image/group.png";let o=e,i={};if(0!==e.indexOf("http")){const t=W.getAppid();var{ratel:n}=to.getServers(t)||{};!/\/$/.test(n)&&5<n.length&&(o=n+"/file/download/avatar"),i=Object.assign(i,{object_name:e})}return r&&(i=Object.assign(i,{image_type:2})),ro({url:o,type:"image",params:i})},getAudio:({url:e,type:t="audio"})=>ro({url:e,type:t,params:{format:"mp3"}}),getChatFile:ro,downloadAudio:({url:e="",type:t="audio"})=>(({url:e="",type:t="",params:r={}})=>e?wn.fileDownloadChatFileUrl(e,r,{operation:"download_file"}):"")({url:e,type:t,params:{format:"mp3"}}),getServers:to.getServers,asyncWechatUnbind:wn.wechatUnbind,asyncWechatIsbind:wn.wechatIsbind,asyncWechatBind:wn.wechatBind,deleteConversation:function(e,t=!0){z("deleteConversation",{id:e,other_devices:t,source:"user_operation"}),t=((e,t=!0)=>{let r=I.DELETE;t&&(r=I.DELETE_EVERYWHERE);const n=new lr({uid:+W.getUid(),deviceSN:wr}),o=new lr({uid:e}),i=new Or({type:S.OPER,operation:{xid:o,type:r}}),s=new br({id:(new Date).getTime(),from:n,payload:i,ns:m.CONVERSATION}),a=new Er;a.setMeta(s);const u=new yr;return u.setCommond(l.SYNC),u.setPayload(a),u})(e,t),wn.sendMessage(t)}};let no={},oo=null,io=!1,so=!1;const ao=function({autoLogin:e=!0,dnsServer:t="https://dns.maximtop.com/v2/app_dns",appid:r="welovemaxim",ws:n=!1}){W.saveAppid(r),to.asyncGetDns(t,r,n).then((n=>{var{ratel:o,fireplace:n}=n;if(!o||!n)return u.log("DNS error, check the server: ",t),void z("flooError",{category:"DNS_FAILED",desc:t});if(uo(r),no={appid:r,baseUrl:o,autoLogin:e,fireplace:n},ao.baseUrl=no.baseUrl,io=!0,oo){const{type:e}=oo;return"login"==e&&ao.login(oo.opt),"qrlogin"==e&&ao.qrlogin(oo.opt),void("tokenLogin"==e&&ao.tokenLogin(oo.user_id,oo.token))}if(no.autoLogin){so=!0;const e=W.getUid(),t=W.getToken();if(e&&t){const e=Sn.asyncGetRosterIdList(!0),t=Yn.asyncGetJoinedGroups(!0);Promise.all([e,t]).then((e=>{var t=e[0];e=e[1];z("imRostersGroupslistReady",{rosters:t,groups:e}),u.log("get roster, group over .... will io connect"),wn.connect(no)})).catch((e=>{z("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))}}})).catch((e=>{}))},uo=function(e){u.log("setup servers for app: ",e);var{ratel:t,fireplace:e}=to.getServers(e)||{};z("refresh_ratel",t),z("refresh_fireplace",e)};ao.login=function(e){io?(z("flooNotice",{category:"loginMessage",desc:"getting token..."}),wn.tokenUser(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;W.saveUid(r),W.saveToken(t),W.saveAesKey(n);var o=Sn.asyncGetRosterIdList(!0);e=Yn.asyncGetJoinedGroups(!0);so=!0,z("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];z("imRostersGroupslistReady",{rosters:n,groups:e}),u.log("get roster, group over .... will io connect"),no=Object.assign({uid:r,token:t},no),wn.connect(no),oo=null})).catch((e=>{z("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{z("loginFail","token failure:"+e.message)}))):oo={type:"login",opt:e}},ao.qrlogin=function(e){io?(z("flooNotice",{category:"loginMessage",desc:"getting token..."}),wn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;W.saveUid(r),W.saveToken(t),W.saveAesKey(n);var o=Sn.asyncGetRosterIdList(!0);e=Yn.asyncGetJoinedGroups(!0);z("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),so=!0,Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];z("imRostersGroupslistReady",{rosters:n,groups:e}),u.log("get roster, group over .... will io connect"),no=Object.assign({uid:r,token:t},no),wn.connect(no),oo=null})).catch((e=>{z("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{z("loginFail","token failure:"+e.message)}))):oo={type:"qrlogin",opt:e}},ao.tokenLogin=function(e,t,r){var n;io?(W.saveUid(e),W.saveToken(t),W.saveAesKey(r),n=Sn.asyncGetRosterIdList(!0),r=Yn.asyncGetJoinedGroups(!0),z("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),so=!0,Promise.all([n,r]).then((r=>{var n=r[0];r=r[1];z("imRostersGroupslistReady",{rosters:n,groups:r}),u.log("get roster, group over .... will io connect"),no=Object.assign({uid:e,token:t},no),wn.connect(no),oo=null})).catch((e=>{z("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))):oo={type:"tokenLogin",user_id:e,token:t}},ao.idLogin=function(e){wn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;W.saveUid(r),W.saveToken(t),W.saveAesKey(n);var o=Sn.asyncGetRosterIdList(!0);e=Yn.asyncGetJoinedGroups(!0);z("flooNotice",{category:"loginMessage",desc:"token success, getting roster lists.."}),so=!0,Promise.all([o,e]).then((e=>{const n=e[0]||[];n.push(r),e=e[1],z("imRostersGroupslistReady",{rosters:n,groups:e}),u.log("get roster, group over .... will io connect"),no=Object.assign({uid:r,token:t},no),wn.connect(no),oo=null})).catch((e=>{z("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{z("loginFail","token failure:"+e.message)}))},ao.wxlogin=function(){},ao.cleanup=function(){u.log("FLOO: IM logout, cleanup the data."),ee.clear(),ue.clear(),F.clear(),W.clear(),oe.clearAll()},ao.isLogin=function(){return so&&W.getUid()&&W.getToken()},ao.on=ao.listen=function(e,t){t?$(e,t):Object.keys(e).forEach((t=>{$(t,e[t])}))},ao.off=function(e,t){t?X(e,t):Object.keys(e).forEach((t=>{X(t,e[t])}))},ao.logout=function(){wn.disConnect(),ao.cleanup()},ao.isReady=function(){return io},ao.disConnect=wn.disConnect;var co=ao;function po(e){return new co(e),co}co.rosterManage=Sn,co.groupManage=Yn,co.userManage=o,co.sysManage=se,t.default=po}]).default);e.init=function(e){return(e=r(t({autoLogin:!0,ws:!0},e))).chatroomManage={create:function(e){var t=this;return this.groupManage.asyncCreate({name:e,type:2}).then((function(e){return t.groupManage.asyncUpdateRequireadminapproval({group_id:e.group_id,apply_approval:0})}))}.bind(e),join:function(e){return this.groupManage.asyncApply({group_id:e})}.bind(e),leave:function(e){return this.groupManage.asyncLeave({group_id:e})}.bind(e),destroy:function(e){return this.groupManage.asyncDestroy({group_id:e})}.bind(e)},e},e.version="1.0.2",Object.defineProperty(e,"__esModule",{value:!0})}));
  