diff --git a/README.md b/README.md index 0dfa31a..76b2b69 100644 --- a/README.md +++ b/README.md @@ -457,10 +457,20 @@ im.groupManage.asyncUpdateAvatar({ im.groupManage.asyncUpdateDescription({ group_id, value -}) - .then(() => { - // - }); +}).then(() => { + // +}); +``` + +#### 更新群扩展 + +```ts +this.im.groupManage.asyncUpdateExt({ + group_id, + value +}).then(() => { + // +}); ``` #### 更新群名称 @@ -1026,4 +1036,7 @@ im.chatroomManage.destroy(group_id).then(() => { | fromServer | boolean | true表示从服务器取数据, false表示从本地缓存取数据 | | apply_approval | 0 \| 1 \| 2 | 入群申请审批设置。0:同意所有申请 1:需要管理员确认 2:拒绝所有申请 | | 禁言群成员 duration | number | 禁言时长,单位为分钟。-1 为永久禁言 | +| file_type | number | 文件类型 100: 普通聊天文件, 101: 语音聊天文件(amr格式),102: 图片聊天文件, 103: 视频聊天文件, 104: 语音聊天文件(mp3格式), 200: 普通共享文件, 201: 语音共享文件, 202: 图片共享文件, 203: 视频共享文件 | +| to_type | number | 1: 用户,2: 群组 | +| to_id | number | 用户ID或群ID | diff --git a/package.json b/package.json index 3b78feb..0da4730 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qnweb-im-demo", - "version": "1.0.2", + "version": "1.0.3", "scripts": { "dev": "vite", "build": "tsc && vite build", diff --git a/src/sdk/qnweb-im.umd.js b/src/sdk/qnweb-im.umd.js index aaa72d7..4578c14 100644 --- a/src/sdk/qnweb-im.umd.js +++ b/src/sdk/qnweb-im.umd.js @@ -1 +1 @@ -!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).QNIM={})}(this,(function(exports){"use strict";var version="1.0.2",__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=c(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<=-y)return C;if(y<=e+1)return w}return e<0?u(-e,t).neg():c(e%l|0,e/l|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=c;var p=Math.pow;function f(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>>0:this.low},N.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},N.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=s).isZero())return a+i;for(;a.length<6;)a="0"+a;i=""+a+i}},N.getHighBits=function(){return this.high},N.getHighBitsUnsigned=function(){return this.high>>>0},N.getLowBits=function(){return this.low},N.getLowBitsUnsigned=function(){return this.low>>>0},N.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},N.eq=N.equals,N.notEquals=function(e){return!this.eq(e)},N.neq=N.notEquals,N.ne=N.notEquals,N.lessThan=function(e){return this.comp(e)<0},N.lt=N.lessThan,N.lessThanOrEqual=function(e){return this.comp(e)<=0},N.lte=N.lessThanOrEqual,N.le=N.lessThanOrEqual,N.greaterThan=function(e){return 0>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},N.comp=N.compare,N.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(_)},N.neg=N.negate,N.add=function(e){o(e)||(e=d(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,p=0,f=0,l=0,h=0;return l+=(h+=i+(65535&e.low))>>>16,f+=(l+=n+u)>>>16,p+=(f+=r+a)>>>16,p+=t+s,c((l&=65535)<<16|(h&=65535),(p&=65535)<<16|(f&=65535),this.unsigned)},N.subtract=function(e){return o(e)||(e=d(e)),this.add(e.neg())},N.sub=N.subtract,N.multiply=function(e){if(this.isZero())return m;if(o(e)||(e=d(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(C))return e.isOdd()?C:m;if(e.eq(C))return this.isOdd()?C: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(g)&&e.lt(g))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,p=65535&e.high,f=e.low>>>16,l=65535&e.low,h=0,y=0,v=0;e=0;return v+=(e+=s*l)>>>16,y+=(v+=i*l)>>>16,v&=65535,y+=(v+=s*f)>>>16,h+=(y+=n*l)>>>16,y&=65535,h+=(y+=i*f)>>>16,y&=65535,h+=(y+=s*p)>>>16,h+=t*l+n*f+i*p+s*a,c((v&=65535)<<16|(e&=65535),(h&=65535)<<16|(y&=65535),this.unsigned)},N.mul=N.multiply,N.divide=function(e){if((e=o(e)?e:d(e)).isZero())throw Error("division by zero");var t,n;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((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 b;n=v}else{if(this.eq(C))return e.eq(_)||e.eq(E)?C:e.eq(C)?_:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?_:E:(t=this.sub(e.mul(i)),i.add(t.div(e)));if(e.eq(C))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:p(2,s-48),f=u(i),l=f.mul(e);l.isNegative()||l.gt(t);)l=(f=u(i-=a,this.unsigned)).mul(e);f.isZero()&&(f=_),n=n.add(f),t=t.sub(l)}return n},N.div=N.divide,N.modulo=function(e){return o(e)||(e=d(e)),r?c((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))},N.mod=N.modulo,N.rem=N.modulo,N.not=function(){return c(~this.low,~this.high,this.unsigned)},N.and=function(e){return o(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},N.or=function(e){return o(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},N.xor=function(e){return o(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},N.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<>>32-e,this.unsigned):c(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},N.shr=N.shiftRight,N.shiftRightUnsigned=function(e){if(o(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},N.shru=N.shiftRightUnsigned,N.shr_u=N.shiftRightUnsigned,N.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},N.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},N.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},N.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]},N.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){(function(e){var n=t;function o(e,t,r){for(var n=Object.keys(t),o=0;ot)return!0;return!1},p.isReservedName=function(e,t){if(e)for(var r=0;r{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)=>{var o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&u(r,e).includes(e.arrayFormatSeparator);r=i?u(r,e):r,r=o||i?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]=f(r[e],t);else n[e]=f(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=p,t.parse=d,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{t=Object.assign({decode:!0},t);const[r,n]=i(e,"#");return Object.assign({url:r.split("?")[0]||"",query:d(p(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:u(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);var n=c(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){var r=36e5,n=864e5;function o(e,t,r){if(!(e=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(n)return R(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var o,i,s,a=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!r||r<0||n=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):v(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,o){var i=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=i=2,a/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var c=-1,p=r;p>>10&1023|55296),p=56320|1023&p),n.push(p),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;ne.length)throw new RangeError("Index out of range")}function A(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function C(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function N(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function k(e,t,r,n,i){return i||N(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return i||N(e,0,r,8),o.write(e,t,r,n,52,8),r+8}t.Buffer=u,t.SlowBuffer=function(e){return u.alloc(+(e=+e!=e?0:e))},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return n=null,t=t,r=r,p(e=e),e<=0||void 0===t?a(n,e):"string"==typeof r?a(n,e).fill(t,r):a(n,e).fill(t);var n},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);or&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,o){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(n,o),p=e.slice(t,r),f=0;fthis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,s,a,u,c,p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var o=e.length-r;if((!n||(n=Number(n))>o)&&(n=o),(o=t.length)%2!=0)throw new TypeError("Invalid hex string");o/2>8,o.push(r%256),o.push(n);return o}(e,(a=this).length-i),a,i,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r=(o*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||E(e,t,this.length);for(var n=t,o=1,i=this[e+--n];0=(o*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){return t||E(e,2,this.length),32768&(e=this[e]|this[e+1]<<8)?4294901760|e:e},u.prototype.readInt16BE=function(e,t){return t||E(e,2,this.length),32768&(e=this[e+1]|this[e]<<8)?4294901760|e:e},u.prototype.readInt32LE=function(e,t){return t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||E(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||E(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||E(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||E(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||w(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i>>8):A(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):C(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||w(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||w(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,s=0;for(this[t+o]=255&e;0<=--o&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):C(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function T(e){return n.toByteArray(function(e){if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(S,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(33))},function(e,t,r){var n=r(82),o=r(24);e.exports=function(e){var t=e.xdomain,r=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(o[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t){e.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},function(e,t,r){var n=r(8);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}r(7)((e.exports=o).prototype),o.prototype.onError=function(e,t){return(e=new Error(e)).type="TransportError",e.description=t,this.emit("error",e),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){e=n.decodePacket(e,this.socket.binaryType),this.onPacket(e)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){e.exports=f;var n,o=r(5),i=o.LongBits,s=o.base64,a=o.utf8;function u(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function c(){}function p(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function f(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}function d(){return o.Buffer?function(){return(f.create=function(){return new n})()}:function(){return new f}}function l(e,t,r){t[r]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function y(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>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}f.create=d(),f.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(f.alloc=o.pool(f.alloc,o.Array.prototype.subarray)),f.prototype._push=function(e,t,r){return this.tail=this.tail.next=new u(e,t,r),this.len+=t,this},(h.prototype=Object.create(u.prototype)).fn=function(e,t,r){for(;127>>=7;t[r]=e},f.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},f.prototype.int32=function(e){return e<0?this._push(y,10,i.fromNumber(e)):this.uint32(e)},f.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},f.prototype.int64=f.prototype.uint64=function(e){return e=i.from(e),this._push(y,e.length(),e)},f.prototype.sint64=function(e){return e=i.from(e).zzEncode(),this._push(y,e.length(),e)},f.prototype.bool=function(e){return this._push(l,1,e?1:0)},f.prototype.sfixed32=f.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},f.prototype.sfixed64=f.prototype.fixed64=function(e){return e=i.from(e),this._push(g,4,e.lo)._push(g,4,e.hi)},f.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},f.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var m=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;return r?(o.isString(e)&&(t=f.alloc(r=s.length(e)),s.decode(e,t,0),e=t),this.uint32(r)._push(m,r,e)):this._push(l,1,0)},f.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(l,1,0)},f.prototype.fork=function(){return this.states=new p(this),this.head=this.tail=new u(c,0,0),this.len=0,this},f.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 u(c,0,0),this.len=0),this},f.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},f.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},f._configure=function(e){n=e,f.create=d(),n._configure()}},function(e,t,r){e.exports=u;var n,o=r(5),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}function c(){return o.Buffer?function(e){return(u.create=function(e){return o.Buffer.isBuffer(e)?new n(e):f(e)})(e)}:f}var p,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")};function d(){var e=new i(0,0),t=0;if(!(4=this.len)throw a(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>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(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 l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new i(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,u.prototype.uint32=(p=4294967295,function(){if(p=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return p;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return p}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return l(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|l(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(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)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.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},u._configure=function(e){n=e,u.create=c(),n._configure();var t=o.Long?"toLong":"toNumber";o.merge(u.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},function(e,t,r){e.exports=s;var n=r(9);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var o=r(10),i=r(1);function s(e,t,r,o){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=o}function a(e){if(e.parent)for(var t=0;t=this._reconnectionAttempts?(c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1):(e=this.backoff.duration(),c("will wait %dms before reconnect attempt",e),this.reconnecting=!0,t=setTimeout((function(){r.skipReconnect||(c("attempting reconnect"),r.emitAll("reconnect_attempt",r.backoff.attempts),r.emitAll("reconnecting",r.backoff.attempts),r.skipReconnect||r.open((function(e){e?(c("reconnect attempt error"),r.reconnecting=!1,r.reconnect(),r.emitAll("reconnect_error",e.data)):(c("reconnect success"),r.onreconnect())})))}),e),this.subs.push({destroy:function(){clearTimeout(t)}}))},l.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,r){var n=r(23),o=r(83),i=r(92);r=r(93);t.polling=function(e){var t,r,s=!1,a=!1,u=!1!==e.jsonp;if("undefined"!=typeof location&&(t="https:"===location.protocol,r=(r=location.port)||(t?443:80),s=e.hostname!==location.hostname||r!==e.port,a=e.secure!==t),e.xdomain=s,e.xscheme=a,"open"in new n(e)&&!e.forceJSONP)return new o(e);if(!u)throw new Error("JSONP disabled");return new i(e)},t.websocket=r},function(e,t,r){var n=r(25),o=r(16),i=r(8),s=r(17),a=r(38),u=r(18)("engine.io-client:polling");e.exports=p;var c=null!=new(r(23))({xdomain:!1}).responseType;function p(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(p,n),p.prototype.name="polling",p.prototype.doOpen=function(){this.poll()},p.prototype.pause=function(e){var t,r=this;function n(){u("paused"),r.readyState="paused",e()}this.readyState="pausing",this.polling||!this.writable?(t=0,this.polling&&(u("we are currently polling - waiting to pause"),t++,this.once("pollComplete",(function(){u("pre-pause polling complete"),--t||n()}))),this.writable||(u("we are currently writing - waiting to pause"),t++,this.once("drain",(function(){u("pre-pause writing complete"),--t||n()})))):n()},p.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},p.prototype.onData=function(e){var t=this;u("polling got data %s",e),i.decodePayload(e,this.socket.binaryType,(function(e,r,n){return"opening"===t.readyState&&"open"===e.type&&t.onOpen(),"close"===e.type?(t.onClose(),!1):void t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},p.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},p.prototype.write=function(e){var t=this;function r(){t.writable=!0,t.emit("drain")}this.writable=!1,i.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,r)}))},p.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=o.encode(e),this.port&&("https"==t&&443!==Number(this.port)||"http"==t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){(function(t){var n=r(85),o=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);e.exports=function e(r){if(!r||"object"!=typeof r)return!1;if(n(r)){for(var o=0,a=r.length;o>>0,8|o.mapKey[u.keyType],u.keyType),void 0===f?t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",c,d):t(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|f,p,d),t("}")("}")):u.repeated?(t("if(%s!=null&&%s.length){",d,d),u.packed&&void 0!==o.packed[p]?t("w.uint32(%i).fork()",(u.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",d)("w.%s(%s[i])",p,d)("w.ldelim()"):(t("for(var i=0;i<%s.length;++i)",d),void 0===f?s(t,u,c,d+"[i]"):t("w.uint32(%i).%s(%s[i])",(u.id<<3|f)>>>0,p,d)),t("}")):(u.optional&&t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",d,u.name),void 0===f?s(t,u,c,d):t("w.uint32(%i).%s(%s)",(u.id<<3|f)>>>0,p,d))}return t("return w")};var n=r(6),o=r(12),i=r(1);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},function(e,t,r){e.exports=v;var n=r(11);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var o=r(6),i=r(28),s=r(10),a=r(57),u=r(58),c=r(29),p=r(27),f=r(26),d=r(1),l=r(55),h=r(60),y=r(61),g=r(62),m=r(63);function v(e,t){n.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}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>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",s.keyType)("case 2:"),void 0===o.basic[a]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",a),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[s.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',u):t("%s[k]=value",u)):s.repeated?(t("if(!(%s&&%s.length))",u,u)("%s=[]",u),void 0!==o.packed[a]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,u)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,u?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function s(e,t,r,o){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",o,r,o,o):e("d%s=types[%i].toObject(m%s,o)",o,r,o);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,i?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var s=0;s>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===n&&(t=o[e.charCodeAt(p)]<<2|o[e.charCodeAt(p+1)]>>4,s[a++]=255&t),1===n&&(t=o[e.charCodeAt(p)]<<10|o[e.charCodeAt(p+1)]<<4|o[e.charCodeAt(p+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],s=0,a=r-o;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return i.join("")}(e,s,a>2]+n[t<<4&63]+"==")):2==o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a>1,p=-7,f=r?o-1:0,d=r?-1:1;r=e[t+f];for(f+=d,i=r&(1<<-p)-1,r>>=-p,p+=a;0>=-p,p+=n;0>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,l=n?1:-1;i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+p?f/n:f*Math.pow(2,1-p))*n&&(s++,n/=2),c<=s+p?(a=0,s=c):1<=s+p?(a=(t*n-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));8<=o;e[r+d]=255&a,d+=l,a/=256,o-=8);for(s=s<>t&63|128)}function c(){if(n<=o)throw Error("Invalid byte index");var e=255&r[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}e.exports={version:"2.1.2",encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=s(e),o=n.length,c=-1,p="";++c>6&31|192):0==(4294901760&e)?(a(e,t)||(e=65533),r=i(e>>12&15|224),r+=u(e,6)):0==(4292870144&e)&&(r=i(e>>18&7|240),r+=u(e,12),r+=u(e,6)),r+i(63&e|128)}(n[c],r);return p},decode:function(e,t){var u=!1!==(t=t||{}).strict;r=s(e),n=r.length,o=0;for(var p,f=[];!1!==(p=function(e){var t,i;if(n>>10&1023|55296),t=56320|1023&t),o+=i(t);return o}(f)}}},function(e,t){var r;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t.encode=function(e){for(var t=new Uint8Array(e),n=t.length,o="",i=0;i>2],o+=r[(3&t[i])<<4|t[i+1]>>4],o+=r[(15&t[i+1])<<2|t[i+2]>>6],o+=r[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){var t,n,o,i,s=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);s=new ArrayBuffer(s);for(var c=new Uint8Array(s),p=0;p>4,c[u++]=(15&n)<<4|o>>2,c[u++]=(3&o)<<6|63&i;return s}},function(e,t){var r=void 0!==r?r:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=r&&r.prototype.append&&r.prototype.getBlob;function s(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t,r=e.buffer;return e.byteLength!==r.byteLength&&((t=new Uint8Array(e.byteLength)).set(new Uint8Array(r,e.byteOffset,e.byteLength)),r=t.buffer),r}return e}))}function a(e,t){t=t||{};var n=new r;return s(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=n?o?Blob:u:i?a:void 0},function(e,t,r){function n(e){var r;function n(){if(n.enabled){var e=n,o=+new Date,i=o-(r||o);e.diff=i,e.prev=r,e.curr=o,r=o;for(var s=new Array(arguments.length),a=0;a';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=s.iframeId,r.src="javascript:0"}r.id=s.iframeId,s.form.appendChild(r),s.iframe=r}this.form||(n=document.createElement("form"),o=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o),this.form.action=this.uri(),p(),e=e.replace(u,"\\\n"),this.area.value=e.replace(a,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===s.iframe.readyState&&c()}:this.iframe.onload=c}},function(e,t,r){(function(t){var n,o,i=r(25),s=r(8),a=r(16),u=r(17),c=r(38),p=r(18)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?n=WebSocket:"undefined"!=typeof self&&(n=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{o=r(94)}catch(u){}var f=n||o;function d(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=n&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(f=o),i.call(this,e)}u(e.exports=d,i),d.prototype.name="websocket",d.prototype.supportsBinary=!0,d.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new f(e,t):new f(e):new f(e,t,r)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},d.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},d.prototype.write=function(e){var r=this;this.writable=!1;for(var n=e.length,o=0,i=n;oencodeURIComponent(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{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,r){var n=e.exports=r(117);n.build="light",n.load=function(e,t,r){return(t="function"==typeof t?(r=t,new n.Root):t||new n.Root).load(e,r)},n.loadSync=function(e,t){return(t=t||new n.Root).loadSync(e)},n.encoder=r(55),n.decoder=r(60),n.verifier=r(61),n.converter=r(62),n.ReflectionObject=r(9),n.Namespace=r(11),n.Root=r(64),n.Enum=r(6),n.Type=r(56),n.Field=r(10),n.OneOf=r(28),n.MapField=r(57),n.Service=r(58),n.Method=r(59),n.Message=r(29),n.wrappers=r(63),n.types=r(12),n.util=r(1),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},function(e,t,r){var n=t;function o(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(26),n.BufferWriter=r(124),n.Reader=r(27),n.BufferReader=r(125),n.util=r(5),n.rpc=r(53),n.roots=r(54),n.configure=o,o()},function(e,t,r){t.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++;t.encode=function(e,t,r){for(var o,i=null,s=[],a=0,u=0;t>2],o=(3&c)<<4,u=1;break;case 1:s[a++]=n[o|c>>4],o=(15&c)<<2,u=2;break;case 2:s[a++]=n[o|c>>6],s[a++]=n[63&c],u=0}8191>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},t.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){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>>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 n(e,t,r){f[0]=e,t[r]=d[0],t[r+1]=d[1],t[r+2]=d[2],t[r+3]=d[3],t[r+4]=d[4],t[r+5]=d[5],t[r+6]=d[6],t[r+7]=d[7]}function u(e,t,r){f[0]=e,t[r]=d[7],t[r+1]=d[6],t[r+2]=d[5],t[r+3]=d[4],t[r+4]=d[3],t[r+5]=d[2],t[r+6]=d[1],t[r+7]=d[0]}function c(e,t){return d[0]=e[t],d[1]=e[t+1],d[2]=e[t+2],d[3]=e[t+3],d[4]=e[t+4],d[5]=e[t+5],d[6]=e[t+6],d[7]=e[t+7],f[0]}function p(e,t){return d[7]=e[t],d[6]=e[t+1],d[5]=e[t+2],d[4]=e[t+3],d[3]=e[t+4],d[2]=e[t+5],d[1]=e[t+6],d[0]=e[t+7],f[0]}var f,d,l,h,y;function g(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>>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){l[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){l[0]=e,t[r]=h[3],t[r+1]=h[2],t[r+2]=h[1],t[r+3]=h[0]}function b(e,t){return h[0]=e[t],h[1]=e[t+1],h[2]=e[t+2],h[3]=e[t+3],l[0]}function E(e,t){return h[3]=e[t],h[2]=e[t+1],h[1]=e[t+2],h[0]=e[t+3],l[0]}}function o(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 i(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 s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=n(n)},function(e,t,r){t.length=function(e){for(var t,r=0,n=0;n>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],8191>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=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){return r<1||o>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){if(0===e)return i;var t=e<0,r=(e=t?-e:e)>>>0;e=(e-r)/4294967296>>>0;return t&&(e=~e>>>0,r=~r>>>0,4294967295<++r&&(r=0,4294967295<++e&&(e=0))),new o(r,e)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(n.isString(e)){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.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},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?i:new o((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},o.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)},o.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},o.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},o.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=i;var n=r(26);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(5);function i(){n.call(this)}function s(e,t,r){e.length<40?o.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}i._configure=function(){i.alloc=o._Buffer_allocUnsafe,i.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&"set"===o.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(i.writeBytesBuffer,t,e),this},i.prototype.string=function(e){var t=o.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},i._configure()},function(e,t,r){e.exports=i;var n=r(27);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(5);function i(e){n.call(this,e)}i._configure=function(){o.Buffer&&(i.prototype._slice=o.Buffer.prototype.slice)},i.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},i._configure()},function(e,t,r){e.exports=o;var n=r(5);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,r){(e.exports=function e(t,r){"string"==typeof t&&(r=t,t=void 0);var n=[];function o(t){if("string"!=typeof t){var r=i();if(e.verbose,r="return "+r,t){for(var s=Object.keys(t),a=new Array(s.length+1),u=new Array(s.length),c=0;c{},l=i,h=i,y=(s=r(4),r.n(s));const g={XSYNC_V1:0,XSYNC_V2:1},m={UNREAD:0,SYNC:1,NOTICE:2,PROVISION:3},v={NONE:0,ZLIB:1},_={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},b={UNKNOWN:0,IOS:1,ANDR:2,WIN:3,OSX:4,LINUX:5,WEB:6},E={ENCRYPT_NONE:0,AES_CBC_128:1,AES_CBC_256:2,CUSTOM:3},w={UNKNOWN:0,MESSAGE:1,GROUP_NOTICE:2,ROSTER_NOTICE:3,USER_NOTICE:4,INFO:5,CONVERSATION:6},A={NORMAL:0,OPER:1,CHAT:2,GROUPCHAT:3},C={UNKNOWN:0,READ_ACK:1,READ_ALL:2,READ_CANCEL:3,DELIVER_ACK:4,RECALL:5,DELETE:6},N={TEXT:0,IMAGE:1,AUDIO:2,VIDEO:3,FILE:4,LOCATION:5,COMMAND:6,FORWARD:7},k=["text","image","audio","video","file","location","command","forward"],O={AT_LEAST_ONCE:0,AT_MOST_ONCE:1,EXACTLY_ONCE:2},S={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},R={WIRE:0,WIFI:1,NET_2G:2,NET_3G:3,NET_4G:4,NET_5G:5,UNKNOWN:6},T={UNKNOWN:0,ADDED:1,REMOVED:2,ACCEPTED:3,DECLINED:4,BLOCKED:5,UNBLOCKED:6,APPLIED:7,INFO_UPDATED:8,MUTED:9,UNMUTED:10},I={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},x={UNKNOWN:0,OPER:1},D={UNKNOWN:0,DELETE:1,DELETE_EVERYWHERE:2},U={UNREAD:0,DELIVERED:1,READ:2},M=["unread","delivered","read"],B=e=>{if(e instanceof y.a)return e.toString();const{low:t,high:r,unsigned:n=!0}=e;if(void 0!==t&&void 0!==r)return new y.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(B(e))})),t}const i={};return Object.keys(e).forEach((t=>{void 0!==e[t]&&(i[t]=B(e[t]))})),i},P=e=>{const{low:t,high:r,unsigned:n}=e;if(void 0!==t&&void 0!==r)return new y.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(P(e))})),t}const i={};return Object.keys(e).forEach((t=>{i[t]=P(e[t])})),i},F=(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 y.a(t,r,e).toNumber():void 0},L=e=>{if("string"==typeof e)return y.a.fromString(e);var{low:t,high:r,unsigned:n=!0}=e;return void 0!==t&&"undefined"!==r?new y.a(t,r,n):"number"==typeof e?y.a.fromNumber(e):new y.a},j=e=>void 0===e?"":"string"==typeof e?e:"number"==typeof e?e+"":(void 0!==e.low&&void 0!==e.high?new y.a(e.low,e.high,!0):new y.a(e)).toString(),G=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:c=0,ext:p,config:f,type:d}=t;let l=null,h=null;try{l=JSON.parse(u)}catch(e){}try{h=JSON.parse(f)}catch(e){}let y=i||t.status,g={id:j(o),from:j(r.uid),to:j(n.uid),content:a,type:k[c],ext:p,status:y||U.UNREAD,timestamp:j(s||0),toType:2==d?"roster":"group"};return l&&(g.attach=l),h&&(g.config=h),g},q=()=>{var e=window.localStorage.getItem("key_user_id");if(e)return+e},Y=(e,t,r=!0,n=0)=>{if(void 0!==t&&void 0!==e){var o=e;if(r&&(o=q()+"_"+e),0{if(void 0!==e){var n=e;if(t&&(n=q()+"_"+e),0{let n=e;t&&(n=q()+"_"+e),0<=r&&(n=n+"_"+r%31),window.localStorage.removeItem(n)},K=(e,t=!0)=>{for(var r=0;r<31;r++)V(e,t,r)},H={saveJoinedGroups:e=>{if(e){const t=(e=Array.isArray(e)?e:[e]).map((e=>e.group_id||e)),r=J("key_group_lists")||[],n=Array.from(new Set(t.concat(r)));Y("key_group_lists",n)}},removeGroup:e=>{const t=J("key_group_lists")||[],r=t.findIndex((t=>t===e));0<=r&&(t.splice(r,1),Y("key_group_lists",t))},getJoinedGroups:()=>J("key_group_lists"),saveGroupInfo:e=>{Array.isArray(e)||(e=[e]);const t=J("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)})),Y("key_group_infos",t)},getGroupInfo:e=>{var t=J("key_group_infos")[e]||{};return Object.assign(t,{group_id:e})},getGroupInfoList:()=>{const e=H.getJoinedGroups()||[],t=H.getAllGroupInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{group_id:e}))})),r},getAllGroupInfos:()=>J("key_group_infos")||{},saveGroupMembers:(e,t,r)=>{Array.isArray(t)||(t=[t]);const n=J("key_group_members")||{},o=n[e]||[];if(r)return n[e]=t,void Y("key_group_members",n);t.forEach((e=>{o.findIndex((t=>t===e))<0&&o.push(e)})),n[e]=o},removeGroupMembers:(e,t)=>{const r=(J("key_group_members")||{})[e]||[];t.forEach((e=>{var t=r.findIndex((t=>t===e));0<=t&&r.splice(t,1)})),Y("key_group_members",r)},getGroupMembers:e=>(J("key_group_members")||{})[e]||[],clear:()=>{V("key_group_infos"),V("key_group_members"),V("key_group_lists")}};var W=H;const z=()=>{var e=J("key_user_id",!1);if(e)return+e},X=()=>{V("key_user_id")},$=()=>{V("key_user_token")},Z=()=>{V("key_user_aes_key")},Q=()=>{V("key_user_device_sn")};var ee={saveToken:e=>Y("key_user_token",e),getToken:()=>J("key_user_token"),deleteToken:$,getAesKey:()=>J("key_user_aes_key"),saveAesKey:e=>Y("key_user_aes_key",e),deleteAesKey:Z,saveDeviceSN:e=>Y("key_user_device_sn",e),getDeviceSN:()=>{let e=J("key_user_device_sn");return e=e||999999999+Math.floor(214e4*Math.random())+"",+e},deleteDeviceSN:Q,saveUid:e=>{if(!e)throw new Error("uid is error ...");Y("key_user_id",e+"",!1)},getUid:z,removeUid:X,getDeviceGuid:()=>{if(!z())return"";let e=J("key_user_device_guid");return e||(e=z()+"_"+Math.floor(2147483648*Math.random()),Y("key_user_device_guid",e)),e},saveProfile:e=>Y("key_user_profile",e),getProfile:()=>J("key_user_profile"),clear:()=>{Q(),Z(),$(),X()},saveAppid:e=>{if(!e)throw new Error("Invalid appid ...");Y("key_app_id",e+"",!1)},getAppid:()=>J("key_app_id",!1)};const te={},re=e=>(void 0===te[e]&&(te[e]=[]),te[e]),ne=(e,t)=>{var r=re(e).findIndex((e=>e.toString()===t.toString()));-1{var r=re(e).findIndex((e=>e.toString()===t.toString()));0<=r&&te[e].splice(r,1)},ie=(e,t)=>{re(e).forEach((e=>{e(t)}))},se={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 c=e.content;if(c||s){"text"!=o&&(c=o);let e=F(n);var t=ee.getUid();e===t&&(e=F(r));const s=J("key_recent_store")||[],p=s.findIndex((t=>t.type===i&&t.id===e));-1{e.forEach((e=>{const r=t,n=J("key_recent_store")||[];let o="",i="";var s=n.findIndex((t=>t.type===r&&t.id===e));-1{const e=J("key_recent_store")||[],t=e.filter((e=>"roster"==e.type)).map((e=>e.id));return ie("imGetRecent",t),e},getRecentById:e=>{const t=J("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}=se.getRecentById(e);if(!(e<0)){const t=J("key_recent_store")||[];t.splice(e,1),Y("key_recent_store",t)}},clear:()=>{V("key_recent_store")}};var ae=se;const ue=e=>{var{payload:t}=e;if(!t)return!1;var{type:e,operation:t={}}=t;if(!t||e!==A.OPER)return!1;var{type:t}=t;return t===C.READ_ACK||t==C.READ_ALL},ce=(e,t)=>{const r=L(t.id);if(0===e.length)e.push(t);else{var n=e[0],o=e[e.length-1];if(-1===r.comp(L(n.id)))e.unshift(t);else if(1===r.comp(L(o.id)))e.push(t);else{let n=0,o=0;for(;n{const t=J("key_roster_sending_message")||[];var r;t.push(e),100<(r=t.length)&&t.splice(0,r-100),Y("key_roster_sending_message",t);var{to:r,id:e}=e;ie("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedRosterMessage:e=>{const{client_mid:t,server_mid:r}=e,n=J("key_roster_sending_message")||[];if(r){var o=n.findIndex((e=>F(e.id)===F(t)));if(-1F(e.id)===F(t)));-1{var{from:t,to:r,type:n}=e;if("command"!=n&&"forward"!=n){n=F(t),t=F(ee.getUid()),r=F(r);const o=J("key_roster_message_store",!0,n=n===t?r:n)||{},i=o[n]||[];ce(i,e),100(J("key_roster_message_store",!0,e)||{})[e]||[],saveFormatedRosterMessage:(e,t=[])=>{const r=J("key_roster_message_store",!0,e)||{};r[e]=t,Y("key_roster_message_store",r,!0,e)},getRosterUnreadMessageIdsByRosterid:e=>{const t=(J("key_roster_message_store",!0,e)||{})[e]||[],r=[];return t.forEach((e=>{var{status:t=U.READ,id:e}=e;t==U.UNREAD&&r.push(e)})),r},deleteRosterMessageByRosterId:e=>{const t=J("key_roster_message_store",!0,e)||{};t[e]&&delete t[e],Y("key_roster_message_store",t,!0,e)},deleteSingleRosterMessage:(e,t)=>{const r=J("key_roster_message_store",!0,e)||{},n=j(t),o=r[e]||[],i=o.findIndex((e=>j(e.id)===n));-1{const t=J("key_group_sending_message")||[];var r;t.push(e),100<(r=t.length)&&t.splice(0,r-100),Y("key_group_sending_message",t);var{to:r,id:e}=e;ie("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedGroupMessage:e=>{const{client_mid:t,server_mid:r}=e,n=J("key_group_sending_message")||[],o=n.findIndex((e=>F(e.id)===F(t)));if(-1{var{to:t,type:r}=e;if("command"!=r&&"forward"!=r){const r=F(t),n=J("key_group_message_store",!0,r)||{},o=n[r]||[];ce(o,e),100(J("key_group_message_store",!0,e)||{})[e]||[],saveFormatedGroupMessage:(e,t=[])=>{const r=J("key_group_message_store",!0,e)||{};r[e]=t,Y("key_group_message_store",r,!0,e)},getGroupUnreadMessageIdsByGid:e=>{const t=(J("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=J("key_group_message_store",!0,e)||{};t[e]&&delete t[e],Y("key_group_message_store",t,!0,e)},deleteSingleGroupMessage:(e,t)=>{const r=J("key_group_message_store",!0,e)||{};t=j(t);const n=r[e]||[],o=n.findIndex((e=>j(e.id)===t));-1{const t=pe.getRosterMessage(e)||[];let r=0;const n=ee.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=F(t))&&t!==n&&e!==U.READ&&r++})),r},getUnreadByGroupId:e=>{const t=pe.getGroupMessage(e)||[];let r=0;const n=ee.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=F(t))&&t!==n&&e!==U.READ&&r++})),r},getRosterMessageById:(e,t)=>{const r=J("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=J("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?pe.deleteGroupMessageByGid(e):pe.deleteRosterMessageByRosterId(e)},clearAll:()=>{K("key_roster_message_store"),K("key_group_message_store")}};var fe=pe,de=e=>{const t=J("key_notice_store")||[];t.push(e),50<(e=t.length)&&t.splice(0,e-50),Y("key_notice_store",t)};u=()=>J("key_notice_store")||[];const le={saveRosterList:(e=[])=>{const t=(e=Array.isArray(e)?e:[e]).map((e=>e.roster_user_id||e.user_id||e)),r=le.getRosterList()||[];var n=Array.isArray(r)?Array.from(new Set(r.concat(t))):t;Y("key_roster_lists",n),le.saveRosterInfo(e)},getRosterList:()=>J("key_roster_lists"),getRosterInfoList:()=>{const e=le.getRosterList()||[],t=le.getAllRosterInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{user_id:e}))})),r},removeRoster:e=>{const t=le.getRosterList(),r=t.indexOf(e);0<=r&&t.splice(r,1),Y("key_roster_lists",t)},removeRosterList:()=>V("key_roster_lists"),saveRosterInfo:(e=[])=>{Array.isArray(e)||(e=[e]);const t=le.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))})),Y("key_roster_infos",t)},getRosterInfo:e=>{var t=(J("key_roster_infos")||{})[e];return t&&Object.assign(t,{user_id:e})},getAllRosterInfos:()=>J("key_roster_infos"),clear:()=>{V("key_roster_infos"),V("key_roster_lists")}};var he=le,ye=(p=r(19),r.n(p));let ge={errTimer:null,errCount:0};ne("refresh_ratel",(e=>{e&&(f.a.defaults.baseURL=e)}));const me=["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"];f.a.defaults.timeout=2e4,f.a.interceptors.request.use((e=>{var t=ee.getToken(),r=ee.getAppid();if(r&&(e.headers.common.app_id=r),t&&(e.headers.common["access-token"]=t),(e=>{let t=!0;return me.forEach((r=>{-1Promise.reject(e)));const ve=(e,t="get",r={},n=[],o=!1,i={})=>{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={};return"get"===(t=t.toLowerCase())||"post"===t&&o?(0+e))),r.user_list&&Array.isArray(r.user_list)&&(r.user_list=r.user_list.map((e=>+e))),r.file_list&&Array.isArray(r.file_list)&&(r.file_list=r.file_list.map((e=>+e))),a=r),f.a[t](e,a,i).then((t=>{ge.errTimer&&clearTimeout(ge.errTimer),ge.errTimer=null,ge.errCount=0;var{data:r={}}=t;if(0!==Object.keys(i).length)return"boolean"==typeof r.data&&r.data||"string"==typeof r.Status&&"OK"===r.Status?void 0:Promise.reject({config:i,url:e});var{data:n,code:t,message:r}=r;return 200===t?n:(402===t&&ie("flooNotice",{category:"action",desc:"relogin"}),Promise.reject({url:e,code:t,message:r}))})).catch((e=>(ge.errTimer&&clearTimeout(ge.errTimer),ge.errTimer=null,ge.errCount=ge.errCount+1,5<=ge.errCount?(ge.errCount=0,ie("ratelError")):ge.errTimer=setTimeout((()=>{ge.errCount=0}),18e5),Promise.reject(e))))},_e=(e,t)=>ve(e,"get",t,["app_id"],!0),be=e=>ve("/token/user","post",e,[["mobile","name"],"password"]),Ee=e=>ve("/token/id","post",e,["user_id","password"]),we=e=>ve("/user/register/v2","post",e,["username","password"]),Ae=e=>ve("/app/user/mobile_bind","post",e,["captcha","mobile"]),Ce=e=>ve("/app/user/mobile_update","post",e,["mobile"]),Ne=e=>ve("/app/captcha/sms","get",e,["mobile"],!0),ke=e=>ve("/app/user/name_check","get",e,["username"],!0),Oe=e=>ve("/app/user/mobile_bind","post",e,["captcha","mobile"]),Se=e=>ve("/app/user/mobile_bind_with_sign","post",e,["sign","mobile"]),Re=e=>ve("/app/user/info_pwd","get",e,["captcha","mobile"],!0),Te=e=>ve("/app/captcha/image","post",e,[]),Ie=e=>ve("/app/captcha/sms_web","get",e,["captcha","image_id","mobile"],!0),xe=e=>ve("/roster/accept","post",e,["user_id"],!0),De=e=>ve("/roster/apply","post",e,["user_id","alias"]),Ue=e=>ve("/roster/decline","post",e,["user_id"]),Me=e=>ve("/roster/delete","post",e,["user_id"],!0),Be=e=>ve("/roster/ext","post",e,["user_id","ext"]),Pe=e=>ve("/roster/id","get",e,["user_id"]),Fe=e=>ve("/roster/list","get",e,[]),Le=e=>ve("/roster/list","post",e,["list"]),je=e=>ve("/roster/name","get",e,["username"]),Ge=e=>ve("/roster/apply/list","get",e,["cursor"],!0),qe=e=>ve("/roster/blocked_list","get",e,[""],!0),Ye=e=>ve("/roster/block","post",e,["user_id"],!0),Je=e=>ve("/roster/unblock","post",e,["user_id"],!0),Ve=e=>ve("/group/admin/add","post",e,["group_id","user_list"]),Ke=e=>ve("/group/admin_list","get",e,["group_id"],!0),He=e=>ve("/group/admin/remove","post",e,["group_id","user_list"]),We=e=>ve("/group/announcement","get",e,["announcement_id","group_id"]),ze=e=>ve("/group/announcement/delete","post",e,["announcement_id","group_id"],!0),Xe=e=>ve("/group/announcement/edit","post",e,["group_id","content","title"]),$e=e=>ve("/group/announcement/list","get",e,["group_id"],!0),Ze=e=>ve("/group/create","post",e,["name"]),Qe=e=>ve("/group/destroy","post",e,["group_id"],!0),et=e=>ve("/group/info","get",e,["group_id"]),tt=e=>ve("/group/info/avatar","post",e,["group_id","value"]),rt=e=>ve("/group/info/description","post",e,["group_id","value"]),nt=e=>ve("/group/info/name","post",e,["group_id","value"]),ot=e=>ve("/group/member_list","get",e,["group_id"]),it=e=>ve("/group/msg/mute_mode","post",e,["group_id","msg_mute_mode"]),st=e=>ve("/group/msg/not_disturb","post",e,["group_id","value"]),at=()=>ve("/group/public_list","get",{},[]),ut=e=>ve("/group/banned_list","get",e,["group_id"]),ct=e=>ve("/group/ban","post",e,["group_id","duration","user_list"]),pt=e=>ve("/group/unban","post",e,["group_id","user_list"]),ft=e=>ve("/group/settings","get",e,["group_id"]),dt=e=>ve("/group/settings/allow_member_invitation","post",e,["group_id","value"]),lt=e=>ve("/group/settings/allow_member_modify","post",e,["group_id","value"]),ht=e=>ve("/group/settings/enable_read_ack","post",e,["group_id","value"]),yt=e=>ve("/group/settings/history_visible","post",e,["group_id","value"]),gt=e=>ve("/group/settings/require_admin_approval","post",e,["group_id","apply_approval"]),mt=e=>ve("/group/transfer","post",e,["group_id","new_owner"]),vt=e=>ve("/group/user_joined","get",e),_t=e=>ve("/group/apply","post",e,["group_id"]),bt=e=>ve("/group/apply/handle","post",e,["approval","group_id","user_id"]),Et=e=>ve("/group/blocked_list","get",e,["group_id"]),wt=e=>ve("/group/block","post",e,["user_list","group_id"]),At=e=>ve("/group/unblock","post",e,["user_list","group_id"]),Ct=e=>ve("/group/kick","post",e,["user_list","group_id"]),Nt=e=>ve("/group/invite","post",e,["user_list","group_id"]),kt=e=>ve("/group/invite/handle","post",e,["approval","user_id","group_id"]),Ot=e=>ve("/group/info/batch","post",e,["group_list"]),St=e=>ve("/group/members/display_name","post",e,["group_id","user_list"]),Rt=e=>ve("/group/leave","post",e,["group_id"],!0),Tt=e=>ve("/group/display_name","post",e,["group_id","value"]),It=e=>ve("/group/application_list","post",e,["group_list"]),xt=()=>ve("/group/invitation_list","get",{},[]),Dt=e=>ve("/group/file/list","get",e,["group_id"],!0),Ut=e=>ve("/group/file/delete","post",e,["file_list","group_id"]),Mt=e=>ve("/group/file/upload","post",e,["name","size","url","group_id"]),Bt=e=>ve("/user/authmode","post",e,["value"],!0),Pt=e=>ve("/user/avatar","post",e,["avatar"]),Ft=e=>ve("/user/mobile","post",e,["mobile"],!0),Lt=e=>ve("/user/nickname","post",e,["nick_name"],!0),jt=()=>ve("/user/profile","get",{},[]),Gt=e=>ve("/user/profile","post",e,[]),qt=e=>ve("/user/push","post",e,["value"]),Yt=e=>ve("/user/push/detail","post",e,["value"]),Jt=e=>ve("/user/push/limit","post",e,["no_push_end_hour","no_push_start_hour"]),Vt=e=>ve("/user/push/nickname","post",e,["value"]),Kt=()=>ve("/user/settings","get",{},[]),Ht=e=>ve("/user/settings","post",e,["user_id"]),Wt=e=>ve("/user/sounds","post",e,["value"]),zt=e=>ve("/user/vibratory","post",e,["value"]),Xt=e=>ve("/user/token/bind","post",e,["device_sn","device_token","notifier_name"]),$t=e=>ve("/user/token/unbind","post",e,[],!0),Zt=e=>ve("/file/upload/forward","get",e,["file_sign","access-token","to_id","to_type"],!0),Qt=(e,t,r)=>ve(e,"post",t,[],!1,r),er=e=>ve("/file/upload/avatar/user","get",e,[],!0),tr=e=>ve("/file/upload/avatar/group","get",e,["group_id"],!0),rr=e=>ve("/file/upload/chat","get",e,["file_type","to_id","to_type"],!0),nr=(e,t,r)=>ve(e,"get",t,[],!0,r),or=e=>ve("/app/qr_code","get",e,[]),ir=e=>ve("/app/qr_login","get",e,["qr_code"]),sr=e=>ve("/app/qrcode/group_sign","get",e,["group_id"],!0),ar=e=>ve("/app/qrcode/group_invite","get",e,["qr_info"],!0),ur=e=>ve("/user/bind_openid","get",e,["open_id"],!0),cr=e=>ve("/app/wechat_login","get",e,["code"],!0),pr=e=>ve("/app/support_staff","get",e,[],!0),fr=()=>ve("/app/wechat/unbind","post"),dr=()=>ve("/app/wechat/is_bind","get"),lr=e=>ve("/app/wechat/bind","post",e,["open_id","type"]),hr=function(e={}){this.uid=e.uid||0,e=void 0===e.deviceSN?ee.getDeviceSN():e.deviceSN,this.deviceSN=e};hr.prototype.setUid=function(e){this.uid=e},hr.prototype.setDeviceSN=function(e){this.deviceSN=e};var yr=hr;function gr(e){var{operation:t={type:C.UNKNOWN,mid:0}}=e;void 0!==(e=Object.assign({},{type:A.NORMAL,ctype:N.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)}gr.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 mr=gr;function vr(e){void 0!==(e=Object.assign({},{vsn:g.XSYNC_V1,compress_method:v.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)}vr.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 _r=vr;function br(e){void 0!==(e=Object.assign({},{encrypt_method:E.ENCRYPT_NONE,os_type:b.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)}br.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 Er=br;function wr(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)}wr.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 Ar=wr;function Cr(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)}Cr.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 Nr=Cr;function kr(e){void 0!==e.type&&(this.type=e.type),void 0!==e.operation&&(this.operation=e.operation)}kr.prototype={setType:function(e){this.type=e},setOperation:function(e){this.operation=e}};var Or=kr;let Sr=ee.getDeviceSN(),Rr=ee.getDeviceGuid();ne("imReceiveUserNotice",(e=>{"kick"===e&&(Sr=0,Rr=999999999+Math.floor(214e4*Math.random())+"",l("new Guid",Rr))})),ne("temporary_deviceSN",(e=>{Sr=e}));const Tr=e=>{const t=new _r;t.setCommond(m.SYNC);const r=new Ar;return e.xid&&r.setXid(e.xid),e.next_key&&r.setKey(e.next_key),t.setPayload(r),t},Ir=e=>{var{gid:t,content:r,type:n,attachment:o,ext:i,priority:e}=e;let s=k.indexOf(n);-1===s&&(s=N.TEXT);const a=new yr({uid:+ee.getUid(),deviceSN:Sr}),u=new yr({uid:t,deviceSN:0}),c=new _r;c.setCommond(m.SYNC);const p=new Ar,f=new mr({from:a,to:u,content:r,ctype:s,type:A.GROUPCHAT,ext:i});return 0{var{uid:t,content:r,type:n,ext:o,attachment:i}=e;ie("imSendRosterMessage",e);let s=k.indexOf(n);-1===s&&(s=N.TEXT);const a=new yr({uid:+ee.getUid(),deviceSN:Sr}),u=new yr({uid:+t,deviceSN:0}),c=new _r;c.setCommond(m.SYNC);const p=new Ar,f=new mr({from:a,to:u,content:r,ctype:s,type:A.CHAT,ext:o});return 0{t=L(t);const r=new _r;r.setCommond(m.SYNC);const n=new yr({uid:ee.getUid(),deviceSN:Sr}),o=new yr({uid:F(e),deviceSN:0}),i=new Ar,s=new mr({from:n,to:o,ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_ACK,mid:t}}),a=new Nr({id:(new Date).getTime()+Math.floor(256*Math.random()),from:n,to:o,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Ur=(e,t)=>{t=L(t);const r=new _r;r.setCommond(m.SYNC);const n=new yr({uid:ee.getUid(),deviceSN:Sr}),o=new yr({uid:F(e),deviceSN:0}),i=new Ar,s=new mr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.RECALL,mid:t,xid:o}}),a=new Nr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:o,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Mr=(e,t)=>{const r=new _r;r.setCommond(m.SYNC);const n=new yr({uid:ee.getUid(),deviceSN:Sr}),o=new yr({uid:F(e),deviceSN:0}),i=new Ar,s=new mr({from:n,to:n,ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_ALL,xid:o,mid:t}}),a=new Nr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Br=(e,t,r)=>{var{content:n,attach:o,type:r}=r;return e?xr({uid:e,content:n,type:r,attachment:o}):Ir({gid:t,content:n,type:r,attachment:o})},Pr={};let Fr=!1;const Lr=e=>{var{status:t={}}=e,{code:r,reason:n}=t;if(r===_.OK)return!0;if(void 0===t.code)return!0;r!==_.INVALID_TOKEN&&r!==_.UNAUTHORIZED||ie("flooNotice",{category:"action",desc:"relogin"}),r!==_.USER_FROZEN&&r!==_.INVALID_LICENSE&&r!==_.LICENSE_LIMIT&&r!==_.APP_FROZEN||ie("flooNotice",{category:"action",desc:"relogin_manually"}),r===_.USER_BANNED?ie("flooError",{category:"USER_BANNED",desc:"用户被禁言"}):r===_.USER_FROZEN?ie("flooError",{category:"USER_FROZEN",desc:"用户被冻结,请联系App管理员。"}):r===_.APP_FROZEN?ie("flooError",{category:"APP_FROZEN",desc:"APP 被冻结,请登陆美信拓扑控制台查看详情。"}):r===_.INVALID_LICENSE?ie("flooError",{category:"LICENSE",desc:"æ— æ•ˆ LICENSE,请确认服务已按时付费。"}):r===_.LICENSE_LIMIT?ie("flooError",{category:"LICENSE",desc:"超出 LICENSE ç”¨æˆ·æ•°é™åˆ¶ï¼Œè¯·è´­ä¹°æ›´é«˜è§„æ ¼æœåŠ¡ã€‚"}):ie("flooError",{category:r,desc:n});var{client_mid:e}=e;return e&&ie("onSendingMessageStatusChanged",{status:"failed",mid:F(e)}),!1},jr=e=>{const{xid:t}=e,{uid:r=0}=t;Pr[r+""]?setTimeout((()=>{Pr[r]=!1,jr(e)}),3e3):(Pr[r+""]=!0,ie("sendMessage",(e=>{e.uid=e.uid||0;const t=new _r;t.setCommond(m.SYNC);const r=new Ar;return r.setXid(e),t.setPayload(r),t})(t)))},Gr=(e=[])=>{e.forEach((e=>{var{ns:t}=e;t===w.UNKNOWN&&l("received unknown message ...",e),t===w.MESSAGE&&Yr(e),t===w.GROUP_NOTICE&&Jr(e),t===w.ROSTER_NOTICE&&Vr(e),t===w.USER_NOTICE&&Kr(e),t===w.CONVERSATION&&qr(e)}))},qr=e=>{var{payload:t={}}=e,{type:e,operation:t}=t;if(e===x.OPER&&(t.op_type==D.DELETE||t.op_type==D.DELETE_EVERYWHERE)){const{xid:e}=t;ie("deleteConveration",{id:e.uid,source:"other_operation"})}},Yr=e=>{var{payload:t={}}=e,{type:r,operation:t}=t;r===A.NORMAL&&ie("messageNormal",e),r===A.CHAT&&ie("imRosterMessage",e),r===A.GROUPCHAT&&ie("imGroupMessage",e),r===A.OPER&&(t.type===C.UNKNOWN&&l("received unknown operation: ",e),e.isReceived=!0,ie("onActionMessage",e))},Jr=e=>{var{payload:t={}}=e,{type:t}=t;t===S.UNKNOWN&&l("received unknown groupnotice: ",e),t===S.PRESENCE&&ie("imGroupPresence",e),t===S.ABSENCE&&ie("imGroupAbesence",e),t===S.CREATED&&ie("imGroupCreated",e),t===S.DESTROYED&&ie("imGroupDestoryed",e),t===S.JOINED&&ie("imGroupJoined",e),t===S.APPLYED&&ie("imGroupApplyed",e),t===S.APPLY_ACCEPTED&&ie("imGroupApplyAccepted",e),t===S.APPLY_DECLINED&&ie("imGroupApplyDeclined",e),t===S.INVITED&&ie("imGroupInvited",e),t===S.INVITE_ACCEPTED&&ie("imGroupInvitedAccepted",e),t===S.INVITE_DECLINED&&ie("imGroupInvitedDeclined",e),t===S.KICKED&&ie("imGroupKicked",e),t===S.BANNED&&ie("imGroupBaned",e),t===S.UNBANNED&&ie("imGroupUnbaned",e),t===S.OWNER_ASSIGNED&&ie("imGroupOwnerAssigned",e),t===S.ADMIN_GRANTED&&ie("imGroupAdminGranted",e),t===S.ADMIN_REVOKED&&ie("imGroupAdminRevoked",e),t===S.BLOCKED&&ie("imGroupBlocked",e),t===S.UNBLOCKED&&ie("imGroupUnblocked",e),t===S.MUTED&&ie("imGroupMuted",e),t===S.UNMUTED&&ie("imGroupUnmuted",e),t===S.INFO_UPDATED&&ie("imGroupInfoUpdated",e),t===S.ANNOUNCEMENT_UPDATED&&ie("imGroupAnnouncementUpdated",e)},Vr=e=>{var{payload:t={}}=e,{type:t}=t;t===T.UNKNOWN&&l("received unknown rosterNotice: ",e),t===T.ADDED&&ie("imRosterAdded",e),t===T.REMOVED&&ie("imRosterRemoved",e),t===T.ACCEPTED&&ie("imRosterAccepted",e),t===T.DECLINED&&ie("imRosterDeclined",e),t===T.BANNED&&ie("imRosterBaned",e),t===T.UNBANNED&&ie("imRosterUnbaned",e),t===T.INFO_UPDATED&&ie("imRosterInfoUpdated",e)},Kr=e=>{var{payload:t={}}=e,{type:t}=t;if(t===I.UNKNOWN||t===I.PASSWORD_CHANGED||t===I.FROZEN||t===I.REMOVED||t===I.KICKED_BY_OTHER_DEVICE||t===I.DEVICE_REMOVED||t===I.CLUSTER_CHANGED)return ee.deleteToken(),ee.deleteDeviceSN(),void ie("flooNotice",{category:"action",desc:"relogin_manually"});t===I.UNKNOWN&&l("received unknown userNotice: ",e);let r="logout";t===I.KICK_BY_SAME_DEVICE&&(r="kick",Fr=!0),ie("imReceiveUserNotice",r)};var Hr=e=>{var{command:t=0,payload:e}=e;t===m.UNREAD&&(e=>{const{unread:t=[]}=e;ie("imReceivedUnread",t),t.forEach((e=>{var{xid:t,n:e}=e;0{if(Lr(e)){var{metas:t=[],xid:r,is_full_sync:n,client_mid:o}=e;if(!n&&o&&L(o).gt(0))return ie("receivedSendMessage",o),void setTimeout((()=>{fe.dealSendedRosterMessage(e),fe.dealSendedGroupMessage(e)}),20);var{next_key:o=0}=e;if(0===o||L(o).eq(0)){const{uid:e=0}=r;delete Pr[e+""]}n?(t&&t.length&&Gr(t),ie("onReceiveHistoryMsg",{messages:(e=>{let t=[];return e.forEach((e=>{t.push(G(e))})),t})(t),next:o})):(t.length&&Gr(t),0===o||L(o).eq(0)||ie("sendMessage",Tr({xid:r,next_key:o})))}})(e),t===m.NOTICE&&jr(e),t===m.PROVISION&&(e=>{if(!Lr(e))return ie("flooNotice",{category:"loginMessage",desc:"login socket failure ......"}),ie("loginFail","socket_failure");var{xid:e={}}=e,{deviceSN:e}=e;ie("temporary_deviceSN",e),Fr||e&&ee.saveDeviceSN(e),ie("flooNotice",{category:"loginMessage",desc:"login socket success....."}),ie("loginSuccess",{}),ie("sendMessage",{vsn:0,compress_method:0,command:0})})(e)};i=r(0),s=r.n(i),p=r(2),i=r.n(p);const Wr=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Provision"),zr=e=>Wr.decode(e),Xr=e=>Wr.encode(e).finish(),$r=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.XID"),Zr=e=>$r.encode(e).finish();p=r(66),p=r.n(p);const Qr=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.MessageBody");p=r(67),p=r.n(p);const en=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.GroupNotice");p=r(68),p=r.n(p);const tn=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.RosterNotice");p=r(69),p=r.n(p);const rn=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.UserNotice");p=r(70),p=r.n(p);const nn=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.Info");p=r(71),p=r.n(p);const on=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.Conversation"),sn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Meta"),an=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.SyncUL"),un=e=>an.decode(e),cn=e=>(e.meta&&(e.meta=(e=>{var t,r,{ns:n,payload:o}=e;return n===w.MESSAGE&&(e.payload=(r=o,Qr.encode(r).finish())),n===w.GROUP_NOTICE&&(e.payload=(e=>{e.from=Zr(e.from);const t=[];return(e.to||[]).forEach((e=>{t.push(Zr(e))})),e.to=t,en.encode(e).finish()})(o)),n===w.ROSTER_NOTICE&&(e.payload=(r=o,tn.encode(r).finish())),n===w.USER_NOTICE&&(e.payload=(t=o,rn.encode(t).finish())),n===w.INFO&&(e.payload=(t=o,nn.encode(t).finish())),n===w.CONVERSATION&&(e.payload=(o=o,on.encode(o).finish())),sn.create(e)})(e.meta)),an.encode(e).finish()),pn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.UnreadDL"),fn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.SyncDL"),dn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Notice"),ln=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Frame"),hn=e=>{e=new Uint8Array(e);const t=ln.decode(e),{command:r,payload:n}=t;return r===m.UNREAD?t.payload=(e=n,pn.decode(e)):r===m.SYNC?t.payload=(e=>{const t=fn.decode(e),{metas:r=[]}=t,n=[];return r.forEach((e=>{var t,r,o,{ns:i,payload:s}=e;i===w.MESSAGE&&(e.payload=(o=s,Qr.decode(o))),i===w.GROUP_NOTICE&&(e.payload=(r=s,en.decode(r))),i===w.ROSTER_NOTICE&&(e.payload=(r=s,tn.decode(r))),i===w.USER_NOTICE&&(e.payload=(t=s,rn.decode(t))),i===w.INFO&&(e.payload=(t=s,nn.decode(t))),i===w.CONVERSATION&&(e.payload=(s=s,on.decode(s))),n.push(e)})),t.metas=n,t})(n):r===m.NOTICE?t.payload={xid:(e=>$r.decode(e))(n)}:r===m.PROVISION&&(t.payload=zr(n)),t},yn=e=>{var t,{payload:r,command:n}=e;return r&&(n===m.UNREAD?e.payload=(t=r,pn.encode(t).finish()):n===m.SYNC?e.payload=cn(r):n===m.NOTICE?e.payload=(t=r,dn.encode(t).finish()):n===m.PROVISION&&(e.payload=Xr(r))),ln.encode(e).finish()};s.a.util.Long=y.a,s.a.configure();const{encode:gn,decode:mn}=a;let vn={},_n=0,bn=null,En=null,wn="normal";const An=()=>1e4+2e4*_n;let Cn=null;ne("refresh_fireplace",(e=>{vn=Object.assign({fireplace:e},vn)})),ne("loginSuccess",(()=>{_n=0,bn&&clearInterval(bn),bn=setInterval((()=>{Sn({vsn:0,compress_method:0,command:0})}),5e4)})),ne("sendMessage",(e=>{Sn(e)})),ne("imReceiveUserNotice",(e=>{wn=e})),ne("reconnect",(({})=>{"normal"===wn&&Nn()}));const Nn=()=>{5<=_n?(_n=0,ie("fireplaceError")):_n++,kn()},kn=()=>{var e=Math.floor(9e3*Math.random())+1e3;setTimeout((()=>{Cn.connect()}),e)},On=()=>{"kick"!==wn&&"normal"!==wn||(ie("flooNotice",{category:"loginMessage",desc:"logining socket service..."}),ie("sendMessage",(e=>{const t=new yr({uid:+e.uid,deviceSN:Sr}),r=new Er;Rr=Rr||ee.getDeviceGuid(),r.setXid(t),r.setToken(e.token),r.setDeviceguid(Rr),r.setSdkvsn("2.0.0"),r.setEncryptmethod(E.AES_CBC_128),r.setEncryptkey(ee.getAesKey()),r.setDeviceinfo("Web");const n=new _r;return n.setCommond(m.PROVISION),n.setPayload(r),n})({token:ee.getToken(),uid:ee.getUid()})))},Sn=e=>{h("SEND :"+JSON.stringify(B(e)));const t=gn(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);t.forEach(((e,t)=>{n[t]=e})),Cn.emit("frame",r)};var Rn=Object.assign(o,{connect:function(e){vn=e,_n=0,wn="normal",(()=>{Cn&&Cn.destroy();var{fireplace:e}=vn;ie("flooNotice",{category:"loginMessage",desc:"socket connecting..."}),Cn=c()(e,{timeout:An(),transports:["websocket"]}),Cn.on("connect",(()=>{ie("flooNotice",{category:"loginMessage",desc:"socket connect success..."}),En&&clearTimeout(En),En=setTimeout(On,An()/10+1e3)})),Cn.on("frame",(e=>{(e=>{e=mn(e=e),h("RECV :"+JSON.stringify(B(e))),Hr(e)})(e)})),Cn.on("disconnect",(e=>{ie("reconnect",{reason:e})})),Cn.on("error",(e=>{ie("reconnect",{reason:"SocketError"})})),Cn.on("reconnect_attempt",(e=>{Cn.io.opts.transports=["polling","websocket"]}))})()},sendMessage:Sn,disConnect:()=>{wn="logout",Cn.disconnect()}}),Tn={asyncGetRosterIdList:e=>e?Rn.rosterList({}).then((e=>(he.saveRosterList(e),e.map((e=>e.user_id||e))))):Promise.resolve(he.getRosterList()),asyncGetRosterInfo:(e,t)=>{var r=he.getRosterInfo(e);return r&&r.username&&!t?Promise.resolve(r):Rn.rosterListPost({list:[e]}).then((e=>(he.saveRosterInfo(e),ie("onRosterListUpdate"),e.length&&e[0]||{})))},asyncRegester:e=>Rn.userRegister(e),asnycGetRosterListDetailByIds:e=>{if(!e||!e.length)return Promise.resolve({});const t=he.getAllRosterInfos(),r=[];return e.forEach((e=>{var n=t[e];n&&n.username||r.push(e)})),(e=Array.from(new Set(r))).length?Rn.rosterListPost({list:e}).then((e=>(he.saveRosterInfo(e),ie("onRosterListUpdate"),e))):Promise.resolve()},asyncGetUserProfile:e=>{var t=ee.getProfile();return t&&(t.name||t.mobile)&&!e?Promise.resolve(t):Rn.userProfile().then((e=>(ee.saveProfile(e),e)))},getRosterMessageByRid:e=>fe.getRosterMessage(e),readRosterMessage:(e,t)=>{ie("imReadRosterMessage",{roster_id:e,mid:t})},asyncDeleteRoster:e=>Rn.rosterDelete(e).then((t=>(he.removeRoster(e.user_id),ae.deleteRecentById(e.user_id),ie("onRosterListUpdate"),t))),getAllRosterDetail:()=>he.getAllRosterInfos(),recallMessage:(e,t)=>{t=Ur(e,t),ie("swapSendMessage",B(t)),ie("sendMessage",t)},deleteMessage:(e,t)=>{t=((e,t)=>{t=L(t);const r=new _r;r.setCommond(m.SYNC);const n=new yr({uid:ee.getUid(),deviceSN:Sr}),o=new yr({uid:F(e),deviceSN:0}),i=new Ar,s=new mr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.DELETE,mid:t,xid:o}}),a=new Nr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),ie("swapSendMessage",B(t)),ie("sendMessage",t)},getUnreadCount:e=>fe.getUnreadByRosterId(e),unreadMessage:(e,t)=>{t=((e,t)=>{t=L(t);const r=new _r;r.setCommond(m.SYNC);const n=new yr({uid:ee.getUid(),deviceSN:Sr}),o=new yr({uid:F(e),deviceSN:0}),i=new Ar,s=new mr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_CANCEL,mid:t,xid:o}}),a=new Nr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),ie("swapSendMessage",B(t)),ie("sendMessage",t)},getRosterInfo:e=>he.getRosterInfo(e),asyncGetApplyList:Rn.rosterApplylist,asyncGetBlockedlist:Rn.rosterBlockedlist,asyncBlockeAdd:Rn.rosterBlockedAdd,asyncBlockeRemove:Rn.rosterBlockeRemove,asyncApply:Rn.rosterApply,asyncAccept:Rn.rosterAccept,asyncDecline:Rn.rosterDecline,asyncUpdateRosterExt:Rn.rosterExt,asyncSearchRosterByName:Rn.rosterName,asyncSearchRosterById:Rn.rosterId};ne("imRostersGroupslistReady",(e=>{var{rosters:e}=e;he.saveRosterList([].concat(e)),Un(e)}));const In={},xn=e=>(new Date).getTime()-(In[e]||0)<1e3,Dn=e=>{var t=(new Date).getTime();In[e]=t},Un=(e=[])=>{Array.isArray(e)||(e=[e]);const t=he.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&&!xn(e)&&r.push(e)&&Dn(e))})),r.length&&Pn(r)},Mn=(e=[],t=!1)=>{if(Array.isArray(e)||(e=[e]),t)Fn(e);else{const t=W.getAllGroupInfos()||{},r=[];e.forEach((e=>{var n=e.group_id||e;if(0{let t=e.filter((e=>Bn.indexOf(e)<0));t.length&&Le({list:t}).then((e=>{t.forEach((t=>{e.findIndex((e=>e.user_id==t))<0&&Bn.push(t)})),he.saveRosterInfo(e),ie("onRosterListUpdate")}))},Fn=(e=[])=>{e.length&&Ot({group_list:e}).then((e=>{W.saveGroupInfo(e),ie("onGroupListUpdate")}))},Ln=(e,t,r,n)=>{if(r){const t=W.getGroupMembers(e);if(!t||!t.length)return}void 0!==t&&(Array.isArray(t)||(t=[t]),St({group_id:e,user_list:t}).then((t=>{if(t&&t.length){const r=[],o=he.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?Le({list:r}).then((r=>{he.saveRosterInfo(r);const o=he.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))),W.saveGroupMembers(e,t,n),ie("onGroupMemberChanged",e)})):(W.saveGroupMembers(e,t,n),ie("onGroupMemberChanged",e))}})))},jn=(e,t)=>{const r=W.getGroupMembers(e);var n;!r||0===r.length||0<=(n=r.findIndex((e=>e.user_id===t)))&&(r.splice(n,1),W.saveGroupMembers(e,r,!0),ie("onGroupMemberChanged",e))};ne("imRostersGroupslistReady",(e=>{var{groups:e}=e;W.saveJoinedGroups([].concat(e)),Mn(e)})),ne("imRosterMessage",(e=>{const t=G(e),{ext:r="",from:n,to:o}=t;let i={};try{i=JSON.parse(r)}catch(e){}if(void 0!==i.input_status&&n!=ee.getUid())ie("onInputStatusMessage",{ext:r,from:n,to:o});else{fe.saveRosterMessage(t),t.toType="roster",ae.saveRecent(t);const e=ee.getUid()==n?o:n;Un(e),ie("onUnreadChange",e)}ie("onRosterMessage",t)})),ne("imSendRosterMessage",(e=>{Un(e.uid)})),ne("imGetRecent",(e=>{Un(e)})),ne("imGroupMessage",(e=>{const t=G(e);fe.saveGroupMessage(t),t.toType="group",ae.saveRecent(t);const r=ee.getUid(),{config:n}=t;n&&n.mentionList&&0<=n.mentionList.indexOf(r)&&ie("onMentionMessage",t),ie("onGroupMessage",t)})),ne("imReceivedUnread",(e=>{var t=e.filter((e=>1===e.type)).map((e=>F(e.xid.uid)));e=e.filter((e=>2===e.type)).map((e=>F(e.xid.uid)));Gn(t),Un(t),qn(e),Mn(e)}));const Gn=e=>{const t=he.getAllRosterInfos()||{},r=[];e.forEach((e=>{var{avatar:n,nick_name:o,username:i}=t[e]||{};n||o||i||e&&!xn(e)&&r.push(e)&&Dn(e)})),r.length?Le({list:r}).then((t=>{he.saveRosterInfo(t),ae.saveUnreadRecent(e,"roster")})):ae.saveUnreadRecent(e,"roster")},qn=e=>{const t=W.getAllGroupInfos()||{},r=[];e.forEach((e=>{var{name:n}=t[e]||{};n||e&&r.push(e)})),r.length?Ot({group_list:r}).then((t=>{W.saveGroupInfo(t),ie("onGroupListUpdate"),ae.saveUnreadRecent(e,"group")})):ae.saveUnreadRecent(e,"group")};ne("imRosterAdded",(e=>{var{payload:t}=e,{to:r=[],from:n}=t,t=ee.getUid();1===r.length&&F(r[0].uid)===t&&(Un([F(n.uid)]),he.saveRosterList(F(n.uid)),ie("onRosterListUpdate",e))})),ne("imRosterRemoved",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=ee.getUid();if(F(r.uid)===o&&1===n.length){const t=F(n[0].uid);he.removeRoster(t),de(e),ae.deleteRecentById(t),fe.deleteRosterMessageByRosterId(t),ie("onRosterRemoved",e)}})),ne("imRosterAccepted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=ee.getUid(),i=F(r.uid);if(1===n.length){const t=F(n[0].uid);i===o?(he.saveRosterList(t),Un(t)):t===o&&(he.saveRosterList(i),Un(i)),ie("onRosterAccepted",e)}})),ne("imRosterDeclined",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=ee.getUid(),i=F(r.uid);if(1===n.length){const t=F(n[0].uid);i!==o&&t!==o||de(e),ie("onRosterDeclined",e)}})),ne("imRrosterBaned",(e=>{ie("onRosterNotice",e)})),ne("imRosterUnbaned",(e=>{ie("onRosterNotice",e)})),ne("imRosterInfoUpdated",(e=>{var{payload:t}=e,{from:r,content:t="{}"}=t,r=F(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},he.getRosterInfo(r),n),he.saveRosterInfo([r]),ie("onRosterInfoUpdated"),ie("onRosterListUpdate"))})),ne("imGroupCreated",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=ee.getUid(),r=F(r.uid),n=F(n.uid);W.saveJoinedGroups(r),n!==t&&Un(n),Mn(r),ie("onGroupListUpdate",e),ie("onGroupCreated",e)})),ne("imGroupDestoryed",(e=>{var t,{payload:r}=e,{gid:n,from:t}=r,o=ee.getUid(),r=F(n.uid);(t=F(t.uid))!==o&&Un(t),W.removeGroup(r),de(e),ae.deleteRecentById(n),fe.deleteGroupMessageByGid(n),ie("onGroupListUpdate"),ie("onGroupDestoryed",e)})),ne("imGroupJoined",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=F(n.uid),s=ee.getUid(),a=F(r.uid),u=[];o.forEach((e=>{u.push(F(e.uid))})),i===s?(W.saveJoinedGroups(a),Mn(a),ie("onGroupListUpdate")):(Ln(a,i,!0),Un(i),ie("onGroupMemberChanged",a)),ie("onGroupJoined",e)})),ne("imGroupApplyed",(e=>{var t,{payload:t}=e,{from:t}=t;(t=F(t.uid))!==ee.getUid()&&(Un([t]),de(e))})),ne("imGroupApplyAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=F(n.uid),s=ee.getUid(),a=F(r.uid),u=[];o.forEach((e=>{u.push(F(e.uid))})),i===s?(Un(u),Ln(a,u,!0),ie("onGroupMemberChanged",a)):(W.saveJoinedGroups(a),Mn(a),Un(i),ie("onGroupListUpdate")),ie("onGroupApplyAccepted",e)})),ne("imGroupApplyDeclined",(e=>{const{payload:t}=e,{from:r,to:n}=t,o=F(r.uid),i=ee.getUid(),s=[];n.forEach((e=>{s.push(F(e.uid))})),o===i?Un(s):de(e),ie("onGroupApplyDeclined",e)})),ne("imGroupInvited",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=F(n.uid),s=ee.getUid(),a=F(r.uid),u=[];o.forEach((e=>{u.push(F(e.uid))})),i!==s&&-1e===s))?(Un(i),Mn(a),de(e)):Un(u),ie("onGroupNotice",e)})),ne("imGroupInvitedAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=F(n.uid),s=ee.getUid(),a=F(r.uid),u=[];o.forEach((e=>{u.push(F(e.uid))})),i===s?(W.saveJoinedGroups(a),Mn(a),ie("onGroupListUpdate")):(Ln(a,i,!0),Un(i),ie("onGroupMemberChanged",a)),ie("onGroupInvitedAccepted",e)})),ne("imGroupInvitedDeclined",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=F(n.uid),n=ee.getUid(),r=F(r.uid);t===n?(de(e),Mn(r)):Un(t),ie("onGroupInvitedDeclined",e)})),ne("imGroupKicked",(e=>{const{payload:t}=e=Object.assign({},e),{gid:r,to:n=[]}=t,o=ee.getUid(),i=F(r.uid),s=[];n.forEach((e=>{s.push(F(e.uid))})),-1e===o))?(W.removeGroup(i),de(e),ae.deleteRecentById(r),fe.deleteGroupMessageByGid(r),ie("onGroupListUpdate")):jn(i,s)})),ne("imGroupBlocked",(e=>{const{payload:t}=e,{gid:r,to:n=[]}=t,o=ee.getUid(),i=F(r.uid),s=[];n.forEach((e=>{s.push(F(e.uid))})),-1e===o))?(W.removeGroup(i),de(e),ae.deleteRecentById(r),fe.deleteGroupMessageByGid(r),ie("onGroupListUpdate")):(Un(s),jn(i,s))})),ne("imGroupUnblocked",(e=>{const{payload:t}=e,{to:r=[]}=t,n=[];r.forEach((e=>{n.push(F(e.uid))})),Un(n)})),ne("imGroupOwnerAssigned",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=F(r.uid),i=ee.getUid(),s=[];n.forEach((e=>{s.push(F(e.uid))})),o!==i&&s.push(o),Un(s),ie("onGroupOwnerAssigned",e)})),ne("imGroupAdminGranted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=F(r.uid),i=ee.getUid(),s=[];n.forEach((e=>{s.push(F(e.uid))})),o!==i&&s.push(o),Un(s),ie("onGroupAdminGranted",e)})),ne("imGroupAdminRevoked",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=F(r.uid),i=ee.getUid(),s=[];n.forEach((e=>{s.push(F(e.uid))})),o!==i&&s.push(o),Un(s),ie("onGroupAdminRevoked",e)})),ne("imGroupMuted",(e=>{ie("onGroupMuted",e)})),ne("imGroupUnblocked",(e=>{ie("onGroupUnblocked",e)})),ne("imGroupBaned",(e=>{ie("onGroupBaned",e)})),ne("imGroupUnbaned",(e=>{ie("onGroupUnbaned",e)})),ne("imGroupInfoUpdated",(e=>{var{payload:t}=e,{gid:r,content:t="{}"}=t,r=F(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},W.getGroupInfo(r),n),W.saveGroupInfo([r]),ie("onGroupListUpdate"))})),ne("imGroupAnnouncementUpdated",(e=>{var{payload:t}=e,{gid:t}=t,t=F(t.uid);Mn(t,!0),ie("onGroupAnnouncementUpdated",e)})),ne("imReadRosterMessage",(e=>{const{roster_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=fe.getRosterMessageById(t,r);if(Yn(e)&&!n){o=!0;const e=Dr(t,r);ie("sendMessage",e)}}else{const e=fe.getRosterMessage(t);let r;if(e.forEach((e=>{if(Yn(e)&&!n){o=!0;const r=Dr(t,e.id);ie("sendMessage",r)}r=e.id})),fe.saveFormatedRosterMessage(t,e),!n&&o){const e=Mr(t,r);ie("sendMessage",e)}}o&&ie("onUnreadChange",t)}));const Yn=e=>{let t=!1;const r=Jn(e,U.READ);if(e&&r){const r=ee.getUid(),n=F(e.from);0{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,fe.saveRosterMessage(G(n)),r=!0}return r};ne("imReadGroupMessage",(e=>{const{group_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=fe.getGroupMessageById(t,r);if(Vn(e)&&!n){o=!0;const t=j(e.from),n=Dr(t,r);ie("sendMessage",n)}}else{const e=fe.getGroupMessage(t);let r;if(e.forEach((e=>{if(Vn(e)&&!n){o=!0;const t=j(e.from),r=Dr(t,e.id);ie("sendMessage",r)}r=e.id})),fe.saveFormatedGroupMessage(t,e),!n&&o){const e=Mr(t,r);ie("sendMessage",e)}}o&&ie("onUnreadChange",t)}));const Vn=e=>{let t=!1;const r=Kn(e,U.READ);if(e&&r){const r=ee.getUid(),n=F(e.from);0{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,fe.saveGroupMessage(G(n)),r=!0}return r},Hn=(e,t)=>{var r;0<(r=t?fe.getGroupMessage(e):fe.getRosterMessage(e)).length&&ae.saveRecent(r[r.length-1])};ne("onActionMessage",(e=>{var t,{payload:r,from:n,to:t,isReceived:o}=e,{type:i,operation:s={}}=r,r=(e=ee.getUid()+"",t?j(t.uid):0),n=e==(t=j(n.uid))+""?r:t;e=-1!=W.getJoinedGroups().indexOf(+r);i===A.OPER&&(({type:t,mid:r,xid:i}=s),s=e?fe.getGroupMessageById(n,r):fe.getRosterMessageById(n,r),t===C.READ_ACK?(e||Yn(s),e&&Vn(s)):t===C.DELIVER_ACK?(e||Jn(s,U.DELIVERED),e&&Kn(s,U.DELIVERED)):t===C.RECALL?(e||fe.deleteSingleRosterMessage(n,r),e&&fe.deleteSingleGroupMessage(n,r),Hn(n,e),ie("onMessageRecalled",{uid:n,mid:r})):t===C.DELETE?(e||fe.deleteSingleRosterMessage(i.uid,r),e&&fe.deleteSingleGroupMessage(i.uid,r),Hn(i.uid,e),ie("onMessageDeleted",{uid:i.uid,mid:r})):t===C.READ_CANCEL?(e||Jn(s,U.UNREAD),e&&Kn(s,U.UNREAD),ie("onMessageCanceled",{uid:n,mid:r})):t===C.READ_ALL&&(e?ie("imReadGroupMessage",{group_id:i.uid,mid:r,isReceived:o}):ie("imReadRosterMessage",{roster_id:i.uid,mid:r,isReceived:o})),n=j(i&&i.uid?i.uid:n),ie("onMessageStatusChanged",{uid:n,mid:j(r)}),ie("onUnreadChange",n))}));const Wn={};ne("swapSendMessage",(e=>{var{payload:t}=e,{meta:t}=t,{id:t}=t;Wn[j(t)]=e})),ne("receivedSendMessage",(e=>{if(e=j(e),e=Wn[e]){const t=e.payload,{meta:r}=t,{payload:n}=r,{type:o}=n;o===A.OPER&&ie("onActionMessage",r)}})),ne("deleteConversation",(({id:e,source:t})=>{ie("flooNotice",{category:"conversation_deleted",desc:{id:e,source:t}});var{idx:r,type:t}=ae.getRecentById(e);r<0||("group"==t?fe.deleteGroupMessageByGid(e):fe.deleteRosterMessageByRosterId(e),ae.deleteRecentById(e))}));var zn=Ln,Xn={asyncGetGroupInfo:(e,t)=>{var r=W.getGroupInfo(e-=0)||{};return r.name&&!t?Promise.resolve(r):Rn.groupInfo({group_id:e}).then((e=>(W.saveGroupInfo([e]),e)))},asyncGetJoinedGroups:e=>e?Rn.groupUserjoined({}).then((e=>Array.isArray(e)?e:W.getGroupInfoList())):Promise.resolve(W.getGroupInfoList()),openGroup:e=>{Rn.groupMemberlist({group_id:e}).then((t=>{W.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&zn(e,t,!1,!0),ie("onGroupMemberChanged",e)}))},getAllGroupDetail:()=>W.getAllGroupInfos(),asyncGetGroupMembers:e=>Rn.groupMemberlist({group_id:e}).then((t=>(W.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&zn(e,t,!1,!0),t))),getGroupMembers:e=>W.getGroupMembers(e)||[],asyncGetGroupListDetail:e=>e&&e.length?Rn.groupInfoBatch({group_list:e}).then((e=>(W.saveGroupInfo(e),e))):Promise.resolve({}),getGruopMessage:e=>fe.getGroupMessage(e),readGroupMessage:(e,t)=>{ie("imReadGroupMessage",{group_id:e,mid:t})},recallMessage:(e,t)=>{t=Ur(e,t),ie("sendMessage",t),ie("swapSendMessage",t)},getUnreadCount:e=>fe.getUnreadByGroupId(e),asyncGetAdminList:Rn.groupAdminList,asyncAdminAdd:Rn.groupAdminAdd,asyncAdminRemove:Rn.groupAdminRemove,asyncGetAnouncementById:Rn.groupAnnouncement,asyncAnouncementDelete:Rn.groupAnnouncementDelete,asyncAnnouncementEdit:Rn.groupAnnouncementEdit,asyncGetAnnouncementList:Rn.groupAnnouncementList,asyncCreate:Rn.groupCreate,asyncDestroy:Rn.groupDestroy,asyncGetInfo:e=>(e.group_id||(e={group_id:e}),Rn.groupInfo(e)),asyncUpdateAvatar:Rn.groupInfoAvatar,asyncUpdateDescription:Rn.groupInfoDdscription,asyncUpdateName:Rn.groupInfoName,asyncGetMemberList:e=>(e.group_id||(e={group_id:e}),Rn.groupMemberlist(e)),asyncGroupMsgMutemode:Rn.groupMsgMutemode,asyncGetPublicList:Rn.groupPubliclist,asyncUpdateMsgNotDisturb:Rn.groupMsgNotdisturb,asyncGroupBannedList:Rn.groupBannedList,asyncGroupBab:Rn.groupBab,asyncGroupUnban:Rn.groupUnban,asyncGetSettings:Rn.groupSettings,asyncUpdateAllowMemberInvitation:Rn.groupSettingsAllowmemberinvitation,asyncUpdateAllowMemberModify:Rn.groupSettingsAllowmembermodify,asyncUpdateEnableReadack:Rn.groupSettingsEnablereadack,asyncUpdateHistoryVisible:Rn.groupSettingsHistoryvisible,asyncUpdateRequireadminapproval:Rn.groupSettingsRequireadminapproval,asyncOwnerTransfer:Rn.groupTransfer,asyncGetUserJoined:Rn.groupUserjoined,asyncApply:Rn.groupApply,asyncApplyHandle:Rn.groupApplyHandle,asyncGroupBockedlist:Rn.groupBockedlist,asyncGroupBlock:Rn.groupBlock,asyncGroupUnblock:Rn.groupUnblock,asyncKick:Rn.groupKick,asyncGetInvitationList:Rn.groupInvitationlist,asyncInvite:Rn.groupInvite,asyncInviteHandle:Rn.groupInviteHandle,asyncGetMemberDisplayName:Rn.groupMembersDidpayname,asyncLeave:Rn.groupLeave,asyncUpdateDisplayName:Rn.groupDisplayname,asncGetApplicationList:Rn.groupApplicationlist,asyncGetFileList:Rn.groupFilelist,asyncFileDelete:Rn.groupFiledelete,asyncFileUpload:Rn.groupFileupload};o={getToken:()=>ee.getToken(),getUid:()=>ee.getUid(),getAppid:()=>ee.getAppid(),getConversationList:()=>ae.getRecents(),deleteToken:ee.deleteToken,getDeviceSN:()=>ee.getDeviceSN(),asyncBindDeviceToken:Rn.bindDeviceToken,asyncUnbindDeviceToken:Rn.unbindDeviceToken,asyncTokenUser:Rn.tokenUser,asyncTokenId:Rn.tokenId,asyncRegister:Rn.userRegister,asyncUserBindMobile:Rn.userBindMobile,asyncUserUpdateMobile:Rn.userUpdateMobile,asyncUserSendSms:Rn.userSendSms,asyncCaptchaSms:Rn.captchaSms,asyncUserNameCheck:Rn.userNameCheck,asyncUserMobileBind:Rn.userMobileBind,asyncUserMobileBindSign:Rn.userMobileBindSign,asyncUserMobileLogin:Rn.userMobileLogin,asyncCaptchaImagePost:Rn.captchaImagePost,asyncUpdateAuthmode:Rn.userAuthmode,asyncUpdateAvatar:Rn.userAvatar,asyncUpdateMobile:Rn.userMobile,asyncUpdateNickName:Rn.userNickname,asyncGetProfile:Rn.userProfile,asyncUpdateProfile:Rn.userProfilePost,asyncGetSettings:Rn.userSettings,asyncUpdateSettings:Rn.userSettingsPost};const $n=(e,t)=>t&&e?e+"_"+t:"",Zn=e=>{if(!e)return{};var t=ro("ws"),{clusters:r,clusterIndex:n,ratelIndex:o,fireIndex:e}=eo(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}:{}):{}};ne("ratelError",(()=>{var e;(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=eo(e);t[r].ratel.length>n+1?(n++,to(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):Qn(e)})(e=ro("app_id"));var{ratel:e}=Zn(e)||{};ie("refresh_ratel",e)})),ne("fireplaceError",(()=>{var e;(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=eo(e),i=t[r];(i.webim||i.ws).length>o+1?(o++,to(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):Qn(e)})(e=ro("app_id"));var{fireplace:e}=Zn(e)||{};ie("refresh_fireplace",e)}));const Qn=e=>{const t=eo(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 to(e,{clusters:r,clusterIndex:n,ratelIndex:0,fireIndex:0})}ie("retrieve_dns")},eo=e=>J($n("key_dns_infos",e),!1)||{},to=(e,t)=>{Y($n("key_dns_infos",e),t,!1)},ro=e=>e?J($n("key_dns_config",e),!1):"",no=(e,t)=>{e&&t&&Y($n("key_dns_config",e),t,!1)};ne("retrieve_dns",(()=>{var e=ro("dns_server"),t=ro("app_id"),r=ro("ws");oo(e,t,r)}));const oo=(e,t,r)=>(no("dns_server",e),no("app_id",t),no("ws",r),(r=Zn(t)).ratel?Promise.resolve(r):_e(e,{app_id:t}).then((e=>((t=>{if(!t)return;const{dns_list:r}=e,n=r.findIndex((e=>0==e.group_level));if(!(n<0)){var o={clusters:r[n].clusters,clusterIndex:0,ratelIndex:0,fireIndex:0};to(t,o)}})(t),Zn(t)))));var io={asyncGetDns:oo,getServers:Zn};const so=({url:e="",params:t={}})=>{if(!e)return"";var r=ee.getToken(),n=ee.getAppid();return t=Object.assign(t,{"access-token":r,app_id:n}),0n,sendRosterMessage:e=>{var t=xr(e);e=t.payload.meta;fe.saveSendingRosterMessage(e),Rn.sendMessage(t)},sendGroupMessage:e=>{var t=Ir(e);e=t.payload.meta;fe.saveSendingGroupMessage(e),Rn.sendMessage(t)},sendMentionMessage:e=>{var t=(()=>{var{gid:t,txt:r,mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}=e,u=N.TEXT;const c=new yr({uid:+ee.getUid(),deviceSN:Sr}),p=new yr({uid:t,deviceSN:0}),f=new _r;f.setCommond(m.SYNC);const d=new Ar,l=new mr({from:c,to:p,content:r,ctype:u,type:A.GROUPCHAT});return l.config=JSON.stringify({mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}),a=new Nr({id:(new Date).getTime(),from:c,to:p,payload:l,ns:w.MESSAGE}),d.setMeta(a),f.setPayload(d),f})(),r=t.payload.meta;fe.saveSendingGroupMessage(r),Rn.sendMessage(t)},sendInputStatusMessage:(e,t)=>{t=((e,t)=>{var r=N.TEXT;const n=new yr({uid:+ee.getUid(),deviceSN:Sr}),o=new yr({uid:+e,deviceSN:0}),i=new _r;i.setCommond(m.SYNC);const s=new Ar,a=new mr({from:n,to:o,ctype:r,type:A.CHAT,ext:JSON.stringify({input_status:t}),qos:O.AT_MOST_ONCE}),u=new Nr({id:(new Date).getTime(),from:n,to:o,payload:a,ns:w.MESSAGE});return s.setMeta(u),i.setPayload(s),i})(e,t),Rn.sendMessage(t)},sendMessage:Rn.sendMessage,getNoticeMessage:u(),getMessageStatus:(e,t,r=!1)=>{var n;return(n=r?fe.getGroupMessageById(e,t):fe.getRosterMessageById(e,t))?M[n.status]:void 0},forwardMessage:function(e){const{uid:t,mid:r,gid:n}=e;let o;o=t?fe.getRosterMessageById(t,r):fe.getGroupMessageById(n,r);const i=o.attach;if(i&&i.url){e=i.url.split("sign=")[1];const r=ee.getToken();Rn.fileForward({file_sign:e,"access-token":r,to_id:+(t||n),to_type:t?1:2}).then((e=>{o.attach.url=e;var r=Br(t,n,o);e=r.payload.meta;t?fe.saveSendingRosterMessage(e):fe.saveSendingGroupMessage(e),Rn.sendMessage(r)}))}else{const e=Br(t,n,o),r=e.payload.meta;t?fe.saveSendingRosterMessage(r):fe.saveSendingGroupMessage(r),Rn.sendMessage(e)}},asyncFileUpload:e=>new Promise(((t,r)=>{const{group_id:n,to_id:o,toType:i,file:s,fileType:a,chatType:u}=e;var c="rosterAvatar"===i?"fileUploadAvatarUrl":"chat"==i?"fileUploadChatFileUrl":"fileUploadGroupAvatarUrl";const p={},f=ee.getToken();"groupAvatar"===i&&(p["access-token"]=f),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"==u&&(p.to_type=2),"roster"==u&&(p.to_type=1),o&&(p.to_id=o),Rn[c](p).then((e=>{let r=new FormData;e.oss_body_param&&e.oss_body_param.key&&(r.append("OSSAccessKeyId",e.oss_body_param.OSSAccessKeyId),r.append("policy",e.oss_body_param.policy),r.append("signature",e.oss_body_param.signature),r.append("callback",e.oss_body_param.callback),r.append("key",e.oss_body_param.key)),r.append("file",s),Rn.asyncFileUpload(e.upload_url,r,{headers:{"Content-Type":"multipart/form-data"}}).then((()=>{t({url:e.download_url})})).catch((e=>{}))})).catch((e=>{r(e)}))})),requireHistoryMessage:(e,t,r)=>{r=((e,t,r)=>{t=L(t);const n=new _r;n.setCommond(m.SYNC);const o=new yr({uid:F(e),deviceSN:0}),i=new Ar;return i.setXid(o),i.setKey(F(t)),i.setFullsyncnum(r),i.setIsfullsync(!0),n.setPayload(i),n})(e,t,r),Rn.sendMessage(r)},makeSearch:e=>{const t=[],r=[];return(he.getRosterInfoList()||[]).forEach((r=>{let n=!1;const{user_id:o,username:i,avatar:s}=r;(fe.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})})),W.getGroupInfoList().forEach((t=>{let n=!1;const{group_id:o,name:i}=t;(fe.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:Rn.fileUploadAvatarUrl,asyncGetGroupAvatarUploadUrl:Rn.fileUploadGroupAvatarUrl,asyncGetFileUploadChatFileUrl:Rn.fileUploadChatFileUrl,asyncQrcode:Rn.qrcode,asyncQrlogin:Rn.qrlogin,asyncQrcodeGroupsign:Rn.qrcodeGroupsign,asyncQrcodeGroupinvite:Rn.qrcodeGroupinvite,asyncWxlogin:Rn.wxlogin,asyncWxbind:Rn.wxbind,asyncGetStaticContact:Rn.getStaticContact,getImage:({avatar:e="",type:t="roster",thumbnail:r=!0,sdefault:n=""})=>{if(/^\//.test(e))return e;if(!e)return"roster"===t?n||"/image/roster.png":n||"/image/group.png";let o=e,i={};if(0!==e.indexOf("http")){const t=ee.getAppid();var{ratel:n}=io.getServers(t)||{};!/\/$/.test(n)&&5so({url:e,type:t,params:{format:"mp3"}}),getChatFile:so,downloadAudio:({url:e="",type:t="audio"})=>(({url:e="",type:t="",params:r={}})=>e?Rn.fileDownloadChatFileUrl(e,r,{operation:"download_file"}):"")({url:e,type:t,params:{format:"mp3"}}),getServers:io.getServers,asyncWechatUnbind:Rn.wechatUnbind,asyncWechatIsbind:Rn.wechatIsbind,asyncWechatBind:Rn.wechatBind,deleteConversation:function(e,t=!0){ie("deleteConversation",{id:e,other_devices:t,source:"user_operation"}),t=((e,t=!0)=>{let r=D.DELETE;t&&(r=D.DELETE_EVERYWHERE);const n=new yr({uid:+ee.getUid(),deviceSN:Sr}),o=new yr({uid:e}),i=new Or({type:x.OPER,operation:{xid:o,type:r}}),s=new Nr({id:(new Date).getTime(),from:n,payload:i,ns:w.CONVERSATION}),a=new Ar;a.setMeta(s);const u=new _r;return u.setCommond(m.SYNC),u.setPayload(a),u})(e,t),Rn.sendMessage(t)}};let ao={},uo=null,co=!1,po=!1;const fo=function({autoLogin:e=!0,dnsServer:t="https://dns.maximtop.com/v2/app_dns",appid:r="welovemaxim",ws:n=!1}){ee.saveAppid(r),io.asyncGetDns(t,r,n).then((n=>{var{ratel:o,fireplace:n}=n;if(o&&n){if(lo(r),ao={appid:r,baseUrl:o,autoLogin:e,fireplace:n},fo.baseUrl=ao.baseUrl,co=!0,uo){const{type:e}=uo;return"login"==e&&fo.login(uo.opt),"qrlogin"==e&&fo.qrlogin(uo.opt),void("tokenLogin"==e&&fo.tokenLogin(uo.user_id,uo.token))}if(ao.autoLogin){const e=ee.getUid(),t=ee.getToken();if(e&&t){const e=Tn.asyncGetRosterIdList(!0),t=Xn.asyncGetJoinedGroups(!0);Promise.all([e,t]).then((e=>{var t=e[0];e=e[1];ie("imRostersGroupslistReady",{rosters:t,groups:e}),Rn.connect(ao)})).catch((e=>{ie("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))}}}else ie("flooError",{category:"DNS_FAILED",desc:t})})).catch((e=>{}))},lo=function(e){var{ratel:t,fireplace:e}=io.getServers(e)||{};ie("refresh_ratel",t),ie("refresh_fireplace",e)};fo.login=function(e){co?(ie("flooNotice",{category:"loginMessage",desc:"getting token..."}),Rn.tokenUser(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;ee.saveUid(r),ee.saveToken(t),ee.saveAesKey(n);var o=Tn.asyncGetRosterIdList(!0);e=Xn.asyncGetJoinedGroups(!0);po=!0,ie("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];ie("imRostersGroupslistReady",{rosters:n,groups:e}),ao=Object.assign({uid:r,token:t},ao),Rn.connect(ao),uo=null})).catch((e=>{ie("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ie("loginFail","token failure:"+e.message)}))):uo={type:"login",opt:e}},fo.qrlogin=function(e){co?(ie("flooNotice",{category:"loginMessage",desc:"getting token..."}),Rn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;ee.saveUid(r),ee.saveToken(t),ee.saveAesKey(n);var o=Tn.asyncGetRosterIdList(!0);e=Xn.asyncGetJoinedGroups(!0);ie("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),po=!0,Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];ie("imRostersGroupslistReady",{rosters:n,groups:e}),ao=Object.assign({uid:r,token:t},ao),Rn.connect(ao),uo=null})).catch((e=>{ie("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ie("loginFail","token failure:"+e.message)}))):uo={type:"qrlogin",opt:e}},fo.tokenLogin=function(e,t,r){var n;co?(ee.saveUid(e),ee.saveToken(t),ee.saveAesKey(r),n=Tn.asyncGetRosterIdList(!0),r=Xn.asyncGetJoinedGroups(!0),ie("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),po=!0,Promise.all([n,r]).then((r=>{var n=r[0];r=r[1];ie("imRostersGroupslistReady",{rosters:n,groups:r}),ao=Object.assign({uid:e,token:t},ao),Rn.connect(ao),uo=null})).catch((e=>{ie("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))):uo={type:"tokenLogin",user_id:e,token:t}},fo.idLogin=function(e){Rn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;ee.saveUid(r),ee.saveToken(t),ee.saveAesKey(n);var o=Tn.asyncGetRosterIdList(!0);e=Xn.asyncGetJoinedGroups(!0);ie("flooNotice",{category:"loginMessage",desc:"token success, getting roster lists.."}),po=!0,Promise.all([o,e]).then((e=>{const n=e[0]||[];n.push(r),e=e[1],ie("imRostersGroupslistReady",{rosters:n,groups:e}),ao=Object.assign({uid:r,token:t},ao),Rn.connect(ao),uo=null})).catch((e=>{ie("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ie("loginFail","token failure:"+e.message)}))},fo.wxlogin=function(){},fo.cleanup=function(){ae.clear(),he.clear(),W.clear(),ee.clear(),fe.clearAll()},fo.isLogin=function(){return po&&ee.getUid()&&ee.getToken()},fo.on=fo.listen=function(e,t){t?ne(e,t):Object.keys(e).forEach((t=>{ne(t,e[t])}))},fo.off=function(e,t){t?oe(e,t):Object.keys(e).forEach((t=>{oe(t,e[t])}))},fo.logout=function(){Rn.disConnect(),fo.cleanup()},fo.isReady=function(){return co},fo.disConnect=Rn.disConnect;var ho=fo;function yo(e){return new ho(e),ho}ho.rosterManage=Tn,ho.groupManage=Xn,ho.userManage=o,ho.sysManage=u,t.default=yo,window.flooIM=e=>yo(e)}],n={},o.m=m,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=130);function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return m[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var m,n},module.exports=l()}(floo2_0_0);var flooim=getDefaultExportFromCjs(floo2_0_0.exports);function createChatroom(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})}))}function joinChatroom(e){return this.groupManage.asyncApply({group_id:e})}function leaveChatroom(e){return this.groupManage.asyncLeave({group_id:e})}function destroyChatroom(e){return this.groupManage.asyncDestroy({group_id:e})}function init(e){return(e=flooim(__assign({ws:!1,autoLogin:!0},e))).chatroomManage={create:createChatroom.bind(e),join:joinChatroom.bind(e),leave:leaveChatroom.bind(e),destroy:destroyChatroom.bind(e)},e}exports.init=init,exports.version=version,Object.defineProperty(exports,"__esModule",{value:!0})})); +!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).QNIM={})}(this,(function(exports){"use strict";var version="1.0.3",__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=c(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<=-y)return C;if(y<=e+1)return w}return e<0?u(-e,t).neg():c(e%l|0,e/l|0,t)}function c(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=u,n.fromBits=c;var p=Math.pow;function f(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>>0:this.low},N.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},N.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((o=s).isZero())return a+i;for(;a.length<6;)a="0"+a;i=""+a+i}},N.getHighBits=function(){return this.high},N.getHighBitsUnsigned=function(){return this.high>>>0},N.getLowBits=function(){return this.low},N.getLowBitsUnsigned=function(){return this.low>>>0},N.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},N.eq=N.equals,N.notEquals=function(e){return!this.eq(e)},N.neq=N.notEquals,N.ne=N.notEquals,N.lessThan=function(e){return this.comp(e)<0},N.lt=N.lessThan,N.lessThanOrEqual=function(e){return this.comp(e)<=0},N.lte=N.lessThanOrEqual,N.le=N.lessThanOrEqual,N.greaterThan=function(e){return 0>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},N.comp=N.compare,N.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(b)},N.neg=N.negate,N.add=function(e){o(e)||(e=d(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,p=0,f=0,l=0,h=0;return l+=(h+=i+(65535&e.low))>>>16,f+=(l+=n+u)>>>16,p+=(f+=r+a)>>>16,p+=t+s,c((l&=65535)<<16|(h&=65535),(p&=65535)<<16|(f&=65535),this.unsigned)},N.subtract=function(e){return o(e)||(e=d(e)),this.add(e.neg())},N.sub=N.subtract,N.multiply=function(e){if(this.isZero())return m;if(o(e)||(e=d(e)),r)return c(r.mul(this.low,this.high,e.low,e.high),r.get_high(),this.unsigned);if(e.isZero())return m;if(this.eq(C))return e.isOdd()?C:m;if(e.eq(C))return this.isOdd()?C: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(g)&&e.lt(g))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,p=65535&e.high,f=e.low>>>16,l=65535&e.low,h=0,y=0,v=0;e=0;return v+=(e+=s*l)>>>16,y+=(v+=i*l)>>>16,v&=65535,y+=(v+=s*f)>>>16,h+=(y+=n*l)>>>16,y&=65535,h+=(y+=i*f)>>>16,y&=65535,h+=(y+=s*p)>>>16,h+=t*l+n*f+i*p+s*a,c((v&=65535)<<16|(e&=65535),(h&=65535)<<16|(y&=65535),this.unsigned)},N.mul=N.multiply,N.divide=function(e){if((e=o(e)?e:d(e)).isZero())throw Error("division by zero");var t,n;if(r)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((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 _;n=v}else{if(this.eq(C))return e.eq(b)||e.eq(E)?C:e.eq(C)?b:(i=this.shr(1).div(e).shl(1)).eq(m)?e.isNegative()?b:E:(t=this.sub(e.mul(i)),i.add(t.div(e)));if(e.eq(C))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:p(2,s-48),f=u(i),l=f.mul(e);l.isNegative()||l.gt(t);)l=(f=u(i-=a,this.unsigned)).mul(e);f.isZero()&&(f=b),n=n.add(f),t=t.sub(l)}return n},N.div=N.divide,N.modulo=function(e){return o(e)||(e=d(e)),r?c((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))},N.mod=N.modulo,N.rem=N.modulo,N.not=function(){return c(~this.low,~this.high,this.unsigned)},N.and=function(e){return o(e)||(e=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},N.or=function(e){return o(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},N.xor=function(e){return o(e)||(e=d(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},N.shiftLeft=function(e){return o(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?c(this.low<>>32-e,this.unsigned):c(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},N.shr=N.shiftRight,N.shiftRightUnsigned=function(e){if(o(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},N.shru=N.shiftRightUnsigned,N.shr_u=N.shiftRightUnsigned,N.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},N.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},N.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},N.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]},N.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){(function(e){var n=t;function o(e,t,r){for(var n=Object.keys(t),o=0;ot)return!0;return!1},p.isReservedName=function(e,t){if(e)for(var r=0;r{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)=>{var o="string"==typeof r&&r.includes(e.arrayFormatSeparator),i="string"==typeof r&&!o&&c(r,e).includes(e.arrayFormatSeparator);r=i?c(r,e):r,r=o||i?r.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===r?r:c(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("&"))if(""!==o){let[e,s]=i(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:c(s,t),r(c(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]=d(r[e],t);else n[e]=d(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=f,t.parse=l,t.stringify=(e,t)=>{if(!e)return"";a((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,[u(t,e),"[",o,"]"].join("")]:[...r,[u(t,e),"[",u(o,e),"]=",u(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[u(t,e),"[]"].join("")]:[...r,[u(t,e),"[]=",u(n,e)].join("")];case"comma":case"separator":return t=>(r,n)=>null==n||0===n.length?r:0===r.length?[[u(t,e),"=",u(n,e)].join("")]:[[r,u(n,e)].join(e.arrayFormatSeparator)];default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,u(t,e)]:[...r,[u(t,e),"=",u(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?u(r,t):Array.isArray(o)?o.reduce(n(r),[]).join("&"):u(r,t)+"="+u(o,t)})).filter((e=>0{t=Object.assign({decode:!0},t);const[r,n]=i(e,"#");return Object.assign({url:r.split("?")[0]||"",query:l(f(e),t)},t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:c(n,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);var n=p(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="#"+u(e.fragmentIdentifier,r)),`${n}${i}${s}`},t.pick=(e,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0},n);var{url:o,query:i,fragmentIdentifier:e}=t.parseUrl(e,n);return t.stringifyUrl({url:o,query:s(i,r),fragmentIdentifier:e},n)},t.exclude=(e,r,n)=>{var o=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,o,n)}},function(e,t){var r=36e5,n=864e5;function o(e,t,r){if(!(e=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(n)return R(e).length;t=(""+t).toLowerCase(),n=!0}}function y(e,t,r){var o,i,s,a=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!r||r<0||n=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):v(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,o){var i=1,s=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s/=i=2,a/=2,r/=2}function u(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var c=-1,p=r;p>>10&1023|55296),p=56320|1023&p),n.push(p),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;ne.length)throw new RangeError("Index out of range")}function A(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o>>8*(n?o:1-o)}function C(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o>>8*(n?o:3-o)&255}function N(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function k(e,t,r,n,i){return i||N(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function O(e,t,r,n,i){return i||N(e,0,r,8),o.write(e,t,r,n,52,8),r+8}t.Buffer=u,t.SlowBuffer=function(e){return u.alloc(+(e=+e!=e?0:e))},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return n=null,t=t,r=r,p(e=e),e<=0||void 0===t?a(n,e):"string"==typeof r?a(n,e).fill(t,r):a(n,e).fill(t);var n},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);or&&(e+=" ... ")),""},u.prototype.compare=function(e,t,r,n,o){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(n,o),p=e.slice(t,r),f=0;fthis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,s,a,u,c,p=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var o=e.length-r;if((!n||(n=Number(n))>o)&&(n=o),(o=t.length)%2!=0)throw new TypeError("Invalid hex string");o/2>8,o.push(r%256),o.push(n);return o}(e,(a=this).length-i),a,i,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},u.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r=(o*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||E(e,t,this.length);for(var n=t,o=1,i=this[e+--n];0=(o*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){return t||E(e,2,this.length),32768&(e=this[e]|this[e+1]<<8)?4294901760|e:e},u.prototype.readInt16BE=function(e,t){return t||E(e,2,this.length),32768&(e=this[e+1]|this[e]<<8)?4294901760|e:e},u.prototype.readInt32LE=function(e,t){return t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||E(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||E(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||E(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||E(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||w(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i>>8):A(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):C(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||w(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||w(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,s=0;for(this[t+o]=255&e;0<=--o&&(i*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/i>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):A(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):A(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):C(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||w(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return O(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return O(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,i=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function T(e){return n.toByteArray(function(e){if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(S,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(34))},function(e,t,r){var n=r(83),o=r(24);e.exports=function(e){var t=e.xdomain,r=e.xscheme,i=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||n))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&i)return new XDomainRequest}catch(e){}if(!t)try{return new(o[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}},function(e,t){e.exports="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")()},function(e,t,r){var n=r(8);function o(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}r(7)((e.exports=o).prototype),o.prototype.onError=function(e,t){return(e=new Error(e)).type="TransportError",e.description=t,this.emit("error",e),this},o.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},o.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},o.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},o.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},o.prototype.onData=function(e){e=n.decodePacket(e,this.socket.binaryType),this.onPacket(e)},o.prototype.onPacket=function(e){this.emit("packet",e)},o.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t,r){(function(t){var n=r(3),o=r(103),i=r(46),s={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:u="undefined"!=typeof XMLHttpRequest||void 0!==t&&"[object process]"===Object.prototype.toString.call(t)?r(47):u,transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=(r=this.transitional)&&r.silentJSONParsing,r=r&&r.forcedJSONParsing;if((t=!t&&"json"===this.responseType)||r&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(t){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return 200<=e&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){c.headers[e]=n.merge(s)})),e.exports=c}).call(this,r(15))},function(e,t,r){e.exports=f;var n,o=r(5),i=o.LongBits,s=o.base64,a=o.utf8;function u(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function c(){}function p(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function f(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}function d(){return o.Buffer?function(){return(f.create=function(){return new n})()}:function(){return new f}}function l(e,t,r){t[r]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function y(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>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}f.create=d(),f.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(f.alloc=o.pool(f.alloc,o.Array.prototype.subarray)),f.prototype._push=function(e,t,r){return this.tail=this.tail.next=new u(e,t,r),this.len+=t,this},(h.prototype=Object.create(u.prototype)).fn=function(e,t,r){for(;127>>=7;t[r]=e},f.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},f.prototype.int32=function(e){return e<0?this._push(y,10,i.fromNumber(e)):this.uint32(e)},f.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},f.prototype.int64=f.prototype.uint64=function(e){return e=i.from(e),this._push(y,e.length(),e)},f.prototype.sint64=function(e){return e=i.from(e).zzEncode(),this._push(y,e.length(),e)},f.prototype.bool=function(e){return this._push(l,1,e?1:0)},f.prototype.sfixed32=f.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},f.prototype.sfixed64=f.prototype.fixed64=function(e){return e=i.from(e),this._push(g,4,e.lo)._push(g,4,e.hi)},f.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},f.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var m=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;return r?(o.isString(e)&&(t=f.alloc(r=s.length(e)),s.decode(e,t,0),e=t),this.uint32(r)._push(m,r,e)):this._push(l,1,0)},f.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(l,1,0)},f.prototype.fork=function(){return this.states=new p(this),this.head=this.tail=new u(c,0,0),this.len=0,this},f.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 u(c,0,0),this.len=0),this},f.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},f.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},f._configure=function(e){n=e,f.create=d(),n._configure()}},function(e,t,r){e.exports=u;var n,o=r(5),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}function c(){return o.Buffer?function(e){return(u.create=function(e){return o.Buffer.isBuffer(e)?new n(e):f(e)})(e)}:f}var p,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")};function d(){var e=new i(0,0),t=0;if(!(4=this.len)throw a(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>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(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 l(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new i(l(this.buf,this.pos+=4),l(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,u.prototype.uint32=(p=4294967295,function(){if(p=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return p;if(p=(p|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return p;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return p}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return l(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|l(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(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)},u.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.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},u._configure=function(e){n=e,u.create=c(),n._configure();var t=o.Long?"toLong":"toNumber";o.merge(u.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},function(e,t,r){e.exports=s;var n=r(9);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var o=r(10),i=r(1);function s(e,t,r,o){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=o}function a(e){if(e.parent)for(var t=0;t=this._reconnectionAttempts?(c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1):(e=this.backoff.duration(),c("will wait %dms before reconnect attempt",e),this.reconnecting=!0,t=setTimeout((function(){r.skipReconnect||(c("attempting reconnect"),r.emitAll("reconnect_attempt",r.backoff.attempts),r.emitAll("reconnecting",r.backoff.attempts),r.skipReconnect||r.open((function(e){e?(c("reconnect attempt error"),r.reconnecting=!1,r.reconnect(),r.emitAll("reconnect_error",e.data)):(c("reconnect success"),r.onreconnect())})))}),e),this.subs.push({destroy:function(){clearTimeout(t)}}))},l.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,r){var n=r(23),o=r(84),i=r(93);r=r(94);t.polling=function(e){var t,r,s=!1,a=!1,u=!1!==e.jsonp;if("undefined"!=typeof location&&(t="https:"===location.protocol,r=(r=location.port)||(t?443:80),s=e.hostname!==location.hostname||r!==e.port,a=e.secure!==t),e.xdomain=s,e.xscheme=a,"open"in new n(e)&&!e.forceJSONP)return new o(e);if(!u)throw new Error("JSONP disabled");return new i(e)},t.websocket=r},function(e,t,r){var n=r(25),o=r(16),i=r(8),s=r(17),a=r(39),u=r(18)("engine.io-client:polling");e.exports=p;var c=null!=new(r(23))({xdomain:!1}).responseType;function p(e){var t=e&&e.forceBase64;c&&!t||(this.supportsBinary=!1),n.call(this,e)}s(p,n),p.prototype.name="polling",p.prototype.doOpen=function(){this.poll()},p.prototype.pause=function(e){var t,r=this;function n(){u("paused"),r.readyState="paused",e()}this.readyState="pausing",this.polling||!this.writable?(t=0,this.polling&&(u("we are currently polling - waiting to pause"),t++,this.once("pollComplete",(function(){u("pre-pause polling complete"),--t||n()}))),this.writable||(u("we are currently writing - waiting to pause"),t++,this.once("drain",(function(){u("pre-pause writing complete"),--t||n()})))):n()},p.prototype.poll=function(){u("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},p.prototype.onData=function(e){var t=this;u("polling got data %s",e),i.decodePayload(e,this.socket.binaryType,(function(e,r,n){return"opening"===t.readyState&&"open"===e.type&&t.onOpen(),"close"===e.type?(t.onClose(),!1):void t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():u('ignoring poll - transport state "%s"',this.readyState))},p.prototype.doClose=function(){var e=this;function t(){u("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(u("transport open - closing"),t()):(u("transport not open - deferring close"),this.once("open",t))},p.prototype.write=function(e){var t=this;function r(){t.writable=!0,t.emit("drain")}this.writable=!1,i.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,r)}))},p.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=o.encode(e),this.port&&("https"==t&&443!==Number(this.port)||"http"==t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e}},function(e,t,r){(function(t){var n=r(86),o=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===o.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===o.call(File);e.exports=function e(r){if(!r||"object"!=typeof r)return!1;if(n(r)){for(var o=0,a=r.length;o>>0,8|o.mapKey[u.keyType],u.keyType),void 0===f?t("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",c,d):t(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|f,p,d),t("}")("}")):u.repeated?(t("if(%s!=null&&%s.length){",d,d),u.packed&&void 0!==o.packed[p]?t("w.uint32(%i).fork()",(u.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",d)("w.%s(%s[i])",p,d)("w.ldelim()"):(t("for(var i=0;i<%s.length;++i)",d),void 0===f?s(t,u,c,d+"[i]"):t("w.uint32(%i).%s(%s[i])",(u.id<<3|f)>>>0,p,d)),t("}")):(u.optional&&t("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",d,u.name),void 0===f?s(t,u,c,d):t("w.uint32(%i).%s(%s)",(u.id<<3|f)>>>0,p,d))}return t("return w")};var n=r(6),o=r(12),i=r(1);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},function(e,t,r){e.exports=v;var n=r(11);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var o=r(6),i=r(29),s=r(10),a=r(58),u=r(59),c=r(30),p=r(28),f=r(27),d=r(1),l=r(56),h=r(61),y=r(62),g=r(63),m=r(64);function v(e,t){n.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 b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}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>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",s.keyType)("case 2:"),void 0===o.basic[a]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",a),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[s.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',u):t("%s[k]=value",u)):s.repeated?(t("if(!(%s&&%s.length))",u,u)("%s=[]",u),void 0!==o.packed[a]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,u)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,u?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function s(e,t,r,o){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",o,r,o,o):e("d%s=types[%i].toObject(m%s,o)",o,r,o);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,i?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,r=o.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var s=0;s>16&255,s[a++]=t>>8&255,s[a++]=255&t;return 2===n&&(t=o[e.charCodeAt(p)]<<2|o[e.charCodeAt(p+1)]>>4,s[a++]=255&t),1===n&&(t=o[e.charCodeAt(p)]<<10|o[e.charCodeAt(p+1)]<<4|o[e.charCodeAt(p+2)]>>2,s[a++]=t>>8&255,s[a++]=255&t),s},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],s=0,a=r-o;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return i.join("")}(e,s,a>2]+n[t<<4&63]+"==")):2==o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a>1,p=-7,f=r?o-1:0,d=r?-1:1;r=e[t+f];for(f+=d,i=r&(1<<-p)-1,r>>=-p,p+=a;0>=-p,p+=n;0>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,l=n?1:-1;i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(t+=1<=s+p?f/n:f*Math.pow(2,1-p))*n&&(s++,n/=2),c<=s+p?(a=0,s=c):1<=s+p?(a=(t*n-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));8<=o;e[r+d]=255&a,d+=l,a/=256,o-=8);for(s=s<>t&63|128)}function c(){if(n<=o)throw Error("Invalid byte index");var e=255&r[o];if(o++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}e.exports={version:"2.1.2",encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=s(e),o=n.length,c=-1,p="";++c>6&31|192):0==(4294901760&e)?(a(e,t)||(e=65533),r=i(e>>12&15|224),r+=u(e,6)):0==(4292870144&e)&&(r=i(e>>18&7|240),r+=u(e,12),r+=u(e,6)),r+i(63&e|128)}(n[c],r);return p},decode:function(e,t){var u=!1!==(t=t||{}).strict;r=s(e),n=r.length,o=0;for(var p,f=[];!1!==(p=function(e){var t,i;if(n>>10&1023|55296),t=56320|1023&t),o+=i(t);return o}(f)}}},function(e,t){var r;r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t.encode=function(e){for(var t=new Uint8Array(e),n=t.length,o="",i=0;i>2],o+=r[(3&t[i])<<4|t[i+1]>>4],o+=r[(15&t[i+1])<<2|t[i+2]>>6],o+=r[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o},t.decode=function(e){var t,n,o,i,s=.75*e.length,a=e.length,u=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);s=new ArrayBuffer(s);for(var c=new Uint8Array(s),p=0;p>4,c[u++]=(15&n)<<4|o>>2,c[u++]=(3&o)<<6|63&i;return s}},function(e,t){var r=void 0!==r?r:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=r&&r.prototype.append&&r.prototype.getBlob;function s(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t,r=e.buffer;return e.byteLength!==r.byteLength&&((t=new Uint8Array(e.byteLength)).set(new Uint8Array(r,e.byteOffset,e.byteLength)),r=t.buffer),r}return e}))}function a(e,t){t=t||{};var n=new r;return s(e).forEach((function(e){n.append(e)})),t.type?n.getBlob(t.type):n.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=n?o?Blob:u:i?a:void 0},function(e,t,r){function n(e){var r;function n(){if(n.enabled){var e=n,o=+new Date,i=o-(r||o);e.diff=i,e.prev=r,e.curr=o,r=o;for(var s=new Array(arguments.length),a=0;a';r=document.createElement(e)}catch(e){(r=document.createElement("iframe")).name=s.iframeId,r.src="javascript:0"}r.id=s.iframeId,s.form.appendChild(r),s.iframe=r}this.form||(n=document.createElement("form"),o=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o),this.form.action=this.uri(),p(),e=e.replace(u,"\\\n"),this.area.value=e.replace(a,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===s.iframe.readyState&&c()}:this.iframe.onload=c}},function(e,t,r){(function(t){var n,o,i=r(25),s=r(8),a=r(16),u=r(17),c=r(39),p=r(18)("engine.io-client:websocket");if("undefined"!=typeof WebSocket?n=WebSocket:"undefined"!=typeof self&&(n=self.WebSocket||self.MozWebSocket),"undefined"==typeof window)try{o=r(95)}catch(u){}var f=n||o;function d(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=n&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(f=o),i.call(this,e)}u(e.exports=d,i),d.prototype.name="websocket",d.prototype.supportsBinary=!0,d.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new f(e,t):new f(e):new f(e,t,r)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},d.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},d.prototype.write=function(e){var r=this;this.writable=!1;for(var n=e.length,o=0,i=n;on[o])return!0;if(r[o]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{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,r){e.exports=function(e,t){for(var r={},n=Object.keys(e),o=Array.isArray(t),i=0;i>2],o=(3&c)<<4,u=1;break;case 1:s[a++]=n[o|c>>4],o=(15&c)<<2,u=2;break;case 2:s[a++]=n[o|c>>6],s[a++]=n[63&c],u=0}8191>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},t.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){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>>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 n(e,t,r){f[0]=e,t[r]=d[0],t[r+1]=d[1],t[r+2]=d[2],t[r+3]=d[3],t[r+4]=d[4],t[r+5]=d[5],t[r+6]=d[6],t[r+7]=d[7]}function u(e,t,r){f[0]=e,t[r]=d[7],t[r+1]=d[6],t[r+2]=d[5],t[r+3]=d[4],t[r+4]=d[3],t[r+5]=d[2],t[r+6]=d[1],t[r+7]=d[0]}function c(e,t){return d[0]=e[t],d[1]=e[t+1],d[2]=e[t+2],d[3]=e[t+3],d[4]=e[t+4],d[5]=e[t+5],d[6]=e[t+6],d[7]=e[t+7],f[0]}function p(e,t){return d[7]=e[t],d[6]=e[t+1],d[5]=e[t+2],d[4]=e[t+3],d[3]=e[t+4],d[2]=e[t+5],d[1]=e[t+6],d[0]=e[t+7],f[0]}var f,d,l,h,y;function g(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>>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){l[0]=e,t[r]=h[0],t[r+1]=h[1],t[r+2]=h[2],t[r+3]=h[3]}function b(e,t,r){l[0]=e,t[r]=h[3],t[r+1]=h[2],t[r+2]=h[1],t[r+3]=h[0]}function _(e,t){return h[0]=e[t],h[1]=e[t+1],h[2]=e[t+2],h[3]=e[t+3],l[0]}function E(e,t){return h[3]=e[t],h[2]=e[t+1],h[1]=e[t+2],h[0]=e[t+3],l[0]}}function o(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 i(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 s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=n(n)},function(e,t,r){t.length=function(e){for(var t,r=0,n=0;n>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],8191>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=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){return r<1||o>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){if(0===e)return i;var t=e<0,r=(e=t?-e:e)>>>0;e=(e-r)/4294967296>>>0;return t&&(e=~e>>>0,r=~r>>>0,4294967295<++r&&(r=0,4294967295<++e&&(e=0))),new o(r,e)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(n.isString(e)){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.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},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var s=String.prototype.charCodeAt;o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?i:new o((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},o.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)},o.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},o.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},o.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=i;var n=r(27);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(5);function i(){n.call(this)}function s(e,t,r){e.length<40?o.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}i._configure=function(){i.alloc=o._Buffer_allocUnsafe,i.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&"set"===o.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(i.writeBytesBuffer,t,e),this},i.prototype.string=function(e){var t=o.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},i._configure()},function(e,t,r){e.exports=i;var n=r(28);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(5);function i(e){n.call(this,e)}i._configure=function(){o.Buffer&&(i.prototype._slice=o.Buffer.prototype.slice)},i.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},i._configure()},function(e,t,r){e.exports=o;var n=r(5);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,r){(e.exports=function e(t,r){"string"==typeof t&&(r=t,t=void 0);var n=[];function o(t){if("string"!=typeof t){var r=i();if(e.verbose,r="return "+r,t){for(var s=Object.keys(t),a=new Array(s.length+1),u=new Array(s.length),c=0;c{},l=i,h=i,y=(s=r(4),r.n(s));const g={XSYNC_V1:0,XSYNC_V2:1},m={UNREAD:0,SYNC:1,NOTICE:2,PROVISION:3},v={NONE:0,ZLIB:1},b={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},_={UNKNOWN:0,IOS:1,ANDR:2,WIN:3,OSX:4,LINUX:5,WEB:6},E={ENCRYPT_NONE:0,AES_CBC_128:1,AES_CBC_256:2,CUSTOM:3},w={UNKNOWN:0,MESSAGE:1,GROUP_NOTICE:2,ROSTER_NOTICE:3,USER_NOTICE:4,INFO:5,CONVERSATION:6},A={NORMAL:0,OPER:1,CHAT:2,GROUPCHAT:3},C={UNKNOWN:0,READ_ACK:1,READ_ALL:2,READ_CANCEL:3,DELIVER_ACK:4,RECALL:5,DELETE:6},N={TEXT:0,IMAGE:1,AUDIO:2,VIDEO:3,FILE:4,LOCATION:5,COMMAND:6,FORWARD:7},k={AT_LEAST_ONCE:0,AT_MOST_ONCE:1,EXACTLY_ONCE:2},O={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},S={WIRE:0,WIFI:1,NET_2G:2,NET_3G:3,NET_4G:4,NET_5G:5,UNKNOWN:6},R={UNKNOWN:0,ADDED:1,REMOVED:2,ACCEPTED:3,DECLINED:4,BLOCKED:5,UNBLOCKED:6,APPLIED:7,INFO_UPDATED:8,MUTED:9,UNMUTED:10},T={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},I={UNKNOWN:0,OPER:1},x={UNKNOWN:0,DELETE:1,DELETE_EVERYWHERE:2},D={UNREAD:0,DELIVERED:1,READ:2},U=e=>{if(e instanceof y.a)return e.toString();const{low:t,high:r,unsigned:n=!0}=e;if(void 0!==t&&void 0!==r)return new y.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(U(e))})),t}const i={};return Object.keys(e).forEach((t=>{void 0!==e[t]&&(i[t]=U(e[t]))})),i},M=e=>{const{low:t,high:r,unsigned:n}=e;if(void 0!==t&&void 0!==r)return new y.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(M(e))})),t}const i={};return Object.keys(e).forEach((t=>{i[t]=M(e[t])})),i},B=(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 y.a(t,r,e).toNumber():void 0},P=e=>{if("string"==typeof e)return y.a.fromString(e);var{low:t,high:r,unsigned:n=!0}=e;return void 0!==t&&"undefined"!==r?new y.a(t,r,n):"number"==typeof e?y.a.fromNumber(e):new y.a},j=e=>void 0===e?"":"string"==typeof e?e:"number"==typeof e?e+"":(void 0!==e.low&&void 0!==e.high?new y.a(e.low,e.high,!0):new y.a(e)).toString(),L=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:c=0,ext:p,config:f,type:d}=t;let l=null,h=null;try{l=JSON.parse(u)}catch(e){}try{h=JSON.parse(f)}catch(e){}let y=i||t.status,g={id:j(o),from:j(r.uid),to:j(n.uid),content:a,type:Object.keys(N)[c].toLowerCase(),ext:p,status:y||D.UNREAD,timestamp:j(s||0),toType:2==d?"roster":"group"};return l&&(g.attach=l),h&&(g.config=h),g},F=()=>{var e=window.localStorage.getItem("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=F()+"_"+e),0{if(void 0!==e){var n=e;if(t&&(n=F()+"_"+e),0{let n=e;t&&(n=F()+"_"+e),0<=r&&(n=n+"_"+r%31),window.localStorage.removeItem(n)},Y=(e,t=!0)=>{for(var r=0;r<31;r++)J(e,t,r)},K={saveJoinedGroups:e=>{if(e){const t=(e=Array.isArray(e)?e:[e]).map((e=>e.group_id||e)),r=q("key_group_lists")||[],n=Array.from(new Set(t.concat(r)));G("key_group_lists",n)}},removeGroup:e=>{const t=q("key_group_lists")||[],r=t.findIndex((t=>t===e));0<=r&&(t.splice(r,1),G("key_group_lists",t))},getJoinedGroups:()=>q("key_group_lists"),saveGroupInfo:e=>{Array.isArray(e)||(e=[e]);const t=q("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=q("key_group_infos")[e]||{};return Object.assign(t,{group_id:e})},getGroupInfoList:()=>{const e=K.getJoinedGroups()||[],t=K.getAllGroupInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{group_id:e}))})),r},getAllGroupInfos:()=>q("key_group_infos")||{},saveGroupMembers:(e,t,r)=>{Array.isArray(t)||(t=[t]);const n=q("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=(q("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=>(q("key_group_members")||{})[e]||[],clear:()=>{J("key_group_infos"),J("key_group_members"),J("key_group_lists")}};var V=K;const H=()=>{var e=q("key_user_id",!1);if(e)return+e},W=()=>{J("key_user_id")},z=()=>{J("key_user_token")},X=()=>{J("key_user_aes_key")},$=()=>{J("key_user_device_sn")};var Z={saveToken:e=>G("key_user_token",e),getToken:()=>q("key_user_token"),deleteToken:z,getAesKey:()=>q("key_user_aes_key"),saveAesKey:e=>G("key_user_aes_key",e),deleteAesKey:X,saveDeviceSN:e=>G("key_user_device_sn",e),getDeviceSN:()=>{let e=q("key_user_device_sn");return e=e||999999999+Math.floor(214e4*Math.random())+"",+e},deleteDeviceSN:$,saveUid:e=>{if(!e)throw new Error("uid is error ...");G("key_user_id",e+"",!1)},getUid:H,removeUid:W,getDeviceGuid:()=>{if(!H())return"";let e=q("key_user_device_guid");return e||(e=H()+"_"+Math.floor(2147483648*Math.random()),G("key_user_device_guid",e)),e},saveProfile:e=>G("key_user_profile",e),getProfile:()=>q("key_user_profile"),clear:()=>{$(),X(),z(),W()},saveAppid:e=>{if(!e)throw new Error("Invalid appid ...");G("key_app_id",e+"",!1)},getAppid:()=>q("key_app_id",!1)};const Q={},ee=e=>(void 0===Q[e]&&(Q[e]=[]),Q[e]),te=(e,t)=>{var r=ee(e).findIndex((e=>e.toString()===t.toString()));-1{var r=ee(e).findIndex((e=>e.toString()===t.toString()));0<=r&&Q[e].splice(r,1)},ne=(e,t)=>{ee(e).forEach((e=>{e(t)}))},oe={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 c=e.content;if(c||s){"text"!=o&&(c=o);let e=B(n);var t=Z.getUid();e===t&&(e=B(r));const s=q("key_recent_store")||[],p=s.findIndex((t=>t.type===i&&t.id===e));-1{e.forEach((e=>{const r=t,n=q("key_recent_store")||[];let o="",i="";var s=n.findIndex((t=>t.type===r&&t.id===e));-1{const e=q("key_recent_store")||[],t=e.filter((e=>"roster"==e.type)).map((e=>e.id));return ne("imGetRecent",t),e},getRecentById:e=>{const t=q("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}=oe.getRecentById(e);if(!(e<0)){const t=q("key_recent_store")||[];t.splice(e,1),G("key_recent_store",t)}},clear:()=>{J("key_recent_store")}};var ie=oe;const se=e=>{var{payload:t}=e;if(!t)return!1;var{type:e,operation:t={}}=t;if(!t||e!==A.OPER)return!1;var{type:t}=t;return t===C.READ_ACK||t==C.READ_ALL},ae=(e,t)=>{const r=P(t.id);if(0===e.length)e.push(t);else{var n=e[0],o=e[e.length-1];if(-1===r.comp(P(n.id)))e.unshift(t);else if(1===r.comp(P(o.id)))e.push(t);else{let n=0,o=0;for(;n{const t=q("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;ne("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedRosterMessage:e=>{const{client_mid:t,server_mid:r}=e,n=q("key_roster_sending_message")||[];if(r){var o=n.findIndex((e=>B(e.id)===B(t)));if(-1B(e.id)===B(t)));-1{var{from:t,to:r,type:n}=e;if("command"!=n&&"forward"!=n){n=B(t),t=B(Z.getUid()),r=B(r);const o=q("key_roster_message_store",!0,n=n===t?r:n)||{},i=o[n]||[];ae(i,e),100(q("key_roster_message_store",!0,e)||{})[e]||[],saveFormatedRosterMessage:(e,t=[])=>{const r=q("key_roster_message_store",!0,e)||{};r[e]=t,G("key_roster_message_store",r,!0,e)},getRosterUnreadMessageIdsByRosterid:e=>{const t=(q("key_roster_message_store",!0,e)||{})[e]||[],r=[];return t.forEach((e=>{var{status:t=D.READ,id:e}=e;t==D.UNREAD&&r.push(e)})),r},deleteRosterMessageByRosterId:e=>{const t=q("key_roster_message_store",!0,e)||{};t[e]&&delete t[e],G("key_roster_message_store",t,!0,e)},deleteSingleRosterMessage:(e,t)=>{const r=q("key_roster_message_store",!0,e)||{},n=j(t),o=r[e]||[],i=o.findIndex((e=>j(e.id)===n));-1{const t=q("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;ne("onSendingMessageStatusChanged",{status:"sending",uid:r.uid,mid:e})},dealSendedGroupMessage:e=>{const{client_mid:t,server_mid:r}=e,n=q("key_group_sending_message")||[],o=n.findIndex((e=>B(e.id)===B(t)));if(-1{var{to:t,type:r}=e;if("command"!=r&&"forward"!=r){const r=B(t),n=q("key_group_message_store",!0,r)||{},o=n[r]||[];ae(o,e),100(q("key_group_message_store",!0,e)||{})[e]||[],saveFormatedGroupMessage:(e,t=[])=>{const r=q("key_group_message_store",!0,e)||{};r[e]=t,G("key_group_message_store",r,!0,e)},getGroupUnreadMessageIdsByGid:e=>{const t=(q("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=q("key_group_message_store",!0,e)||{};t[e]&&delete t[e],G("key_group_message_store",t,!0,e)},deleteSingleGroupMessage:(e,t)=>{const r=q("key_group_message_store",!0,e)||{};t=j(t);const n=r[e]||[],o=n.findIndex((e=>j(e.id)===t));-1{const t=ue.getRosterMessage(e)||[];let r=0;const n=Z.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=B(t))&&t!==n&&e!==D.READ&&r++})),r},getUnreadByGroupId:e=>{const t=ue.getGroupMessage(e)||[];let r=0;const n=Z.getUid();return t.forEach((e=>{var t,{from:t,status:e}=e;0<(t=B(t))&&t!==n&&e!==D.READ&&r++})),r},getRosterMessageById:(e,t)=>{const r=q("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=q("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?ue.deleteGroupMessageByGid(e):ue.deleteRosterMessageByRosterId(e)},clearAll:()=>{Y("key_roster_message_store"),Y("key_group_message_store")}};var ce=ue,pe=e=>{const t=q("key_notice_store")||[];t.push(e),50<(e=t.length)&&t.splice(0,e-50),G("key_notice_store",t)};u=()=>q("key_notice_store")||[];const fe={saveRosterList:(e=[])=>{const t=(e=Array.isArray(e)?e:[e]).map((e=>e.roster_user_id||e.user_id||e)),r=fe.getRosterList()||[];var n=Array.isArray(r)?Array.from(new Set(r.concat(t))):t;G("key_roster_lists",n),fe.saveRosterInfo(e)},getRosterList:()=>q("key_roster_lists"),getRosterInfoList:()=>{const e=fe.getRosterList()||[],t=fe.getAllRosterInfos()||{},r=[];return e.forEach((e=>{var n=t[e]||{};r.push(Object.assign({},n,{user_id:e}))})),r},removeRoster:e=>{const t=fe.getRosterList(),r=t.indexOf(e);0<=r&&t.splice(r,1),G("key_roster_lists",t)},removeRosterList:()=>J("key_roster_lists"),saveRosterInfo:(e=[])=>{Array.isArray(e)||(e=[e]);const t=fe.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=(q("key_roster_infos")||{})[e]||{user_id:e};return t&&Object.assign(t,{user_id:e})},getAllRosterInfos:()=>q("key_roster_infos"),clear:()=>{J("key_roster_infos"),J("key_roster_lists")}};var de=fe,le=(p=r(19),r.n(p));let he={errTimer:null,errCount:0};te("refresh_ratel",(e=>{e&&(f.a.defaults.baseURL=e)}));const ye=["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"];f.a.defaults.timeout=2e4,f.a.interceptors.request.use((e=>{var t=Z.getToken(),r=Z.getAppid();if(r&&(e.headers.common.app_id=r),t&&(e.headers.common["access-token"]=t),(e=>{let t=!0;return ye.forEach((r=>{-1Promise.reject(e)));const ge=(e,t="get",r={},n=[],o=!1,i={})=>{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={};return"get"===(t=t.toLowerCase())||"post"===t&&o?(0+e))),r.user_list&&Array.isArray(r.user_list)&&(r.user_list=r.user_list.map((e=>+e))),r.file_list&&Array.isArray(r.file_list)&&(r.file_list=r.file_list.map((e=>+e))),a=r),f.a[t](e,a,i).then((t=>{he.errTimer&&clearTimeout(he.errTimer),he.errTimer=null,he.errCount=0;var{data:r={}}=t;if(0!==Object.keys(i).length)return"boolean"==typeof r.data&&r.data||"string"==typeof r.Status&&"OK"===r.Status?void 0:Promise.reject({config:i,url:e});var{data:n,code:t,message:r}=r;return 200===t?n:(402===t&&ne("flooNotice",{category:"action",desc:"relogin"}),Promise.reject({url:e,code:t,message:r}))})).catch((e=>(he.errTimer&&clearTimeout(he.errTimer),he.errTimer=null,he.errCount=he.errCount+1,5<=he.errCount?(he.errCount=0,ne("ratelError")):he.errTimer=setTimeout((()=>{he.errCount=0}),18e5),Promise.reject(e))))},me=(e,t)=>ge(e,"get",t,["app_id"],!0),ve=e=>ge("/token/user","post",e,[["mobile","name"],"password"]),be=e=>ge("/token/id","post",e,["user_id","password"]),_e=e=>ge("/user/register/v2","post",e,["username","password"]),Ee=e=>ge("/app/user/mobile_bind","post",e,["captcha","mobile"]),we=e=>ge("/app/user/mobile_update","post",e,["mobile"]),Ae=e=>ge("/app/captcha/sms","get",e,["mobile"],!0),Ce=e=>ge("/app/user/name_check","get",e,["username"],!0),Ne=e=>ge("/app/user/mobile_bind","post",e,["captcha","mobile"]),ke=e=>ge("/app/user/mobile_bind_with_sign","post",e,["sign","mobile"]),Oe=e=>ge("/app/user/info_pwd","get",e,["captcha","mobile"],!0),Se=e=>ge("/app/captcha/image","post",e,[]),Re=e=>ge("/app/captcha/sms_web","get",e,["captcha","image_id","mobile"],!0),Te=e=>ge("/roster/accept","post",e,["user_id"],!0),Ie=e=>ge("/roster/apply","post",e,["user_id","alias"]),xe=e=>ge("/roster/decline","post",e,["user_id"]),De=e=>ge("/roster/delete","post",e,["user_id"],!0),Ue=e=>ge("/roster/ext","post",e,["user_id","ext"]),Me=e=>ge("/roster/id","get",e,["user_id"]),Be=e=>ge("/roster/list","get",e,[]),Pe=e=>ge("/roster/list","post",e,["list"]),je=e=>ge("/roster/name","get",e,["username"]),Le=e=>ge("/roster/apply/list","get",e,["cursor"],!0),Fe=e=>ge("/roster/blocked_list","get",e,[""],!0),Ge=e=>ge("/roster/block","post",e,["user_id"],!0),qe=e=>ge("/roster/unblock","post",e,["user_id"],!0),Je=e=>ge("/group/admin/add","post",e,["group_id","user_list"]),Ye=e=>ge("/group/admin_list","get",e,["group_id"],!0),Ke=e=>ge("/group/admin/remove","post",e,["group_id","user_list"]),Ve=e=>ge("/group/announcement","get",e,["announcement_id","group_id"]),He=e=>ge("/group/announcement/delete","post",e,["announcement_id","group_id"],!0),We=e=>ge("/group/announcement/edit","post",e,["group_id","content","title"]),ze=e=>ge("/group/announcement/list","get",e,["group_id"],!0),Xe=e=>ge("/group/create","post",e,["name"]),$e=e=>ge("/group/destroy","post",e,["group_id"],!0),Ze=e=>ge("/group/info","get",e,["group_id"]),Qe=e=>ge("/group/info/avatar","post",e,["group_id","value"]),et=e=>ge("/group/info/description","post",e,["group_id","value"]),tt=e=>ge("/group/info/ext","post",e,["group_id","value"]),rt=e=>ge("/group/info/name","post",e,["group_id","value"]),nt=e=>ge("/group/member_list","get",e,["group_id"]),ot=e=>ge("/group/msg/mute_mode","post",e,["group_id","msg_mute_mode"]),it=e=>ge("/group/msg/not_disturb","post",e,["group_id","value"]),st=()=>ge("/group/public_list","get",{},[]),at=e=>ge("/group/banned_list","get",e,["group_id"]),ut=e=>ge("/group/ban","post",e,["group_id","duration","user_list"]),ct=e=>ge("/group/unban","post",e,["group_id","user_list"]),pt=e=>ge("/group/settings","get",e,["group_id"]),ft=e=>ge("/group/settings/allow_member_invitation","post",e,["group_id","value"]),dt=e=>ge("/group/settings/allow_member_modify","post",e,["group_id","value"]),lt=e=>ge("/group/settings/enable_read_ack","post",e,["group_id","value"]),ht=e=>ge("/group/settings/history_visible","post",e,["group_id","value"]),yt=e=>ge("/group/settings/require_admin_approval","post",e,["group_id","apply_approval"]),gt=e=>ge("/group/transfer","post",e,["group_id","new_owner"]),mt=e=>ge("/group/user_joined","get",e),vt=e=>ge("/group/apply","post",e,["group_id"]),bt=e=>ge("/group/apply/handle","post",e,["approval","group_id","user_id"]),_t=e=>ge("/group/blocked_list","get",e,["group_id"]),Et=e=>ge("/group/block","post",e,["user_list","group_id"]),wt=e=>ge("/group/unblock","post",e,["user_list","group_id"]),At=e=>ge("/group/kick","post",e,["user_list","group_id"]),Ct=e=>ge("/group/invite","post",e,["user_list","group_id"]),Nt=e=>ge("/group/invite/handle","post",e,["approval","user_id","group_id"]),kt=e=>ge("/group/info/batch","post",e,["group_list"]),Ot=e=>ge("/group/members/display_name","post",e,["group_id","user_list"]),St=e=>ge("/group/leave","post",e,["group_id"],!0),Rt=e=>ge("/group/display_name","post",e,["group_id","value"]),Tt=e=>ge("/group/application_list","post",e,["group_list"]),It=()=>ge("/group/invitation_list","get",{},[]),xt=e=>ge("/group/file/list","get",e,["group_id"],!0),Dt=e=>ge("/group/file/delete","post",e,["file_list","group_id"]),Ut=e=>ge("/group/file/upload","post",e,["name","size","url","group_id"]),Mt=e=>ge("/user/authmode","post",e,["value"],!0),Bt=e=>ge("/user/avatar","post",e,["avatar"]),Pt=e=>ge("/user/mobile","post",e,["mobile"],!0),jt=e=>ge("/user/nickname","post",e,["nick_name"],!0),Lt=()=>ge("/user/profile","get",{},[]),Ft=e=>ge("/user/profile","post",e,[]),Gt=e=>ge("/user/push","post",e,["value"]),qt=e=>ge("/user/push/detail","post",e,["value"]),Jt=e=>ge("/user/push/limit","post",e,["no_push_end_hour","no_push_start_hour"]),Yt=e=>ge("/user/push/nickname","post",e,["value"]),Kt=()=>ge("/user/settings","get",{},[]),Vt=e=>ge("/user/settings","post",e,["user_id"]),Ht=e=>ge("/user/sounds","post",e,["value"]),Wt=e=>ge("/user/vibratory","post",e,["value"]),zt=e=>ge("/user/token/bind","post",e,["device_sn","device_token","notifier_name"]),Xt=e=>ge("/user/token/unbind","post",e,[],!0),$t=e=>ge("/file/upload/forward","get",e,["file_sign","access-token","to_id","to_type"],!0),Zt=(e,t,r)=>ge(e,"post",t,[],!1,r),Qt=e=>ge("/file/upload/avatar/user","get",e,[],!0),er=e=>ge("/file/upload/avatar/group","get",e,["group_id"],!0),tr=e=>ge("/file/upload/chat","get",e,["file_type","to_id","to_type"],!0),rr=(e,t,r)=>ge(e,"get",t,[],!0,r),nr=e=>ge("/app/qr_code","get",e,[]),or=e=>ge("/app/qr_login","get",e,["qr_code"]),ir=e=>ge("/app/qrcode/group_sign","get",e,["group_id"],!0),sr=e=>ge("/app/qrcode/group_invite","get",e,["qr_info"],!0),ar=e=>ge("/user/bind_openid","get",e,["open_id"],!0),ur=e=>ge("/app/wechat_login","get",e,["code"],!0),cr=e=>ge("/app/support_staff","get",e,[],!0),pr=()=>ge("/app/wechat/unbind","post"),fr=()=>ge("/app/wechat/is_bind","get"),dr=e=>ge("/app/wechat/bind","post",e,["open_id","type"]),lr=function(e={}){this.uid=e.uid||0,e=void 0===e.deviceSN?Z.getDeviceSN():e.deviceSN,this.deviceSN=e};lr.prototype.setUid=function(e){this.uid=e},lr.prototype.setDeviceSN=function(e){this.deviceSN=e};var hr=lr;function yr(e){var{operation:t={type:C.UNKNOWN,mid:0}}=e;void 0!==(e=Object.assign({},{type:A.NORMAL,ctype:N.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)}yr.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 gr=yr;function mr(e){void 0!==(e=Object.assign({},{vsn:g.XSYNC_V1,compress_method:v.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)}mr.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 vr=mr;function br(e){void 0!==(e=Object.assign({},{encrypt_method:E.ENCRYPT_NONE,os_type:_.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)}br.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 _r=br;function Er(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)}Er.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 wr=Er;function Ar(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)}Ar.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 Cr=Ar;function Nr(e){void 0!==e.type&&(this.type=e.type),void 0!==e.operation&&(this.operation=e.operation)}Nr.prototype={setType:function(e){this.type=e},setOperation:function(e){this.operation=e}};var kr=Nr;let Or=Z.getDeviceSN(),Sr=Z.getDeviceGuid();te("userKicked",(()=>{Or=0,Sr=999999999+Math.floor(214e4*Math.random())+""})),te("temporary_deviceSN",(e=>{Or=e}));const Rr=e=>{const t=new vr;t.setCommond(m.SYNC);const r=new wr;return e.xid&&r.setXid(e.xid),e.next_key&&r.setKey(e.next_key),t.setPayload(r),t},Tr=e=>{const{gid:t,content:r,type:n="text",attachment:o,ext:i,priority:s}=e;e=Object.keys(N).indexOf(n.toUpperCase());const a=new hr({uid:+Z.getUid(),deviceSN:Or}),u=new hr({uid:t,deviceSN:0}),c=new vr;c.setCommond(m.SYNC);const p=new wr,f=new gr({from:a,to:u,content:r,ctype:e,type:A.GROUPCHAT,ext:i});return 0{const{uid:t,content:r,type:n="text",ext:o,attachment:i}=e;ne("imSendRosterMessage",e),e=Object.keys(N).indexOf(n.toUpperCase());const s=new hr({uid:+Z.getUid(),deviceSN:Or}),a=new hr({uid:+t,deviceSN:0}),u=new vr;u.setCommond(m.SYNC);const c=new wr,p=new gr({from:s,to:a,content:r,ctype:e,type:A.CHAT,ext:o});return 0{t=P(t);const r=new vr;r.setCommond(m.SYNC);const n=new hr({uid:Z.getUid(),deviceSN:Or}),o=new hr({uid:B(e),deviceSN:0}),i=new wr,s=new gr({from:n,to:o,ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_ACK,mid:t}}),a=new Cr({id:(new Date).getTime()+Math.floor(256*Math.random()),from:n,to:o,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Dr=(e,t)=>{t=P(t);const r=new vr;r.setCommond(m.SYNC);const n=new hr({uid:Z.getUid(),deviceSN:Or}),o=new hr({uid:B(e),deviceSN:0}),i=new wr,s=new gr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.RECALL,mid:t,xid:o}}),a=new Cr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:o,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Ur=(e,t)=>{const r=new vr;r.setCommond(m.SYNC);const n=new hr({uid:Z.getUid(),deviceSN:Or}),o=new hr({uid:B(e),deviceSN:0}),i=new wr,s=new gr({from:n,to:n,ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_ALL,xid:o,mid:t}}),a=new Cr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r},Mr=(e,t,r)=>{var{content:n,attach:o,type:r}=r;return e?Ir({uid:e,content:n,type:r,attachment:o}):Tr({gid:t,content:n,type:r,attachment:o})},Br={};let Pr=!1;const jr=e=>{var{status:t={}}=e,{code:r,reason:n}=t;if(r===b.OK)return!0;if(void 0===t.code)return!0;r!==b.INVALID_TOKEN&&r!==b.UNAUTHORIZED||ne("flooNotice",{category:"action",desc:"relogin"}),r!==b.USER_FROZEN&&r!==b.INVALID_LICENSE&&r!==b.LICENSE_LIMIT&&r!==b.APP_FROZEN||ne("flooNotice",{category:"action",desc:"relogin_manually"}),r===b.USER_BANNED?ne("flooError",{category:"USER_BANNED",desc:"用户被禁言"}):r===b.USER_FROZEN?ne("flooError",{category:"USER_FROZEN",desc:"用户被冻结,请联系App管理员。"}):r===b.APP_FROZEN?ne("flooError",{category:"APP_FROZEN",desc:"APP 被冻结,请登陆美信拓扑控制台查看详情。"}):r===b.INVALID_LICENSE?ne("flooError",{category:"LICENSE",desc:"无效 LICENSE,请确认服务已按时付费。"}):r===b.LICENSE_LIMIT?ne("flooError",{category:"LICENSE",desc:"超出 LICENSE 用户数限制,请购买更高规格服务。"}):ne("flooError",{category:r,desc:n});var{client_mid:e}=e;return e&&ne("onSendingMessageStatusChanged",{status:"failed",mid:B(e)}),!1},Lr=e=>{const{xid:t}=e,{uid:r=0}=t;Br[r+""]?setTimeout((()=>{Br[r]=!1,Lr(e)}),3e3):(Br[r+""]=!0,ne("sendMessage",(e=>{e.uid=e.uid||0;const t=new vr;t.setCommond(m.SYNC);const r=new wr;return r.setXid(e),t.setPayload(r),t})(t)))},Fr=(e=[])=>{e.forEach((e=>{var{ns:t}=e;t===w.UNKNOWN&&l("received unknown message ...",e),t===w.MESSAGE&&qr(e),t===w.GROUP_NOTICE&&Jr(e),t===w.ROSTER_NOTICE&&Yr(e),t===w.USER_NOTICE&&Kr(e),t===w.CONVERSATION&&Gr(e)}))},Gr=e=>{var{payload:t={}}=e,{type:e,operation:t}=t;if(e===I.OPER&&(t.op_type==x.DELETE||t.op_type==x.DELETE_EVERYWHERE)){const{xid:e}=t;ne("deleteConveration",{id:e.uid,source:"other_operation"})}},qr=e=>{var{payload:t={}}=e,{type:r,operation:t}=t;r===A.NORMAL&&ne("messageNormal",e),r===A.CHAT&&ne("imRosterMessage",e),r===A.GROUPCHAT&&ne("imGroupMessage",e),r===A.OPER&&(t.type===C.UNKNOWN&&l("received unknown operation: ",e),e.isReceived=!0,ne("onActionMessage",e))},Jr=e=>{var{payload:t={}}=e,{type:t}=t;t===O.UNKNOWN&&l("received unknown groupnotice: ",e),t===O.PRESENCE&&ne("imGroupPresence",e),t===O.ABSENCE&&ne("imGroupAbesence",e),t===O.CREATED&&ne("imGroupCreated",e),t===O.DESTROYED&&ne("imGroupDestoryed",e),t===O.JOINED&&ne("imGroupJoined",e),t===O.APPLYED&&ne("imGroupApplyed",e),t===O.APPLY_ACCEPTED&&ne("imGroupApplyAccepted",e),t===O.APPLY_DECLINED&&ne("imGroupApplyDeclined",e),t===O.INVITED&&ne("imGroupInvited",e),t===O.INVITE_ACCEPTED&&ne("imGroupInvitedAccepted",e),t===O.INVITE_DECLINED&&ne("imGroupInvitedDeclined",e),t===O.KICKED&&ne("imGroupKicked",e),t===O.BANNED&&ne("imGroupBaned",e),t===O.UNBANNED&&ne("imGroupUnbaned",e),t===O.OWNER_ASSIGNED&&ne("imGroupOwnerAssigned",e),t===O.ADMIN_GRANTED&&ne("imGroupAdminGranted",e),t===O.ADMIN_REVOKED&&ne("imGroupAdminRevoked",e),t===O.BLOCKED&&ne("imGroupBlocked",e),t===O.UNBLOCKED&&ne("imGroupUnblocked",e),t===O.MUTED&&ne("imGroupMuted",e),t===O.UNMUTED&&ne("imGroupUnmuted",e),t===O.INFO_UPDATED&&ne("imGroupInfoUpdated",e),t===O.ANNOUNCEMENT_UPDATED&&ne("imGroupAnnouncementUpdated",e)},Yr=e=>{var{payload:t={}}=e,{type:t}=t;t===R.UNKNOWN&&l("received unknown rosterNotice: ",e),t===R.ADDED&&ne("imRosterAdded",e),t===R.REMOVED&&ne("imRosterRemoved",e),t===R.ACCEPTED&&ne("imRosterAccepted",e),t===R.DECLINED&&ne("imRosterDeclined",e),t===R.BANNED&&ne("imRosterBaned",e),t===R.UNBANNED&&ne("imRosterUnbaned",e),t===R.INFO_UPDATED&&ne("imRosterInfoUpdated",e)},Kr=e=>{var{payload:t={}}=e,{type:t}=t;t!==T.UNKNOWN&&t!==T.PASSWORD_CHANGED&&t!==T.FROZEN&&t!==T.REMOVED&&t!==T.KICKED_BY_OTHER_DEVICE&&t!==T.DEVICE_REMOVED&&t!==T.CLUSTER_CHANGED||(Z.deleteToken(),Z.deleteDeviceSN(),ne("flooNotice",{category:"action",desc:"relogin_manually"})),t===T.UNKNOWN&&l("received unknown userNotice: ",e),t===T.KICK_BY_SAME_DEVICE&&(Pr=!0,ne("userKicked")),ne("flooNotice",{category:"userNotice",desc:Object.keys(T)[t]})};i=r(0),s=r.n(i),p=r(2),i=r.n(p);const Vr=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Provision"),Hr=e=>Vr.decode(e),Wr=e=>Vr.encode(e).finish(),zr=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.XID"),Xr=e=>zr.encode(e).finish();p=r(67),p=r.n(p);const $r=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.MessageBody");p=r(68),p=r.n(p);const Zr=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.GroupNotice");p=r(69),p=r.n(p);const Qr=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.RosterNotice");p=r(70),p=r.n(p);const en=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.UserNotice");p=r(71),p=r.n(p);const tn=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.Info");p=r(72),p=r.n(p);const rn=s.a.Root.fromJSON(p.a).lookupType("im.floo.protobuf.Conversation"),nn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Meta"),on=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.SyncUL"),sn=e=>on.decode(e),an=e=>(e.meta&&(e.meta=(e=>{var t,r,{ns:n,payload:o}=e;return n===w.MESSAGE&&(e.payload=(r=o,$r.encode(r).finish())),n===w.GROUP_NOTICE&&(e.payload=(e=>{e.from=Xr(e.from);const t=[];return(e.to||[]).forEach((e=>{t.push(Xr(e))})),e.to=t,Zr.encode(e).finish()})(o)),n===w.ROSTER_NOTICE&&(e.payload=(r=o,Qr.encode(r).finish())),n===w.USER_NOTICE&&(e.payload=(t=o,en.encode(t).finish())),n===w.INFO&&(e.payload=(t=o,tn.encode(t).finish())),n===w.CONVERSATION&&(e.payload=(o=o,rn.encode(o).finish())),nn.create(e)})(e.meta)),on.encode(e).finish()),un=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.UnreadDL"),cn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.SyncDL"),pn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Notice"),fn=s.a.Root.fromJSON(i.a).lookupType("im.floo.protobuf.Frame"),dn=e=>{e=new Uint8Array(e);const t=fn.decode(e),{command:r,payload:n}=t;return r===m.UNREAD?t.payload=(e=n,un.decode(e)):r===m.SYNC?t.payload=(e=>{const t=cn.decode(e),{metas:r=[]}=t,n=[];return r.forEach((e=>{var t,r,o,{ns:i,payload:s}=e;i===w.MESSAGE&&(e.payload=(o=s,$r.decode(o))),i===w.GROUP_NOTICE&&(e.payload=(r=s,Zr.decode(r))),i===w.ROSTER_NOTICE&&(e.payload=(r=s,Qr.decode(r))),i===w.USER_NOTICE&&(e.payload=(t=s,en.decode(t))),i===w.INFO&&(e.payload=(t=s,tn.decode(t))),i===w.CONVERSATION&&(e.payload=(s=s,rn.decode(s))),n.push(e)})),t.metas=n,t})(n):r===m.NOTICE?t.payload={xid:(e=>zr.decode(e))(n)}:r===m.PROVISION&&(t.payload=Hr(n)),t},ln=e=>{var t,{payload:r,command:n}=e;return r&&(n===m.UNREAD?e.payload=(t=r,un.encode(t).finish()):n===m.SYNC?e.payload=an(r):n===m.NOTICE?e.payload=(t=r,pn.encode(t).finish()):n===m.PROVISION&&(e.payload=Wr(r))),fn.encode(e).finish()};s.a.util.Long=y.a,s.a.configure();const{encode:hn,decode:yn}=a;let gn={},mn=0,vn=null,bn="normal",_n=null;te("refresh_fireplace",(e=>{gn=Object.assign({fireplace:e},gn)})),te("loginSuccess",(()=>{mn=0,vn&&clearInterval(vn),vn=setInterval((()=>{Cn({vsn:0,compress_method:0,command:0})}),5e4)})),te("sendMessage",(e=>{Cn(e)})),te("userKicked",(()=>{bn="kick"})),te("reconnect",(({})=>{"normal"===bn&&En()}));const En=()=>{5<=mn?(mn=0,ne("fireplaceError")):mn++,wn()},wn=()=>{var e=Math.floor(9e3*Math.random())+1e3;setTimeout((()=>{_n.connect()}),e)},An=e=>{e=yn(e=e),h("RECV :"+JSON.stringify(U(e))),(e=>{var{command:t=0,payload:e}=e;t===m.UNREAD&&(e=>{const{unread:t=[]}=e;ne("imReceivedUnread",t),t.forEach((e=>{var{xid:t,n:e}=e;0{if(jr(e)){var{metas:t=[],xid:r,is_full_sync:n,client_mid:o}=e;if(!n&&o&&P(o).gt(0))return ne("receivedSendMessage",o),setTimeout((()=>{ce.dealSendedRosterMessage(e),ce.dealSendedGroupMessage(e)}),20);var{next_key:o=0}=e;if(0===o||P(o).eq(0)){const{uid:e=0}=r;delete Br[e+""]}n?(t&&t.length&&Fr(t),ne("onReceiveHistoryMsg",{next:o})):(t.length&&Fr(t),0===o||P(o).eq(0)||ne("sendMessage",Rr({xid:r,next_key:o})))}})(e),t===m.NOTICE&&Lr(e),t===m.PROVISION&&(e=>{if(!jr(e))return ne("flooNotice",{category:"loginMessage",desc:"login socket failure ......"}),ne("loginFail","socket_failure");var{xid:e={}}=e,{deviceSN:e}=e;ne("temporary_deviceSN",e),Pr||e&&Z.saveDeviceSN(e),ne("flooNotice",{category:"loginMessage",desc:"login socket success....."}),ne("loginSuccess",{}),ne("sendMessage",{vsn:0,compress_method:0,command:0})})(e)})(e)},Cn=e=>{h("SEND :"+JSON.stringify(U(e)));const t=hn(e),r=new ArrayBuffer(t.length),n=new Uint8Array(r);t.forEach(((e,t)=>{n[t]=e})),_n.emit("frame",r)};var Nn=Object.assign(o,{connect:function(e){gn=e,mn=0,bn="normal",(()=>{_n&&_n.destroy();var{fireplace:e}=gn;ne("flooNotice",{category:"loginMessage",desc:"socket connecting..."}),_n=c()(e,{timeout:1e4+2e4*mn,transports:["websocket"]}),_n.on("connect",(()=>{ne("flooNotice",{category:"loginMessage",desc:"socket connect success..."}),ne("flooNotice",{category:"loginMessage",desc:"logining socket service..."}),ne("sendMessage",(e=>{const t=new hr({uid:+e.uid,deviceSN:Or}),r=new _r;Sr=Sr||Z.getDeviceGuid(),r.setXid(t),r.setToken(e.token),r.setDeviceguid(Sr),r.setSdkvsn("2.0.0"),r.setEncryptmethod(E.AES_CBC_128),r.setEncryptkey(Z.getAesKey()),r.setDeviceinfo("Web");const n=new vr;return n.setCommond(m.PROVISION),n.setPayload(r),n})({token:Z.getToken(),uid:Z.getUid()}))})),_n.on("frame",(e=>{An(e)})),_n.on("disconnect",(e=>{ne("reconnect",{reason:e})})),_n.on("error",(e=>{ne("reconnect",{reason:"SocketError"})})),_n.on("reconnect_attempt",(e=>{_n.io.opts.transports=["polling","websocket"]}))})()},sendMessage:Cn,disConnect:()=>{bn="logout",_n&&_n.disconnect()}}),kn={asyncGetRosterIdList:e=>e?Nn.rosterList({}).then((e=>(de.saveRosterList(e),e.map((e=>e.user_id||e))))):Promise.resolve(de.getRosterList()),asyncGetRosterInfo:(e,t)=>{var r=de.getRosterInfo(e);return r&&r.username&&!t?Promise.resolve(r):Nn.rosterListPost({list:[e]}).then((t=>(de.saveRosterInfo(t),ne("onRosterInfoUpdate",[e]),t.length&&t[0]||{})))},asyncRegester:e=>Nn.userRegister(e),asnycGetRosterListDetailByIds:e=>{if(!e||!e.length)return Promise.resolve({});const t=de.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?Nn.rosterListPost({list:n}).then((e=>(de.saveRosterInfo(e),ne("onRosterInfoUpdate",n),e))):Promise.resolve()},asyncGetUserProfile:e=>{var t=Z.getProfile();return t&&(t.name||t.mobile)&&!e?Promise.resolve(t):Nn.userProfile().then((e=>(Z.saveProfile(e),e)))},getRosterMessageByRid:e=>ce.getRosterMessage(e),readRosterMessage:(e,t)=>{ne("imReadRosterMessage",{roster_id:e,mid:t})},asyncDeleteRoster:e=>Nn.rosterDelete(e).then((t=>(de.removeRoster(e.user_id),ie.deleteRecentById(e.user_id),ne("onRosterListUpdate"),t))),getAllRosterDetail:()=>de.getAllRosterInfos(),recallMessage:(e,t)=>{t=Dr(e,t),ne("swapSendMessage",U(t)),ne("sendMessage",t)},deleteMessage:(e,t)=>{t=((e,t)=>{t=P(t);const r=new vr;r.setCommond(m.SYNC);const n=new hr({uid:Z.getUid(),deviceSN:Or}),o=new hr({uid:B(e),deviceSN:0}),i=new wr,s=new gr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.DELETE,mid:t,xid:o}}),a=new Cr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),ne("swapSendMessage",U(t)),ne("sendMessage",t)},getUnreadCount:e=>ce.getUnreadByRosterId(e),unreadMessage:(e,t)=>{t=((e,t)=>{t=P(t);const r=new vr;r.setCommond(m.SYNC);const n=new hr({uid:Z.getUid(),deviceSN:Or}),o=new hr({uid:B(e),deviceSN:0}),i=new wr,s=new gr({ctype:N.COMMAND,type:A.OPER,operation:{type:C.READ_CANCEL,mid:t,xid:o}}),a=new Cr({id:parseInt((new Date).getTime()+""+Math.floor(256*Math.random())),from:n,to:n,payload:s,ns:w.MESSAGE});return i.setMeta(a),r.setPayload(i),r})(e,t),ne("swapSendMessage",U(t)),ne("sendMessage",t)},getRosterInfo:e=>de.getRosterInfo(e),asyncGetApplyList:Nn.rosterApplylist,asyncGetBlockedlist:Nn.rosterBlockedlist,asyncBlockeAdd:Nn.rosterBlockedAdd,asyncBlockeRemove:Nn.rosterBlockeRemove,asyncApply:Nn.rosterApply,asyncAccept:Nn.rosterAccept,asyncDecline:Nn.rosterDecline,asyncUpdateRosterExt:Nn.rosterExt,asyncSearchRosterByName:Nn.rosterName,asyncSearchRosterById:Nn.rosterId};te("imRostersGroupslistReady",(e=>{var{rosters:e}=e;de.saveRosterList([].concat(e)),Tn(e)}));const On={},Sn=e=>(new Date).getTime()-(On[e]||0)<1e3,Rn=e=>{var t=(new Date).getTime();On[e]=t},Tn=(e=[])=>{Array.isArray(e)||(e=[e]);const t=de.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&&!Sn(e)&&r.push(e)&&Rn(e))})),r.length&&Dn(r)},In=(e=[],t=!1)=>{if(Array.isArray(e)||(e=[e]),t)Un(e);else{const t=V.getAllGroupInfos()||{},r=[];e.forEach((e=>{var n=e.group_id||e;if(0{let t=e.filter((e=>xn.indexOf(e)<0));t.length&&Pe({list:t}).then((e=>{t.forEach((t=>{e.findIndex((e=>e.user_id==t))<0&&xn.push(t)})),de.saveRosterInfo(e),ne("onRosterListUpdate")}))},Un=(e=[])=>{e.length&&kt({group_list:e}).then((e=>{V.saveGroupInfo(e),ne("onGroupListUpdate")}))},Mn=(e,t,r,n)=>{if(r){const t=V.getGroupMembers(e);if(!t||!t.length)return}void 0!==t&&(Array.isArray(t)||(t=[t]),Ot({group_id:e,user_list:t}).then((t=>{if(t&&t.length){const r=[],o=de.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?Pe({list:r}).then((r=>{de.saveRosterInfo(r);const o=de.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))),V.saveGroupMembers(e,t,n),ne("onGroupMemberChanged",e)})):(V.saveGroupMembers(e,t,n),ne("onGroupMemberChanged",e))}})))},Bn=(e,t)=>{const r=V.getGroupMembers(e);var n;!r||0===r.length||0<=(n=r.findIndex((e=>e.user_id===t)))&&(r.splice(n,1),V.saveGroupMembers(e,r,!0),ne("onGroupMemberChanged",e))};te("imRostersGroupslistReady",(e=>{var{groups:e}=e;V.saveJoinedGroups([].concat(e)),In(e)})),te("imRosterMessage",(e=>{const t=L(e),{ext:r="",from:n,to:o}=t;let i={};try{i=JSON.parse(r)}catch(e){}if(void 0!==i.input_status&&n!=Z.getUid())ne("onInputStatusMessage",{ext:r,from:n,to:o});else{ce.saveRosterMessage(t),t.toType="roster",ie.saveRecent(t);const e=Z.getUid()==n?o:n;Tn(e),ne("onUnreadChange",e)}ne("onRosterMessage",t)})),te("imSendRosterMessage",(e=>{Tn(e.uid)})),te("imGetRecent",(e=>{Tn(e)})),te("imGroupMessage",(e=>{const t=L(e);ce.saveGroupMessage(t),t.toType="group",ie.saveRecent(t);const r=Z.getUid(),{config:n}=t;n&&n.mentionList&&0<=n.mentionList.indexOf(r)&&ne("onMentionMessage",t),ne("onGroupMessage",t)})),te("imReceivedUnread",(e=>{var t=e.filter((e=>1===e.type)).map((e=>B(e.xid.uid)));e=e.filter((e=>2===e.type)).map((e=>B(e.xid.uid)));Pn(t),Tn(t),jn(e),In(e)}));const Pn=e=>{const t=de.getAllRosterInfos()||{},r=[];e.forEach((e=>{var{avatar:n,nick_name:o,username:i}=t[e]||{};n||o||i||e&&!Sn(e)&&r.push(e)&&Rn(e)})),r.length?Pe({list:r}).then((t=>{de.saveRosterInfo(t),ie.saveUnreadRecent(e,"roster")})):ie.saveUnreadRecent(e,"roster")},jn=e=>{const t=V.getAllGroupInfos()||{},r=[];e.forEach((e=>{var{name:n}=t[e]||{};n||e&&r.push(e)})),r.length?kt({group_list:r}).then((t=>{V.saveGroupInfo(t),ne("onGroupListUpdate"),ie.saveUnreadRecent(e,"group")})):ie.saveUnreadRecent(e,"group")};te("imRosterAdded",(e=>{var{payload:t}=e,{to:r=[],from:n}=t,t=Z.getUid();1===r.length&&B(r[0].uid)===t&&(Tn([B(n.uid)]),de.saveRosterList(B(n.uid)),ne("onRosterListUpdate",e))})),te("imRosterRemoved",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=Z.getUid();if(B(r.uid)===o&&1===n.length){const t=B(n[0].uid);de.removeRoster(t),pe(e),ie.deleteRecentById(t),ce.deleteRosterMessageByRosterId(t),ne("onRosterRemoved",e)}})),te("imRosterAccepted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=Z.getUid(),i=B(r.uid);if(1===n.length){const t=B(n[0].uid);i===o?(de.saveRosterList(t),Tn(t)):t===o&&(de.saveRosterList(i),Tn(i)),ne("onRosterAccepted",e)}})),te("imRosterDeclined",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=Z.getUid(),i=B(r.uid);if(1===n.length){const t=B(n[0].uid);i!==o&&t!==o||pe(e),ne("onRosterDeclined",e)}})),te("imRrosterBaned",(e=>{ne("onRosterNotice",e)})),te("imRosterUnbaned",(e=>{ne("onRosterNotice",e)})),te("imRosterInfoUpdated",(e=>{var{payload:t}=e,{from:r,content:t="{}"}=t,r=B(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},de.getRosterInfo(r),n),de.saveRosterInfo([r]),ne("onRosterInfoUpdate"),ne("onRosterListUpdate"))})),te("imGroupCreated",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=Z.getUid(),r=B(r.uid),n=B(n.uid);V.saveJoinedGroups(r),n!==t&&Tn(n),In(r),ne("onGroupListUpdate",e),ne("onGroupCreated",e)})),te("imGroupDestoryed",(e=>{var t,{payload:r}=e,{gid:n,from:t}=r,o=Z.getUid(),r=B(n.uid);(t=B(t.uid))!==o&&Tn(t),V.removeGroup(r),pe(e),ie.deleteRecentById(n),ce.deleteGroupMessageByGid(n),ne("onGroupListUpdate"),ne("onGroupDestoryed",e)})),te("imGroupJoined",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=B(n.uid),s=Z.getUid(),a=B(r.uid),u=[];o.forEach((e=>{u.push(B(e.uid))})),i===s?(V.saveJoinedGroups(a),In(a),ne("onGroupListUpdate")):(Mn(a,i,!0),Tn(i),ne("onGroupMemberChanged",a)),ne("onGroupJoined",e)})),te("imGroupApplyed",(e=>{var t,{payload:t}=e,{from:t}=t;(t=B(t.uid))!==Z.getUid()&&(Tn([t]),pe(e))})),te("imGroupApplyAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=B(n.uid),s=Z.getUid(),a=B(r.uid),u=[];o.forEach((e=>{u.push(B(e.uid))})),i===s?(Tn(u),Mn(a,u,!0),ne("onGroupMemberChanged",a)):(V.saveJoinedGroups(a),In(a),Tn(i),ne("onGroupListUpdate")),ne("onGroupApplyAccepted",e)})),te("imGroupApplyDeclined",(e=>{const{payload:t}=e,{from:r,to:n}=t,o=B(r.uid),i=Z.getUid(),s=[];n.forEach((e=>{s.push(B(e.uid))})),o===i?Tn(s):pe(e),ne("onGroupApplyDeclined",e)})),te("imGroupInvited",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=B(n.uid),s=Z.getUid(),a=B(r.uid),u=[];o.forEach((e=>{u.push(B(e.uid))})),i!==s&&-1e===s))?(Tn(i),In(a),pe(e)):Tn(u),ne("onGroupNotice",e)})),te("imGroupInvitedAccepted",(e=>{const{payload:t}=e,{gid:r,from:n,to:o=[]}=t,i=B(n.uid),s=Z.getUid(),a=B(r.uid),u=[];o.forEach((e=>{u.push(B(e.uid))})),i===s?(V.saveJoinedGroups(a),In(a),ne("onGroupListUpdate")):(Mn(a,i,!0),Tn(i),ne("onGroupMemberChanged",a)),ne("onGroupInvitedAccepted",e)})),te("imGroupInvitedDeclined",(e=>{var{payload:t}=e,{gid:r,from:n}=t,t=B(n.uid),n=Z.getUid(),r=B(r.uid);t===n?(pe(e),In(r)):Tn(t),ne("onGroupInvitedDeclined",e)})),te("imGroupKicked",(e=>{const{payload:t}=e=Object.assign({},e),{gid:r,to:n=[]}=t,o=Z.getUid(),i=B(r.uid),s=[];n.forEach((e=>{s.push(B(e.uid))})),-1e===o))?(V.removeGroup(i),pe(e),ie.deleteRecentById(r),ce.deleteGroupMessageByGid(r),ne("onGroupListUpdate")):Bn(i,s)})),te("imGroupBlocked",(e=>{const{payload:t}=e,{gid:r,to:n=[]}=t,o=Z.getUid(),i=B(r.uid),s=[];n.forEach((e=>{s.push(B(e.uid))})),-1e===o))?(V.removeGroup(i),pe(e),ie.deleteRecentById(r),ce.deleteGroupMessageByGid(r),ne("onGroupListUpdate")):(Tn(s),Bn(i,s))})),te("imGroupUnblocked",(e=>{const{payload:t}=e,{to:r=[]}=t,n=[];r.forEach((e=>{n.push(B(e.uid))})),Tn(n)})),te("imGroupOwnerAssigned",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=B(r.uid),i=Z.getUid(),s=[];n.forEach((e=>{s.push(B(e.uid))})),o!==i&&s.push(o),Tn(s),ne("onGroupOwnerAssigned",e)})),te("imGroupAdminGranted",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=B(r.uid),i=Z.getUid(),s=[];n.forEach((e=>{s.push(B(e.uid))})),o!==i&&s.push(o),Tn(s),ne("onGroupAdminGranted",e)})),te("imGroupAdminRevoked",(e=>{const{payload:t}=e,{from:r,to:n=[]}=t,o=B(r.uid),i=Z.getUid(),s=[];n.forEach((e=>{s.push(B(e.uid))})),o!==i&&s.push(o),Tn(s),ne("onGroupAdminRevoked",e)})),te("imGroupMuted",(e=>{ne("onGroupMuted",e)})),te("imGroupUnblocked",(e=>{ne("onGroupUnblocked",e)})),te("imGroupBaned",(e=>{ne("onGroupBaned",e)})),te("imGroupUnbaned",(e=>{ne("onGroupUnbaned",e)})),te("imGroupInfoUpdated",(e=>{var{payload:t}=e,{gid:r,content:t="{}"}=t,r=B(r.uid);let n={};try{n=JSON.parse(t)}catch(e){}Object.keys(n).length&&(r=Object.assign({},V.getGroupInfo(r),n),V.saveGroupInfo([r]),ne("onGroupListUpdate"))})),te("imGroupAnnouncementUpdated",(e=>{var{payload:t}=e,{gid:t}=t,t=B(t.uid);In(t,!0),ne("onGroupAnnouncementUpdated",e)})),te("imReadRosterMessage",(e=>{const{roster_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=ce.getRosterMessageById(t,r);if(Ln(e)&&!n){o=!0;const e=xr(t,r);ne("sendMessage",e)}}else{let e;if(ce.getRosterMessage(t).forEach((r=>{if(Ln(r)&&!n){o=!0;const e=xr(t,r.id);ne("sendMessage",e)}e=r.id})),!n&&o){const r=Ur(t,e);ne("sendMessage",r)}}o&&ne("onUnreadChange",t)}));const Ln=e=>{let t=!1;const r=Fn(e,D.READ);if(e&&r){const r=Z.getUid(),n=B(e.from);0{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,ce.saveRosterMessage(L(n)),r=!0}return r};te("imReadGroupMessage",(e=>{const{group_id:t,mid:r,isReceived:n}=e;let o=!1;if(r){const e=ce.getGroupMessageById(t,r);if(Gn(e)&&!n){o=!0;const t=j(e.from),n=xr(t,r);ne("sendMessage",n)}}else{const e=ce.getGroupMessage(t);let r;if(e.forEach((e=>{if(Gn(e)&&!n){o=!0;const t=j(e.from),r=xr(t,e.id);ne("sendMessage",r)}r=e.id})),ce.saveFormatedGroupMessage(t,e),!n&&o){const e=Ur(t,r);ne("sendMessage",e)}}o&&ne("onUnreadChange",t)}));const Gn=e=>{let t=!1;const r=qn(e,D.READ);if(e&&r){const r=Z.getUid(),n=B(e.from);0{let r=!1;if(e&&e.status!=t){const n=e;n.status=t,ce.saveGroupMessage(L(n)),r=!0}return r},Jn=(e,t)=>{var r;0<(r=t?ce.getGroupMessage(e):ce.getRosterMessage(e)).length&&ie.saveRecent(r[r.length-1])};te("onActionMessage",(e=>{var t,{payload:r,from:n,to:t,isReceived:o}=e,{type:i,operation:s={}}=r,r=(e=Z.getUid()+"",t?j(t.uid):0),n=e==(t=j(n.uid))+""?r:t;e=-1!=V.getJoinedGroups().indexOf(+r);i===A.OPER&&(({type:t,mid:r,xid:i}=s),s=e?ce.getGroupMessageById(n,r):ce.getRosterMessageById(n,r),t===C.READ_ACK?(e||Ln(s),e&&Gn(s)):t===C.DELIVER_ACK?(e||Fn(s,D.DELIVERED),e&&qn(s,D.DELIVERED)):t===C.RECALL?(e||ce.deleteSingleRosterMessage(n,r),e&&ce.deleteSingleGroupMessage(n,r),Jn(n,e),ne("onMessageRecalled",{uid:n,mid:r})):t===C.DELETE?(e||ce.deleteSingleRosterMessage(i.uid,r),e&&ce.deleteSingleGroupMessage(i.uid,r),Jn(i.uid,e),ne("onMessageDeleted",{uid:i.uid,mid:r})):t===C.READ_CANCEL?(e||Fn(s,D.UNREAD),e&&qn(s,D.UNREAD),ne("onMessageCanceled",{uid:n,mid:r})):t===C.READ_ALL&&(e?ne("imReadGroupMessage",{group_id:i.uid,mid:r,isReceived:o}):ne("imReadRosterMessage",{roster_id:i.uid,mid:r,isReceived:o})),n=j(i&&i.uid?i.uid:n),ne("onMessageStatusChanged",{uid:n,mid:j(r)}),ne("onUnreadChange",n))}));const Yn={};te("swapSendMessage",(e=>{var{payload:t}=e,{meta:t}=t,{id:t}=t;Yn[j(t)]=e})),te("receivedSendMessage",(e=>{if(e=j(e),e=Yn[e]){const t=e.payload,{meta:r}=t,{payload:n}=r,{type:o}=n;o===A.OPER&&ne("onActionMessage",r)}})),te("deleteConversation",(({id:e,source:t})=>{ne("flooNotice",{category:"conversation_deleted",desc:{id:e,source:t}});var{idx:r,type:t}=ie.getRecentById(e);r<0||("group"==t?ce.deleteGroupMessageByGid(e):ce.deleteRosterMessageByRosterId(e),ie.deleteRecentById(e))}));var Kn=Mn,Vn={asyncGetGroupInfo:(e,t)=>{var r=V.getGroupInfo(e-=0)||{};return r.name&&!t?Promise.resolve(r):Nn.groupInfo({group_id:e}).then((e=>(V.saveGroupInfo([e]),e)))},asyncGetJoinedGroups:e=>e?Nn.groupUserjoined({}).then((e=>Array.isArray(e)?e:V.getGroupInfoList())):Promise.resolve(V.getGroupInfoList()),openGroup:e=>{Nn.groupMemberlist({group_id:e}).then((t=>{V.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&Kn(e,t,!1,!0),ne("onGroupMemberChanged",e)}))},getAllGroupDetail:()=>V.getAllGroupInfos(),asyncGetGroupMembers:e=>Nn.groupMemberlist({group_id:e}).then((t=>(V.saveGroupMembers(e,t),(t=t.map((e=>e.user_id))).length&&Kn(e,t,!1,!0),t))),getGroupMembers:e=>V.getGroupMembers(e)||[],asyncGetGroupListDetail:e=>e&&e.length?Nn.groupInfoBatch({group_list:e}).then((e=>(V.saveGroupInfo(e),e))):Promise.resolve({}),getGruopMessage:e=>ce.getGroupMessage(e),readGroupMessage:(e,t)=>{ne("imReadGroupMessage",{group_id:e,mid:t})},recallMessage:(e,t)=>{t=Dr(e,t),ne("sendMessage",t),ne("swapSendMessage",t)},getUnreadCount:e=>ce.getUnreadByGroupId(e),asyncGetAdminList:Nn.groupAdminList,asyncAdminAdd:Nn.groupAdminAdd,asyncAdminRemove:Nn.groupAdminRemove,asyncGetAnouncementById:Nn.groupAnnouncement,asyncAnouncementDelete:Nn.groupAnnouncementDelete,asyncAnnouncementEdit:Nn.groupAnnouncementEdit,asyncGetAnnouncementList:Nn.groupAnnouncementList,asyncCreate:Nn.groupCreate,asyncDestroy:Nn.groupDestroy,asyncGetInfo:e=>(e.group_id||(e={group_id:e}),Nn.groupInfo(e)),asyncUpdateAvatar:Nn.groupInfoAvatar,asyncUpdateDescription:Nn.groupInfoDdscription,asyncUpdateExt:Nn.groupInfoExt,asyncUpdateName:Nn.groupInfoName,asyncGetMemberList:e=>(e.group_id||(e={group_id:e}),Nn.groupMemberlist(e)),asyncGroupMsgMutemode:Nn.groupMsgMutemode,asyncGetPublicList:Nn.groupPubliclist,asyncUpdateMsgNotDisturb:Nn.groupMsgNotdisturb,asyncGroupBannedList:Nn.groupBannedList,asyncGroupBab:Nn.groupBab,asyncGroupUnban:Nn.groupUnban,asyncGetSettings:Nn.groupSettings,asyncUpdateAllowMemberInvitation:Nn.groupSettingsAllowmemberinvitation,asyncUpdateAllowMemberModify:Nn.groupSettingsAllowmembermodify,asyncUpdateEnableReadack:Nn.groupSettingsEnablereadack,asyncUpdateHistoryVisible:Nn.groupSettingsHistoryvisible,asyncUpdateRequireadminapproval:Nn.groupSettingsRequireadminapproval,asyncOwnerTransfer:Nn.groupTransfer,asyncGetUserJoined:Nn.groupUserjoined,asyncApply:Nn.groupApply,asyncApplyHandle:Nn.groupApplyHandle,asyncGroupBockedlist:Nn.groupBockedlist,asyncGroupBlock:Nn.groupBlock,asyncGroupUnblock:Nn.groupUnblock,asyncKick:Nn.groupKick,asyncGetInvitationList:Nn.groupInvitationlist,asyncInvite:Nn.groupInvite,asyncInviteHandle:Nn.groupInviteHandle,asyncGetMemberDisplayName:Nn.groupMembersDidpayname,asyncLeave:Nn.groupLeave,asyncUpdateDisplayName:Nn.groupDisplayname,asncGetApplicationList:Nn.groupApplicationlist,asyncGetFileList:Nn.groupFilelist,asyncFileDelete:Nn.groupFiledelete,asyncFileUpload:Nn.groupFileupload};o={getToken:()=>Z.getToken(),getUid:()=>Z.getUid(),getAppid:()=>Z.getAppid(),getConversationList:()=>ie.getRecents(),deleteToken:Z.deleteToken,getDeviceSN:()=>Z.getDeviceSN(),asyncBindDeviceToken:Nn.bindDeviceToken,asyncUnbindDeviceToken:Nn.unbindDeviceToken,asyncTokenUser:Nn.tokenUser,asyncTokenId:Nn.tokenId,asyncRegister:Nn.userRegister,asyncUserBindMobile:Nn.userBindMobile,asyncUserUpdateMobile:Nn.userUpdateMobile,asyncUserSendSms:Nn.userSendSms,asyncCaptchaSms:Nn.captchaSms,asyncUserNameCheck:Nn.userNameCheck,asyncUserMobileBind:Nn.userMobileBind,asyncUserMobileBindSign:Nn.userMobileBindSign,asyncUserMobileLogin:Nn.userMobileLogin,asyncCaptchaImagePost:Nn.captchaImagePost,asyncUpdateAuthmode:Nn.userAuthmode,asyncUpdateAvatar:Nn.userAvatar,asyncUpdateMobile:Nn.userMobile,asyncUpdateNickName:Nn.userNickname,asyncGetProfile:Nn.userProfile,asyncUpdateProfile:Nn.userProfilePost,asyncGetSettings:Nn.userSettings,asyncUpdateSettings:Nn.userSettingsPost};const Hn=(e,t)=>t&&e?e+"_"+t:"",Wn=e=>{if(!e)return{};var t=Zn("ws"),{clusters:r,clusterIndex:n,ratelIndex:o,fireIndex:e}=Xn(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}:{}):{}};te("ratelError",(()=>{var e;(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=Xn(e);t[r].ratel.length>n+1?(n++,$n(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):zn(e)})(e=Zn("app_id"));var{ratel:e}=Wn(e)||{};ne("refresh_ratel",e)})),te("fireplaceError",(()=>{var e;(e=>{var{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o}=Xn(e),i=t[r];(i.webim||i.ws).length>o+1?(o++,$n(e,{clusters:t,clusterIndex:r,ratelIndex:n,fireIndex:o})):zn(e)})(e=Zn("app_id"));var{fireplace:e}=Wn(e)||{};ne("refresh_fireplace",e)}));const zn=e=>{const t=Xn(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 $n(e,{clusters:r,clusterIndex:n,ratelIndex:0,fireIndex:0})}ne("retrieve_dns")},Xn=e=>q(Hn("key_dns_infos",e),!1)||{},$n=(e,t)=>{G(Hn("key_dns_infos",e),t,!1)},Zn=e=>e?q(Hn("key_dns_config",e),!1):"",Qn=(e,t)=>{e&&t&&G(Hn("key_dns_config",e),t,!1)};te("retrieve_dns",(()=>{var e=Zn("dns_server"),t=Zn("app_id"),r=Zn("ws");eo(e,t,r)}));const eo=(e,t,r)=>(Qn("dns_server",e),Qn("app_id",t),Qn("ws",r),(r=Wn(t)).ratel?Promise.resolve(r):me(e,{app_id:t}).then((e=>((t=>{if(!t)return;const{dns_list:r}=e,n=r.findIndex((e=>0==e.group_level));if(!(n<0)){var o={clusters:r[n].clusters,clusterIndex:0,ratelIndex:0,fireIndex:0};$n(t,o)}})(t),Wn(t)))));var to={asyncGetDns:eo,getServers:Wn};const ro=({url:e="",params:t={}})=>{if(!e)return"";var r=Z.getToken(),n=Z.getAppid();return t=Object.assign(t,{"access-token":r,app_id:n}),0n,sendRosterMessage:e=>{var t=Ir(e);e=t.payload.meta;ce.saveSendingRosterMessage(e),Nn.sendMessage(t)},sendGroupMessage:e=>{var t=Tr(e);e=t.payload.meta;ce.saveSendingGroupMessage(e),Nn.sendMessage(t)},sendMentionMessage:e=>{var t=(()=>{var{gid:t,txt:r,mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}=e,u=N.TEXT;const c=new hr({uid:+Z.getUid(),deviceSN:Or}),p=new hr({uid:t,deviceSN:0}),f=new vr;f.setCommond(m.SYNC);const d=new wr,l=new gr({from:c,to:p,content:r,ctype:u,type:A.GROUPCHAT});return l.config=JSON.stringify({mentionAll:n,mentionList:o,mentionedMessage:i,pushMessage:s,senderNickname:a}),a=new Cr({id:(new Date).getTime(),from:c,to:p,payload:l,ns:w.MESSAGE}),d.setMeta(a),f.setPayload(d),f})(),r=t.payload.meta;ce.saveSendingGroupMessage(r),Nn.sendMessage(t)},sendInputStatusMessage:(e,t)=>{t=((e,t)=>{var r=N.TEXT;const n=new hr({uid:+Z.getUid(),deviceSN:Or}),o=new hr({uid:+e,deviceSN:0}),i=new vr;i.setCommond(m.SYNC);const s=new wr,a=new gr({from:n,to:o,ctype:r,type:A.CHAT,ext:JSON.stringify({input_status:t}),qos:k.AT_MOST_ONCE}),u=new Cr({id:(new Date).getTime(),from:n,to:o,payload:a,ns:w.MESSAGE});return s.setMeta(u),i.setPayload(s),i})(e,t),Nn.sendMessage(t)},sendMessage:Nn.sendMessage,getNoticeMessage:u(),getMessageStatus:(e,t,r=!1)=>{var n=r?ce.getGroupMessageById(e,t):ce.getRosterMessageById(e,t);const o=Object.keys(D)[n.status];return o?o.toLowerCase():void 0},forwardMessage:function(e){const{uid:t,mid:r,gid:n}=e;let o;o=t?ce.getRosterMessageById(t,r):ce.getGroupMessageById(n,r);const i=o.attach;if(i&&i.url){e=i.url.split("sign=")[1];const r=Z.getToken();Nn.fileForward({file_sign:e,"access-token":r,to_id:+(t||n),to_type:t?1:2}).then((e=>{o.attach.url=e;var r=Mr(t,n,o);e=r.payload.meta;t?ce.saveSendingRosterMessage(e):ce.saveSendingGroupMessage(e),Nn.sendMessage(r)}))}else{const e=Mr(t,n,o),r=e.payload.meta;t?ce.saveSendingRosterMessage(r):ce.saveSendingGroupMessage(r),Nn.sendMessage(e)}},asyncFileUpload:e=>new Promise(((t,r)=>{const{group_id:n,to_id:o,toType:i,file:s,fileType:a,chatType:u}=e;var c="rosterAvatar"===i?"fileUploadAvatarUrl":"chat"==i?"fileUploadChatFileUrl":"fileUploadGroupAvatarUrl";const p={},f=Z.getToken();"groupAvatar"===i&&(p["access-token"]=f),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"==u&&(p.to_type=2),"roster"==u&&(p.to_type=1),o&&(p.to_id=o),Nn[c](p).then((e=>{let r=new FormData;e.oss_body_param&&e.oss_body_param.key&&(r.append("OSSAccessKeyId",e.oss_body_param.OSSAccessKeyId),r.append("policy",e.oss_body_param.policy),r.append("signature",e.oss_body_param.signature),r.append("callback",e.oss_body_param.callback),r.append("key",e.oss_body_param.key)),r.append("file",s),Nn.asyncFileUpload(e.upload_url,r,{headers:{"Content-Type":"multipart/form-data"}}).then((()=>{t({url:e.download_url})})).catch((e=>{}))})).catch((e=>{r(e)}))})),requireHistoryMessage:(e,t,r)=>{r=((e,t,r)=>{t=P(t);const n=new vr;n.setCommond(m.SYNC);const o=new hr({uid:B(e),deviceSN:0}),i=new wr;return i.setXid(o),i.setKey(B(t)),i.setFullsyncnum(r),i.setIsfullsync(!0),n.setPayload(i),n})(e,t,r),Nn.sendMessage(r)},makeSearch:e=>{const t=[],r=[];return(de.getRosterInfoList()||[]).forEach((r=>{let n=!1;const{user_id:o,username:i,avatar:s}=r;(ce.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})})),V.getGroupInfoList().forEach((t=>{let n=!1;const{group_id:o,name:i}=t;(ce.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:Nn.fileUploadAvatarUrl,asyncGetGroupAvatarUploadUrl:Nn.fileUploadGroupAvatarUrl,asyncGetFileUploadChatFileUrl:Nn.fileUploadChatFileUrl,asyncQrcode:Nn.qrcode,asyncQrlogin:Nn.qrlogin,asyncQrcodeGroupsign:Nn.qrcodeGroupsign,asyncQrcodeGroupinvite:Nn.qrcodeGroupinvite,asyncWxlogin:Nn.wxlogin,asyncWxbind:Nn.wxbind,asyncGetStaticContact:Nn.getStaticContact,getImage:({avatar:e="",type:t="roster",thumbnail:r=!0,sdefault:n=""})=>{if(/^\//.test(e))return e;if(!e)return"roster"===t?n||"/image/roster.png":n||"/image/group.png";let o=e,i={};if(0!==e.indexOf("http")){const t=Z.getAppid();var{ratel:n}=to.getServers(t)||{};!/\/$/.test(n)&&5ro({url:e,type:t,params:{format:"mp3"}}),getChatFile:ro,downloadAudio:({url:e="",type:t="audio"})=>(({url:e="",type:t="",params:r={}})=>e?Nn.fileDownloadChatFileUrl(e,r,{operation:"download_file"}):"")({url:e,type:t,params:{format:"mp3"}}),getServers:to.getServers,asyncWechatUnbind:Nn.wechatUnbind,asyncWechatIsbind:Nn.wechatIsbind,asyncWechatBind:Nn.wechatBind,deleteConversation:function(e,t=!0){ne("deleteConversation",{id:e,other_devices:t,source:"user_operation"}),t=((e,t=!0)=>{let r=x.DELETE;t&&(r=x.DELETE_EVERYWHERE);const n=new hr({uid:+Z.getUid(),deviceSN:Or}),o=new hr({uid:e}),i=new kr({type:I.OPER,operation:{xid:o,type:r}}),s=new Cr({id:(new Date).getTime(),from:n,payload:i,ns:w.CONVERSATION}),a=new wr;a.setMeta(s);const u=new vr;return u.setCommond(m.SYNC),u.setPayload(a),u})(e,t),Nn.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}){Z.saveAppid(r),to.asyncGetDns(t,r,n).then((n=>{var{ratel:o,fireplace:n}=n;if(o&&n){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=Z.getUid(),t=Z.getToken();if(e&&t){const e=kn.asyncGetRosterIdList(!0),t=Vn.asyncGetJoinedGroups(!0);Promise.all([e,t]).then((e=>{var t=e[0];e=e[1];ne("imRostersGroupslistReady",{rosters:t,groups:e}),Nn.connect(no)})).catch((e=>{ne("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))}}}else ne("flooError",{category:"DNS_FAILED",desc:t})})).catch((e=>{}))},uo=function(e){var{ratel:t,fireplace:e}=to.getServers(e)||{};ne("refresh_ratel",t),ne("refresh_fireplace",e)};ao.login=function(e){io?(ne("flooNotice",{category:"loginMessage",desc:"getting token..."}),Nn.tokenUser(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;Z.saveUid(r),Z.saveToken(t),Z.saveAesKey(n);var o=kn.asyncGetRosterIdList(!0);e=Vn.asyncGetJoinedGroups(!0);so=!0,ne("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];ne("imRostersGroupslistReady",{rosters:n,groups:e}),no=Object.assign({uid:r,token:t},no),Nn.connect(no),oo=null})).catch((e=>{ne("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ne("loginFail","token failure:"+e.message)}))):oo={type:"login",opt:e}},ao.qrlogin=function(e){io?(ne("flooNotice",{category:"loginMessage",desc:"getting token..."}),Nn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;Z.saveUid(r),Z.saveToken(t),Z.saveAesKey(n);var o=kn.asyncGetRosterIdList(!0);e=Vn.asyncGetJoinedGroups(!0);ne("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),so=!0,Promise.all([o,e]).then((e=>{var n=e[0];e=e[1];ne("imRostersGroupslistReady",{rosters:n,groups:e}),no=Object.assign({uid:r,token:t},no),Nn.connect(no),oo=null})).catch((e=>{ne("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ne("loginFail","token failure:"+e.message)}))):oo={type:"qrlogin",opt:e}},ao.tokenLogin=function(e,t,r){var n;io?(Z.saveUid(e),Z.saveToken(t),Z.saveAesKey(r),n=kn.asyncGetRosterIdList(!0),r=Vn.asyncGetJoinedGroups(!0),ne("flooNotice",{category:"loginMessage",desc:"token sucecc, getting roster lists.."}),so=!0,Promise.all([n,r]).then((r=>{var n=r[0];r=r[1];ne("imRostersGroupslistReady",{rosters:n,groups:r}),no=Object.assign({uid:e,token:t},no),Nn.connect(no),oo=null})).catch((e=>{ne("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))):oo={type:"tokenLogin",user_id:e,token:t}},ao.idLogin=function(e){Nn.tokenId(e).then((e=>{const{token:t,user_id:r,public_key:n}=e;Z.saveUid(r),Z.saveToken(t),Z.saveAesKey(n);var o=kn.asyncGetRosterIdList(!0);e=Vn.asyncGetJoinedGroups(!0);ne("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],ne("imRostersGroupslistReady",{rosters:n,groups:e}),no=Object.assign({uid:r,token:t},no),Nn.connect(no),oo=null})).catch((e=>{ne("flooNotice",{category:"loginMessage",desc:"get roster list failure:"+e.message})}))})).catch((e=>{ne("loginFail","token failure:"+e.message)}))},ao.wxlogin=function(){},ao.cleanup=function(){ie.clear(),de.clear(),V.clear(),Z.clear(),ce.clearAll()},ao.isLogin=function(){return so&&Z.getUid()&&Z.getToken()},ao.on=ao.listen=function(e,t){t?te(e,t):Object.keys(e).forEach((t=>{te(t,e[t])}))},ao.off=function(e,t){t?re(e,t):Object.keys(e).forEach((t=>{re(t,e[t])}))},ao.logout=function(){Nn.disConnect(),ao.cleanup()},ao.isReady=function(){return io},ao.disConnect=Nn.disConnect;var co=ao;function po(e){return new co(e),co}co.rosterManage=kn,co.groupManage=Vn,co.userManage=o,co.sysManage=u,t.default=po,window.flooIM=e=>po(e)}],n={},o.m=m,o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=134);function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return m[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var m,n},module.exports=l()}(floo2_0_0);var flooim=getDefaultExportFromCjs(floo2_0_0.exports);function createChatroom(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})}))}function joinChatroom(e){return this.groupManage.asyncApply({group_id:e})}function leaveChatroom(e){return this.groupManage.asyncLeave({group_id:e})}function destroyChatroom(e){return this.groupManage.asyncDestroy({group_id:e})}function init(e){return(e=flooim(__assign({ws:!1,autoLogin:!0},e))).chatroomManage={create:createChatroom.bind(e),join:joinChatroom.bind(e),leave:leaveChatroom.bind(e),destroy:destroyChatroom.bind(e)},e}exports.init=init,exports.version=version,Object.defineProperty(exports,"__esModule",{value:!0})}));