tencent_cloud_chat_uikit_fl.../example/web/tim-js-friendship.js

2 lines
627 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){s(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function d(e,t,n){return(d=l()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&u(r,n.prototype),r}).apply(null,arguments)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return d(e,arguments,c(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),u(o,e)})(e)}function g(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function f(e){var t=l();return function(){var n,o=c(e);if(t){var r=c(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return h(this,n)}}function m(e,t){return v(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,r,a=[],s=!0,i=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);s=!0);}catch(c){i=!0,r=c}finally{try{s||null==n.return||n.return()}finally{if(i)throw r}}return a}(e,t)||I(e,t)||T()}function M(e){return function(e){if(Array.isArray(e))return E(e)}(e)||y(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){if(Array.isArray(e))return e}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function T(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function S(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=I(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){i=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(i)throw a}}}}var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(e,t){return e(t={exports:{}},t.exports),t.exports}var C,N,R=function(e){return e&&e.Math==Math&&e},O=R("object"==typeof globalThis&&globalThis)||R("object"==typeof window&&window)||R("object"==typeof self&&self)||R("object"==typeof A&&A)||function(){return this}()||Function("return this")(),L=function(e){try{return!!e()}catch(t){return!0}},k=!L((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),G=!L((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),P=Function.prototype.call,b=G?P.bind(P):function(){return P.apply(P,arguments)},U={}.propertyIsEnumerable,w=Object.getOwnPropertyDescriptor,F={f:w&&!U.call({1:2},1)?function(e){var t=w(this,e);return!!t&&t.enumerable}:U},q=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},x=Function.prototype,V=x.bind,B=x.call,H=G&&V.bind(B,B),K=G?function(e){return e&&H(e)}:function(e){return e&&function(){return B.apply(e,arguments)}},j=K({}.toString),W=K("".slice),Y=function(e){return W(j(e),8,-1)},$=O.Object,z=K("".split),J=L((function(){return!$("z").propertyIsEnumerable(0)}))?function(e){return"String"==Y(e)?z(e,""):$(e)}:$,X=O.TypeError,Q=function(e){if(null==e)throw X("Can't call method on "+e);return e},Z=function(e){return J(Q(e))},ee=function(e){return"function"==typeof e},te=function(e){return"object"==typeof e?null!==e:ee(e)},ne=function(e){return ee(e)?e:void 0},oe=function(e,t){return arguments.length<2?ne(O[e]):O[e]&&O[e][t]},re=K({}.isPrototypeOf),ae=oe("navigator","userAgent")||"",se=O.process,ie=O.Deno,ce=se&&se.versions||ie&&ie.version,ue=ce&&ce.v8;ue&&(N=(C=ue.split("."))[0]>0&&C[0]<4?1:+(C[0]+C[1])),!N&&ae&&(!(C=ae.match(/Edge\/(\d+)/))||C[1]>=74)&&(C=ae.match(/Chrome\/(\d+)/))&&(N=+C[1]);var le=N,de=!!Object.getOwnPropertySymbols&&!L((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&le&&le<41})),pe=de&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ge=O.Object,_e=pe?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ee(t)&&re(t.prototype,ge(e))},he=O.String,fe=function(e){try{return he(e)}catch(t){return"Object"}},me=O.TypeError,Me=function(e){if(ee(e))return e;throw me(fe(e)+" is not a function")},ve=function(e,t){var n=e[t];return null==n?void 0:Me(n)},ye=O.TypeError,Ie=Object.defineProperty,Ee=function(e,t){try{Ie(O,e,{value:t,configurable:!0,writable:!0})}catch(n){O[e]=t}return t},Te=O["__core-js_shared__"]||Ee("__core-js_shared__",{}),Se=D((function(e){(e.exports=function(e,t){return Te[e]||(Te[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"})})),Ae=O.Object,De=function(e){return Ae(Q(e))},Ce=K({}.hasOwnProperty),Ne=Object.hasOwn||function(e,t){return Ce(De(e),t)},Re=0,Oe=Math.random(),Le=K(1..toString),ke=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Le(++Re+Oe,36)},Ge=Se("wks"),Pe=O.Symbol,be=Pe&&Pe.for,Ue=pe?Pe:Pe&&Pe.withoutSetter||ke,we=function(e){if(!Ne(Ge,e)||!de&&"string"!=typeof Ge[e]){var t="Symbol."+e;de&&Ne(Pe,e)?Ge[e]=Pe[e]:Ge[e]=pe&&be?be(t):Ue(t)}return Ge[e]},Fe=O.TypeError,qe=we("toPrimitive"),xe=function(e,t){if(!te(e)||_e(e))return e;var n,o=ve(e,qe);if(o){if(void 0===t&&(t="default"),n=b(o,e,t),!te(n)||_e(n))return n;throw Fe("Can't convert object to primitive value")}return void 0===t&&(t="number"),function(e,t){var n,o;if("string"===t&&ee(n=e.toString)&&!te(o=b(n,e)))return o;if(ee(n=e.valueOf)&&!te(o=b(n,e)))return o;if("string"!==t&&ee(n=e.toString)&&!te(o=b(n,e)))return o;throw ye("Can't convert object to primitive value")}(e,t)},Ve=function(e){var t=xe(e,"string");return _e(t)?t:t+""},Be=O.document,He=te(Be)&&te(Be.createElement),Ke=function(e){return He?Be.createElement(e):{}},je=!k&&!L((function(){return 7!=Object.defineProperty(Ke("div"),"a",{get:function(){return 7}}).a})),We=Object.getOwnPropertyDescriptor,Ye={f:k?We:function(e,t){if(e=Z(e),t=Ve(t),je)try{return We(e,t)}catch(n){}if(Ne(e,t))return q(!b(F.f,e,t),e[t])}},$e=k&&L((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ze=O.String,Je=O.TypeError,Xe=function(e){if(te(e))return e;throw Je(ze(e)+" is not an object")},Qe=O.TypeError,Ze=Object.defineProperty,et=Object.getOwnPropertyDescriptor,nt={f:k?$e?function(e,t,n){if(Xe(e),t=Ve(t),Xe(n),"function"==typeof e&&"prototype"===t&&"value"in n&&"writable"in n&&!n.writable){var o=et(e,t);o&&o.writable&&(e[t]=n.value,n={configurable:"configurable"in n?n.configurable:o.configurable,enumerable:"enumerable"in n?n.enumerable:o.enumerable,writable:!1})}return Ze(e,t,n)}:Ze:function(e,t,n){if(Xe(e),t=Ve(t),Xe(n),je)try{return Ze(e,t,n)}catch(o){}if("get"in n||"set"in n)throw Qe("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},ot=k?function(e,t,n){return nt.f(e,t,q(1,n))}:function(e,t,n){return e[t]=n,e},rt=K(Function.toString);ee(Te.inspectSource)||(Te.inspectSource=function(e){return rt(e)});var at,st,it,ct=Te.inspectSource,ut=O.WeakMap,lt=ee(ut)&&/native code/.test(ct(ut)),dt=Se("keys"),pt=function(e){return dt[e]||(dt[e]=ke(e))},gt={},_t=O.TypeError,ht=O.WeakMap;if(lt||Te.state){var ft=Te.state||(Te.state=new ht),mt=K(ft.get),Mt=K(ft.has),vt=K(ft.set);at=function(e,t){if(Mt(ft,e))throw new _t("Object already initialized");return t.facade=e,vt(ft,e,t),t},st=function(e){return mt(ft,e)||{}},it=function(e){return Mt(ft,e)}}else{var yt=pt("state");gt[yt]=!0,at=function(e,t){if(Ne(e,yt))throw new _t("Object already initialized");return t.facade=e,ot(e,yt,t),t},st=function(e){return Ne(e,yt)?e[yt]:{}},it=function(e){return Ne(e,yt)}}var It={set:at,get:st,has:it,enforce:function(e){return it(e)?st(e):at(e,{})},getterFor:function(e){return function(t){var n;if(!te(t)||(n=st(t)).type!==e)throw _t("Incompatible receiver, "+e+" required");return n}}},Et=Function.prototype,Tt=k&&Object.getOwnPropertyDescriptor,St=Ne(Et,"name"),At={EXISTS:St,PROPER:St&&"something"===function(){}.name,CONFIGURABLE:St&&(!k||k&&Tt(Et,"name").configurable)},Dt=D((function(e){var t=At.CONFIGURABLE,n=It.get,o=It.enforce,r=String(String).split("String");(e.exports=function(e,n,a,s){var i,c=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,l=!!s&&!!s.noTargetGet,d=s&&void 0!==s.name?s.name:n;ee(a)&&("Symbol("===String(d).slice(0,7)&&(d="["+String(d).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Ne(a,"name")||t&&a.name!==d)&&ot(a,"name",d),(i=o(a)).source||(i.source=r.join("string"==typeof d?d:""))),e!==O?(c?!l&&e[n]&&(u=!0):delete e[n],u?e[n]=a:ot(e,n,a)):u?e[n]=a:Ee(n,a)})(Function.prototype,"toString",(function(){return ee(this)&&n(this).source||ct(this)}))})),Ct=Math.ceil,Nt=Math.floor,Rt=function(e){var t=+e;return t!=t||0===t?0:(t>0?Nt:Ct)(t)},Ot=Math.max,Lt=Math.min,kt=function(e,t){var n=Rt(e);return n<0?Ot(n+t,0):Lt(n,t)},Gt=Math.min,Pt=function(e){return e>0?Gt(Rt(e),9007199254740991):0},bt=function(e){return Pt(e.length)},Ut=function(e){return function(t,n,o){var r,a=Z(t),s=bt(a),i=kt(o,s);if(e&&n!=n){for(;s>i;)if((r=a[i++])!=r)return!0}else for(;s>i;i++)if((e||i in a)&&a[i]===n)return e||i||0;return!e&&-1}},wt={includes:Ut(!0),indexOf:Ut(!1)},Ft=wt.indexOf,qt=K([].push),xt=function(e,t){var n,o=Z(e),r=0,a=[];for(n in o)!Ne(gt,n)&&Ne(o,n)&&qt(a,n);for(;t.length>r;)Ne(o,n=t[r++])&&(~Ft(a,n)||qt(a,n));return a},Vt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bt=Vt.concat("length","prototype"),Ht={f:Object.getOwnPropertyNames||function(e){return xt(e,Bt)}},Kt={f:Object.getOwnPropertySymbols},jt=K([].concat),Wt=oe("Reflect","ownKeys")||function(e){var t=Ht.f(Xe(e)),n=Kt.f;return n?jt(t,n(e)):t},Yt=function(e,t,n){for(var o=Wt(t),r=nt.f,a=Ye.f,s=0;s<o.length;s++){var i=o[s];Ne(e,i)||n&&Ne(n,i)||r(e,i,a(t,i))}},$t=/#|\.prototype\./,zt=function(e,t){var n=Xt[Jt(e)];return n==Zt||n!=Qt&&(ee(t)?L(t):!!t)},Jt=zt.normalize=function(e){return String(e).replace($t,".").toLowerCase()},Xt=zt.data={},Qt=zt.NATIVE="N",Zt=zt.POLYFILL="P",en=zt,tn=Ye.f,nn=function(e,t){var n,o,r,a,s,i=e.target,c=e.global,u=e.stat;if(n=c?O:u?O[i]||Ee(i,{}):(O[i]||{}).prototype)for(o in t){if(a=t[o],r=e.noTargetGet?(s=tn(n,o))&&s.value:n[o],!en(c?o:i+(u?".":"#")+o,e.forced)&&void 0!==r){if(typeof a==typeof r)continue;Yt(a,r)}(e.sham||r&&r.sham)&&ot(a,"sham",!0),Dt(n,o,a,e)}},on={};on[we("toStringTag")]="z";var rn="[object z]"===String(on),an=we("toStringTag"),sn=O.Object,cn="Arguments"==Y(function(){return arguments}()),un=rn?Y:function(e){var t,n,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=sn(e),an))?n:cn?Y(t):"Object"==(o=Y(t))&&ee(t.callee)?"Arguments":o},ln=O.String,dn=function(e){if("Symbol"===un(e))throw TypeError("Cannot convert a Symbol value to a string");return ln(e)},pn="\t\n\v\f\r    \u2028\u2029\ufeff",gn=K("".replace),_n="["+pn+"]",hn=RegExp("^"+_n+_n+"*"),fn=RegExp(_n+_n+"*$"),mn=function(e){return function(t){var n=dn(Q(t));return 1&e&&(n=gn(n,hn,"")),2&e&&(n=gn(n,fn,"")),n}},Mn={start:mn(1),end:mn(2),trim:mn(3)},vn=Mn.trim,yn=O.parseInt,In=O.Symbol,En=In&&In.iterator,Tn=/^[+-]?0x/i,Sn=K(Tn.exec),An=8!==yn(pn+"08")||22!==yn(pn+"0x16")||En&&!L((function(){yn(Object(En))}))?function(e,t){var n=vn(dn(e));return yn(n,t>>>0||(Sn(Tn,n)?16:10))}:yn;nn({global:!0,forced:parseInt!=An},{parseInt:An});var Dn,Cn=Object.keys||function(e){return xt(e,Vt)},Nn={f:k&&!$e?Object.defineProperties:function(e,t){Xe(e);for(var n,o=Z(t),r=Cn(t),a=r.length,s=0;a>s;)nt.f(e,n=r[s++],o[n]);return e}},Rn=oe("document","documentElement"),On=pt("IE_PROTO"),Ln=function(){},kn=function(e){return"<script>"+e+"<\/script>"},Gn=function(e){e.write(kn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Pn=function(){try{Dn=new ActiveXObject("htmlfile")}catch(o){}var e,t;Pn="undefined"!=typeof document?document.domain&&Dn?Gn(Dn):((t=Ke("iframe")).style.display="none",Rn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(kn("document.F=Object")),e.close(),e.F):Gn(Dn);for(var n=Vt.length;n--;)delete Pn.prototype[Vt[n]];return Pn()};gt[On]=!0;var bn=Object.create||function(e,t){var n;return null!==e?(Ln.prototype=Xe(e),n=new Ln,Ln.prototype=null,n[On]=e):n=Pn(),void 0===t?n:Nn.f(n,t)};nn({target:"Object",stat:!0,sham:!k},{create:bn});var Un=K(K.bind),wn=function(e,t){return Me(e),void 0===t?e:G?Un(e,t):function(){return e.apply(t,arguments)}},Fn=Array.isArray||function(e){return"Array"==Y(e)},qn=function(){},xn=[],Vn=oe("Reflect","construct"),Bn=/^\s*(?:class|function)\b/,Hn=K(Bn.exec),Kn=!Bn.exec(qn),jn=function(e){if(!ee(e))return!1;try{return Vn(qn,xn,e),!0}catch(t){return!1}},Wn=function(e){if(!ee(e))return!1;switch(un(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Kn||!!Hn(Bn,ct(e))}catch(t){return!0}};Wn.sham=!0;var Yn=!Vn||L((function(){var e;return jn(jn.call)||!jn(Object)||!jn((function(){e=!0}))||e}))?Wn:jn,$n=we("species"),zn=O.Array,Jn=function(e,t){return new(function(e){var t;return Fn(e)&&(t=e.constructor,(Yn(t)&&(t===zn||Fn(t.prototype))||te(t)&&null===(t=t[$n]))&&(t=void 0)),void 0===t?zn:t}(e))(0===t?0:t)},Xn=K([].push),Qn=function(e){var t=1==e,n=2==e,o=3==e,r=4==e,a=6==e,s=7==e,i=5==e||a;return function(c,u,l,d){for(var p,g,_=De(c),h=J(_),f=wn(u,l),m=bt(h),M=0,v=d||Jn,y=t?v(c,m):n||s?v(c,0):void 0;m>M;M++)if((i||M in h)&&(g=f(p=h[M],M,_),e))if(t)y[M]=g;else if(g)switch(e){case 3:return!0;case 5:return p;case 6:return M;case 2:Xn(y,p)}else switch(e){case 4:return!1;case 7:Xn(y,p)}return a?-1:o||r?r:y}},Zn={forEach:Qn(0),map:Qn(1),filter:Qn(2),some:Qn(3),every:Qn(4),find:Qn(5),findIndex:Qn(6),filterReject:Qn(7)},eo=function(e,t){var n=[][e];return!!n&&L((function(){n.call(null,t||function(){throw 1},1)}))},to=Zn.forEach,no=eo("forEach")?[].forEach:function(e){return to(this,e,arguments.length>1?arguments[1]:void 0)};nn({target:"Array",proto:!0,forced:[].forEach!=no},{forEach:no});var oo=rn?{}.toString:function(){return"[object "+un(this)+"]"};rn||Dt(Object.prototype,"toString",oo,{unsafe:!0});var ro={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ao=Ke("span").classList,so=ao&&ao.constructor&&ao.constructor.prototype,io=so===Object.prototype?void 0:so,co=function(e){if(e&&e.forEach!==no)try{ot(e,"forEach",no)}catch(t){e.forEach=no}};for(var uo in ro)ro[uo]&&co(O[uo]&&O[uo].prototype);co(io);var lo=L((function(){Cn(1)}));nn({target:"Object",stat:!0,forced:lo},{keys:function(e){return Cn(De(e))}});var po=function(e,t,n){var o,r;Xe(e);try{if(!(o=ve(e,"return"))){if("throw"===t)throw n;return n}o=b(o,e)}catch(a){r=!0,o=a}if("throw"===t)throw n;if(r)throw o;return Xe(o),n},go=function(e,t,n,o){try{return o?t(Xe(n)[0],n[1]):t(n)}catch(r){po(e,"throw",r)}},_o={},ho=we("iterator"),fo=Array.prototype,mo=function(e){return void 0!==e&&(_o.Array===e||fo[ho]===e)},Mo=function(e,t,n){var o=Ve(t);o in e?nt.f(e,o,q(0,n)):e[o]=n},vo=we("iterator"),yo=function(e){if(null!=e)return ve(e,vo)||ve(e,"@@iterator")||_o[un(e)]},Io=O.TypeError,Eo=function(e,t){var n=arguments.length<2?yo(e):t;if(Me(n))return Xe(b(n,e));throw Io(fe(e)+" is not iterable")},To=O.Array,So=function(e){var t=De(e),n=Yn(this),o=arguments.length,r=o>1?arguments[1]:void 0,a=void 0!==r;a&&(r=wn(r,o>2?arguments[2]:void 0));var s,i,c,u,l,d,p=yo(t),g=0;if(!p||this==To&&mo(p))for(s=bt(t),i=n?new this(s):To(s);s>g;g++)d=a?r(t[g],g):t[g],Mo(i,g,d);else for(l=(u=Eo(t,p)).next,i=n?new this:[];!(c=b(l,u)).done;g++)d=a?go(u,r,[c.value,g],!0):c.value,Mo(i,g,d);return i.length=g,i},Ao=we("iterator"),Do=!1;try{var Co=0,No={next:function(){return{done:!!Co++}},return:function(){Do=!0}};No[Ao]=function(){return this},Array.from(No,(function(){throw 2}))}catch(FS){}var Ro=function(e,t){if(!t&&!Do)return!1;var n=!1;try{var o={};o[Ao]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(FS){}return n},Oo=!Ro((function(e){Array.from(e)}));nn({target:"Array",stat:!0,forced:Oo},{from:So});var Lo,ko,Go,Po=K("".charAt),bo=K("".charCodeAt),Uo=K("".slice),wo=function(e){return function(t,n){var o,r,a=dn(Q(t)),s=Rt(n),i=a.length;return s<0||s>=i?e?"":void 0:(o=bo(a,s))<55296||o>56319||s+1===i||(r=bo(a,s+1))<56320||r>57343?e?Po(a,s):o:e?Uo(a,s,s+2):r-56320+(o-55296<<10)+65536}},Fo={codeAt:wo(!1),charAt:wo(!0)},qo=!L((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),xo=pt("IE_PROTO"),Vo=O.Object,Bo=Vo.prototype,Ho=qo?Vo.getPrototypeOf:function(e){var t=De(e);if(Ne(t,xo))return t[xo];var n=t.constructor;return ee(n)&&t instanceof n?n.prototype:t instanceof Vo?Bo:null},Ko=we("iterator"),jo=!1;[].keys&&("next"in(Go=[].keys())?(ko=Ho(Ho(Go)))!==Object.prototype&&(Lo=ko):jo=!0),(null==Lo||L((function(){var e={};return Lo[Ko].call(e)!==e})))&&(Lo={}),ee(Lo[Ko])||Dt(Lo,Ko,(function(){return this}));var Wo={IteratorPrototype:Lo,BUGGY_SAFARI_ITERATORS:jo},Yo=nt.f,$o=we("toStringTag"),zo=function(e,t,n){e&&!n&&(e=e.prototype),e&&!Ne(e,$o)&&Yo(e,$o,{configurable:!0,value:t})},Jo=Wo.IteratorPrototype,Xo=function(){return this},Qo=function(e,t,n,o){var r=t+" Iterator";return e.prototype=bn(Jo,{next:q(+!o,n)}),zo(e,r,!1),_o[r]=Xo,e},Zo=O.String,er=O.TypeError,tr=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=K(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(FS){}return function(n,o){return Xe(n),function(e){if("object"==typeof e||ee(e))return e;throw er("Can't set "+Zo(e)+" as a prototype")}(o),t?e(n,o):n.__proto__=o,n}}():void 0),nr=At.PROPER,or=At.CONFIGURABLE,rr=Wo.IteratorPrototype,ar=Wo.BUGGY_SAFARI_ITERATORS,sr=we("iterator"),ir=function(){return this},cr=function(e,t,n,o,r,a,s){Qo(n,t,o);var i,c,u,l=function(e){if(e===r&&h)return h;if(!ar&&e in g)return g[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},d=t+" Iterator",p=!1,g=e.prototype,_=g[sr]||g["@@iterator"]||r&&g[r],h=!ar&&_||l(r),f="Array"==t&&g.entries||_;if(f&&(i=Ho(f.call(new e)))!==Object.prototype&&i.next&&(Ho(i)!==rr&&(tr?tr(i,rr):ee(i[sr])||Dt(i,sr,ir)),zo(i,d,!0)),nr&&"values"==r&&_&&"values"!==_.name&&(or?ot(g,"name","values"):(p=!0,h=function(){return b(_,this)})),r)if(c={values:l("values"),keys:a?h:l("keys"),entries:l("entries")},s)for(u in c)(ar||p||!(u in g))&&Dt(g,u,c[u]);else nn({target:t,proto:!0,forced:ar||p},c);return g[sr]!==h&&Dt(g,sr,h,{name:r}),_o[t]=h,c},ur=Fo.charAt,lr=It.set,dr=It.getterFor("String Iterator");cr(String,"String",(function(e){lr(this,{type:"String Iterator",string:dn(e),index:0})}),(function(){var e,t=dr(this),n=t.string,o=t.index;return o>=n.length?{value:void 0,done:!0}:(e=ur(n,o),t.index+=e.length,{value:e,done:!1})}));var pr={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},gr={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},_r=K([].slice),hr=O.Function,fr=K([].concat),mr=K([].join),Mr={},vr=function(e,t,n){if(!Ne(Mr,t)){for(var o=[],r=0;r<t;r++)o[r]="a["+r+"]";Mr[t]=hr("C,a","return new C("+mr(o,",")+")")}return Mr[t](e,n)},yr=G?hr.bind:function(e){var t=Me(this),n=t.prototype,o=_r(arguments,1),r=function(){var n=fr(o,_r(arguments));return this instanceof r?vr(t,n.length,n):t.apply(e,n)};return te(n)&&(r.prototype=n),r};nn({target:"Function",proto:!0,forced:Function.bind!==yr},{bind:yr});var Ir=we("species"),Er=function(e){return le>=51||!L((function(){var t=[];return(t.constructor={})[Ir]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Tr=Zn.map,Sr=Er("map");nn({target:"Array",proto:!0,forced:!Sr},{map:function(e){return Tr(this,e,arguments.length>1?arguments[1]:void 0)}});var Ar=function(){function e(){o(this,e),this.cache=[],this.options=null}return a(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),Dr=At.EXISTS,Cr=nt.f,Nr=Function.prototype,Rr=K(Nr.toString),Or=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Lr=K(Or.exec);k&&!Dr&&Cr(Nr,"name",{configurable:!0,get:function(){try{return Lr(Or,Rr(this))[1]}catch(FS){return""}}});var kr=we("isConcatSpreadable"),Gr=O.TypeError,Pr=le>=51||!L((function(){var e=[];return e[kr]=!1,e.concat()[0]!==e})),br=Er("concat"),Ur=function(e){if(!te(e))return!1;var t=e[kr];return void 0!==t?!!t:Fn(e)};nn({target:"Array",proto:!0,forced:!Pr||!br},{concat:function(e){var t,n,o,r,a,s=De(this),i=Jn(s,0),c=0;for(t=-1,o=arguments.length;t<o;t++)if(Ur(a=-1===t?s:arguments[t])){if(c+(r=bt(a))>9007199254740991)throw Gr("Maximum allowed index exceeded");for(n=0;n<r;n++,c++)n in a&&Mo(i,c,a[n])}else{if(c>=9007199254740991)throw Gr("Maximum allowed index exceeded");Mo(i,c++,a)}return i.length=c,i}});var wr=D((function(e,t){var n,o,r,a,s,i,c,u,l,d,p,g,_,h,f,m,M,v;e.exports=(n="function"==typeof Promise,o="object"==typeof self?self:A,r="undefined"!=typeof Symbol,a="undefined"!=typeof Map,s="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,l=r&&void 0!==Symbol.iterator,d=r&&void 0!==Symbol.toStringTag,p=s&&"function"==typeof Set.prototype.entries,g=a&&"function"==typeof Map.prototype.entries,_=p&&Object.getPrototypeOf((new Set).entries()),h=g&&Object.getPrototypeOf((new Map).entries()),f=l&&"function"==typeof Array.prototype[Symbol.iterator],m=f&&Object.getPrototypeOf([][Symbol.iterator]()),M=l&&"function"==typeof String.prototype[Symbol.iterator],v=M&&Object.getPrototypeOf(""[Symbol.iterator]()),function(e){var t=typeof e;if("object"!==t)return t;if(null===e)return"null";if(e===o)return"global";if(Array.isArray(e)&&(!1===d||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var r=d&&e[Symbol.toStringTag];if("string"==typeof r)return r;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":n&&l===Promise.prototype?"Promise":s&&l===Set.prototype?"Set":a&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":a&&l===h?"Map Iterator":s&&l===_?"Set Iterator":f&&l===m?"Array Iterator":M&&l===v?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(8,-1)})}));nn({target:"Array",stat:!0},{isArray:Fn});var Fr=function(e,t,n){var o,r;return tr&&ee(o=t.constructor)&&o!==n&&te(r=o.prototype)&&r!==n.prototype&&tr(e,r),e},qr=K(1..valueOf),xr=Ht.f,Vr=Ye.f,Br=nt.f,Hr=Mn.trim,Kr=O.Number,jr=Kr.prototype,Wr=O.TypeError,Yr=K("".slice),$r=K("".charCodeAt),zr=function(e){var t=xe(e,"number");return"bigint"==typeof t?t:Jr(t)},Jr=function(e){var t,n,o,r,a,s,i,c,u=xe(e,"number");if(_e(u))throw Wr("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=Hr(u),43===(t=$r(u,0))||45===t){if(88===(n=$r(u,2))||120===n)return NaN}else if(48===t){switch($r(u,1)){case 66:case 98:o=2,r=49;break;case 79:case 111:o=8,r=55;break;default:return+u}for(s=(a=Yr(u,2)).length,i=0;i<s;i++)if((c=$r(a,i))<48||c>r)return NaN;return parseInt(a,o)}return+u};if(en("Number",!Kr(" 0o1")||!Kr("0b1")||Kr("+0x1"))){for(var Xr,Qr=function(e){var t=arguments.length<1?0:Kr(zr(e)),n=this;return re(jr,n)&&L((function(){qr(n)}))?Fr(Object(t),n,Qr):t},Zr=k?xr(Kr):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),ea=0;Zr.length>ea;ea++)Ne(Kr,Xr=Zr[ea])&&!Ne(Qr,Xr)&&Br(Qr,Xr,Vr(Kr,Xr));Qr.prototype=jr,jr.constructor=Qr,Dt(O,"Number",Qr)}var ta=L((function(){Ho(1)}));nn({target:"Object",stat:!0,forced:ta,sham:!qo},{getPrototypeOf:function(e){return Ho(De(e))}});var na,oa,ra=function(){var e=Xe(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},aa=O.RegExp,sa=L((function(){var e=aa("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),ia=sa||L((function(){return!aa("a","y").sticky})),ca={BROKEN_CARET:sa||L((function(){var e=aa("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:ia,UNSUPPORTED_Y:sa},ua=O.RegExp,la=L((function(){var e=ua(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),da=O.RegExp,pa=L((function(){var e=da("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),ga=It.get,_a=Se("native-string-replace",String.prototype.replace),ha=RegExp.prototype.exec,fa=ha,ma=K("".charAt),Ma=K("".indexOf),va=K("".replace),ya=K("".slice),Ia=(oa=/b*/g,b(ha,na=/a/,"a"),b(ha,oa,"a"),0!==na.lastIndex||0!==oa.lastIndex),Ea=ca.BROKEN_CARET,Ta=void 0!==/()??/.exec("")[1];(Ia||Ta||Ea||la||pa)&&(fa=function(e){var t,n,o,r,a,s,i,c=this,u=ga(c),l=dn(e),d=u.raw;if(d)return d.lastIndex=c.lastIndex,t=b(fa,d,l),c.lastIndex=d.lastIndex,t;var p=u.groups,g=Ea&&c.sticky,_=b(ra,c),h=c.source,f=0,m=l;if(g&&(_=va(_,"y",""),-1===Ma(_,"g")&&(_+="g"),m=ya(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==ma(l,c.lastIndex-1))&&(h="(?: "+h+")",m=" "+m,f++),n=new RegExp("^(?:"+h+")",_)),Ta&&(n=new RegExp("^"+h+"$(?!\\s)",_)),Ia&&(o=c.lastIndex),r=b(ha,g?n:c,m),g?r?(r.input=ya(r.input,f),r[0]=ya(r[0],f),r.index=c.lastIndex,c.lastIndex+=r[0].length):c.lastIndex=0:Ia&&r&&(c.lastIndex=c.global?r.index+r[0].length:o),Ta&&r&&r.length>1&&b(_a,r[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(r[a]=void 0)})),r&&p)for(r.groups=s=bn(null),a=0;a<p.length;a++)s[(i=p[a])[0]]=r[i[1]];return r});var Sa=fa;nn({target:"RegExp",proto:!0,forced:/./.exec!==Sa},{exec:Sa});var Aa=Date.prototype,Da=K(Aa.toString),Ca=K(Aa.getTime);"Invalid Date"!=String(new Date(NaN))&&Dt(Aa,"toString",(function(){var e=Ca(this);return e==e?Da(this):"Invalid Date"}));var Na=At.PROPER,Ra=RegExp.prototype,Oa=Ra.toString,La=K(ra),ka=L((function(){return"/a/b"!=Oa.call({source:"a",flags:"b"})})),Ga=Na&&"toString"!=Oa.name;(ka||Ga)&&Dt(RegExp.prototype,"toString",(function(){var e=Xe(this),t=dn(e.source),n=e.flags;return"/"+t+"/"+dn(void 0===n&&re(Ra,e)&&!("flags"in Ra)?La(e):n)}),{unsafe:!0});var Pa=we("species"),ba=RegExp.prototype,Ua=function(e,t,n,o){var r=we(e),a=!L((function(){var t={};return t[r]=function(){return 7},7!=""[e](t)})),s=a&&!L((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Pa]=function(){return n},n.flags="",n[r]=/./[r]),n.exec=function(){return t=!0,null},n[r](""),!t}));if(!a||!s||n){var i=K(/./[r]),c=t(r,""[e],(function(e,t,n,o,r){var s=K(e),c=t.exec;return c===Sa||c===ba.exec?a&&!r?{done:!0,value:i(t,n,o)}:{done:!0,value:s(n,t,o)}:{done:!1}}));Dt(String.prototype,e,c[0]),Dt(ba,r,c[1])}o&&ot(ba[r],"sham",!0)},wa=Fo.charAt,Fa=function(e,t,n){return t+(n?wa(e,t).length:1)},qa=O.TypeError,xa=function(e,t){var n=e.exec;if(ee(n)){var o=b(n,e,t);return null!==o&&Xe(o),o}if("RegExp"===Y(e))return b(Sa,e,t);throw qa("RegExp#exec called on incompatible receiver")};Ua("match",(function(e,t,n){return[function(t){var n=Q(this),o=null==t?void 0:ve(t,e);return o?b(o,t,n):new RegExp(t)[e](dn(n))},function(e){var o=Xe(this),r=dn(e),a=n(t,o,r);if(a.done)return a.value;if(!o.global)return xa(o,r);var s=o.unicode;o.lastIndex=0;for(var i,c=[],u=0;null!==(i=xa(o,r));){var l=dn(i[0]);c[u]=l,""===l&&(o.lastIndex=Fa(r,Pt(o.lastIndex),s)),u++}return 0===u?null:c}]}));var Va=O.Date,Ba=K(Va.prototype.getTime);nn({target:"Date",stat:!0},{now:function(){return Ba(new Va)}});var Ha=we("unscopables"),Ka=Array.prototype;null==Ka[Ha]&&nt.f(Ka,Ha,{configurable:!0,value:bn(null)});var ja=function(e){Ka[Ha][e]=!0},Wa=wt.includes;nn({target:"Array",proto:!0},{includes:function(e){return Wa(this,e,arguments.length>1?arguments[1]:void 0)}}),ja("includes");var Ya=we("match"),$a=function(e){var t;return te(e)&&(void 0!==(t=e[Ya])?!!t:"RegExp"==Y(e))},za=O.TypeError,Ja=function(e){if($a(e))throw za("The method doesn't accept regular expressions");return e},Xa=we("match"),Qa=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[Xa]=!1,"/./"[e](t)}catch(o){}}return!1},Za=K("".indexOf);nn({target:"String",proto:!0,forced:!Qa("includes")},{includes:function(e){return!!~Za(dn(Q(this)),dn(Ja(e)),arguments.length>1?arguments[1]:void 0)}});var es=O.RangeError,ts=K((function(e){var t=dn(Q(this)),n="",o=Rt(e);if(o<0||Infinity==o)throw es("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(t+=t))1&o&&(n+=t);return n})),ns=K("".slice),os=Math.ceil,rs=function(e){return function(t,n,o){var r,a,s=dn(Q(t)),i=Pt(n),c=s.length,u=void 0===o?" ":dn(o);return i<=c||""==u?s:((a=ts(u,os((r=i-c)/u.length))).length>r&&(a=ns(a,0,r)),e?s+a:a+s)}},as={start:rs(!1),end:rs(!0)}.start,ss=O.RangeError,is=Math.abs,cs=Date.prototype,us=cs.toISOString,ls=K(cs.getTime),ds=K(cs.getUTCDate),ps=K(cs.getUTCFullYear),gs=K(cs.getUTCHours),_s=K(cs.getUTCMilliseconds),hs=K(cs.getUTCMinutes),fs=K(cs.getUTCMonth),ms=K(cs.getUTCSeconds),Ms=L((function(){return"0385-07-25T07:06:39.999Z"!=us.call(new Date(-50000000000001))}))||!L((function(){us.call(new Date(NaN))}))?function(){if(!isFinite(ls(this)))throw ss("Invalid time value");var e=ps(this),t=_s(this),n=e<0?"-":e>9999?"+":"";return n+as(is(e),n?6:4,0)+"-"+as(fs(this)+1,2,0)+"-"+as(ds(this),2,0)+"T"+as(gs(this),2,0)+":"+as(hs(this),2,0)+":"+as(ms(this),2,0)+"."+as(t,3,0)+"Z"}:us;nn({target:"Date",proto:!0,forced:Date.prototype.toISOString!==Ms},{toISOString:Ms});var vs=Function.prototype,ys=vs.apply,Is=vs.call,Es="object"==typeof Reflect&&Reflect.apply||(G?Is.bind(ys):function(){return Is.apply(ys,arguments)}),Ts=Math.floor,Ss=K("".charAt),As=K("".replace),Ds=K("".slice),Cs=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Ns=/\$([$&'`]|\d{1,2})/g,Rs=function(e,t,n,o,r,a){var s=n+e.length,i=o.length,c=Ns;return void 0!==r&&(r=De(r),c=Cs),As(a,c,(function(a,c){var u;switch(Ss(c,0)){case"$":return"$";case"&":return e;case"`":return Ds(t,0,n);case"'":return Ds(t,s);case"<":u=r[Ds(c,1,-1)];break;default:var l=+c;if(0===l)return a;if(l>i){var d=Ts(l/10);return 0===d?a:d<=i?void 0===o[d-1]?Ss(c,1):o[d-1]+Ss(c,1):a}u=o[l-1]}return void 0===u?"":u}))},Os=we("replace"),Ls=Math.max,ks=Math.min,Gs=K([].concat),Ps=K([].push),bs=K("".indexOf),Us=K("".slice),ws="$0"==="a".replace(/./,"$0"),Fs=!!/./[Os]&&""===/./[Os]("a","$0");Ua("replace",(function(e,t,n){var o=Fs?"$":"$0";return[function(e,n){var o=Q(this),r=null==e?void 0:ve(e,Os);return r?b(r,e,o,n):b(t,dn(o),e,n)},function(e,r){var a=Xe(this),s=dn(e);if("string"==typeof r&&-1===bs(r,o)&&-1===bs(r,"$<")){var i=n(t,a,s,r);if(i.done)return i.value}var c=ee(r);c||(r=dn(r));var u=a.global;if(u){var l=a.unicode;a.lastIndex=0}for(var d=[];;){var p=xa(a,s);if(null===p)break;if(Ps(d,p),!u)break;""===dn(p[0])&&(a.lastIndex=Fa(s,Pt(a.lastIndex),l))}for(var g,_="",h=0,f=0;f<d.length;f++){for(var m=dn((p=d[f])[0]),M=Ls(ks(Rt(p.index),s.length),0),v=[],y=1;y<p.length;y++)Ps(v,void 0===(g=p[y])?g:String(g));var I=p.groups;if(c){var E=Gs([m],v,M,s);void 0!==I&&Ps(E,I);var T=dn(Es(r,void 0,E))}else T=Rs(m,s,M,v,I,r);M>=h&&(_+=Us(s,h,M)+T,h=M+m.length)}return _+Us(s,h)}]}),!!L((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!ws||Fs);var qs=nt.f,xs=It.set,Vs=It.getterFor("Array Iterator"),Bs=cr(Array,"Array",(function(e,t){xs(this,{type:"Array Iterator",target:Z(e),index:0,kind:t})}),(function(){var e=Vs(this),t=e.target,n=e.kind,o=e.index++;return!t||o>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:o,done:!1}:"values"==n?{value:t[o],done:!1}:{value:[o,t[o]],done:!1}}),"values"),Hs=_o.Arguments=_o.Array;if(ja("keys"),ja("values"),ja("entries"),k&&"values"!==Hs.name)try{qs(Hs,"name",{value:"values"})}catch(FS){}var Ks=we("iterator"),js=we("toStringTag"),Ws=Bs.values,Ys=function(e,t){if(e){if(e[Ks]!==Ws)try{ot(e,Ks,Ws)}catch(FS){e[Ks]=Ws}if(e[js]||ot(e,js,t),ro[t])for(var n in Bs)if(e[n]!==Bs[n])try{ot(e,n,Bs[n])}catch(FS){e[n]=Bs[n]}}};for(var $s in ro)Ys(O[$s]&&O[$s].prototype,$s);Ys(io,"DOMTokenList");var zs=Er("slice"),Js=we("species"),Xs=O.Array,Qs=Math.max;nn({target:"Array",proto:!0,forced:!zs},{slice:function(e,t){var n,o,r,a=Z(this),s=bt(a),i=kt(e,s),c=kt(void 0===t?s:t,s);if(Fn(a)&&(n=a.constructor,(Yn(n)&&(n===Xs||Fn(n.prototype))||te(n)&&null===(n=n[Js]))&&(n=void 0),n===Xs||void 0===n))return _r(a,i,c);for(o=new(void 0===n?Xs:n)(Qs(c-i,0)),r=0;i<c;i++,r++)i in a&&Mo(o,r,a[i]);return o.length=r,o}});var Zs=K([].join),ei=J!=Object,ti=eo("join",",");nn({target:"Array",proto:!0,forced:ei||!ti},{join:function(e){return Zs(Z(this),void 0===e?",":e)}});var ni=wt.indexOf,oi=K([].indexOf),ri=!!oi&&1/oi([1],1,-0)<0,ai=eo("indexOf");nn({target:"Array",proto:!0,forced:ri||!ai},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return ri?oi(this,e,t)||0:ni(this,e,t)}});var si=O.Array,ii=Math.max,ci=function(e,t,n){for(var o=bt(e),r=kt(t,o),a=kt(void 0===n?o:n,o),s=si(ii(a-r,0)),i=0;r<a;r++,i++)Mo(s,i,e[r]);return s.length=i,s},ui=Ht.f,li="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],di={f:function(e){return li&&"Window"==Y(e)?function(e){try{return ui(e)}catch(FS){return ci(li)}}(e):ui(Z(e))}},pi=di.f,gi=L((function(){return!Object.getOwnPropertyNames(1)}));nn({target:"Object",stat:!0,forced:gi},{getOwnPropertyNames:pi});var _i=Zn.find,hi=!0;"find"in[]&&Array(1).find((function(){hi=!1})),nn({target:"Array",proto:!0,forced:hi},{find:function(e){return _i(this,e,arguments.length>1?arguments[1]:void 0)}}),ja("find");var fi,mi=Ye.f,Mi=K("".startsWith),vi=K("".slice),yi=Math.min,Ii=Qa("startsWith"),Ei=!(Ii||(fi=mi(String.prototype,"startsWith"),!fi||fi.writable));nn({target:"String",proto:!0,forced:!Ei&&!Ii},{startsWith:function(e){var t=dn(Q(this));Ja(e);var n=Pt(yi(arguments.length>1?arguments[1]:void 0,t.length)),o=dn(e);return Mi?Mi(t,o,n):vi(t,n,n+o.length)===o}});var Ti,Si,Ai,Di,Ci=O.Promise,Ni=function(e,t,n){for(var o in t)Dt(e,o,t[o],n);return e},Ri=we("species"),Oi=function(e){var t=oe(e),n=nt.f;k&&t&&!t[Ri]&&n(t,Ri,{configurable:!0,get:function(){return this}})},Li=O.TypeError,ki=function(e,t){if(re(t,e))return e;throw Li("Incorrect invocation")},Gi=O.TypeError,Pi=function(e,t){this.stopped=e,this.result=t},bi=Pi.prototype,Ui=function(e,t,n){var o,r,a,s,i,c,u,l=n&&n.that,d=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),g=!(!n||!n.INTERRUPTED),_=wn(t,l),h=function(e){return o&&po(o,"normal",e),new Pi(!0,e)},f=function(e){return d?(Xe(e),g?_(e[0],e[1],h):_(e[0],e[1])):g?_(e,h):_(e)};if(p)o=e;else{if(!(r=yo(e)))throw Gi(fe(e)+" is not iterable");if(mo(r)){for(a=0,s=bt(e);s>a;a++)if((i=f(e[a]))&&re(bi,i))return i;return new Pi(!1)}o=Eo(e,r)}for(c=o.next;!(u=b(c,o)).done;){try{i=f(u.value)}catch(FS){po(o,"throw",FS)}if("object"==typeof i&&i&&re(bi,i))return i}return new Pi(!1)},wi=O.TypeError,Fi=function(e){if(Yn(e))return e;throw wi(fe(e)+" is not a constructor")},qi=we("species"),xi=function(e,t){var n,o=Xe(e).constructor;return void 0===o||null==(n=Xe(o)[qi])?t:Fi(n)},Vi=O.TypeError,Bi=function(e,t){if(e<t)throw Vi("Not enough arguments");return e},Hi=/(?:ipad|iphone|ipod).*applewebkit/i.test(ae),Ki="process"==Y(O.process),ji=O.setImmediate,Wi=O.clearImmediate,Yi=O.process,$i=O.Dispatch,zi=O.Function,Ji=O.MessageChannel,Xi=O.String,Qi=0,Zi={};try{Ti=O.location}catch(FS){}var ec=function(e){if(Ne(Zi,e)){var t=Zi[e];delete Zi[e],t()}},tc=function(e){return function(){ec(e)}},nc=function(e){ec(e.data)},oc=function(e){O.postMessage(Xi(e),Ti.protocol+"//"+Ti.host)};ji&&Wi||(ji=function(e){Bi(arguments.length,1);var t=ee(e)?e:zi(e),n=_r(arguments,1);return Zi[++Qi]=function(){Es(t,void 0,n)},Si(Qi),Qi},Wi=function(e){delete Zi[e]},Ki?Si=function(e){Yi.nextTick(tc(e))}:$i&&$i.now?Si=function(e){$i.now(tc(e))}:Ji&&!Hi?(Di=(Ai=new Ji).port2,Ai.port1.onmessage=nc,Si=wn(Di.postMessage,Di)):O.addEventListener&&ee(O.postMessage)&&!O.importScripts&&Ti&&"file:"!==Ti.protocol&&!L(oc)?(Si=oc,O.addEventListener("message",nc,!1)):Si="onreadystatechange"in Ke("script")?function(e){Rn.appendChild(Ke("script")).onreadystatechange=function(){Rn.removeChild(this),ec(e)}}:function(e){setTimeout(tc(e),0)});var rc,ac,sc,ic,cc,uc,lc,dc,pc={set:ji,clear:Wi},gc=/ipad|iphone|ipod/i.test(ae)&&void 0!==O.Pebble,_c=/web0s(?!.*chrome)/i.test(ae),hc=Ye.f,fc=pc.set,mc=O.MutationObserver||O.WebKitMutationObserver,Mc=O.document,vc=O.process,yc=O.Promise,Ic=hc(O,"queueMicrotask"),Ec=Ic&&Ic.value;Ec||(rc=function(){var e,t;for(Ki&&(e=vc.domain)&&e.exit();ac;){t=ac.fn,ac=ac.next;try{t()}catch(FS){throw ac?ic():sc=void 0,FS}}sc=void 0,e&&e.enter()},Hi||Ki||_c||!mc||!Mc?!gc&&yc&&yc.resolve?((lc=yc.resolve(void 0)).constructor=yc,dc=wn(lc.then,lc),ic=function(){dc(rc)}):Ki?ic=function(){vc.nextTick(rc)}:(fc=wn(fc,O),ic=function(){fc(rc)}):(cc=!0,uc=Mc.createTextNode(""),new mc(rc).observe(uc,{characterData:!0}),ic=function(){uc.data=cc=!cc}));var Tc=Ec||function(e){var t={fn:e,next:void 0};sc&&(sc.next=t),ac||(ac=t,ic()),sc=t},Sc=function(e){var t,n;this.promise=new e((function(e,o){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=o})),this.resolve=Me(t),this.reject=Me(n)},Ac={f:function(e){return new Sc(e)}},Dc=function(e,t){if(Xe(e),te(t)&&t.constructor===e)return t;var n=Ac.f(e);return(0,n.resolve)(t),n.promise},Cc=function(e){try{return{error:!1,value:e()}}catch(FS){return{error:!0,value:FS}}},Nc=function(){this.head=null,this.tail=null};Nc.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Rc,Oc,Lc,kc,Gc=Nc,Pc="object"==typeof window,bc=pc.set,Uc=we("species"),wc="Promise",Fc=It.getterFor(wc),qc=It.set,xc=It.getterFor(wc),Vc=Ci&&Ci.prototype,Bc=Ci,Hc=Vc,Kc=O.TypeError,jc=O.document,Wc=O.process,Yc=Ac.f,$c=Yc,zc=!!(jc&&jc.createEvent&&O.dispatchEvent),Jc=ee(O.PromiseRejectionEvent),Xc=!1,Qc=en(wc,(function(){var e=ct(Bc),t=e!==String(Bc);if(!t&&66===le)return!0;if(le>=51&&/native code/.test(e))return!1;var n=new Bc((function(e){e(1)})),o=function(e){e((function(){}),(function(){}))};return(n.constructor={})[Uc]=o,!(Xc=n.then((function(){}))instanceof o)||!t&&Pc&&!Jc})),Zc=Qc||!Ro((function(e){Bc.all(e).catch((function(){}))})),eu=function(e){var t;return!(!te(e)||!ee(t=e.then))&&t},tu=function(e,t){var n,o,r,a=t.value,s=1==t.state,i=s?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{i?(s||(2===t.rejection&&su(t),t.rejection=1),!0===i?n=a:(l&&l.enter(),n=i(a),l&&(l.exit(),r=!0)),n===e.promise?u(Kc("Promise-chain cycle")):(o=eu(n))?b(o,n,c,u):c(n)):u(a)}catch(FS){l&&!r&&l.exit(),u(FS)}},nu=function(e,t){e.notified||(e.notified=!0,Tc((function(){for(var n,o=e.reactions;n=o.get();)tu(n,e);e.notified=!1,t&&!e.rejection&&ru(e)})))},ou=function(e,t,n){var o,r;zc?((o=jc.createEvent("Event")).promise=t,o.reason=n,o.initEvent(e,!1,!0),O.dispatchEvent(o)):o={promise:t,reason:n},!Jc&&(r=O["on"+e])?r(o):"unhandledrejection"===e&&function(e,t){var n=O.console;n&&n.error&&(1==arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},ru=function(e){b(bc,O,(function(){var t,n=e.facade,o=e.value;if(au(e)&&(t=Cc((function(){Ki?Wc.emit("unhandledRejection",o,n):ou("unhandledrejection",n,o)})),e.rejection=Ki||au(e)?2:1,t.error))throw t.value}))},au=function(e){return 1!==e.rejection&&!e.parent},su=function(e){b(bc,O,(function(){var t=e.facade;Ki?Wc.emit("rejectionHandled",t):ou("rejectionhandled",t,e.value)}))},iu=function(e,t,n){return function(o){e(t,o,n)}},cu=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,nu(e,!0))},uu=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw Kc("Promise can't be resolved itself");var o=eu(t);o?Tc((function(){var n={done:!1};try{b(o,t,iu(uu,n,e),iu(cu,n,e))}catch(FS){cu(n,FS,e)}})):(e.value=t,e.state=1,nu(e,!1))}catch(FS){cu({done:!1},FS,e)}}};if(Qc&&(Hc=(Bc=function(e){ki(this,Hc),Me(e),b(Rc,this);var t=Fc(this);try{e(iu(uu,t),iu(cu,t))}catch(FS){cu(t,FS)}}).prototype,(Rc=function(e){qc(this,{type:wc,done:!1,notified:!1,parent:!1,reactions:new Gc,rejection:!1,state:0,value:void 0})}).prototype=Ni(Hc,{then:function(e,t){var n=xc(this),o=Yc(xi(this,Bc));return n.parent=!0,o.ok=!ee(e)||e,o.fail=ee(t)&&t,o.domain=Ki?Wc.domain:void 0,0==n.state?n.reactions.add(o):Tc((function(){tu(o,n)})),o.promise},catch:function(e){return this.then(void 0,e)}}),Oc=function(){var e=new Rc,t=Fc(e);this.promise=e,this.resolve=iu(uu,t),this.reject=iu(cu,t)},Ac.f=Yc=function(e){return e===Bc||e===Lc?new Oc(e):$c(e)},ee(Ci)&&Vc!==Object.prototype)){kc=Vc.then,Xc||(Dt(Vc,"then",(function(e,t){var n=this;return new Bc((function(e,t){b(kc,n,e,t)})).then(e,t)}),{unsafe:!0}),Dt(Vc,"catch",Hc.catch,{unsafe:!0}));try{delete Vc.constructor}catch(FS){}tr&&tr(Vc,Hc)}nn({global:!0,wrap:!0,forced:Qc},{Promise:Bc}),zo(Bc,wc,!1),Oi(wc),Lc=oe(wc),nn({target:wc,stat:!0,forced:Qc},{reject:function(e){var t=Yc(this);return b(t.reject,void 0,e),t.promise}}),nn({target:wc,stat:!0,forced:Qc},{resolve:function(e){return Dc(this,e)}}),nn({target:wc,stat:!0,forced:Zc},{all:function(e){var t=this,n=Yc(t),o=n.resolve,r=n.reject,a=Cc((function(){var n=Me(t.resolve),a=[],s=0,i=1;Ui(e,(function(e){var c=s++,u=!1;i++,b(n,t,e).then((function(e){u||(u=!0,a[c]=e,--i||o(a))}),r)})),--i||o(a)}));return a.error&&r(a.value),n.promise},race:function(e){var t=this,n=Yc(t),o=n.reject,r=Cc((function(){var r=Me(t.resolve);Ui(e,(function(e){b(r,t,e).then(n.resolve,o)}))}));return r.error&&o(r.value),n.promise}});var lu=ca.UNSUPPORTED_Y,du=Math.min,pu=[].push,gu=K(/./.exec),_u=K(pu),hu=K("".slice);Ua("split",(function(e,t,n){var o;return o="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var o=dn(Q(this)),r=void 0===n?4294967295:n>>>0;if(0===r)return[];if(void 0===e)return[o];if(!$a(e))return b(t,o,e,r);for(var a,s,i,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,d=new RegExp(e.source,u+"g");(a=b(Sa,d,o))&&!((s=d.lastIndex)>l&&(_u(c,hu(o,l,a.index)),a.length>1&&a.index<o.length&&Es(pu,c,ci(a,1)),i=a[0].length,l=s,c.length>=r));)d.lastIndex===a.index&&d.lastIndex++;return l===o.length?!i&&gu(d,"")||_u(c,""):_u(c,hu(o,l)),c.length>r?ci(c,0,r):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:b(t,this,e,n)}:t,[function(t,n){var r=Q(this),a=null==t?void 0:ve(t,e);return a?b(a,t,r,n):b(o,dn(r),t,n)},function(e,r){var a=Xe(this),s=dn(e),i=n(o,a,s,r,o!==t);if(i.done)return i.value;var c=xi(a,RegExp),u=a.unicode,l=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(lu?"g":"y"),d=new c(lu?"^(?:"+a.source+")":a,l),p=void 0===r?4294967295:r>>>0;if(0===p)return[];if(0===s.length)return null===xa(d,s)?[s]:[];for(var g=0,_=0,h=[];_<s.length;){d.lastIndex=lu?0:_;var f,m=xa(d,lu?hu(s,_):s);if(null===m||(f=du(Pt(d.lastIndex+(lu?_:0)),s.length))===g)_=Fa(s,_,u);else{if(_u(h,hu(s,g,_)),h.length===p)return h;for(var M=1;M<=m.length-1;M++)if(_u(h,m[M]),h.length===p)return h;_=g=f}}return _u(h,hu(s,g)),h}]}),!!L((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),lu);var fu=Fo.codeAt;nn({target:"String",proto:!0},{codePointAt:function(e){return fu(this,e)}});var mu=Mn.trim,Mu=K("".charAt),vu=O.parseFloat,yu=O.Symbol,Iu=yu&&yu.iterator,Eu=1/vu(pn+"-0")!=-Infinity||Iu&&!L((function(){vu(Object(Iu))}))?function(e){var t=mu(dn(e)),n=vu(t);return 0===n&&"-"==Mu(t,0)?-0:n}:vu;nn({global:!0,forced:parseFloat!=Eu},{parseFloat:Eu});var Tu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return a(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),Su={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://api.im.qcloud.com"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.im.qcloud.com",BACKUP:"wss://wssind.my-imcloud.com",STAT:"https://apiind.my-imcloud.com"}}},Au={WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,UNI_NATIVE_APP:15},Du="1.7.3",Cu=537048168,Nu="CHINA",Ru="OVERSEA",Ou="SINGAPORE",Lu="KOREA",ku="GERMANY",Gu="IND",Pu={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://api.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nu;this.CURRENT=Su.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",GROUP:"group_open_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush"},CMD:{ACCESS_LAYER:"accesslayer",LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_list",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"delete",PIN_CONVERSATION:"top",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},bu={SEARCH_MSG:new Tu(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new Tu(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new Tu(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new Tu(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new Tu(0,Math.pow(2,4)).toString(),USER_STATUS:new Tu(0,Math.pow(2,7)).toString()};Pu.HOST.setCurrent(Nu);var Uu,wu="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Fu="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),qu="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),xu="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),Vu="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),Bu="undefined"!=typeof uni&&"undefined"==typeof window,Hu="undefined"!=typeof uni,Ku=wu||Fu||qu||xu||Vu||Bu,ju=("undefined"!=typeof uni||"undefined"!=typeof window)&&!Ku,Wu=Fu?qq:qu?tt:xu?swan:Vu?my:wu?wx:Bu?uni:{},Yu=(Uu="WEB",cl?Uu="WEB":Fu?Uu="QQ_MP":qu?Uu="TT_MP":xu?Uu="BAIDU_MP":Vu?Uu="ALI_MP":wu?Uu="WX_MP":Bu&&(Uu="UNI_NATIVE_APP"),Au[Uu]),$u=ju&&window&&window.navigator&&window.navigator.userAgent||"",zu=/AppleWebKit\/([\d.]+)/i.exec($u),Ju=(zu&&parseFloat(zu.pop()),/iPad/i.test($u)),Xu=/iPhone/i.test($u)&&!Ju,Qu=/iPod/i.test($u),Zu=Xu||Ju||Qu,el=function(){var e=$u.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),tl=/Android/i.test($u),nl=function(){var e=$u.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),ol=(tl&&/webkit/i.test($u),/Firefox/i.test($u),/Edge/i.test($u)),rl=!ol&&/Chrome/i.test($u),al=(function(){var e=$u.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test($u)||$u.indexOf("Trident")>-1&&$u.indexOf("rv:11.0")>-1),sl=(/MSIE\s8\.0/.test($u),function(){var e=/MSIE\s(\d+)\.\d/.exec($u),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test($u)&&/rv:11.0/.test($u)&&(t=11),t}()),il=(/Safari/i.test($u),/TBS\/\d+/i.test($u)),cl=(function(){var e=$u.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}(),!il&&/MQQBrowser\/\d+/i.test($u),!il&&/ QQBrowser\/\d+/i.test($u),/(micromessenger|webbrowser)/i.test($u)),ul=/Windows/i.test($u),ll=/MAC OS X/i.test($u),dl=(/MicroMessenger/i.test($u),ju&&"undefined"!=typeof Worker&&!al),pl=tl||Zu,gl=L((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),_l=Object.isExtensible,hl=L((function(){_l(1)}))||gl?function(e){return!!te(e)&&((!gl||"ArrayBuffer"!=Y(e))&&(!_l||_l(e)))}:_l,fl=!L((function(){return Object.isExtensible(Object.preventExtensions({}))})),ml=D((function(e){var t=nt.f,n=!1,o=ke("meta"),r=0,a=function(e){t(e,o,{value:{objectID:"O"+r++,weakData:{}}})},s=e.exports={enable:function(){s.enable=function(){},n=!0;var e=Ht.f,t=K([].splice),r={};r[o]=1,e(r).length&&(Ht.f=function(n){for(var r=e(n),a=0,s=r.length;a<s;a++)if(r[a]===o){t(r,a,1);break}return r},nn({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:di.f}))},fastKey:function(e,t){if(!te(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Ne(e,o)){if(!hl(e))return"F";if(!t)return"E";a(e)}return e[o].objectID},getWeakData:function(e,t){if(!Ne(e,o)){if(!hl(e))return!0;if(!t)return!1;a(e)}return e[o].weakData},onFreeze:function(e){return fl&&n&&hl(e)&&!Ne(e,o)&&a(e),e}};gt[o]=!0})),Ml=(ml.enable,ml.fastKey,ml.getWeakData,ml.onFreeze,nt.f),vl=ml.fastKey,yl=It.set,Il=It.getterFor;!function(e,t,n){var o=-1!==e.indexOf("Map"),r=-1!==e.indexOf("Weak"),a=o?"set":"add",s=O[e],i=s&&s.prototype,c=s,u={},l=function(e){var t=K(i[e]);Dt(i,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(r&&!te(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return r&&!te(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(r&&!te(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(en(e,!ee(s)||!(r||i.forEach&&!L((function(){(new s).entries().next()})))))c=n.getConstructor(t,e,o,a),ml.enable();else if(en(e,!0)){var d=new c,p=d[a](r?{}:-0,1)!=d,g=L((function(){d.has(1)})),_=Ro((function(e){new s(e)})),h=!r&&L((function(){for(var e=new s,t=5;t--;)e[a](t,t);return!e.has(-0)}));_||((c=t((function(e,t){ki(e,i);var n=Fr(new s,e,c);return null!=t&&Ui(t,n[a],{that:n,AS_ENTRIES:o}),n}))).prototype=i,i.constructor=c),(g||h)&&(l("delete"),l("has"),o&&l("get")),(h||p)&&l(a),r&&i.clear&&delete i.clear}u[e]=c,nn({global:!0,forced:c!=s},u),zo(c,e),r||n.setStrong(c,e,o)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,o){var r=e((function(e,r){ki(e,a),yl(e,{type:t,index:bn(null),first:void 0,last:void 0,size:0}),k||(e.size=0),null!=r&&Ui(r,e[o],{that:e,AS_ENTRIES:n})})),a=r.prototype,s=Il(t),i=function(e,t,n){var o,r,a=s(e),i=c(e,t);return i?i.value=n:(a.last=i={index:r=vl(t,!0),key:t,value:n,previous:o=a.last,next:void 0,removed:!1},a.first||(a.first=i),o&&(o.next=i),k?a.size++:e.size++,"F"!==r&&(a.index[r]=i)),e},c=function(e,t){var n,o=s(e),r=vl(t);if("F"!==r)return o.index[r];for(n=o.first;n;n=n.next)if(n.key==t)return n};return Ni(a,{clear:function(){for(var e=s(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,k?e.size=0:this.size=0},delete:function(e){var t=s(this),n=c(this,e);if(n){var o=n.next,r=n.previous;delete t.index[n.index],n.removed=!0,r&&(r.next=o),o&&(o.previous=r),t.first==n&&(t.first=o),t.last==n&&(t.last=r),k?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=s(this),o=wn(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:n.first;)for(o(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Ni(a,n?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return i(this,0===e?0:e,t)}}:{add:function(e){return i(this,e=0===e?0:e,e)}}),k&&Ml(a,"size",{get:function(){return s(this).size}}),r},setStrong:function(e,t,n){var o=t+" Iterator",r=Il(t),a=Il(o);cr(e,t,(function(e,t){yl(this,{type:o,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),Oi(t)}});var El,Tl,Sl="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};El="undefined"!=typeof console?console:void 0!==Sl&&Sl.console?Sl.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Al=function(){},Dl=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Cl=Dl.length;Cl--;)Tl=Dl[Cl],console[Tl]||(El[Tl]=Al);var Nl=El,Rl=0,Ol=function(){return(new Date).getTime()+Rl},Ll=function(){Rl=0},kl=function(){return Math.floor(Ol()/1e3)},Gl=0,Pl=new Map;function bl(){var e,t=((e=new Date).setTime(Ol()),e);return"TIM "+t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())+":"}var Ul={arguments2String:function(e){var t;if(1===e.length)t=bl()+e[0];else{t=bl();for(var n=0,o=e.length;n<o;n++)td(e[n])?od(e[n])?t+=ud(e[n]):t+=JSON.stringify(e[n]):t+=e[n],t+=" "}return t},debug:function(){if(Gl<=-1){var e=this.arguments2String(arguments);Nl.debug(e)}},log:function(){if(Gl<=0){var e=this.arguments2String(arguments);Nl.log(e)}},info:function(){if(Gl<=1){var e=this.arguments2String(arguments);Nl.info(e)}},warn:function(){if(Gl<=2){var e=this.arguments2String(arguments);Nl.warn(e)}},error:function(){if(Gl<=3){var e=this.arguments2String(arguments);Nl.error(e)}},time:function(e){Pl.set(e,id.now())},timeEnd:function(e){if(Pl.has(e)){var t=id.now()-Pl.get(e);return Pl.delete(e),t}return Nl.warn("未找到对应label: ".concat(e,", 请在调用 logger.timeEnd 前,调用 logger.time")),0},setLevel:function(e){e<4&&Nl.log(bl()+"set level from "+Gl+" to "+e),Gl=e},getLevel:function(){return Gl}},wl={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Fl={NICK:"Tag_Profile_IM_Nick",GENDER:"Tag_Profile_IM_Gender",BIRTHDAY:"Tag_Profile_IM_BirthDay",LOCATION:"Tag_Profile_IM_Location",SELFSIGNATURE:"Tag_Profile_IM_SelfSignature",ALLOWTYPE:"Tag_Profile_IM_AllowType",LANGUAGE:"Tag_Profile_IM_Language",AVATAR:"Tag_Profile_IM_Image",MESSAGESETTINGS:"Tag_Profile_IM_MsgSettings",ADMINFORBIDTYPE:"Tag_Profile_IM_AdminForbidType",LEVEL:"Tag_Profile_IM_Level",ROLE:"Tag_Profile_IM_Role"},ql={GROUP:"Tag_SNS_IM_Group",REMARK:"Tag_SNS_IM_Remark",ADDSOURCE:"Tag_SNS_IM_AddSource",ADDWORDING:"Tag_SNS_IM_AddWording",ADDTIME:"Tag_SNS_IM_AddTime"},xl={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},Vl={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},Bl={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Hl="JoinedSuccess",Kl="WaitAdminApproval",jl="@TGS#_",Wl="@TOPIC#_",Yl=["url"],$l=function(e){return"file"===rd(e)},zl=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"===n(e)&&e.constructor===Number)},Jl=function(e){return"string"==typeof e},Xl=function(e){return null!==e&&"object"===n(e)},Ql=function(e){if("object"!==n(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return t===o},Zl=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===rd(e)},ed=function(e){return void 0===e},td=function(e){return Zl(e)||Xl(e)},nd=function(e){return"function"==typeof e},od=function(e){return e instanceof Error},rd=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ad=function(e){if("string"!=typeof e)return!1;var t=e[0];return!/[^a-zA-Z0-9]/.test(t)},sd=0;Date.now||(Date.now=function(){return(new Date).getTime()});var id={now:function(){0===sd&&(sd=Date.now()-1);var e=Date.now()-sd;return e>4294967295?(sd+=4294967295,Date.now()-sd):e},utc:function(){return Math.round(Date.now()/1e3)}},cd=function e(t,n,o,r){if(!td(t)||!td(n))return 0;for(var a,s=0,i=Object.keys(n),c=0,u=i.length;c<u;c++)if(a=i[c],!(ed(n[a])||o&&o.includes(a)))if(td(t[a])&&td(n[a]))s+=e(t[a],n[a],o,r);else{if(r&&r.includes(n[a]))continue;t[a]!==n[a]&&(t[a]=n[a],s+=1)}return s},ud=function(e){return JSON.stringify(e,["message","code"])},ld=function(e){if(0===e.length)return 0;for(var t=0,n=0,o="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)n+=e[t++].charCodeAt[t]<=255?1:!1===o?3:2;return n},dd=function(e){var t=e||99999999;return Math.round(Math.random()*t)},pd="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",gd=pd.length,_d=function(e,t){for(var n in e)if(e[n]===t)return!0;return!1},hd={},fd=function(){if(Ku)return"https:";if(ju&&"undefined"==typeof window)return"https:";var e=window.location.protocol;return["http:","https:"].indexOf(e)<0&&(e="http:"),e},md=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")},Md=function e(t){if(0===Object.getOwnPropertyNames(t).length)return Object.create(null);var o=Array.isArray(t)?[]:Object.create(null),r="";for(var a in t)null!==t[a]?void 0!==t[a]?(r=n(t[a]),["string","number","function","boolean"].indexOf(r)>=0?o[a]=t[a]:o[a]=e(t[a])):o[a]=void 0:o[a]=null;return o};function vd(e,t){Zl(e)&&Zl(t)?t.forEach((function(t){var n=t.key,o=t.value,r=e.find((function(e){return e.key===n}));r?r.value=o:e.push({key:n,value:o})})):Ul.warn("updateCustomField target 或 source 不是数组,忽略此次更新。")}var yd=function(e){return e===gr.GRP_PUBLIC},Id=function(e){return e===gr.GRP_AVCHATROOM},Ed=function(e){var t=e.type,n=e.groupID;return t===gr.GRP_COMMUNITY||"".concat(n).startsWith(jl)&&!"".concat(n).includes(Wl)},Td=function(e){return"".concat(e).startsWith(jl)&&"".concat(e).includes(Wl)},Sd=function(e){return Jl(e)&&e.slice(0,3)===gr.CONV_C2C},Ad=function(e){return Jl(e)&&e.slice(0,5)===gr.CONV_GROUP},Dd=function(e){return Jl(e)&&e===gr.CONV_SYSTEM};function Cd(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function Nd(e){return Ku?new Promise((function(t,n){Wu.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):al&&9===sl?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Rd(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Od(){var e="unknown";if(ll&&(e="mac"),ul&&(e="windows"),Zu&&(e="ios"),tl&&(e="android"),Ku)try{var t=Wu.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(FS){}return e}function Ld(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.length<n;)e.push("0");for(;t.length<n;)t.push("0");for(var o=0;o<n;o++){var r=parseInt(e[o]),a=parseInt(t[o]);if(r>a)return 1;if(r<a)return-1}return 0}function kd(e){var t=e.originUrl,n=void 0===t?void 0:t,o=e.originWidth,r=e.originHeight,a=e.min,s=void 0===a?198:a,i=parseInt(o),c=parseInt(r),u={url:void 0,width:0,height:0};if((i<=c?i:c)<=s)u.url=n,u.width=i,u.height=c;else{c<=i?(u.width=Math.ceil(i*s/c),u.height=s):(u.width=s,u.height=Math.ceil(c*s/i));var l=n&&n.indexOf("?")>-1?"".concat(n,"&"):"".concat(n,"?");u.url="".concat(l,198===s?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return ed(n)?g(u,Yl):u}function Gd(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n<e.length;n++)e[n].setType(n)}function Pd(e){var t=e.servcmd;return t.slice(t.indexOf(".")+1)}function bd(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function Ud(e,t){return e.includes(t)}function wd(e,t){return e.includes(t)}function Fd(e){return e.split(Wl)[0]}var qd=function(e,t){if(ed(t))return"";switch(e){case gr.MSG_TEXT:return t.text;case gr.MSG_IMAGE:return"[图片]";case gr.MSG_LOCATION:return"[位置]";case gr.MSG_AUDIO:return"[语音]";case gr.MSG_VIDEO:return"[视频]";case gr.MSG_FILE:return"[文件]";case gr.MSG_CUSTOM:return"[自定义消息]";case gr.MSG_GRP_TIP:return"[群提示消息]";case gr.MSG_GRP_SYS_NOTICE:return"[群系统通知]";case gr.MSG_FACE:return"[动画表情]";case gr.MSG_MERGER:return"[聊天记录]";default:return""}};function xd(e){return e===gr.MSG_TEXT||e===gr.MSG_CUSTOM||e===gr.MSG_LOCATION||e===gr.MSG_FACE}var Vd=Object.prototype.hasOwnProperty;function Bd(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Ql(e)){for(var t in e)if(Vd.call(e,t))return!1;return!0}return!("map"!==rd(e)&&!function(e){return"set"===rd(e)}(e)&&!$l(e))&&0===e.size}function Hd(e,t,n){if(void 0===t)return!0;var o=!0;if("object"===wr(t).toLowerCase())Object.keys(t).forEach((function(r){var a=1===e.length?e[0][r]:void 0;o=!!Kd(a,t[r],n,r)&&o}));else if("array"===wr(t).toLowerCase())for(var r=0;r<t.length;r++)o=!!Kd(e[r],t[r],n,t[r].name)&&o;if(o)return o;throw new Error("Params validate failed.")}function Kd(e,t,n,o){if(void 0===t)return!0;var r=!0;return t.required&&Bd(e)&&(Nl.error("TIM [".concat(n,'] Missing required params: "').concat(o,'".')),r=!1),Bd(e)||wr(e).toLowerCase()===t.type.toLowerCase()||(Nl.error("TIM [".concat(n,'] Invalid params: type check failed for "').concat(o,'".Expected ').concat(t.type,".")),r=!1),t.validator&&!t.validator(e)&&(Nl.error("TIM [".concat(n,"] Invalid params: custom validator check failed for params.")),r=!1),r}var jd={f:we},Wd=O,Yd=nt.f,$d=Zn.forEach,zd=pt("hidden"),Jd=we("toPrimitive"),Xd=It.set,Qd=It.getterFor("Symbol"),Zd=Object.prototype,ep=O.Symbol,tp=ep&&ep.prototype,np=O.TypeError,op=O.QObject,rp=oe("JSON","stringify"),ap=Ye.f,sp=nt.f,ip=di.f,cp=F.f,up=K([].push),lp=Se("symbols"),dp=Se("op-symbols"),pp=Se("string-to-symbol-registry"),gp=Se("symbol-to-string-registry"),_p=Se("wks"),hp=!op||!op.prototype||!op.prototype.findChild,fp=k&&L((function(){return 7!=bn(sp({},"a",{get:function(){return sp(this,"a",{value:7}).a}})).a}))?function(e,t,n){var o=ap(Zd,t);o&&delete Zd[t],sp(e,t,n),o&&e!==Zd&&sp(Zd,t,o)}:sp,mp=function(e,t){var n=lp[e]=bn(tp);return Xd(n,{type:"Symbol",tag:e,description:t}),k||(n.description=t),n},Mp=function(e,t,n){e===Zd&&Mp(dp,t,n),Xe(e);var o=Ve(t);return Xe(n),Ne(lp,o)?(n.enumerable?(Ne(e,zd)&&e[zd][o]&&(e[zd][o]=!1),n=bn(n,{enumerable:q(0,!1)})):(Ne(e,zd)||sp(e,zd,q(1,{})),e[zd][o]=!0),fp(e,o,n)):sp(e,o,n)},vp=function(e,t){Xe(e);var n=Z(t),o=Cn(n).concat(Tp(n));return $d(o,(function(t){k&&!b(yp,n,t)||Mp(e,t,n[t])})),e},yp=function(e){var t=Ve(e),n=b(cp,this,t);return!(this===Zd&&Ne(lp,t)&&!Ne(dp,t))&&(!(n||!Ne(this,t)||!Ne(lp,t)||Ne(this,zd)&&this[zd][t])||n)},Ip=function(e,t){var n=Z(e),o=Ve(t);if(n!==Zd||!Ne(lp,o)||Ne(dp,o)){var r=ap(n,o);return!r||!Ne(lp,o)||Ne(n,zd)&&n[zd][o]||(r.enumerable=!0),r}},Ep=function(e){var t=ip(Z(e)),n=[];return $d(t,(function(e){Ne(lp,e)||Ne(gt,e)||up(n,e)})),n},Tp=function(e){var t=e===Zd,n=ip(t?dp:Z(e)),o=[];return $d(n,(function(e){!Ne(lp,e)||t&&!Ne(Zd,e)||up(o,lp[e])})),o};if(de||(tp=(ep=function(){if(re(tp,this))throw np("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?dn(arguments[0]):void 0,t=ke(e),n=function(e){this===Zd&&b(n,dp,e),Ne(this,zd)&&Ne(this[zd],t)&&(this[zd][t]=!1),fp(this,t,q(1,e))};return k&&hp&&fp(Zd,t,{configurable:!0,set:n}),mp(t,e)}).prototype,Dt(tp,"toString",(function(){return Qd(this).tag})),Dt(ep,"withoutSetter",(function(e){return mp(ke(e),e)})),F.f=yp,nt.f=Mp,Nn.f=vp,Ye.f=Ip,Ht.f=di.f=Ep,Kt.f=Tp,jd.f=function(e){return mp(we(e),e)},k&&(sp(tp,"description",{configurable:!0,get:function(){return Qd(this).description}}),Dt(Zd,"propertyIsEnumerable",yp,{unsafe:!0}))),nn({global:!0,wrap:!0,forced:!de,sham:!de},{Symbol:ep}),$d(Cn(_p),(function(e){!function(e){var t=Wd.Symbol||(Wd.Symbol={});Ne(t,e)||Yd(t,e,{value:jd.f(e)})}(e)})),nn({target:"Symbol",stat:!0,forced:!de},{for:function(e){var t=dn(e);if(Ne(pp,t))return pp[t];var n=ep(t);return pp[t]=n,gp[n]=t,n},keyFor:function(e){if(!_e(e))throw np(e+" is not a symbol");if(Ne(gp,e))return gp[e]},useSetter:function(){hp=!0},useSimple:function(){hp=!1}}),nn({target:"Object",stat:!0,forced:!de,sham:!k},{create:function(e,t){return void 0===t?bn(e):vp(bn(e),t)},defineProperty:Mp,defineProperties:vp,getOwnPropertyDescriptor:Ip}),nn({target:"Object",stat:!0,forced:!de},{getOwnPropertyNames:Ep,getOwnPropertySymbols:Tp}),nn({target:"Object",stat:!0,forced:L((function(){Kt.f(1)}))},{getOwnPropertySymbols:function(e){return Kt.f(De(e))}}),rp){var Sp=!de||L((function(){var e=ep();return"[null]"!=rp([e])||"{}"!=rp({a:e})||"{}"!=rp(Object(e))}));nn({target:"JSON",stat:!0,forced:Sp},{stringify:function(e,t,n){var o=_r(arguments),r=t;if((te(t)||void 0!==e)&&!_e(e))return Fn(t)||(t=function(e,t){if(ee(r)&&(t=b(r,this,e,t)),!_e(t))return t}),o[1]=t,Es(rp,null,o)}})}if(!tp[Jd]){var Ap=tp.valueOf;Dt(tp,Jd,(function(e){return b(Ap,this)}))}zo(ep,"Symbol"),gt[zd]=!0;var Dp=nt.f,Cp=O.Symbol,Np=Cp&&Cp.prototype;if(k&&ee(Cp)&&(!("description"in Np)||void 0!==Cp().description)){var Rp={},Op=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:dn(arguments[0]),t=re(Np,this)?new Cp(e):void 0===e?Cp():Cp(e);return""===e&&(Rp[t]=!0),t};Yt(Op,Cp),Op.prototype=Np,Np.constructor=Op;var Lp="Symbol(test)"==String(Cp("test")),kp=K(Np.toString),Gp=K(Np.valueOf),Pp=/^Symbol\((.*)\)[^)]+$/,bp=K("".replace),Up=K("".slice);Dp(Np,"description",{configurable:!0,get:function(){var e=Gp(this),t=kp(e);if(Ne(Rp,e))return"";var n=Lp?Up(t,7,-1):bp(t,Pp,"$1");return""===n?void 0:n}}),nn({global:!0,forced:!0},{Symbol:Op})}var wp={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},Fp={NOT_START:"notStart",PENDING:"pengding",RESOLVED:"resolved",REJECTED:"rejected"},qp=function(e){return!!e&&(!!(Sd(e)||Ad(e)||Dd(e))||(console.warn("非法的会话 ID:".concat(e,"。会话 ID 组成方式C2C + userID单聊GROUP + groupID群聊@TIM#SYSTEM系统通知会话")),!1))},xp="请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#",Vp=function(e){return e.param?"".concat(e.api," ").concat(e.param," ").concat(e.desc,"。").concat(xp).concat(e.api):"".concat(e.api," ").concat(e.desc,"。").concat(xp).concat(e.api)},Bp={type:"String",required:!0},Hp={type:"Array",required:!0},Kp={type:"Object",required:!0},jp={login:{userID:Bp,userSig:Bp},addToBlacklist:{userIDList:Hp},on:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Vp({api:"on",param:"eventName",desc:"类型必须为 String且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Vp({api:"on",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("on 接口的 handler 参数推荐使用具名函数。具名函数可以使用 off 接口取消订阅,匿名函数无法取消订阅。"),!0)}}],once:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Vp({api:"once",param:"eventName",desc:"类型必须为 String且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Vp({api:"once",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("once 接口的 handler 参数推荐使用具名函数。"),!0)}}],off:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(Vp({api:"off",param:"eventName",desc:"类型必须为 String且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(Vp({api:"off",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("off 接口无法为匿名函数取消监听事件。"),!0)}}],sendMessage:[t({name:"message"},Kp)],getMessageList:{conversationID:t(t({},Bp),{},{validator:function(e){return qp(e)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e){return!(!ed(e)&&!/^[1-9][0-9]*$/.test(e))||(console.warn(Vp({api:"getMessageList",param:"count",desc:"必须为正整数"})),!1)}}},getMessageListHopping:{conversationID:t(t({},Bp),{},{validator:function(e){return qp(e)}}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e){return!(!ed(e)&&0!==e&&1!==e)||(console.warn(Vp({api:"getMessageListHopping",param:"direction",desc:"必须传 0 或 1"})),!1)}},count:{type:"Number",validator:function(e){return!(!ed(e)&&!/^[1-9][0-9]*$/.test(e))||(console.warn(Vp({api:"getMessageListHopping",param:"count",desc:"必须为正整数"})),!1)}}},setMessageRead:{conversationID:t(t({},Bp),{},{validator:function(e){return qp(e)}})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e){return!e||-1!==[gr.READ_ALL_C2C_MSG,gr.READ_ALL_GROUP_MSG,gr.READ_ALL_MSG].indexOf(e)||(console.warn(Vp({api:"setAllMessageRead",param:"scope",desc:"取值必须为 TIM.TYPES.READ_ALL_C2C_MSG, TIM.TYPES.READ_ALL_GROUP_MSG 或 TIM.TYPES.READ_ALL_MSG"})),!1)}}},getConversationProfile:[t(t({name:"conversationID"},Bp),{},{validator:function(e){return qp(e)}})],deleteConversation:[t(t({name:"conversationID"},Bp),{},{validator:function(e){return qp(e)}})],pinConversation:{conversationID:t(t({},Bp),{},{validator:function(e){return qp(e)}}),isPinned:t({},{type:"Boolean",required:!0})},getConversationList:[{name:"options",type:"Array",validator:function(e){return!!ed(e)||(0!==e.length||(console.warn(Vp({api:"getConversationList",desc:"获取指定会话时不能传入空数组"})),!1))}}],getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Bp,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Hp},createGroup:{name:Bp},joinGroup:{groupID:Bp,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Bp)],handleApplication:{message:Kp,handleAction:Bp,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Bp,newOwnerID:Bp},updateGroupProfile:{groupID:Bp,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Bp)],searchGroupByID:[t({name:"groupID"},Bp)],initGroupAttributes:{groupID:Bp,groupAttributes:t(t({},Kp),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!Jl(e[n]))return console.warn(Vp({api:"initGroupAttributes",desc:"群属性 value 必须是字符串"})),t=!1})),t}})},setGroupAttributes:{groupID:Bp,groupAttributes:t(t({},Kp),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!Jl(e[n]))return console.warn(Vp({api:"setGroupAttributes",desc:"群属性 value 必须是字符串"})),t=!1})),t}})},deleteGroupAttributes:{groupID:Bp,keyList:{type:"Array",validator:function(e){if(ed(e))return console.warn(Vp({api:"deleteGroupAttributes",desc:"缺少必填参数keyList"})),!1;if(!Zl(e))return!1;if(!Bd(e)){var t=!0;return e.forEach((function(e){if(!Jl(e))return console.warn(Vp({api:"deleteGroupAttributes",desc:"群属性 key 必须是字符串"})),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Bp,keyList:{type:"Array",validator:function(e){if(ed(e))return console.warn(Vp({api:"getGroupAttributes",desc:"缺少必填参数keyList"})),!1;if(!Zl(e))return!1;if(!Bd(e)){var t=!0;return e.forEach((function(e){if(!Jl(e))return console.warn(Vp({api:"getGroupAttributes",desc:"群属性 key 必须是字符串"})),t=!1})),t}return!0}}},getGroupMemberList:{groupID:Bp,count:{type:"Number"}},getGroupMemberProfile:{groupID:Bp,userIDList:Hp,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Bp,userIDList:Hp},setGroupMemberRole:{groupID:Bp,userID:Bp,role:Bp},setGroupMemberMuteTime:{groupID:Bp,userID:Bp,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Bp,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return Jl(e)?(e.length,!0):(console.warn(Vp({api:"setGroupMemberNameCard",param:"nameCard",desc:"类型必须为 String"})),!1)}}},setGroupMemberCustomField:{groupID:Bp,userID:{type:"String"},memberCustomField:Hp},deleteGroupMember:{groupID:Bp},createTextMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return Ql(e)?Jl(e.text)?0!==e.text.length||(console.warn(Vp({api:"createTextMessage",desc:"消息内容不能为空"})),!1):(console.warn(Vp({api:"createTextMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Vp({api:"createTextMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createTextAtMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return Ql(e)?Jl(e.text)?0===e.text.length?(console.warn(Vp({api:"createTextAtMessage",desc:"消息内容不能为空"})),!1):!(e.atUserList&&!Zl(e.atUserList))||(console.warn(Vp({api:"createTextAtMessage",desc:"payload.atUserList 类型必须为数组"})),!1):(console.warn(Vp({api:"createTextAtMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(Vp({api:"createTextAtMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createCustomMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return Ql(e)?e.data&&!Jl(e.data)?(console.warn(Vp({api:"createCustomMessage",param:"payload.data",desc:"类型必须为 String"})),!1):e.description&&!Jl(e.description)?(console.warn(Vp({api:"createCustomMessage",param:"payload.description",desc:"类型必须为 String"})),!1):!(e.extension&&!Jl(e.extension))||(console.warn(Vp({api:"createCustomMessage",param:"payload.extension",desc:"类型必须为 String"})),!1):(console.warn(Vp({api:"createCustomMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createImageMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){if(!Ql(e))return console.warn(Vp({api:"createImageMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(ed(e.file))return console.warn(Vp({api:"createImageMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ju){if(!(e.file instanceof HTMLInputElement||$l(e.file)))return Ql(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Vp({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Vp({api:"createImageMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Vp({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return ed(e)&&console.warn(Vp({api:"createImageMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}})},createAudioMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return!!Ql(e)||(console.warn(Vp({api:"createAudioMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return ed(e)&&console.warn(Vp({api:"createAudioMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createVideoMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){if(!Ql(e))return console.warn(Vp({api:"createVideoMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(ed(e.file))return console.warn(Vp({api:"createVideoMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ju){if(!(e.file instanceof HTMLInputElement||$l(e.file)))return Ql(e.file)&&"undefined"!=typeof uni?!!$l(e.file.tempFile)||(console.warn(Vp({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Vp({api:"createVideoMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Vp({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return ed(e)&&console.warn(Vp({api:"createVideoMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createFaceMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return Ql(e)?zl(e.index)?!!Jl(e.data)||(console.warn(Vp({api:"createFaceMessage",param:"payload.data",desc:"类型必须为 String"})),!1):(console.warn(Vp({api:"createFaceMessage",param:"payload.index",desc:"类型必须为 Number"})),!1):(console.warn(Vp({api:"createFaceMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createFileMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){if(!Ql(e))return console.warn(Vp({api:"createFileMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(ed(e.file))return console.warn(Vp({api:"createFileMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(ju){if(!(e.file instanceof HTMLInputElement||$l(e.file)))return Ql(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(console.warn(Vp({api:"createFileMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1):(console.warn(Vp({api:"createFileMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(Vp({api:"createFileMessage",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return ed(e)&&console.warn(Vp({api:"createFileMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createLocationMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){return Ql(e)?Jl(e.description)?zl(e.longitude)?!!zl(e.latitude)||(console.warn(Vp({api:"createLocationMessage",param:"payload.latitude",desc:"类型必须为 Number"})),!1):(console.warn(Vp({api:"createLocationMessage",param:"payload.longitude",desc:"类型必须为 Number"})),!1):(console.warn(Vp({api:"createLocationMessage",param:"payload.description",desc:"类型必须为 String"})),!1):(console.warn(Vp({api:"createLocationMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createMergerMessage:{to:Bp,conversationType:Bp,payload:t(t({},Kp),{},{validator:function(e){if(Bd(e.messageList))return console.warn(Vp({api:"createMergerMessage",desc:"不能为空数组"})),!1;if(Bd(e.compatibleText))return console.warn(Vp({api:"createMergerMessage",desc:"类型必须为 String且不能为空"})),!1;var t=!1;return e.messageList.forEach((function(e){e.status===wp.FAIL&&(t=!0)})),!t||(console.warn(Vp({api:"createMergerMessage",desc:"不支持合并已发送失败的消息"})),!1)}})},revokeMessage:[t(t({name:"message"},Kp),{},{validator:function(e){return Bd(e)?(console.warn(Vp({api:"revokeMessage",desc:"请传入消息Message实例"})),!1):e.conversationType===gr.CONV_SYSTEM?(console.warn(Vp({api:"revokeMessage",desc:"不能撤回系统会话消息,只能撤回单聊消息或群消息"})),!1):!0!==e.isRevoked||(console.warn(Vp({api:"revokeMessage",desc:"消息已经被撤回,请勿重复操作"})),!1)}})],deleteMessage:[t(t({name:"messageList"},Hp),{},{validator:function(e){return!Bd(e)||(console.warn(Vp({api:"deleteMessage",param:"messageList",desc:"不能为空数组"})),!1)}})],modifyMessage:[t(t({name:"message"},Kp),{},{validator:function(e){return Bd(e)?(console.warn(Vp({api:"modifyMessage",desc:"请传入消息Message实例"})),!1):e.conversationType===gr.CONV_SYSTEM?(console.warn(Vp({api:"modifyMessage",desc:"不支持修改系统会话消息,只能修改单聊消息或群消息"})),!1):!0!==e._onlineOnlyFlag||(console.warn(Vp({api:"modifyMessage",desc:"不支持修改在线消息"})),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return Zl(e)?(0===e.length&&console.warn(Vp({api:"getUserProfile",param:"userIDList",desc:"不能为空数组"})),!0):(console.warn(Vp({api:"getUserProfile",param:"userIDList",desc:"必须为数组"})),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!ed(e)||(!!Zl(e)||(console.warn(Vp({api:"updateMyProfile",param:"profileCustomField",desc:"必须为数组"})),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!Jl(e)||(console.warn(Vp({api:"setSelfStatus",param:"customStatus",desc:Bp})),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return Zl(e)?0!==e.length||(console.warn(Vp({api:"getUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Vp({api:"getUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return Zl(e)?0!==e.length||(console.warn(Vp({api:"subscribeUserStatus",param:"userIDList",desc:"不能为空数组"})),!1):(console.warn(Vp({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!Zl(e)||(console.warn(Vp({api:"subscribeUserStatus",param:"userIDList",desc:"必须为数组"})),!1))}}},addFriend:{to:Bp,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(console.warn(Vp({api:"addFriend",desc:"加好友来源字段的关键字长度不得超过8字节"})),!1):(console.warn(Vp({api:"addFriend",desc:"加好友来源字段的前缀必须是AddSource_Type_"})),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(Jl(e)&&e.length>96)||(console.warn(Vp({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}}},deleteFriend:{userIDList:Hp},checkFriend:{userIDList:Hp},getFriendProfile:{userIDList:Hp},updateFriend:{userID:Bp,remark:{type:"String",required:!1,validator:function(e){return!(Jl(e)&&e.length>96)||(console.warn(Vp({api:"updateFriend",desc:" 备注长度最长不得超过 96 个字节"})),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!Zl(e))return console.warn(Vp({api:"updateFriend",param:"friendCustomField",desc:"必须为数组"})),!1;var t=!0;return e.forEach((function(e){return Jl(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?Jl(e.value)?e.value.length>8?(console.warn(Vp({api:"updateFriend",desc:"好友自定义字段的关键字长度不得超过8字节"})),t=!1):void 0:(console.warn(Vp({api:"updateFriend",desc:"类型必须为 String"})),t=!1):(console.warn(Vp({api:"updateFriend",desc:"好友自定义字段的前缀必须是 Tag_SNS_Custom"})),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Bp},refuseFriendApplication:{userID:Bp},deleteFriendApplication:{userID:Bp},createFriendGroup:{name:Bp},deleteFriendGroup:{name:Bp},addToFriendGroup:{name:Bp,userIDList:Hp},removeFromFriendGroup:{name:Bp,userIDList:Hp},renameFriendGroup:{oldName:Bp,newName:Bp},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return Zl(e)?0!==e.length||(console.warn(Vp({api:"sendMessageReadReceipt",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Vp({api:"sendMessageReadReceipt",param:"messageList",desc:"必须为数组"})),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return Zl(e)?0!==e.length||(console.warn(Vp({api:"getMessageReadReceiptList",param:"messageList",desc:"不能为空数组"})),!1):(console.warn(Vp({api:"getMessageReadReceiptList",param:"messageList",desc:"必须为数组"})),!1)}}],createTopicInCommunity:{groupID:Bp,topicName:Bp},deleteTopicFromCommunity:{groupID:Bp,topicIDList:{type:"Array",validator:function(e){return!e||(!!Zl(e)||(console.warn(Vp({api:"deleteTopicFromCommunity",param:"topicIDList",desc:"必须为数组"})),!1))}}},updateTopicProfile:{groupID:Bp,topicID:Bp},getTopicList:{groupID:Bp,topicIDList:{type:"Array",validator:function(e){return!e||(!!Zl(e)||(console.warn(Vp({api:"getTopicList",param:"topicIDList",desc:"必须为数组"})),!1))}}}},Wp={login:"login",logout:"logout",on:"on",once:"once",off:"off",setLogLevel:"setLogLevel",registerPlugin:"registerPlugin",destroy:"destroy",createTextMessage:"createTextMessage",createTextAtMessage:"createTextAtMessage",createImageMessage:"createImageMessage",createAudioMessage:"createAudioMessage",createVideoMessage:"createVideoMessage",createCustomMessage:"createCustomMessage",createFaceMessage:"createFaceMessage",createFileMessage:"createFileMessage",createLocationMessage:"createLocationMessage",createMergerMessage:"createMergerMessage",downloadMergerMessage:"downloadMergerMessage",createForwardMessage:"createForwardMessage",sendMessage:"sendMessage",resendMessage:"resendMessage",revokeMessage:"revokeMessage",deleteMessage:"deleteMessage",modifyMessage:"modifyMessage",sendMessageReadReceipt:"sendMessageReadReceipt",getGroupMessageReadMemberList:"getGroupMessageReadMemberList",getMessageReadReceiptList:"getMessageReadReceiptList",getMessageList:"getMessageList",findMessage:"findMessage",getMessageListHopping:"getMessageListHopping",setMessageRead:"setMessageRead",setAllMessageRead:"setAllMessageRead",getConversationList:"getConversationList",getConversationProfile:"getConversationProfile",deleteConversation:"deleteConversation",pinConversation:"pinConversation",getGroupList:"getGroupList",getGroupProfile:"getGroupProfile",createGroup:"createGroup",joinGroup:"joinGroup",updateGroupProfile:"updateGroupProfile",quitGroup:"quitGroup",dismissGroup:"dismissGroup",changeGroupOwner:"changeGroupOwner",searchGroupByID:"searchGroupByID",setMessageRemindType:"setMessageRemindType",handleGroupApplication:"handleGroupApplication",initGroupAttributes:"initGroupAttributes",setGroupAttributes:"setGroupAttributes",deleteGroupAttributes:"deleteGroupAttributes",getGroupAttributes:"getGroupAttributes",getJoinedCommunityList:"getJoinedCommunityList",createTopicInCommunity:"createTopicInCommunity",deleteTopicFromCommunity:"deleteTopicFromCommunity",updateTopicProfile:"updateTopicProfile",getTopicList:"getTopicList",getGroupMemberProfile:"getGroupMemberProfile",getGroupMemberList:"getGroupMemberList",addGroupMember:"addGroupMember",deleteGroupMember:"deleteGroupMember",setGroupMemberNameCard:"setGroupMemberNameCard",setGroupMemberMuteTime:"setGroupMemberMuteTime",setGroupMemberRole:"setGroupMemberRole",setGroupMemberCustomField:"setGroupMemberCustomField",getGroupOnlineMemberCount:"getGroupOnlineMemberCount",getMyProfile:"getMyProfile",getUserProfile:"getUserProfile",updateMyProfile:"updateMyProfile",setSelfStatus:"setSelfStatus",getUserStatus:"getUserStatus",subscribeUserStatus:"subscribeUserStatus",unsubscribeUserStatus:"unsubscribeUserStatus",getBlacklist:"getBlacklist",addToBlacklist:"addToBlacklist",removeFromBlacklist:"removeFromBlacklist",getFriendList:"getFriendList",addFriend:"addFriend",deleteFriend:"deleteFriend",checkFriend:"checkFriend",updateFriend:"updateFriend",getFriendProfile:"getFriendProfile",getFriendApplicationList:"getFriendApplicationList",refuseFriendApplication:"refuseFriendApplication",deleteFriendApplication:"deleteFriendApplication",acceptFriendApplication:"acceptFriendApplication",setFriendApplicationRead:"setFriendApplicationRead",getFriendGroupList:"getFriendGroupList",createFriendGroup:"createFriendGroup",renameFriendGroup:"renameFriendGroup",deleteFriendGroup:"deleteFriendGroup",addToFriendGroup:"addToFriendGroup",removeFromFriendGroup:"removeFromFriendGroup",callExperimentalAPI:"callExperimentalAPI"},Yp=!!Ci&&L((function(){Ci.prototype.finally.call({then:function(){}},(function(){}))}));if(nn({target:"Promise",proto:!0,real:!0,forced:Yp},{finally:function(e){var t=xi(this,oe("Promise")),n=ee(e);return this.then(n?function(n){return Dc(t,e()).then((function(){return n}))}:e,n?function(n){return Dc(t,e()).then((function(){throw n}))}:e)}}),ee(Ci)){var $p=oe("Promise").prototype.finally;Ci.prototype.finally!==$p&&Dt(Ci.prototype,"finally",$p,{unsafe:!0})}var zp=/MSIE .\./.test(ae),Jp=O.Function,Xp=function(e){return function(t,n){var o=Bi(arguments.length,1)>2,r=ee(t)?t:Jp(t),a=o?_r(arguments,2):void 0;return e(o?function(){Es(r,this,a)}:r,n)}};nn({global:!0,bind:!0,forced:zp},{setTimeout:Xp(O.setTimeout),setInterval:Xp(O.setInterval)});var Qp=Zn.filter,Zp=Er("filter");nn({target:"Array",proto:!0,forced:!Zp},{filter:function(e){return Qp(this,e,arguments.length>1?arguments[1]:void 0)}});var eg,tg="sign",ng="message",og="user",rg="c2c",ag="group",sg="sns",ig="groupMember",cg="Topic",ug="conversation",lg="context",dg="storage",pg="eventStat",gg="netMonitor",_g="bigDataChannel",hg="upload",fg="plugin",mg="syncUnreadMessage",Mg="session",vg="channel",yg="message_loss_detection",Ig="cloudControl",Eg="workerTimer",Tg="pullGroupMessage",Sg="qualityStat",Ag="commercialConfig",Dg=function(){function e(t){o(this,e),this._moduleManager=t,this._className=""}return a(e,[{key:"isLoggedIn",value:function(){return this._moduleManager.getModule(lg).isLoggedIn()}},{key:"isOversea",value:function(){return this._moduleManager.getModule(lg).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._moduleManager.getModule(lg).isPrivateNetWork()}},{key:"getMyUserID",value:function(){return this._moduleManager.getModule(lg).getUserID()}},{key:"getMyTinyID",value:function(){return this._moduleManager.getModule(lg).getTinyID()}},{key:"getModule",value:function(e){return this._moduleManager.getModule(e)}},{key:"getPlatform",value:function(){return Yu}},{key:"getNetworkType",value:function(){return this._moduleManager.getModule(gg).getNetworkType()}},{key:"probeNetwork",value:function(e){return this.isPrivateNetWork()?Promise.resolve([!0,this.getNetworkType()]):this._moduleManager.getModule(gg).probe(e)}},{key:"getCloudConfig",value:function(e){return this._moduleManager.getModule(Ig).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._moduleManager.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._moduleManager.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._moduleManager.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._moduleManager.getModule(lg).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!Bd(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(pr.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return Bd(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._moduleManager.getModule(Mg).request(e)}},{key:"canIUse",value:function(e){return this._moduleManager.getModule(Ag).hasPurchasedFeature(e)}}]),e}(),Cg="wslogin",Ng="wslogout",Rg="wshello",Og="KickOther",Lg="getmsg",kg="authkey",Gg="sendmsg",Pg="send_group_msg",bg="portrait_get_all",Ug="portrait_set",wg="black_list_get",Fg="black_list_add",qg="black_list_delete",xg="friend_get",Vg="friend_get_list",Bg="friend_check",Hg="friend_delete",Kg="friend_add",jg="friend_update",Wg="friend_response",Yg="pendency_get",$g="pendency_delete",zg="pendency_report",Jg="group_get",Xg="group_add",Qg="group_delete",Zg="group_update",e_="msgwithdraw",t_="msgreaded",n_="set_c2c_peer_mute_notifications",o_="get_c2c_peer_mute_notifications",r_="getroammsg",a_="get_peer_read_time",s_="delete_c2c_msg_ramble",i_="modify_c2c_msg",c_="page_get",u_="get",l_="delete",d_="top",p_="deletemsg",g_="get_joined_group_list",__="get_group_self_member_info",h_="create_group",f_="destroy_group",m_="modify_group_base_info",M_="apply_join_group",v_="apply_join_group_noauth",y_="quit_group",I_="get_group_public_info",E_="change_group_owner",T_="handle_apply_join_group",S_="handle_invite_join_group",A_="group_msg_recall",D_="msg_read_report",C_="read_all_unread_msg",N_="group_msg_get",R_="get_group_msg_receipt",O_="group_msg_receipt",L_="c2c_msg_read_receipt",k_="get_group_msg_receipt_detail",G_="get_pendency",P_="deletemsg",b_="get_msg",U_="get_msg_noauth",w_="get_online_member_num",F_="delete_group_ramble_msg_by_seq",q_="modify_group_msg",x_="set_group_attr",V_="modify_group_attr",B_="delete_group_attr",H_="clear_group_attr",K_="get_group_attr",j_="get_group_member_info",W_="get_specified_group_member_info",Y_="add_group_member",$_="delete_group_member",z_="modify_group_member_info",J_="cos",X_="pre_sig",Q_="video_cover",Z_="tim_web_report_v2",eh="alive",th="msg_push",nh="multi_msg_push_ws",oh="ws_msg_push_ack",rh="stat_forceoffline",ah="save_relay_json_msg",sh="get_relay_json_msg",ih="fetch_config",ch="push_configv2",uh="fetch_imsdk_purchase_bitsv2",lh="push_imsdk_purchase_bitsv2",dh="notify2",ph="create_topic",gh="destroy_topic",_h="modify_topic",hh="get_topic",fh="ws_set_custom_status",mh="ws_get_user_status",Mh="ws_status_subscribe",vh="ws_status_unsubscribe",yh={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS:2103,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,MESSAGE_CONTROL_INFO_FAIL:2113,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_Work:2622,MEMBER_NOT_IN_GROUP:2623,CANNOT_USE_GRP_ATTR_NOT_AVCHATROOM:2641,CANNOT_USE_GRP_ATTR_AVCHATROOM_UNJOIN:2642,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,CANNOT_KICK_MEMBER_IN_AVCHATROOM:2680,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,ADD_BLACKLIST_INVALID_PARAM:2740,DEL_BLACKLIST_INVALID_PARAM:2741,CANNOT_ADD_SELF_TO_BLACKLIST:2742,ADD_FRIEND_INVALID_PARAM:2760,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NETWORK_BASE_OPTIONS_NO_URL:2802,NETWORK_UNDEFINED_SERVER_NAME:2803,NETWORK_PACKAGE_UNDEFINED:2804,NO_NETWORK:2805,CONVERTOR_IRREGULAR_PARAMS:2900,NOTICE_RUNLOOP_UNEXPECTED_CONDITION:2901,NOTICE_RUNLOOP_OFFSET_LOST:2902,UNCAUGHT_ERROR:2903,GET_LONGPOLL_ID_FAILED:2904,INVALID_OPERATION:2905,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,LONG_POLL_KICK_OUT:91101,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,LONG_POLL_API_PARAM_ERROR:90001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},Ih={NO_SDKAPPID:"无 SDKAppID",NO_ACCOUNT_TYPE:"无 accountType",NO_IDENTIFIER:"无 userID",NO_USERSIG:"无 userSig",NO_TINYID:"无 tinyID",NO_A2KEY:"无 a2key",USER_NOT_LOGGED_IN:"用户未登录",REPEAT_LOGIN:"重复登录",COS_UNDETECTED:"未检测到 COS 上传插件",COS_GET_SIG_FAIL:"获取 COS 预签名 URL 失败",MESSAGE_SEND_FAIL:"消息发送失败",MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS:"MessageController.constructor() 需要参数 options",MESSAGE_SEND_NEED_MESSAGE_INSTANCE:"需要 Message 的实例",MESSAGE_SEND_INVALID_CONVERSATION_TYPE:'Message.conversationType 只能为 "C2C" 或 "GROUP"',MESSAGE_FILE_IS_EMPTY:"无法发送空文件",MESSAGE_ONPROGRESS_FUNCTION_ERROR:"回调函数运行时遇到错误,请检查接入侧代码",MESSAGE_REVOKE_FAIL:"消息撤回失败",MESSAGE_DELETE_FAIL:"消息删除失败",MESSAGE_UNREAD_ALL_FAIL:"设置所有未读消息为已读处理失败",MESSAGE_CONTROL_INFO_FAIL:"社群不支持消息发送控制选项",READ_RECEIPT_MESSAGE_LIST_EMPTY:"消息列表中没有需要发送已读回执的消息",MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:"不能在支持话题的群组中发消息,请检查群组 isSupportTopic 属性",CANNOT_DELETE_GROUP_SYSTEM_NOTICE:"不支持删除群系统通知",MESSAGE_IMAGE_SELECT_FILE_FIRST:"请先选择一个图片",MESSAGE_IMAGE_TYPES_LIMIT:"只允许上传 jpg png jpeg gif bmp image webp 格式的图片",MESSAGE_IMAGE_SIZE_LIMIT:"图片大小超过20M无法发送",MESSAGE_AUDIO_UPLOAD_FAIL:"语音上传失败",MESSAGE_AUDIO_SIZE_LIMIT:"语音大小大于20M无法发送",MESSAGE_VIDEO_UPLOAD_FAIL:"视频上传失败",MESSAGE_VIDEO_SIZE_LIMIT:"视频大小超过100M无法发送",MESSAGE_VIDEO_TYPES_LIMIT:"只允许上传 mp4 格式的视频",MESSAGE_FILE_UPLOAD_FAIL:"文件上传失败",MESSAGE_FILE_SELECT_FILE_FIRST:"请先选择一个文件",MESSAGE_FILE_SIZE_LIMIT:"文件大小超过100M无法发送 ",MESSAGE_FILE_URL_IS_EMPTY:"缺少必要的参数文件 URL",MESSAGE_MERGER_TYPE_INVALID:"非合并消息",MESSAGE_MERGER_KEY_INVALID:"合并消息的 messageKey 无效",MESSAGE_MERGER_DOWNLOAD_FAIL:"下载合并消息失败",MESSAGE_FORWARD_TYPE_INVALID:"选择的消息类型(如群提示消息)不可以转发",MESSAGE_MODIFY_CONFLICT:"修改消息时发生冲突",MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:"直播群不支持修改消息",CONVERSATION_NOT_FOUND:"没有找到相应的会话,请检查传入参数",USER_OR_GROUP_NOT_FOUND:"没有找到相应的用户或群组,请检查传入参数",CONVERSATION_UN_RECORDED_TYPE:"未记录的会话类型",ILLEGAL_GROUP_TYPE:"非法的群类型,请检查传入参数",CANNOT_JOIN_WORK:"不能加入 Work 类型的群组",ILLEGAL_GROUP_ID:"群组 ID 非法,非 Community 类型群组不能以 @TGS#_ 为前缀Community 类型群组必须以 @TGS#_ 为前缀且不能包含 @TOPIC#_ 字符串",CANNOT_CHANGE_OWNER_IN_AVCHATROOM:"AVChatRoom 类型的群组不能转让群主",CANNOT_CHANGE_OWNER_TO_SELF:"不能把群主转让给自己",CANNOT_DISMISS_WORK:"不能解散 Work 类型的群组",MEMBER_NOT_IN_GROUP:"用户不在该群组内",JOIN_GROUP_FAIL:"加群失败,请检查传入参数或重试",CANNOT_ADD_MEMBER_IN_AVCHATROOM:"AVChatRoom 类型的群不支持邀请群成员",CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:"非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群",CANNOT_KICK_MEMBER_IN_AVCHATROOM:"不能在 AVChatRoom 类型的群组踢人",NOT_OWNER:"你不是群主,只有群主才有权限操作",CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:"不能在 Work / AVChatRoom 类型的群中设置群成员身份",INVALID_MEMBER_ROLE:"不合法的群成员身份,请检查传入参数",CANNOT_SET_SELF_MEMBER_ROLE:"不能设置自己的群成员身份,请检查传入参数",CANNOT_MUTE_SELF:"不能将自己禁言,请检查传入参数",NOT_MY_FRIEND:"非好友关系",ALREADY_MY_FRIEND:"已经是好友关系",FRIEND_GROUP_EXISTED:"好友分组已存在",FRIEND_GROUP_NOT_EXIST:"好友分组不存在",FRIEND_APPLICATION_NOT_EXIST:"好友申请不存在",UPDATE_PROFILE_INVALID_PARAM:"传入 updateMyProfile 接口的参数无效",UPDATE_PROFILE_NO_KEY:"updateMyProfile 无标配资料字段或自定义资料字段",ADD_BLACKLIST_INVALID_PARAM:"传入 addToBlacklist 接口的参数无效",DEL_BLACKLIST_INVALID_PARAM:"传入 removeFromBlacklist 接口的参数无效",CANNOT_ADD_SELF_TO_BLACKLIST:"不能拉黑自己",ADD_FRIEND_INVALID_PARAM:"传入 addFriend 接口的参数无效",NETWORK_ERROR:"网络错误",NETWORK_TIMEOUT:"请求超时",NETWORK_BASE_OPTIONS_NO_URL:"网络层初始化错误,缺少 URL 参数",NETWORK_UNDEFINED_SERVER_NAME:"打包错误,未定义的 serverName",NETWORK_PACKAGE_UNDEFINED:"未定义的 packageConfig",NO_NETWORK:"未连接到网络",CONVERTOR_IRREGULAR_PARAMS:"不规范的参数名称",NOTICE_RUNLOOP_UNEXPECTED_CONDITION:"意料外的通知条件",NOTICE_RUNLOOP_OFFSET_LOST:"_syncOffset 丢失",GET_LONGPOLL_ID_FAILED:"获取 longpolling id 失败",UNCAUGHT_ERROR:"未经明确定义的错误",INVALID_OPERATION:"无效操作,如调用了未定义或者未实现的方法等",CANNOT_FIND_PROTOCOL:"无法找到协议",CANNOT_FIND_MODULE:"无法找到模块请参考https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-03-sns.html",SDK_IS_NOT_READY:"接口需要 SDK 处于 ready 状态后才能调用",LOGGING_IN:"用户正在登录中",LOGIN_FAILED:"用户登录失败",KICKED_OUT_MULT_DEVICE:"用户多终端登录被踢出",KICKED_OUT_MULT_ACCOUNT:"用户多实例登录被踢出",KICKED_OUT_USERSIG_EXPIRED:"用户 userSig 过期被踢出",LOGGED_OUT:"用户已登出",KICKED_OUT_REST_API:"用户被 REST API - kick 接口: https://cloud.tencent.com/document/product/269/3853 踢出",OVER_FREQUENCY_LIMIT:"超出 SDK 频率控制",LONG_POLL_KICK_OUT:"检测到多个 web 实例登录,消息通道下线",OPEN_SERVICE_OVERLOAD_ERROR:"后台服务正忙,请稍后再试",MESSAGE_A2KEY_EXPIRED:"消息错误码UserSig 或 A2 失效。",ACCOUNT_A2KEY_EXPIRED:"帐号错误码UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",LONG_POLL_API_PARAM_ERROR:"longPoll API parameters error",ILLEGAL_TOPIC_ID:"topicID 非法",CANNOT_USE_COMMERCIAL_ABILITY:"套餐包不支持该接口的使用,请升级到旗舰版套餐"},Eh="networkRTT",Th="messageE2EDelay",Sh="sendMessageC2C",Ah="sendMessageGroup",Dh="sendMessageGroupAV",Ch="sendMessageRichMedia",Nh="cosUpload",Rh="messageReceivedGroup",Oh="messageReceivedGroupAVPush",Lh="messageReceivedGroupAVPull",kh=(s(eg={},Eh,2),s(eg,Th,3),s(eg,Sh,4),s(eg,Ah,5),s(eg,Dh,6),s(eg,Ch,7),s(eg,Rh,8),s(eg,Oh,9),s(eg,Lh,10),s(eg,Nh,11),eg),Gh={info:4,warning:5,error:6},Ph={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},bh={login:4},Uh=function(){function e(t){o(this,e),this.eventType=bh[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Ol()}return a(e,[{key:"updateTimeStamp",value:function(){this.timestamp=Ol()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=Ol();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,n){return e instanceof Error?(this._sentFlag||(this.setNetworkType(n),t?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):(this.setCode(yh.NO_NETWORK),this.setMoreMessage(Ih.NO_NETWORK)),this.setLevel("error")),this):(Ul.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}},{key:"setCode",value:function(e){return ed(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),zl(e)?this.code=e:Ul.warn("SSOLogData.setCode value not a number, please check!",e,n(e))),this}},{key:"setMessage",value:function(e){return ed(e)||this._sentFlag||(zl(e)&&(this.message=e.toString()),Jl(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return ed(e)||this._sentFlag||(this.level=Gh[e]),this}},{key:"setMoreMessage",value:function(e){return Bd(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(ed(e))Ul.warn("SSOLogData.setNetworkType value is undefined, please check!");else{var t=Ph[e.toLowerCase()];ed(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),wh={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",LOGIN:"login",LOGOUT:"logout",KICKED_OUT:"kickedOut",REGISTER_PLUGIN:"registerPlugin",KICK_OTHER:"kickOther",WS_CONNECT:"wsConnect",WS_ON_OPEN:"wsOnOpen",WS_ON_CLOSE:"wsOnClose",WS_ON_ERROR:"wsOnError",NETWORK_CHANGE:"networkChange",GET_COS_AUTH_KEY:"getCosAuthKey",GET_COS_PRE_SIG_URL:"getCosPreSigUrl",GET_SNAPSHOT_INFO:"getSnapshotInfo",UPLOAD:"upload",SEND_MESSAGE:"sendMessage",SEND_MESSAGE_WITH_RECEIPT:"sendMessageWithReceipt",SEND_COMBO_MESSAGE:"sendComboMessage",GET_C2C_ROAMING_MESSAGES:"getC2CRoamingMessages",GET_GROUP_ROAMING_MESSAGES:"getGroupRoamingMessages",GET_C2C_ROAMING_MESSAGES_HOPPING:"getC2CRoamingMessagesHopping",GET_GROUP_ROAMING_MESSAGES_HOPPING:"getGroupRoamingMessagesHopping",GET_READ_RECEIPT:"getReadReceipt",GET_READ_RECEIPT_DETAIL:"getReadReceiptDetail",SEND_READ_RECEIPT:"sendReadReceipt",SEND_C2C_READ_RECEIPT:"sendC2CReadReceipt",REVOKE_MESSAGE:"revokeMessage",DELETE_MESSAGE:"deleteMessage",EDIT_MESSAGE:"modifyMessage",SET_C2C_MESSAGE_READ:"setC2CMessageRead",SET_GROUP_MESSAGE_READ:"setGroupMessageRead",EMPTY_MESSAGE_BODY:"emptyMessageBody",GET_PEER_READ_TIME:"getPeerReadTime",UPLOAD_MERGER_MESSAGE:"uploadMergerMessage",DOWNLOAD_MERGER_MESSAGE:"downloadMergerMessage",JSON_PARSE_ERROR:"jsonParseError",MESSAGE_E2E_DELAY_EXCEPTION:"messageE2EDelayException",GET_CONVERSATION_LIST:"getConversationList",GET_CONVERSATION_PROFILE:"getConversationProfile",DELETE_CONVERSATION:"deleteConversation",PIN_CONVERSATION:"pinConversation",GET_CONVERSATION_LIST_IN_STORAGE:"getConversationListInStorage",SYNC_CONVERSATION_LIST:"syncConversationList",SET_ALL_MESSAGE_READ:"setAllMessageRead",CREATE_GROUP:"createGroup",APPLY_JOIN_GROUP:"applyJoinGroup",QUIT_GROUP:"quitGroup",SEARCH_GROUP_BY_ID:"searchGroupByID",CHANGE_GROUP_OWNER:"changeGroupOwner",HANDLE_GROUP_APPLICATION:"handleGroupApplication",HANDLE_GROUP_INVITATION:"handleGroupInvitation",SET_MESSAGE_REMIND_TYPE:"setMessageRemindType",DISMISS_GROUP:"dismissGroup",UPDATE_GROUP_PROFILE:"updateGroupProfile",GET_GROUP_LIST:"getGroupList",GET_GROUP_PROFILE:"getGroupProfile",GET_GROUP_LIST_IN_STORAGE:"getGroupListInStorage",GET_GROUP_LAST_SEQUENCE:"getGroupLastSequence",GET_GROUP_MISSING_MESSAGE:"getGroupMissingMessage",PAGING_GET_GROUP_LIST:"pagingGetGroupList",PAGING_GET_GROUP_LIST_WITH_TOPIC:"pagingGetGroupListWithTopic",GET_GROUP_SIMPLIFIED_INFO:"getGroupSimplifiedInfo",JOIN_WITHOUT_AUTH:"joinWithoutAuth",INIT_GROUP_ATTRIBUTES:"initGroupAttributes",SET_GROUP_ATTRIBUTES:"setGroupAttributes",DELETE_GROUP_ATTRIBUTES:"deleteGroupAttributes",GET_GROUP_ATTRIBUTES:"getGroupAttributes",GET_GROUP_MEMBER_LIST:"getGroupMemberList",GET_GROUP_MEMBER_PROFILE:"getGroupMemberProfile",ADD_GROUP_MEMBER:"addGroupMember",DELETE_GROUP_MEMBER:"deleteGroupMember",SET_GROUP_MEMBER_MUTE_TIME:"setGroupMemberMuteTime",SET_GROUP_MEMBER_NAME_CARD:"setGroupMemberNameCard",SET_GROUP_MEMBER_ROLE:"setGroupMemberRole",SET_GROUP_MEMBER_CUSTOM_FIELD:"setGroupMemberCustomField",GET_GROUP_ONLINE_MEMBER_COUNT:"getGroupOnlineMemberCount",SYNC_MESSAGE:"syncMessage",LONG_POLLING_AV_ERROR:"longPollingAVError",MESSAGE_LOSS:"messageLoss",MESSAGE_STACKED:"messageStacked",GET_USER_PROFILE:"getUserProfile",UPDATE_MY_PROFILE:"updateMyProfile",GET_BLACKLIST:"getBlacklist",ADD_TO_BLACKLIST:"addToBlacklist",REMOVE_FROM_BLACKLIST:"removeFromBlacklist",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",ADD_FRIEND:"addFriend",CHECK_FRIEND:"checkFriend",DELETE_FRIEND:"removeFromFriendList",GET_FRIEND_PROFILE:"getFriendProfile",GET_FRIEND_LIST:"getFriendList",UPDATE_FRIEND:"updateFriend",GET_FRIEND_APPLICATION_LIST:"getFriendApplicationList",DELETE_FRIEND_APPLICATION:"deleteFriendApplication",ACCEPT_FRIEND_APPLICATION:"acceptFriendApplication",REFUSE_FRIEND_APPLICATION:"refuseFriendApplication",SET_FRIEND_APPLICATION_READ:"setFriendApplicationRead",CREATE_FRIEND_GROUP:"createFriendGroup",DELETE_FRIEND_GROUP:"deleteFriendGroup",RENAME_FRIEND_GROUP:"renameFriendGroup",ADD_TO_FRIEND_GROUP:"addToFriendGroup",REMOVE_FROM_FRIEND_GROUP:"removeFromFriendGroup",GET_FRIEND_GROUP_LIST:"getFriendGroupList",CREATE_TOPIC:"createTopic",DELETE_TOPIC:"deleteTopic",UPDATE_TOPIC_PROFILE:"updateTopicProfile",GET_TOPIC_LIST:"getTopicList",RELAY_GET_TOPIC_LIST:"relayGetTopicList",GET_TOPIC_LAST_SEQUENCE:"getTopicLastSequence",MP_HIDE_TO_SHOW:"mpHideToShow",CALLBACK_FUNCTION_ERROR:"callbackFunctionError",FETCH_CLOUD_CONTROL_CONFIG:"fetchCloudControlConfig",PUSHED_CLOUD_CONTROL_CONFIG:"pushedCloudControlConfig",FETCH_COMMERCIAL_CONFIG:"fetchCommercialConfig",PUSHED_COMMERCIAL_CONFIG:"pushedCommercialConfig",ERROR:"error",LAST_MESSAGE_NOT_EXIST:"lastMessageNotExist"},Fh=F.f,qh=K(Fh),xh=K([].push),Vh=function(e){return function(t){for(var n,o=Z(t),r=Cn(o),a=r.length,s=0,i=[];a>s;)n=r[s++],k&&!qh(o,n)||xh(i,e?[n,o[n]]:o[n]);return i}},Bh={entries:Vh(!0),values:Vh(!1)}.values;nn({target:"Object",stat:!0},{values:function(e){return Bh(e)}});var Hh=function(){function e(t){o(this,e),this.type=gr.MSG_TEXT,this.content={text:t.text||""}}return a(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),Kh=we("iterator"),jh=!L((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,n="";return e.pathname="c%20d",t.forEach((function(e,o){t.delete("b"),n+=o+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[Kh]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),Wh=Object.assign,Yh=Object.defineProperty,$h=K([].concat),zh=!Wh||L((function(){if(k&&1!==Wh({b:1},Wh(Yh({},"a",{enumerable:!0,get:function(){Yh(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol();return e[n]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),7!=Wh({},e)[n]||"abcdefghijklmnopqrst"!=Cn(Wh({},t)).join("")}))?function(e,t){for(var n=De(e),o=arguments.length,r=1,a=Kt.f,s=F.f;o>r;)for(var i,c=J(arguments[r++]),u=a?$h(Cn(c),a(c)):Cn(c),l=u.length,d=0;l>d;)i=u[d++],k&&!b(s,c,i)||(n[i]=c[i]);return n}:Wh,Jh=/[^\0-\u007E]/,Xh=/[.\u3002\uFF0E\uFF61]/g,Qh="Overflow: input needs wider integers to process",Zh=O.RangeError,ef=K(Xh.exec),tf=Math.floor,nf=String.fromCharCode,of=K("".charCodeAt),rf=K([].join),af=K([].push),sf=K("".replace),cf=K("".split),uf=K("".toLowerCase),lf=function(e){return e+22+75*(e<26)},df=function(e,t,n){var o=0;for(e=n?tf(e/700):e>>1,e+=tf(e/t);e>455;)e=tf(e/35),o+=36;return tf(o+36*e/(e+38))},pf=function(e){var t,n,o=[],r=(e=function(e){for(var t=[],n=0,o=e.length;n<o;){var r=of(e,n++);if(r>=55296&&r<=56319&&n<o){var a=of(e,n++);56320==(64512&a)?af(t,((1023&r)<<10)+(1023&a)+65536):(af(t,r),n--)}else af(t,r)}return t}(e)).length,a=128,s=0,i=72;for(t=0;t<e.length;t++)(n=e[t])<128&&af(o,nf(n));var c=o.length,u=c;for(c&&af(o,"-");u<r;){var l=2147483647;for(t=0;t<e.length;t++)(n=e[t])>=a&&n<l&&(l=n);var d=u+1;if(l-a>tf((2147483647-s)/d))throw Zh(Qh);for(s+=(l-a)*d,a=l,t=0;t<e.length;t++){if((n=e[t])<a&&++s>2147483647)throw Zh(Qh);if(n==a){for(var p=s,g=36;;){var _=g<=i?1:g>=i+26?26:g-i;if(p<_)break;var h=p-_,f=36-_;af(o,nf(lf(_+h%f))),p=tf(h/f),g+=36}af(o,nf(lf(p))),i=df(s,d,u==c),s=0,u++}}s++,a++}return rf(o,"")},gf=Math.floor,_f=function(e,t){var n=e.length,o=gf(n/2);return n<8?hf(e,t):ff(e,_f(ci(e,0,o),t),_f(ci(e,o),t),t)},hf=function(e,t){for(var n,o,r=e.length,a=1;a<r;){for(o=a,n=e[a];o&&t(e[o-1],n)>0;)e[o]=e[--o];o!==a++&&(e[o]=n)}return e},ff=function(e,t,n,o){for(var r=t.length,a=n.length,s=0,i=0;s<r||i<a;)e[s+i]=s<r&&i<a?o(t[s],n[i])<=0?t[s++]:n[i++]:s<r?t[s++]:n[i++];return e},mf=_f,Mf=we("iterator"),vf=It.set,yf=It.getterFor("URLSearchParams"),If=It.getterFor("URLSearchParamsIterator"),Ef=oe("fetch"),Tf=oe("Request"),Sf=oe("Headers"),Af=Tf&&Tf.prototype,Df=Sf&&Sf.prototype,Cf=O.RegExp,Nf=O.TypeError,Rf=O.decodeURIComponent,Of=O.encodeURIComponent,Lf=K("".charAt),kf=K([].join),Gf=K([].push),Pf=K("".replace),bf=K([].shift),Uf=K([].splice),wf=K("".split),Ff=K("".slice),qf=/\+/g,xf=Array(4),Vf=function(e){return xf[e-1]||(xf[e-1]=Cf("((?:%[\\da-f]{2}){"+e+"})","gi"))},Bf=function(e){try{return Rf(e)}catch(FS){return e}},Hf=function(e){var t=Pf(e,qf," "),n=4;try{return Rf(t)}catch(FS){for(;n;)t=Pf(t,Vf(n--),Bf);return t}},Kf=/[!'()~]|%20/g,jf={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Wf=function(e){return jf[e]},Yf=function(e){return Pf(Of(e),Kf,Wf)},$f=Qo((function(e,t){vf(this,{type:"URLSearchParamsIterator",iterator:Eo(yf(e).entries),kind:t})}),"Iterator",(function(){var e=If(this),t=e.kind,n=e.iterator.next(),o=n.value;return n.done||(n.value="keys"===t?o.key:"values"===t?o.value:[o.key,o.value]),n}),!0),zf=function(e){this.entries=[],this.url=null,void 0!==e&&(te(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Lf(e,0)?Ff(e,1):e:dn(e)))};zf.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,n,o,r,a,s,i,c=yo(e);if(c)for(n=(t=Eo(e,c)).next;!(o=b(n,t)).done;){if(a=(r=Eo(Xe(o.value))).next,(s=b(a,r)).done||(i=b(a,r)).done||!b(a,r).done)throw Nf("Expected sequence with length 2");Gf(this.entries,{key:dn(s.value),value:dn(i.value)})}else for(var u in e)Ne(e,u)&&Gf(this.entries,{key:u,value:dn(e[u])})},parseQuery:function(e){if(e)for(var t,n,o=wf(e,"&"),r=0;r<o.length;)(t=o[r++]).length&&(n=wf(t,"="),Gf(this.entries,{key:Hf(bf(n)),value:Hf(kf(n,"="))}))},serialize:function(){for(var e,t=this.entries,n=[],o=0;o<t.length;)e=t[o++],Gf(n,Yf(e.key)+"="+Yf(e.value));return kf(n,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Jf=function(){ki(this,Xf);var e=arguments.length>0?arguments[0]:void 0;vf(this,new zf(e))},Xf=Jf.prototype;if(Ni(Xf,{append:function(e,t){Bi(arguments.length,2);var n=yf(this);Gf(n.entries,{key:dn(e),value:dn(t)}),n.updateURL()},delete:function(e){Bi(arguments.length,1);for(var t=yf(this),n=t.entries,o=dn(e),r=0;r<n.length;)n[r].key===o?Uf(n,r,1):r++;t.updateURL()},get:function(e){Bi(arguments.length,1);for(var t=yf(this).entries,n=dn(e),o=0;o<t.length;o++)if(t[o].key===n)return t[o].value;return null},getAll:function(e){Bi(arguments.length,1);for(var t=yf(this).entries,n=dn(e),o=[],r=0;r<t.length;r++)t[r].key===n&&Gf(o,t[r].value);return o},has:function(e){Bi(arguments.length,1);for(var t=yf(this).entries,n=dn(e),o=0;o<t.length;)if(t[o++].key===n)return!0;return!1},set:function(e,t){Bi(arguments.length,1);for(var n,o=yf(this),r=o.entries,a=!1,s=dn(e),i=dn(t),c=0;c<r.length;c++)(n=r[c]).key===s&&(a?Uf(r,c--,1):(a=!0,n.value=i));a||Gf(r,{key:s,value:i}),o.updateURL()},sort:function(){var e=yf(this);mf(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,n=yf(this).entries,o=wn(e,arguments.length>1?arguments[1]:void 0),r=0;r<n.length;)o((t=n[r++]).value,t.key,this)},keys:function(){return new $f(this,"keys")},values:function(){return new $f(this,"values")},entries:function(){return new $f(this,"entries")}},{enumerable:!0}),Dt(Xf,Mf,Xf.entries,{name:"entries"}),Dt(Xf,"toString",(function(){return yf(this).serialize()}),{enumerable:!0}),zo(Jf,"URLSearchParams"),nn({global:!0,forced:!jh},{URLSearchParams:Jf}),!jh&&ee(Sf)){var Qf=K(Df.has),Zf=K(Df.set),em=function(e){if(te(e)){var t,n=e.body;if("URLSearchParams"===un(n))return t=e.headers?new Sf(e.headers):new Sf,Qf(t,"content-type")||Zf(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),bn(e,{body:q(0,dn(n)),headers:q(0,t)})}return e};if(ee(Ef)&&nn({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Ef(e,arguments.length>1?em(arguments[1]):{})}}),ee(Tf)){var tm=function(e){return ki(this,Af),new Tf(e,arguments.length>1?em(arguments[1]):{})};Af.constructor=tm,tm.prototype=Af,nn({global:!0,forced:!0},{Request:tm})}}var nm,om={URLSearchParams:Jf,getState:yf},rm=Nn.f,am=Fo.codeAt,sm=It.set,im=It.getterFor("URL"),cm=om.URLSearchParams,um=om.getState,lm=O.URL,dm=O.TypeError,pm=O.parseInt,gm=Math.floor,_m=Math.pow,hm=K("".charAt),fm=K(/./.exec),mm=K([].join),Mm=K(1..toString),vm=K([].pop),ym=K([].push),Im=K("".replace),Em=K([].shift),Tm=K("".split),Sm=K("".slice),Am=K("".toLowerCase),Dm=K([].unshift),Cm=/[a-z]/i,Nm=/[\d+-.a-z]/i,Rm=/\d/,Om=/^0x/i,Lm=/^[0-7]+$/,km=/^\d+$/,Gm=/^[\da-f]+$/i,Pm=/[\0\t\n\r #%/:<>?@[\\\]^|]/,bm=/[\0\t\n\r #/:<>?@[\\\]^|]/,Um=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,wm=/[\t\n\r]/g,Fm=function(e){var t,n,o,r;if("number"==typeof e){for(t=[],n=0;n<4;n++)Dm(t,e%256),e=gm(e/256);return mm(t,".")}if("object"==typeof e){for(t="",o=function(e){for(var t=null,n=1,o=null,r=0,a=0;a<8;a++)0!==e[a]?(r>n&&(t=o,n=r),o=null,r=0):(null===o&&(o=a),++r);return r>n&&(t=o,n=r),t}(e),n=0;n<8;n++)r&&0===e[n]||(r&&(r=!1),o===n?(t+=n?":":"::",r=!0):(t+=Mm(e[n],16),n<7&&(t+=":")));return"["+t+"]"}return e},qm={},xm=zh({},qm,{" ":1,'"':1,"<":1,">":1,"`":1}),Vm=zh({},xm,{"#":1,"?":1,"{":1,"}":1}),Bm=zh({},Vm,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Hm=function(e,t){var n=am(e,0);return n>32&&n<127&&!Ne(t,e)?e:encodeURIComponent(e)},Km={ftp:21,file:null,http:80,https:443,ws:80,wss:443},jm=function(e,t){var n;return 2==e.length&&fm(Cm,hm(e,0))&&(":"==(n=hm(e,1))||!t&&"|"==n)},Wm=function(e){var t;return e.length>1&&jm(Sm(e,0,2))&&(2==e.length||"/"===(t=hm(e,2))||"\\"===t||"?"===t||"#"===t)},Ym=function(e){return"."===e||"%2e"===Am(e)},$m={},zm={},Jm={},Xm={},Qm={},Zm={},eM={},tM={},nM={},oM={},rM={},aM={},sM={},iM={},cM={},uM={},lM={},dM={},pM={},gM={},_M={},hM=function(e,t,n){var o,r,a,s=dn(e);if(t){if(r=this.parse(s))throw dm(r);this.searchParams=null}else{if(void 0!==n&&(o=new hM(n,!0)),r=this.parse(s,null,o))throw dm(r);(a=um(new cm)).bindURL(this),this.searchParams=a}};hM.prototype={type:"URL",parse:function(e,t,n){var o,r,a,s,i,c=this,u=t||$m,l=0,d="",p=!1,g=!1,_=!1;for(e=dn(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=Im(e,Um,"")),e=Im(e,wm,""),o=So(e);l<=o.length;){switch(r=o[l],u){case $m:if(!r||!fm(Cm,r)){if(t)return"Invalid scheme";u=Jm;continue}d+=Am(r),u=zm;break;case zm:if(r&&(fm(Nm,r)||"+"==r||"-"==r||"."==r))d+=Am(r);else{if(":"!=r){if(t)return"Invalid scheme";d="",u=Jm,l=0;continue}if(t&&(c.isSpecial()!=Ne(Km,d)||"file"==d&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=d,t)return void(c.isSpecial()&&Km[c.scheme]==c.port&&(c.port=null));d="","file"==c.scheme?u=iM:c.isSpecial()&&n&&n.scheme==c.scheme?u=Xm:c.isSpecial()?u=tM:"/"==o[l+1]?(u=Qm,l++):(c.cannotBeABaseURL=!0,ym(c.path,""),u=pM)}break;case Jm:if(!n||n.cannotBeABaseURL&&"#"!=r)return"Invalid scheme";if(n.cannotBeABaseURL&&"#"==r){c.scheme=n.scheme,c.path=ci(n.path),c.query=n.query,c.fragment="",c.cannotBeABaseURL=!0,u=_M;break}u="file"==n.scheme?iM:Zm;continue;case Xm:if("/"!=r||"/"!=o[l+1]){u=Zm;continue}u=nM,l++;break;case Qm:if("/"==r){u=oM;break}u=dM;continue;case Zm:if(c.scheme=n.scheme,r==nm)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=ci(n.path),c.query=n.query;else if("/"==r||"\\"==r&&c.isSpecial())u=eM;else if("?"==r)c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=ci(n.path),c.query="",u=gM;else{if("#"!=r){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=ci(n.path),c.path.length--,u=dM;continue}c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,c.path=ci(n.path),c.query=n.query,c.fragment="",u=_M}break;case eM:if(!c.isSpecial()||"/"!=r&&"\\"!=r){if("/"!=r){c.username=n.username,c.password=n.password,c.host=n.host,c.port=n.port,u=dM;continue}u=oM}else u=nM;break;case tM:if(u=nM,"/"!=r||"/"!=hm(d,l+1))continue;l++;break;case nM:if("/"!=r&&"\\"!=r){u=oM;continue}break;case oM:if("@"==r){p&&(d="%40"+d),p=!0,a=So(d);for(var h=0;h<a.length;h++){var f=a[h];if(":"!=f||_){var m=Hm(f,Bm);_?c.password+=m:c.username+=m}else _=!0}d=""}else if(r==nm||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()){if(p&&""==d)return"Invalid authority";l-=So(d).length+1,d="",u=rM}else d+=r;break;case rM:case aM:if(t&&"file"==c.scheme){u=uM;continue}if(":"!=r||g){if(r==nm||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()){if(c.isSpecial()&&""==d)return"Invalid host";if(t&&""==d&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(d))return s;if(d="",u=lM,t)return;continue}"["==r?g=!0:"]"==r&&(g=!1),d+=r}else{if(""==d)return"Invalid host";if(s=c.parseHost(d))return s;if(d="",u=sM,t==aM)return}break;case sM:if(!fm(Rm,r)){if(r==nm||"/"==r||"?"==r||"#"==r||"\\"==r&&c.isSpecial()||t){if(""!=d){var M=pm(d,10);if(M>65535)return"Invalid port";c.port=c.isSpecial()&&M===Km[c.scheme]?null:M,d=""}if(t)return;u=lM;continue}return"Invalid port"}d+=r;break;case iM:if(c.scheme="file","/"==r||"\\"==r)u=cM;else{if(!n||"file"!=n.scheme){u=dM;continue}if(r==nm)c.host=n.host,c.path=ci(n.path),c.query=n.query;else if("?"==r)c.host=n.host,c.path=ci(n.path),c.query="",u=gM;else{if("#"!=r){Wm(mm(ci(o,l),""))||(c.host=n.host,c.path=ci(n.path),c.shortenPath()),u=dM;continue}c.host=n.host,c.path=ci(n.path),c.query=n.query,c.fragment="",u=_M}}break;case cM:if("/"==r||"\\"==r){u=uM;break}n&&"file"==n.scheme&&!Wm(mm(ci(o,l),""))&&(jm(n.path[0],!0)?ym(c.path,n.path[0]):c.host=n.host),u=dM;continue;case uM:if(r==nm||"/"==r||"\\"==r||"?"==r||"#"==r){if(!t&&jm(d))u=dM;else if(""==d){if(c.host="",t)return;u=lM}else{if(s=c.parseHost(d))return s;if("localhost"==c.host&&(c.host=""),t)return;d="",u=lM}continue}d+=r;break;case lM:if(c.isSpecial()){if(u=dM,"/"!=r&&"\\"!=r)continue}else if(t||"?"!=r)if(t||"#"!=r){if(r!=nm&&(u=dM,"/"!=r))continue}else c.fragment="",u=_M;else c.query="",u=gM;break;case dM:if(r==nm||"/"==r||"\\"==r&&c.isSpecial()||!t&&("?"==r||"#"==r)){if(".."===(i=Am(i=d))||"%2e."===i||".%2e"===i||"%2e%2e"===i?(c.shortenPath(),"/"==r||"\\"==r&&c.isSpecial()||ym(c.path,"")):Ym(d)?"/"==r||"\\"==r&&c.isSpecial()||ym(c.path,""):("file"==c.scheme&&!c.path.length&&jm(d)&&(c.host&&(c.host=""),d=hm(d,0)+":"),ym(c.path,d)),d="","file"==c.scheme&&(r==nm||"?"==r||"#"==r))for(;c.path.length>1&&""===c.path[0];)Em(c.path);"?"==r?(c.query="",u=gM):"#"==r&&(c.fragment="",u=_M)}else d+=Hm(r,Vm);break;case pM:"?"==r?(c.query="",u=gM):"#"==r?(c.fragment="",u=_M):r!=nm&&(c.path[0]+=Hm(r,qm));break;case gM:t||"#"!=r?r!=nm&&("'"==r&&c.isSpecial()?c.query+="%27":c.query+="#"==r?"%23":Hm(r,qm)):(c.fragment="",u=_M);break;case _M:r!=nm&&(c.fragment+=Hm(r,xm))}l++}},parseHost:function(e){var t,n,o;if("["==hm(e,0)){if("]"!=hm(e,e.length-1))return"Invalid host";if(!(t=function(e){var t,n,o,r,a,s,i,c=[0,0,0,0,0,0,0,0],u=0,l=null,d=0,p=function(){return hm(e,d)};if(":"==p()){if(":"!=hm(e,1))return;d+=2,l=++u}for(;p();){if(8==u)return;if(":"!=p()){for(t=n=0;n<4&&fm(Gm,p());)t=16*t+pm(p(),16),d++,n++;if("."==p()){if(0==n)return;if(d-=n,u>6)return;for(o=0;p();){if(r=null,o>0){if(!("."==p()&&o<4))return;d++}if(!fm(Rm,p()))return;for(;fm(Rm,p());){if(a=pm(p(),10),null===r)r=a;else{if(0==r)return;r=10*r+a}if(r>255)return;d++}c[u]=256*c[u]+r,2!=++o&&4!=o||u++}if(4!=o)return;break}if(":"==p()){if(d++,!p())return}else if(p())return;c[u++]=t}else{if(null!==l)return;d++,l=++u}}if(null!==l)for(s=u-l,u=7;0!=u&&s>0;)i=c[u],c[u--]=c[l+s-1],c[l+--s]=i;else if(8!=u)return;return c}(Sm(e,1,-1))))return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=function(e){var t,n,o=[],r=cf(sf(uf(e),Xh,"."),".");for(t=0;t<r.length;t++)n=r[t],af(o,ef(Jh,n)?"xn--"+pf(n):n);return rf(o,".")}(e),fm(Pm,e))return"Invalid host";if(null===(t=function(e){var t,n,o,r,a,s,i,c=Tm(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(n=[],o=0;o<t;o++){if(""==(r=c[o]))return e;if(a=10,r.length>1&&"0"==hm(r,0)&&(a=fm(Om,r)?16:8,r=Sm(r,8==a?1:2)),""===r)s=0;else{if(!fm(10==a?km:8==a?Lm:Gm,r))return e;s=pm(r,a)}ym(n,s)}for(o=0;o<t;o++)if(s=n[o],o==t-1){if(s>=_m(256,5-t))return null}else if(s>255)return null;for(i=vm(n),o=0;o<n.length;o++)i+=n[o]*_m(256,3-o);return i}(e)))return"Invalid host";this.host=t}else{if(fm(bm,e))return"Invalid host";for(t="",n=So(e),o=0;o<n.length;o++)t+=Hm(n[o],qm);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Ne(Km,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&jm(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,n=e.username,o=e.password,r=e.host,a=e.port,s=e.path,i=e.query,c=e.fragment,u=t+":";return null!==r?(u+="//",e.includesCredentials()&&(u+=n+(o?":"+o:"")+"@"),u+=Fm(r),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+mm(s,"/"):"",null!==i&&(u+="?"+i),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw dm(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new fM(e.path[0]).origin}catch(FS){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+Fm(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(dn(e)+":",$m)},getUsername:function(){return this.username},setUsername:function(e){var t=So(dn(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var n=0;n<t.length;n++)this.username+=Hm(t[n],Bm)}},getPassword:function(){return this.password},setPassword:function(e){var t=So(dn(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var n=0;n<t.length;n++)this.password+=Hm(t[n],Bm)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Fm(e):Fm(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,rM)},getHostname:function(){var e=this.host;return null===e?"":Fm(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,aM)},getPort:function(){var e=this.port;return null===e?"":dn(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=dn(e))?this.port=null:this.parse(e,sM))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+mm(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,lM))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=dn(e))?this.query=null:("?"==hm(e,0)&&(e=Sm(e,1)),this.query="",this.parse(e,gM)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=dn(e))?("#"==hm(e,0)&&(e=Sm(e,1)),this.fragment="",this.parse(e,_M)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var fM=function(e){var t=ki(this,mM),n=Bi(arguments.length,1)>1?arguments[1]:void 0,o=sm(t,new hM(e,!1,n));k||(t.href=o.serialize(),t.origin=o.getOrigin(),t.protocol=o.getProtocol(),t.username=o.getUsername(),t.password=o.getPassword(),t.host=o.getHost(),t.hostname=o.getHostname(),t.port=o.getPort(),t.pathname=o.getPathname(),t.search=o.getSearch(),t.searchParams=o.getSearchParams(),t.hash=o.getHash())},mM=fM.prototype,MM=function(e,t){return{get:function(){return im(this)[e]()},set:t&&function(e){return im(this)[t](e)},configurable:!0,enumerable:!0}};if(k&&rm(mM,{href:MM("serialize","setHref"),origin:MM("getOrigin"),protocol:MM("getProtocol","setProtocol"),username:MM("getUsername","setUsername"),password:MM("getPassword","setPassword"),host:MM("getHost","setHost"),hostname:MM("getHostname","setHostname"),port:MM("getPort","setPort"),pathname:MM("getPathname","setPathname"),search:MM("getSearch","setSearch"),searchParams:MM("getSearchParams"),hash:MM("getHash","setHash")}),Dt(mM,"toJSON",(function(){return im(this).serialize()}),{enumerable:!0}),Dt(mM,"toString",(function(){return im(this).serialize()}),{enumerable:!0}),lm){var vM=lm.createObjectURL,yM=lm.revokeObjectURL;vM&&Dt(fM,"createObjectURL",wn(vM,lm)),yM&&Dt(fM,"revokeObjectURL",wn(yM,lm))}zo(fM,"URL"),nn({global:!0,forced:!jh,sham:!k},{URL:fM}),nn({target:"Object",stat:!0,forced:Object.assign!==zh},{assign:zh});var IM=function(){function e(t){o(this,e),this._imageMemoryURL="",Ku?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=gr.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||wl.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._defaultImage="http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg",this._autoFixUrl()}return a(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=dd(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=t.url||e._imageMemoryURL||e._defaultImage},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=ed(e)||ed(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o<n;o++)t=this.content.imageInfoArray[o],e[o].size&&(t.size=e[o].size),e[o].url&&t.setImageUrl(e[o].url),e[o].width&&(t.width=e[o].width),e[o].height&&(t.height=e[o].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",n="",o=["http","https"],r=null,a=0;a<e;a++)this.content.imageInfoArray[a].url&&""!==(r=this.content.imageInfoArray[a]).imageUrl&&(n=r.imageUrl.slice(0,r.imageUrl.indexOf("://")+1),t=r.imageUrl.slice(r.imageUrl.indexOf("://")+1),o.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[a].setImageUrl([n,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=wl[e.toUpperCase()]||wl.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,r=t.height,a=void 0===r?0:r;0!==o&&0!==a&&(Gd(e),Object.assign(e[2],kd({originWidth:o,originHeight:a,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),EM=function(){function e(t){o(this,e),this.type=gr.MSG_FACE,this.content=t||null}return a(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),TM=function(){function e(t){o(this,e),this.type=gr.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:t.url,remoteAudioUrl:t.url||"",uuid:t.uuid}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),SM={from:!0,groupID:!0,groupName:!0,to:!0},AM=function(){function e(t){o(this,e),this.type=gr.MSG_GRP_TIP,this.content={},this._initContent(t)}return a(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];SM[o]&&(this.content.groupProfile[o]=e[o])}}},{key:"_updateMemberList",value:function(e){Bd(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach((function(t){e.forEach((function(e){t.userID===e.userID&&Object.assign(t,e)}))}))}},{key:"_initNewGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];"muteAllMembers"!==o?this.content.newGroupProfile[o]=e[o]:this.content.newGroupProfile[o]=1===e[o]}}}]),e}(),DM={from:!0,groupID:!0,groupName:!0,to:!0},CM=function(){function e(t){o(this,e),this.type=gr.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return a(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"memberInfoList":break;case"remarkInfo":t.content.handleMessage=e[n];break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;default:t.content[n]=e[n]}}))}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];DM[o]&&("groupName"===o?this.content.groupProfile.name=e[o]:this.content.groupProfile[o]=e[o])}}}]),e}(),NM=Math.min,RM=[].lastIndexOf,OM=!!RM&&1/[1].lastIndexOf(1,-0)<0,LM=eo("lastIndexOf"),kM=OM||!LM?function(e){if(OM)return Es(RM,this,arguments)||0;var t=Z(this),n=bt(t),o=n-1;for(arguments.length>1&&(o=NM(o,Rt(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}:RM;nn({target:"Array",proto:!0,forced:kM!==[].lastIndexOf},{lastIndexOf:kM});var GM=function(){function e(t){o(this,e),this.type=gr.MSG_FILE,this._percent=0;var n=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:t.url||"",uuid:t.uuid,fileName:n.name||"",fileSize:n.size||0}}return a(e,[{key:"_getFileInfo",value:function(e){if(!ed(e.fileName)&&!ed(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(Bu){if(t.path&&-1!==t.path.indexOf(".")){var n=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=n,t.name||(t.name="".concat(dd(999999),".").concat(n))}t.name||(t.type="",t.name=t.path.slice(t.path.lastIndexOf("/")+1).toLowerCase()),t.suffix&&(t.type=t.suffix),t.url||(t.url=t.path)}return{size:t.size,name:t.name}}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),PM=function(){function e(t){o(this,e),this.type=gr.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return a(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),bM=function(){function e(t){o(this,e),this.type=gr.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:t.videoUrl,videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:t.thumbUrl,snapshotUrl:t.thumbUrl}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;Bd(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),Bd(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),Bd(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),UM=function(){function e(t){o(this,e),this.type=gr.MSG_LOCATION;var n=t.description,r=t.longitude,a=t.latitude;this.content={description:n,longitude:r,latitude:a}}return a(e,[{key:"sendable",value:function(){return!0}}]),e}(),wM=function(){function e(t){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",t.ID)this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(gr.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(gr.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var n=t.elements[0].type,r=t.elements[0].content;this._patchRichMediaPayload(n,r),n===gr.MSG_MERGER?this.messageBody.push({type:n,payload:new FM(r).content}):this.messageBody.push({type:n,payload:r}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to)}}return a(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===gr.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===gr.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===gr.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===gr.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}}]),e}(),FM=function(){function e(t){if(o(this,e),this.type=gr.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var n=t.downloadKey,r=t.pbDownloadKey,a=t.title,s=t.abstractList,i=t.compatibleText,c=t.version;this.content.downloadKey=n,this.content.pbDownloadKey=r,this.content.title=a,this.content.abstractList=s,this.content.compatibleText=i,this.content.version=c||0}else if(Bd(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var u=t.messageList,l=t.title,d=t.abstractList,p=t.compatibleText,g=t.version,_=[];u.forEach((function(e){if(!Bd(e)){var t=new wM(e);_.push(t)}})),this.content.messageList=_,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=g||0}Ul.debug("MergerElement.content:",this.content)}return a(e,[{key:"sendable",value:function(){return!Bd(this.content.messageList)||!Bd(this.content.downloadKey)}}]),e}(),qM={1:gr.MSG_PRIORITY_HIGH,2:gr.MSG_PRIORITY_NORMAL,3:gr.MSG_PRIORITY_LOW,4:gr.MSG_PRIORITY_LOWEST},xM=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||gr.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:dd(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=1===t.isPeerRead||!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||wp.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||kl()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t)}return a(e,[{key:"elements",get:function(){return Ul.warn("Message 实例的 elements 属性即将废弃,请尽快修改。使用 type 和 payload 属性处理单条消息,兼容组合消息使用 _elements 属性!!!"),this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){Jl(e.nick)&&(this.nick=e.nick),Jl(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;Ql(t)&&Jl(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==gr.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(gr.MSG_AT_ALL))})),Zl(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(gr.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?wp.SUCCESS:wp.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"!=typeof this._elements[0].sendable?(Ul.warn("".concat(this._elements[0].type,' need "boolean : sendable()" method')),!1):this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===gr.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return Ul.error("autoIncrementIndex(string: key) need key parameter"),!1;if(void 0===hd[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),r="0".concat(t.getSeconds()).slice(-2);hd[e]=parseInt([n,o,r,"0001"].join("")),n=null,o=null,r=null,Ul.log("autoIncrementIndex start index:".concat(hd[e]))}return hd[e]++}(e)),0===this.sequence&&this.conversationType===gr.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===gr.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n="",o=this.conversationType;o!==gr.CONV_SYSTEM?(n=o===gr.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID="".concat(o).concat(n)):this.conversationID=gr.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Hh||e instanceof IM||e instanceof EM||e instanceof TM||e instanceof GM||e instanceof bM||e instanceof AM||e instanceof CM||e instanceof PM||e instanceof UM||e instanceof FM}},{key:"setElement",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var n=function(e){if(e.type&&e.content)switch(e.type){case gr.MSG_TEXT:t.setTextElement(e.content);break;case gr.MSG_IMAGE:t.setImageElement(e.content);break;case gr.MSG_AUDIO:t.setAudioElement(e.content);break;case gr.MSG_FILE:t.setFileElement(e.content);break;case gr.MSG_VIDEO:t.setVideoElement(e.content);break;case gr.MSG_CUSTOM:t.setCustomElement(e.content);break;case gr.MSG_LOCATION:t.setLocationElement(e.content);break;case gr.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case gr.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case gr.MSG_FACE:t.setFaceElement(e.content);break;case gr.MSG_MERGER:t.setMergerElement(e.content);break;default:Ul.warn(e.type,e.content,"no operation......")}};if(Zl(e))for(var o=0;o<e.length;o++)n(e[o]);else n(e);this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){var t="string"==typeof e?e:e.text,n=new Hh({text:t});this._elements.push(n)}},{key:"setImageElement",value:function(e){var t=new IM(e);this._elements.push(t)}},{key:"setAudioElement",value:function(e){var t=new TM(e);this._elements.push(t)}},{key:"setFileElement",value:function(e){var t=new GM(e);this._elements.push(t)}},{key:"setVideoElement",value:function(e){var t=new bM(e);this._elements.push(t)}},{key:"setLocationElement",value:function(e){var t=new UM(e);this._elements.push(t)}},{key:"setCustomElement",value:function(e){var t=new PM(e);this._elements.push(t)}},{key:"setGroupTipElement",value:function(e){var t={},n=e.operationType;Bd(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):n!==gr.GRP_TIP_MBR_JOIN&&n!==gr.GRP_TIP_MBR_KICKED_OUT&&n!==gr.GRP_TIP_MBR_SET_ADMIN&&n!==gr.GRP_TIP_MBR_CANCELED_ADMIN||(t=e.memberInfoList[0]);var o=t,r=o.nick,a=o.avatar;Jl(r)&&(this.nick=r),Jl(a)&&(this.avatar=a);var s=new AM(e);this._elements.push(s)}},{key:"setGroupSystemNoticeElement",value:function(e){var t=new CM(e);this._elements.push(t)}},{key:"setFaceElement",value:function(e){var t=new EM(e);this._elements.push(t)}},{key:"setMergerElement",value:function(e){var t=new FM(e);this._elements.push(t)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"getRelayFlag",value:function(){return this._relayFlag}},{key:"_computePriority",value:function(e){if(ed(e))return gr.MSG_PRIORITY_NORMAL;if(Jl(e)&&-1!==Object.values(qM).indexOf(e))return e;if(zl(e)){var t=""+e;if(-1!==Object.keys(qM).indexOf(t))return qM[t]}return gr.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,n=e.avatar;Jl(t)&&(this.nick=t),Jl(n)&&(this.avatar=n)}},{key:"setNameCard",value:function(e){Jl(e)&&(this.nameCard=e)}}]),e}(),VM=function(e){return{code:0,data:e||{}}},BM="https://cloud.tencent.com/document/product/",HM="您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】 页面校验 UserSig。",KM="UserSig 非法,请使用官网提供的 API 重新生成 UserSig(".concat(BM,"269/32688)。"),jM="#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement",WM={70001:"UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",70002:"UserSig 长度为0请检查传入的 UserSig 是否正确。",70003:KM,70005:KM,70009:"UserSig 验证失败,可能因为生成 UserSig 时混用了其他 SDKAppID 的私钥或密钥导致,请使用对应 SDKAppID 下的私钥或密钥重新生成 UserSig(".concat(BM,"269/32688)。"),70013:"请求中的 UserID 与生成 UserSig 时使用的 UserID 不匹配。".concat(HM),70014:"请求中的 SDKAppID 与生成 UserSig 时使用的 SDKAppID 不匹配。".concat(HM),70016:"密钥不存在UserSig 验证失败,请在即时通信 IM 控制台获取密钥(".concat(BM,"269/32578#.E8.8E.B7.E5.8F.96.E5.AF.86.E9.92.A5)。"),70020:"SDKAppID 未找到,请在即时通信 IM 控制台确认应用信息。",70050:"UserSig 验证次数过于频繁。请检查 UserSig 是否正确并于1分钟后重新验证。".concat(HM),70051:"帐号被拉入黑名单。",70052:"UserSig 已经失效,请重新生成,再次尝试。",70107:"因安全原因被限制登录,请不要频繁登录。",70169:"请求的用户帐号不存在。",70114:"".concat("服务端内部超时,请稍后重试。"),70202:"".concat("服务端内部超时,请稍后重试。"),70206:"请求中批量数量不合法。",70402:"参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。",70403:"请求失败,需要 App 管理员权限。",70398:"帐号数超限。如需创建多于100个帐号请将应用升级为专业版具体操作指引请参见购买指引(".concat(BM,"269/32458)。"),70500:"".concat("服务端内部错误,请重试。"),71e3:"删除帐号失败。仅支持删除体验版帐号,您当前应用为专业版,暂不支持帐号删除。",20001:"请求包非法。",20002:"UserSig 或 A2 失效。",20003:"消息发送方或接收方 UserID 无效或不存在,请检查 UserID 是否已导入即时通信 IM。",20004:"网络异常,请重试。",20005:"".concat("服务端内部错误,请重试。"),20006:"触发发送".concat("单聊消息","之前回调App 后台返回禁止下发该消息。"),20007:"发送".concat("单聊消息",",被对方拉黑,禁止发送。消息发送状态默认展示为失败,您可以登录控制台修改该场景下的消息发送状态展示结果,具体操作请参见消息保留设置(").concat(BM,"269/38656)。"),20009:"消息发送双方互相不是好友,禁止发送(配置".concat("单聊消息","校验好友关系才会出现)。"),20010:"发送".concat("单聊消息",",自己不是对方的好友(单向关系),禁止发送。"),20011:"发送".concat("单聊消息",",对方不是自己的好友(单向关系),禁止发送。"),20012:"发送方被禁言,该条消息被禁止发送。",20016:"消息撤回超过了时间限制默认2分钟。",20018:"删除漫游内部错误。",90001:"JSON 格式解析失败,请检查请求包是否符合 JSON 规范。",90002:"".concat("JSON 格式请求包体","中 MsgBody 不符合消息格式描述,或者 MsgBody 不是 Array 类型,请参考 TIMMsgElement 对象的定义(").concat(BM,"269/2720").concat(jM,")。"),90003:"".concat("JSON 格式请求包体","中缺少 To_Account 字段或者 To_Account 帐号不存在。"),90005:"".concat("JSON 格式请求包体","中缺少 MsgRandom 字段或者 MsgRandom 字段不是 Integer 类型。"),90006:"".concat("JSON 格式请求包体","中缺少 MsgTimeStamp 字段或者 MsgTimeStamp 字段不是 Integer 类型。"),90007:"".concat("JSON 格式请求包体","中 MsgBody 类型不是 Array 类型,请将其修改为 Array 类型。"),90008:"".concat("JSON 格式请求包体","中缺少 From_Account 字段或者 From_Account 帐号不存在。"),90009:"请求需要 App 管理员权限。",90010:"".concat("JSON 格式请求包体","不符合消息格式描述,请参考 TIMMsgElement 对象的定义(").concat(BM,"269/2720").concat(jM,")。"),90011:"批量发消息目标帐号超过500请减少 To_Account 中目标帐号数量。",90012:"To_Account 没有注册或不存在,请确认 To_Account 是否导入即时通信 IM 或者是否拼写错误。",90026:"消息离线存储时间错误最多不能超过7天。",90031:"".concat("JSON 格式请求包体","中 SyncOtherMachine 字段不是 Integer 类型。"),90044:"".concat("JSON 格式请求包体","中 MsgLifeTime 字段不是 Integer 类型。"),90048:"请求的用户帐号不存在。",90054:"撤回请求中的 MsgKey 不合法。",90994:"".concat("服务端内部错误,请重试。"),90995:"".concat("服务端内部错误,请重试。"),91e3:"".concat("服务端内部错误,请重试。"),90992:"".concat("服务端内部错误,请重试。","如果所有请求都返回该错误码,且 App 配置了第三方回调,请检查 App 服务端是否正常向即时通信 IM 后台服务端返回回调结果。"),93e3:"JSON 数据包超长消息包体请不要超过8k。",91101:"Web 端长轮询被踢Web 端同时在线实例个数超出限制)。",10002:"".concat("服务端内部错误,请重试。"),10003:"请求中的接口名称错误,请核对接口名称并重试。",10004:"参数非法,请根据错误描述检查请求是否正确。",10005:"请求包体中携带的帐号数量过多。",10006:"操作频率限制,请尝试降低调用的频率。",10007:"操作权限不足,例如 Work ".concat("群组","中普通成员尝试执行踢人操作,但只有 App 管理员才有权限。"),10008:"请求非法,可能是请求中携带的签名信息验证不正确,请再次尝试。",10009:"该群不允许群主主动退出。",10010:"".concat("群组","不存在,或者曾经存在过,但是目前已经被解散。"),10011:"解析 JSON 包体失败,请检查包体的格式是否符合 JSON 格式。",10012:"发起操作的 UserID 非法,请检查发起操作的用户 UserID 是否填写正确。",10013:"被邀请加入的用户已经是群成员。",10014:"群已满员,无法将请求中的用户加入".concat("群组",",如果是批量加人,可以尝试减少加入用户的数量。"),10015:"找不到指定 ID 的".concat("群组","。"),10016:"App 后台通过第三方回调拒绝本次操作。",10017:"因被禁言而不能发送消息,请检查发送者是否被设置禁言。",10018:"应答包长度超过最大包长1MB请求的内容过多请尝试减少单次请求的数据量。",10019:"请求的用户帐号不存在。",10021:"".concat("群组"," ID 已被使用,请选择其他的").concat("群组"," ID。"),10023:"发消息的频率超限,请延长两次发消息时间的间隔。",10024:"此邀请或者申请请求已经被处理。",10025:"".concat("群组"," ID 已被使用,并且操作者为群主,可以直接使用。"),10026:"该 SDKAppID 请求的命令字已被禁用。",10030:"请求撤回的消息不存在。",10031:"消息撤回超过了时间限制默认2分钟。",10032:"请求撤回的消息不支持撤回操作。",10033:"".concat("群组","类型不支持消息撤回操作。"),10034:"该消息类型不支持删除操作。",10035:"直播群和在线成员广播大群不支持删除消息。",10036:"直播群创建数量超过了限制,请参考价格说明(".concat(BM,"269/11673)购买预付费套餐“IM直播群”。"),10037:"单个用户可创建和加入的".concat("群组","数量超过了限制,请参考价格说明(").concat(BM,"269/11673)购买或升级预付费套餐“单人可创建与加入").concat("群组","数”。"),10038:"群成员数量超过限制,请参考价格说明(".concat(BM,"269/11673)购买或升级预付费套餐“扩展群人数上限”。"),10041:"该应用SDKAppID已配置不支持群消息撤回。",10050:"群属性 key 不存在",10056:"请在写入群属性前先使用 getGroupAttributes 接口更新本地群属性,避免冲突。",10059:"非旗舰版",10060:"群人数超过已读回执人数上限",10061:"在线消息不支持已读回执",10062:"找不到群消息的已读回执信息",20026:"消息不存在",20029:"该群类型不支持修改消息。",30001:"请求参数错误,请根据错误描述检查请求参数",30002:"SDKAppID 不匹配",30003:"请求的用户帐号不存在",30004:"请求需要 App 管理员权限",30005:"关系链字段中包含敏感词",30006:"".concat("服务端内部错误,请重试。"),30007:"".concat("网络超时,请稍后重试. "),30008:"并发写导致写冲突,建议使用批量方式",30009:"后台禁止该用户发起加好友请求",30010:"自己的好友数已达系统上限",30011:"分组已达系统上限",30012:"未决数已达系统上限",30014:"对方的好友数已达系统上限",30515:"请求添加好友时,对方在自己的黑名单中,不允许加好友",30516:"请求添加好友时,对方的加好友验证方式是不允许任何人添加自己为好友",30525:"请求添加好友时,自己在对方的黑名单中,不允许加好友",30539:"等待对方同意",30540:"添加好友请求被安全策略打击,请勿频繁发起添加好友请求",31704:"与请求删除的帐号之间不存在好友关系",31707:"删除好友请求被安全策略打击,请勿频繁发起删除好友请求"},YM=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this)).code=e.code,r.message=WM[e.code]||e.message,r.data=e.data||{},r}return a(n)}(p(Error)),$M=null,zM=function(e){$M=e},JM=function(e){return Promise.resolve(VM(e))},XM=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof YM)return t&&null!==$M&&$M.emit(pr.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new YM({code:yh.UNCAUGHT_ERROR,message:e.message});return t&&null!==$M&&$M.emit(pr.ERROR,n),Promise.reject(n)}if(ed(e)||ed(e.code)||ed(e.message))Ul.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!");else{if(zl(e.code)&&Jl(e.message)){var o=new YM(e);return t&&null!==$M&&$M.emit(pr.ERROR,o),Promise.reject(o)}Ul.error("IMPromise.reject code(错误码)必须为数字message(错误信息)必须为字符串!!!")}},QM=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="C2CModule",t._messageFromUnreadDBMap=new Map,t}return a(r,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,r=e.C2CPairUnreadList;Ul.debug("".concat(this._className,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var a=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:r,isInstantMessage:n}),s=a.conversationOptionsList,i=a.messageList,c=a.isUnreadC2CMessage;(this.filterModifiedMessage(i),s.length>0)&&this.getModule(ug).onNewMessage({conversationOptionsList:s,isInstantMessage:n,isUnreadC2CMessage:c});var u=this.filterUnmodifiedMessage(i);n&&u.length>0&&this.emitOuterEvent(pr.MESSAGE_RECEIVED,u),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,r=e.isInstantMessage,a=null,s=[],i=[],c={},u=this.getModule(_g),l=this.getModule(Sg),d=!1,p=this.getModule(ug),g=0,_=t.length;g<_;g++){var h=t[g];h.currentUser=this.getMyUserID(),h.conversationType=gr.CONV_C2C,h.isSystemMessage=!!h.isSystemMessage,(ed(h.nick)||ed(h.avatar))&&(d=!0,Ul.debug("".concat(this._className,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),a=new xM(h),h.elements=u.parseElements(h.elements,h.from),a.setElement(h.elements),a.setNickAndAvatar({nick:h.nick,avatar:h.avatar});var f=a.conversationID;if(r){if(1===this._messageFromUnreadDBMap.get(a.ID))continue;var m=!1;if(a.from!==this.getMyUserID()){var M=p.getLatestMessageSentByPeer(f);if(M){var v=M.nick,y=M.avatar;d?a.setNickAndAvatar({nick:v,avatar:y}):v===a.nick&&y===a.avatar||(m=!0)}}else{var I=p.getLatestMessageSentByMe(f);if(I){var E=I.nick,T=I.avatar;E===a.nick&&T===a.avatar||p.modifyMessageSentByMe({conversationID:f,latestNick:a.nick,latestAvatar:a.avatar})}}var S=1===t[g].isModified;if(p.isMessageSentByCurrentInstance(a)?a.isModified=S:S=!1,0===h.msgLifeTime)a._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(a)||i.push(a);else{if(!p.pushIntoMessageList(i,a,S))continue;m&&(p.modifyMessageSentByPeer({conversationID:f,latestNick:a.nick,latestAvatar:a.avatar}),p.updateUserProfileSpecifiedKey({conversationID:f,nick:a.nick,avatar:a.avatar}))}r&&a.clientTime>0&&l.addMessageDelay(a.clientTime)}else this._messageFromUnreadDBMap.set(a.ID,1);if(0!==h.msgLifeTime){if(!1===a._onlineOnlyFlag){var A=p.getLastMessageTime(f);if(zl(A)&&a.time<A)continue;if(ed(c[f])){var D=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||(D=1)),c[f]=s.push({conversationID:f,unreadCount:D,type:a.conversationType,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var C=c[f];s[C].type=a.conversationType,s[C].subType=a.conversationSubType,s[C].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||s[C].unreadCount++)}}}else a._onlineOnlyFlag=!0}var N=!1;if(Zl(o))for(var R=function(e,t){if(o[e].unreadCount>0){N=!0;var n=s.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:s.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:gr.CONV_C2C})}},O=0,L=o.length;O<L;O++)R(O);if(Zl(n))for(var k=function(e,t){s.find((function(t){return t.conversationID==="C2C".concat(n[e].from)}))||s.push({conversationID:"C2C".concat(n[e].from),type:gr.CONV_C2C,lastMsgTime:n[e].lastMsgTime})},G=0,P=n.length;G<P;G++)k(G);return{conversationOptionsList:s,messageList:i,isUnreadC2CMessage:N}}},{key:"onC2CMessageRevoked",value:function(e){var t=this;Ul.debug("".concat(this._className,".onC2CMessageRevoked count:").concat(e.dataList.length));var n=this.getModule(ug),o=[],r=null;e.dataList.forEach((function(e){if(e.c2cMessageRevokedNotify){var a=e.c2cMessageRevokedNotify.revokedInfos;ed(a)||a.forEach((function(e){var a=t.getMyUserID()===e.from?"".concat(gr.CONV_C2C).concat(e.to):"".concat(gr.CONV_C2C).concat(e.from);(r=n.revoke(a,e.sequence,e.random))&&o.push(r)}))}})),0!==o.length&&(n.onMessageRevoked(o),this.emitOuterEvent(pr.MESSAGE_REVOKED,o))}},{key:"onC2CMessageReadReceipt",value:function(e){var t=this;e.dataList.forEach((function(e){if(!Bd(e.c2cMessageReadReceipt)){var n=e.c2cMessageReadReceipt.to;e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){var o=e.peerReadTime;Ul.debug("".concat(t._className,"._onC2CMessageReadReceipt to:").concat(n," peerReadTime:").concat(o));var r="".concat(gr.CONV_C2C).concat(n),a=t.getModule(ug);a.recordPeerReadTime(r,o),a.updateMessageIsPeerReadProperty(r,o)}))}}))}},{key:"onC2CMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){if(!Bd(e.c2cMessageReadNotice)){var n=t.getModule(ug);e.c2cMessageReadNotice.uinPairReadArray.forEach((function(e){var o=e.from,r=e.peerReadTime;Ul.debug("".concat(t._className,".onC2CMessageReadNotice from:").concat(o," lastReadTime:").concat(r));var a="".concat(gr.CONV_C2C).concat(o);n.updateIsReadAfterReadReport({conversationID:a,lastMessageTime:r}),n.updateUnreadCount(a)}))}}))}},{key:"onC2CMessageModified",value:function(e){Ul.debug("".concat(this._className,".onC2CMessageModified options:"),JSON.stringify(e));var n=this.getModule(ug);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:gr.CONV_C2C}))}))}},{key:"onReadReceiptList",value:function(e){Ul.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e));var t=e.dataList,n=t.userID,o=t.readReceiptList;this.getModule(ug).updateReadReceiptInfo({userID:n,readReceiptList:o})}},{key:"sendMessage",value:function(e,t){var n=this._createC2CMessagePack(e,t);return this.request(n)}},{key:"_createC2CMessagePack",value:function(e,t){var n=null;t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0}));var o="";Jl(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var r=[];if(Ql(t)&&Ql(t.messageControlInfo)){var a=t.messageControlInfo,s=a.excludedFromUnreadCount,i=a.excludedFromLastMessage;!0===s&&r.push("NoUnread"),!0===i&&r.push("NoLastMsg")}return{protocolName:Gg,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:this.isOnlineMessage(e,t)?0:void 0,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:r,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0}}}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:e_,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;return Ul.log("".concat(this._className,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:s_,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,r=void 0===o?0:o,a=e.sequence,s=e.random,i=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return xd(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:i_,requestData:{from:t,to:n,version:r,sequence:a,random:s,time:i,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,r="".concat(this._className,".setMessageRead");Ul.log("".concat(r," conversationID:").concat(n," lastMessageTime:").concat(o)),zl(o)||Ul.warn("".concat(r," 请勿修改 Conversation.lastMessage.lastTime否则可能会导致已读上报结果不准确"));var a=new Uh(wh.SET_C2C_MESSAGE_READ);return a.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:t_,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(r," ok"));var e=t.getModule(ug);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),VM()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.log("".concat(r," failed. error:"),e),XM(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessage"),o=e.peerAccount,r=e.conversationID,a=e.count,s=e.lastMessageTime,i=e.messageKey,c="peerAccount:".concat(o," count:").concat(a||15," lastMessageTime:").concat(s||0," messageKey:").concat(i);Ul.log("".concat(n," ").concat(c));var u=new Uh(wh.GET_C2C_ROAMING_MESSAGES);return this.request({protocolName:r_,requestData:{peerAccount:o,count:a||15,lastMessageTime:s||0,messageKey:i}}).then((function(e){var o=e.data,a=o.complete,s=o.messageList,i=o.messageKey,l=o.lastMessageTime;ed(s)?Ul.log("".concat(n," ok. complete:").concat(a," but messageList is undefined!")):Ul.log("".concat(n," ok. complete:").concat(a," count:").concat(s.length)),u.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(a," length:").concat(s.length)).end();var d=t.getModule(ug);1===a&&d.setCompleted(r);var p=d.onRoamingMessage(s,r);d.modifyMessageList(r),d.updateIsRead(r),d.updateRoamingMessageKeyAndTime(r,i,l);var g=d.getPeerReadTime(r);if(Ul.log("".concat(n," update isPeerRead property. conversationID:").concat(r," peerReadTime:").concat(g)),g)d.updateMessageIsPeerReadProperty(r,g);else{var _=r.replace(gr.CONV_C2C,"");t.getRemotePeerReadTime([_]).then((function(){d.updateMessageIsPeerReadProperty(r,d.getPeerReadTime(r))}))}var h="";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(r);f&&(h=f.ID)}return Ul.log("".concat(n," nextReqID:").concat(h," stored message count:").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];u.setMessage(c).setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessagesHopping"),o=e.peerAccount,r=e.time,a=void 0===r?0:r,s=e.count,i=e.direction,c="".concat(gr.CONV_C2C).concat(o),u="peerAccount:".concat(o," count:").concat(s," time:").concat(a," direction:").concat(i);Ul.log("".concat(n," ").concat(u));var l=new Uh(wh.GET_C2C_ROAMING_MESSAGES_HOPPING);return this.request({protocolName:r_,requestData:{peerAccount:o,count:s+1,lastMessageTime:a,direction:i}}).then((function(e){var o=e.data,r=o.complete,a=o.messageList,s=void 0===a?[]:a,d=o.lastMessageTime;Ul.log("".concat(n," ok. complete:").concat(r," count:").concat(s.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(r," length:").concat(s.length)).end(),1!==r&&(1===i?s.pop():s.shift());var p=t.getModule(ug).onRoamingMessage(s,c,!1);t._modifyMessageList(c,p);var g=t._computeResult({complete:r,lastMessageTime:d,resultList:p});return VM(g)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setMessage(u).setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,r=e.resultList,a={messageList:M(void 0===r?[]:r),isCompleted:!1,nextMessageTime:""};return 1===n?(a.isCompleted=!0,a):(a.nextMessageTime=o,a)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(ug).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,r=n.userProfile.avatar,a=this.getModule(og).getNickAndAvatarByUserID(this.getMyUserID()),s=a.nick,i=a.avatar,c=t.length-1;c>=0;c--){var u=t[c];"in"===u.flow&&(u.nick!==o&&u.setNickAndAvatar({nick:o}),u.avatar!==r&&u.setNickAndAvatar({avatar:r})),"out"===u.flow&&(u.nick!==s&&u.setNickAndAvatar({nick:s}),u.avatar!==i&&u.setNickAndAvatar({avatar:i}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._className,".getRemotePeerReadTime");if(Bd(e))return Ul.warn("".concat(n," userIDList is empty!")),Promise.resolve();var o=new Uh(wh.GET_PEER_READ_TIME);return Ul.log("".concat(n," userIDList:").concat(e)),this.request({protocolName:a_,requestData:{userIDList:e}}).then((function(r){var a=r.data.peerReadTimeList;Ul.log("".concat(n," ok. peerReadTimeList:").concat(a));for(var s="",i=t.getModule(ug),c=0;c<e.length;c++)s+="".concat(e[c],"-").concat(a[c]," "),a[c]>0&&i.recordPeerReadTime("C2C".concat(e[c]),a[c]);o.setNetworkType(t.getNetworkType()).setMessage(s).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.warn("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(gr.CONV_C2C,""),o=new Uh(wh.SEND_C2C_READ_RECEIPT);o.setMessage("peerAccount:".concat(n));var r=this.getMyUserID(),a=e.filter((function(e){return e.from!==r&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===a.length)return XM({code:yh.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:Ih.READ_RECEIPT_MESSAGE_LIST_EMPTY});var s="".concat(this._className,".sendReadReceipt");return Ul.log("".concat(s,". peerAccount:").concat(n," messageInfoList length:").concat(a.length)),this.request({protocolName:L_,requestData:{peerAccount:n,messageInfoList:a}}).then((function(e){return o.end(),Ul.log("".concat(s," ok")),VM()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.warn("".concat(s," failed. error:"),e),XM(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._className,".getReadReceiptList"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return Ul.log("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),JM({messageList:o})}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._messageFromUnreadDBMap.clear()}}]),r}(Dg),ZM=ae.match(/firefox\/(\d+)/i),ev=!!ZM&&+ZM[1],tv=/MSIE|Trident/.test(ae),nv=ae.match(/AppleWebKit\/(\d+)\./),ov=!!nv&&+nv[1],rv=[],av=K(rv.sort),sv=K(rv.push),iv=L((function(){rv.sort(void 0)})),cv=L((function(){rv.sort(null)})),uv=eo("sort"),lv=!L((function(){if(le)return le<70;if(!(ev&&ev>3)){if(tv)return!0;if(ov)return ov<603;var e,t,n,o,r="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(o=0;o<47;o++)rv.push({k:t+o,v:n})}for(rv.sort((function(e,t){return t.v-e.v})),o=0;o<rv.length;o++)t=rv[o].k.charAt(0),r.charAt(r.length-1)!==t&&(r+=t);return"DGBEFHACIJK"!==r}}));nn({target:"Array",proto:!0,forced:iv||!cv||!uv||!lv},{sort:function(e){void 0!==e&&Me(e);var t=De(this);if(lv)return void 0===e?av(t):av(t,e);var n,o,r=[],a=bt(t);for(o=0;o<a;o++)o in t&&sv(r,t[o]);for(mf(r,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:dn(t)>dn(n)?1:-1}}(e)),n=r.length,o=0;o<n;)t[o]=r[o++];for(;o<a;)delete t[o++];return t}});var dv=Zn.findIndex,pv=!0;"findIndex"in[]&&Array(1).findIndex((function(){pv=!1})),nn({target:"Array",proto:!0,forced:pv},{findIndex:function(e){return dv(this,e,arguments.length>1?arguments[1]:void 0)}}),ja("findIndex");var gv=function(){function e(){o(this,e),this.list=new Map,this._className="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map,this._groupLocalLastMessageSequenceMap=new Map}return a(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var r=this._getUniqueIDOfMessage(e),a=this.list.get(n).has(r);if(a){var s=this.list.get(n).get(r);if(!t||!0===s.isModified)return o=!1}return this.list.get(n).set(r,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),this._setGroupLocalLastMessageSequence(n,e),o}},{key:"unshift",value:function(e,t){var n;if(Zl(e)){if(e.length>0){n=e[0].conversationID;var o=e.length;this._unshiftMultipleMessages(e,t),this._setGroupLocalLastMessageSequence(n,e[o-1])}}else n=e.conversationID,this._unshiftSingleMessage(e,t),this._setGroupLocalLastMessageSequence(n,e);if(n&&n.startsWith(gr.CONV_C2C)){var r=Array.from(this.list.get(n).values()),a=r.length;if(0===a)return;for(var s=a-1;s>=0;s--)if("out"===r[s].flow){this._setLatestMessageSentByMe(n,r[s]);break}for(var i=a-1;i>=0;i--)if("in"===r[i].flow){this._setLatestMessageSentByPeer(n,r[i]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var r=this.list.get(n),a=Array.from(r);r.has(o)||(a.unshift([o,e]),this.list.set(n,new Map(a)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],r=e[0].conversationID,a=this.list.get(r),s=this.list.has(r)?Array.from(a):[],i=0;i<n;i++){var c=this._getUniqueIDOfMessage(e[i]);a&&a.has(c)||(o.push([c,e[i]]),t.push(e[i]))}this.list.set(r,new Map(o.concat(s)))}},{key:"remove",value:function(e){var t=e.conversationID,n=this._getUniqueIDOfMessage(e);this.list.has(t)&&this.list.get(t).delete(n)}},{key:"revoke",value:function(e,t,n){if(Ul.debug("revoke message",e,t,n),this.list.has(e)){var o,r=S(this.list.get(e));try{for(r.s();!(o=r.n()).done;){var a=m(o.value,2)[1];if(a.sequence===t&&!a.isRevoked&&(ed(n)||a.random===n))return a.isRevoked=!0,a}}catch(s){r.e(s)}finally{r.f()}}return null}},{key:"removeByConversationID",value:function(e){this.list.has(e)&&(this.list.delete(e),this._latestMessageSentByPeerMap.delete(e),this._latestMessageSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){var t,n=null,o=S(this.list);try{for(o.s();!(t=o.n()).done;)for(var r=M(m(t.value,2)[1].values()),a=r.length,s=0;s<a;s++)if(r[s].ID===e){n=r[s];break}}catch(i){o.e(i)}finally{o.f()}return n}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){var n=[];if(this.list.has(e)){var o,r=S(this.list.get(e));try{for(r.s();!(o=r.n()).done;){var a=m(o.value,2)[1];a.time<=t&&!a.isPeerRead&&"out"===a.flow&&(a.isPeerRead=!0,n.push(a))}}catch(s){r.e(s)}finally{r.f()}Ul.log("".concat(this._className,".updateMessageIsPeerReadProperty conversationID:").concat(e," peerReadTime:").concat(t," count:").concat(n.length))}return n}},{key:"updateMessageIsModifiedProperty",value:function(e){var t=e.conversationID;if(this.list.has(t)){var n=this._getUniqueIDOfMessage(e),o=this.list.get(t).get(n);o&&(o.isModified=!0)}}},{key:"hasLocalMessageList",value:function(e){return this.list.has(e)}},{key:"getLocalMessageList",value:function(e){return this.hasLocalMessageList(e)?M(this.list.get(e).values()):[]}},{key:"hasLocalMessage",value:function(e,t){for(var n=!1,o=this.getLocalMessageList(e),r=o.length,a=0;a<r;a++)o[a].ID===t&&(n=!0);return n}},{key:"getLocalMessage",value:function(e,t){for(var n=null,o=this.getLocalMessageList(e),r=o.length,a=0;a<r;a++)if(o[a].ID===t){n=o[a];break}return n}},{key:"getLocalLastMessage",value:function(e){var t=this.getLocalMessageList(e);return t[t.length-1]}},{key:"getLocalOldestMessage",value:function(e){return this.getLocalMessageList(e)[0]}},{key:"_setLatestMessageSentByPeer",value:function(e,t){e.startsWith(gr.CONV_C2C)&&"in"===t.flow&&this._latestMessageSentByPeerMap.set(e,t)}},{key:"_setLatestMessageSentByMe",value:function(e,t){e.startsWith(gr.CONV_C2C)&&"out"===t.flow&&this._latestMessageSentByMeMap.set(e,t)}},{key:"_setGroupLocalLastMessageSequence",value:function(e,t){e.startsWith(gr.CONV_GROUP)&&this._groupLocalLastMessageSequenceMap.set(e,t.sequence)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._latestMessageSentByPeerMap.get(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._latestMessageSentByMeMap.get(e)}},{key:"getGroupLocalLastMessageSequence",value:function(e){return this._groupLocalLastMessageSequenceMap.get(e)||0}},{key:"modifyMessageSentByPeer",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,r=this.list.get(t);if(!Bd(r)){var a=Array.from(r.values()),s=a.length;if(0!==s){for(var i=null,c=0,u=!1,l=s-1;l>=0;l--)"in"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),u=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));Ul.log("".concat(this._className,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(c))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,r=this.list.get(t);if(!Bd(r)){var a=Array.from(r.values()),s=a.length;if(0!==s){for(var i=null,c=0,u=!1,l=s-1;l>=0;l--)"out"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),u=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));Ul.log("".concat(this._className,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(c))}}}},{key:"getTopicConversationIDList",value:function(e){return M(this.list.keys()).filter((function(t){return t.startsWith("".concat(gr.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===Ul.getLevel()){console.group("conversationID-messageCount");var e,t=S(this.list);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],r=n[1];console.log("".concat(o,"-").concat(r.size))}}catch(a){t.e(a)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(Ul.debug("".concat(this._className,".onMessageModified conversationID:").concat(e," uniqueID:").concat(n," has:").concat(o)),o){var r=this.list.get(e).get(n),a=t.messageVersion,s=t.elements,i=t.cloudCustomData;return r.version<a?(r.version=a,r._elements=JSON.parse(JSON.stringify(s)),r.payload=JSON.parse(JSON.stringify(s[0].content)),r.type=s[0].type,r.cloudCustomData=i,r.isModified=!0,{isUpdated:!0,message:r}):{isUpdated:!1,message:r}}return{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMessage",value:function(e){var t=e.from,n=e.to,o=e.random,r=e.sequence,a=e.time;return"".concat(t,"-").concat(n,"-").concat(o,"-").concat(r,"-").concat(a)}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear(),this._groupLocalLastMessageSequenceMap.clear()}}]),e}(),_v="_a2KeyAndTinyIDUpdated",hv="_cloudConfigUpdated",fv="_profileUpdated";function mv(e){this.mixin(e)}mv.mixin=function(e){var t=e.prototype||e;t._isReady=!1,t.ready=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var Mv=["jpg","jpeg","gif","png","bmp","image","webp"],vv=["mp4"],yv=1,Iv=2,Ev=3,Tv=255,Sv=function(){function e(t){var n=this;o(this,e),Bd(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||gr.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||gr.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],Bd(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return a(e,[{key:"validate",value:function(e){var t=!0,n="";if(Bd(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,r=null,a=0;a<o;a++){if(r=e.profileCustomField[a],!Jl(r.key)||-1===r.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"自定义资料字段的前缀必须是 Tag_Profile_Custom"};if(!Jl(r.value))return{valid:!1,tips:"自定义资料字段的 value 必须是字符串"}}for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if("profileCustomField"===s)continue;if(Bd(e[s])&&!Jl(e[s])&&!zl(e[s])){n="key:"+s+", invalid value:"+e[s],t=!1;continue}switch(s){case"nick":Jl(e[s])||(n="nick should be a string",t=!1),ld(e[s])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(ld(e[s])," bytes"),t=!1);break;case"gender":_d(xl,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":zl(e.birthday)||(n="birthday should be a number",t=!1);break;case"location":Jl(e.location)||(n="location should be a string",t=!1);break;case"selfSignature":Jl(e.selfSignature)||(n="selfSignature should be a string",t=!1);break;case"allowType":_d(Bl,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":zl(e.language)||(n="language should be a number",t=!1);break;case"avatar":Jl(e.avatar)||(n="avatar should be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings should be 0 or 1",t=!1);break;case"adminForbidType":_d(Vl,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":zl(e.level)||(n="level should be a number",t=!1);break;case"role":zl(e.role)||(n="role should be a number",t=!1);break;default:n="unknown key:"+s+" "+e[s],t=!1}}return{valid:t,tips:n}}}]),e}(),Av=a((function e(t){o(this,e),this.value=t,this.next=null})),Dv=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,Ul.debug("SinglyLinkedList init MAX_LENGTH:".concat(this.MAX_LENGTH))}return a(e,[{key:"set",value:function(e){var t=new Av(e);if(this.map.size<this.MAX_LENGTH)null===this.pTail?(this.pTail=t,this.pNodeToDel=t):(this.pTail.next=t,this.pTail=t),this.map.set(e,1);else{var n=this.pNodeToDel;this.pNodeToDel=this.pNodeToDel.next,this.map.delete(n.value),n.next=null,n=null,this.pTail.next=t,this.pTail=t,this.map.set(e,1)}}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"tail",value:function(){return this.pTail}},{key:"size",value:function(){return this.map.size}},{key:"data",value:function(){return Array.from(this.map.keys())}},{key:"reset",value:function(){for(var e;null!==this.pNodeToDel;)e=this.pNodeToDel,this.pNodeToDel=this.pNodeToDel.next,e.next=null,e=null;this.pTail=null,this.map.clear()}}]),e}(),Cv=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic"],Nv=function(){function e(t){o(this,e),this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._initGroup(t)}return a(e,[{key:"memberNum",get:function(){return Ul.warn("v2.8.0起弃用memberNum请使用 memberCount"),this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return Ul.warn("v2.8.0起弃用maxMemberNum请使用 maxMemberCount"),this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)Cv.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=this,n=JSON.parse(JSON.stringify(e));n.lastMsgTime&&(this.lastMessage.lastTime=n.lastMsgTime),ed(n.muteAllMembers)||("On"===n.muteAllMembers?n.muteAllMembers=!0:n.muteAllMembers=!1),n.groupCustomField&&vd(this.groupCustomField,n.groupCustomField),ed(n.memberNum)||(this.memberCount=n.memberNum),ed(n.maxMemberNum)||(this.maxMemberCount=n.maxMemberNum),ed(n.isSupportTopic)||(this.isSupportTopic=zl(n.isSupportTopic)?1===n.isSupportTopic:n.isSupportTopic),cd(this,n,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Zl(n.members)&&n.members.length>0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&cd(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};cd(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),Rv=function(e){return ed(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1}:e instanceof xM?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:qd(e.type,e.payload),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1}:t(t({},e),{},{messageForShow:qd(e.type,e.payload)})},Ov=function(){function e(t){o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Rv(t.lastMessage),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this._initProfile(t)}return a(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(gr.CONV_C2C)?this.conversationID.replace(gr.CONV_C2C,""):this.conversationID.startsWith(gr.CONV_GROUP)?this.conversationID.replace(gr.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),ed(this.userProfile)&&this.type===gr.CONV_C2C?this.userProfile=new Sv({userID:e.conversationID.replace("C2C","")}):ed(this.groupProfile)&&this.type===gr.CONV_GROUP&&(this.groupProfile=new Nv({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;ed(t)||(Id(this.subType)?this.unreadCount=0:n&&this.type===gr.CONV_GROUP||n&&this.type===gr.CONV_TOPIC||o&&this.type===gr.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Rv(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(v(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==n.indexOf(gr.CONV_AT_ME)&&-1!==n.indexOf(gr.CONV_AT_ALL)&&(n=[gr.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o),Ul.debug("Conversation.updateGroupAtInfoList conversationID:".concat(this.conversationID),this.groupAtInfoList)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!Ed({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(gr.CONV_AT_ME)>-1&&e.groupAtType.indexOf(gr.CONV_AT_ALL)>-1&&(t.atTypeArray=[gr.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(gr.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(gr.CONV_AT_ME)>-1&&(t.atTypeArray=[gr.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){this.unreadCount>=1&&(this.unreadCount-=1)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,n=e.time;return this.type===gr.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===gr.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}}]),e}(),Lv=function(){function e(t){o(this,e),this._conversationModule=t,this._className="MessageRemindHandler",this._updateSequence=0}return a(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._className,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:o_,updateSequence:this._updateSequence}).then((function(n){Ul.log("".concat(t," ok"));var o=n.data,r=o.updateSequence,a=o.muteFlagList;e._updateSequence=r,e._patchC2CMessageRemindType(a)})).catch((function(e){Ul.error("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,n=0,o="";Zl(e)&&e.length>0&&e.forEach((function(e){var r=e.userID,a=e.muteFlag;0===a?o=gr.MSG_REMIND_ACPT_AND_NOTE:1===a?o=gr.MSG_REMIND_DISCARD:2===a&&(o=gr.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:r,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),Ul.log("".concat(this._className,"._patchC2CMessageRemindType count:").concat(n))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):Zl(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._className,"._setGroupMessageRemindType"),o=e.groupID,r=e.messageRemindType,a="groupID:".concat(o," messageRemindType:").concat(r),s=new Uh(wh.SET_MESSAGE_REMIND_TYPE);return s.setMessage(a),this._getModule(ig).modifyGroupMemberInfo({groupID:o,messageRemindType:r,userID:this._conversationModule.getMyUserID()}).then((function(){s.setNetworkType(t._conversationModule.getNetworkType()).end(),Ul.log("".concat(n," ok. ").concat(a));var o=t.onGroupMessageRemindTypeUpdated(e);return VM(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(ag).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),Td(t)){var r=t,a=Fd(r),s=this._getModule(cg).getLocalTopic(a,r);return s&&(s.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:a,topic:s})),{topic:s}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._className,"._setC2CMessageRemindType"),o=e.userIDList,r=e.messageRemindType,a=o.slice(0,30),s=0;r===gr.MSG_REMIND_DISCARD?s=1:r===gr.MSG_REMIND_ACPT_NOT_NOTE&&(s=2);var i="userIDList:".concat(a," messageRemindType:").concat(r),c=new Uh(wh.SET_MESSAGE_REMIND_TYPE);return c.setMessage(i),this._conversationModule.request({protocolName:n_,requestData:{userIDList:a,muteFlag:s}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,s=o.updateSequence,i=o.errorList;t._updateSequence=s;var u=[],l=[];Zl(i)&&i.forEach((function(e){u.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=a.filter((function(e){return-1===u.indexOf(e)}));Ul.log("".concat(n," ok. successUserIDList:").concat(d," failureUserIDList:").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:r})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),a.length=u.length=0,JM({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];c.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._updateSequence=0}}]),e}(),kv=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="ConversationModule",mv.mixin(_(t)),t._messageListHandler=new gv,t._messageRemindHandler=new Lv(_(t)),t.singlyLinkedList=new Dv(100),t._pagingStatus=Fp.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._initListeners(),t}return a(r,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(_v,this._initLocalConversationList,this),e.on(fv,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new Uh(wh.GET_CONVERSATION_LIST_IN_STORAGE);Ul.log("".concat(this._className,"._initLocalConversationList."));var n="",o=this._getStorageConversationList();if(o){for(var r=o.length,a=0;a<r;a++){var s=o[a];if(s){if(s.conversationID==="".concat(gr.CONV_C2C,"@TLS#ERROR")||s.conversationID==="".concat(gr.CONV_C2C,"@TLS#NOT_FOUND"))continue;if(s.groupProfile){var i=s.groupProfile.type;if(Id(i))continue}}this._conversationMap.set(o[a].conversationID,new Ov(o[a]))}this.emitConversationUpdate(!0,!1),n="count:".concat(r)}else n="count:0";t.setNetworkType(this.getNetworkType()).setMessage(n).end(),this.getModule(rg)||this.triggerReady(),this.ready((function(){e._tmpGroupList.length>0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,r=void 0===o||o,a=e.isUnreadC2CMessage,s=void 0!==a&&a;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:r,isUnreadC2CMessage:s,isFromGetConversations:!1}),this._setStorageConversationList(),n.filter((function(e){return e.type===gr.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!Zl(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var r=t._conversationMap.get(o);r.groupProfile=JSON.parse(JSON.stringify(e)),r.lastMessage.lastSequence<e.nextMessageSeq&&(r.lastMessage.lastSequence=e.nextMessageSeq-1),r.subType||(r.subType=e.type)}})),n&&this.emitConversationUpdate(!0,!1)}else this._tmpGroupList=e}},{key:"_updateConversationUserProfile",value:function(e){var t=this;e.data.forEach((function(e){var n="C2C".concat(e.userID);t._conversationMap.has(n)&&(t._conversationMap.get(n).userProfile=e)})),this.emitConversationUpdate(!0,!1)}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=!1;e.forEach((function(e){(n=t._conversationMap.get(e.conversationID))&&(n.reduceUnreadCount(),n.isLastMessageRevoked(e)&&(o=!0,n.setLastMessageRevoked(!0)))})),o&&this.emitConversationUpdate(!0,!1)}}},{key:"onMessageDeleted",value:function(e){var t=this;if(0!==e.length){var n=null;e.forEach((function(e){(n=t._messageListHandler.getLocalMessage(e.conversationID,e.ID))&&(n.isDeleted=!0),e!==n&&(e.isDeleted=!0)}));for(var o=e[0].conversationID,r=this._messageListHandler.getLocalMessageList(o),a={},s=r.length-1;s>=0;s--)if(!r[s].isDeleted){a=r[s];break}var i=this._conversationMap.get(o);if(i){var c=!1;i.lastMessage.lastSequence===a.sequence&&i.lastMessage.lastTime===a.time||(Bd(a)&&(a=void 0),i.updateLastMessage(a),i.type!==gr.CONV_TOPIC&&(c=!0),Ul.log("".concat(this._className,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),i.lastMessage)),o.startsWith(gr.CONV_C2C)&&this.updateUnreadCount(o),c&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,n=e.from,o=e.to,r=e.time,a=e.sequence,s=e.elements,i=e.cloudCustomData,c=e.messageVersion,u=this.getMyUserID(),l="".concat(t).concat(o);o===u&&t===gr.CONV_C2C&&(l="".concat(t).concat(n));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(pr.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(Ul.log("".concat(this._className,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(_," from:").concat(n," to:").concat(o)),_){this.getModule(cg).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;Ul.debug("".concat(this._className.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===r&&f.lastSequence===a&&f.version!==c&&(f.type=s[0].type,f.payload=s[0].content,f.messageForShow=qd(f.type,f.payload),f.cloudCustomData=i,f.version=c,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,r=null;o.forEach((function(e){e.groupAtTips?r=e.groupAtTips:e.elements?r=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(r=t(t({},e),{},{sync:!0})),r.__random=e.random,r.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(r)})),Ul.debug("".concat(this._className,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,r=n.from,a=n.topicID,s=void 0===a?void 0:a,i=n.sync,c=void 0!==i&&i;if(r!==e.getMyUserID())if(ed(s)){var u=e._conversationMap.get("".concat(gr.CONV_GROUP).concat(o));u&&(u.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(gr.CONV_GROUP).concat(s));if(l){l.updateGroupAtInfoList(n);var d=e.getModule(cg),p=l.groupAtInfoList;d.onConversationProxy({topicID:s,groupAtInfoList:p})}if(Bd(l)&&c)e.updateTopicConversation([{conversationID:"".concat(gr.CONV_GROUP).concat(s),type:gr.CONV_TOPIC}]),e._conversationMap.get("".concat(gr.CONV_GROUP).concat(s)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==gr.CONV_C2C||n.push(e.conversationID.replace(gr.CONV_C2C,""))})),n.length>0){Ul.debug("".concat(this._className,"._getC2CPeerReadTime userIDList:").concat(n));var o=this.getModule(rg);o&&o.getRemotePeerReadTime(n)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(dg).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(dg).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(ag);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(pr.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return M(this._conversationMap.values()).filter((function(e){return e.type!==gr.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new Uh(wh.SYNC_CONVERSATION_LIST);return this._pagingStatus===Fp.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){return e._pagingStatus=Fp.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=Fp.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=m(e,2),r=o[0],a=o[1];t.setError(n,r,a).end()})),XM(n)}))}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),r=this.getModule(ag).getGroupList();Promise.all([n,o,r]).then((function(){var n=Date.now()-t;Ul.log("".concat(e._className,"._patchConversationProperties ok. cost ").concat(n," ms")),e.emitConversationUpdate(!0,!1)}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._className,"._pagingGetConversationList");return Ul.log("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex)),this._pagingStatus=Fp.PENDING,this.request({protocolName:c_,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingStartIndex,orderType:1}}).then((function(n){var o=n.data,r=o.completeFlag,a=o.conversations,s=void 0===a?[]:a,i=o.timeStamp,c=o.startIndex,u=o.pinnedTimeStamp,l=o.pinnedStartIndex;if(Ul.log("".concat(t," ok. completeFlag:").concat(r," count:").concat(s.length," isReady:").concat(e._isReady)),s.length>0){var d=e._getConversationOptions(s);e._updateLocalConversationList({conversationOptionsList:d,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return JM();e.triggerReady()}return e._pagingTimeStamp=i,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=u,e._pagingPinnedStartIndex=l,1!==r?e._pagingGetConversationList():(e._handleGroupAtTipsList(),JM())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(Ul.warn("".concat(t," failed. error:"),n),e.triggerReady())),n}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(M(t.toBeUpdatedConversationList),M(this._conversationMap)))),n||this._updateUserOrGroupProfile(t.newConversationList),Ul.debug("".concat(this._className,"._updateLocalConversationList cost ").concat(Date.now()-o," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,r=e.isUnreadC2CMessage,a=void 0!==r&&r,s=[],i=[],c=this.getModule(ag),u=this.getModule(sg),l=0,d=t.length;l<d;l++){var p=new Ov(t[l]),g=p.conversationID;if(g!=="".concat(gr.CONV_C2C,"@TLS#ERROR")&&g!=="".concat(gr.CONV_C2C,"@TLS#NOT_FOUND"))if(this._conversationMap.has(g)){var _=this._conversationMap.get(g),h=["unreadCount","allowType","adminForbidType","payload","isPinned"];!1===o&&h.push("lastMessage");var f=t[l].lastMessage,m=!ed(f);m||t[l].type===gr.CONV_TOPIC||this._onLastMessageNotExist(t[l]),ed(o)&&m&&null===_.lastMessage.payload&&(_.lastMessage.payload=f.payload),cd(_,p,h,[null,void 0,"",0,NaN]),_.updateUnreadCount({nextUnreadCount:p.unreadCount,isFromGetConversations:n,isUnreadC2CMessage:a}),o&&m&&(f.payload&&(_.lastMessage.payload=f.payload),_.type===gr.CONV_GROUP&&(_.lastMessage.nameCard=f.nameCard,_.lastMessage.nick=f.nick)),m&&_.lastMessage.cloudCustomData!==f.cloudCustomData&&(_.lastMessage.cloudCustomData=f.cloudCustomData||""),this._conversationMap.delete(g),s.push([g,_])}else{if(p.type===gr.CONV_GROUP&&c){var M=p.groupProfile.groupID,v=c.getLocalGroupProfile(M);v&&(p.groupProfile=v,p.updateUnreadCount({nextUnreadCount:0}))}else if(p.type===gr.CONV_C2C){var y=g.replace(gr.CONV_C2C,"");u&&u.isMyFriend(y)&&(p.remark=u.getFriendRemark(y))}i.push(p),s.push([g,p])}}var I=this.getModule(cg);return s.forEach((function(e){if(e[1].type===gr.CONV_TOPIC){var t=e[1],n=t.conversationID,o=t.unreadCount,r=t.groupAtInfoList;I.onConversationProxy({topicID:n.replace(gr.CONV_GROUP,""),unreadCount:o,groupAtInfoList:Bd(r)?void 0:r})}})),{toBeUpdatedConversationList:s,newConversationList:i}}},{key:"_onLastMessageNotExist",value:function(e){new Uh(wh.LAST_MESSAGE_NOT_EXIST).setMessage("".concat(JSON.stringify(e))).setNetworkType(this.getNetworkType()).end()}},{key:"_sortConversationList",value:function(e){var t=[],n=[];return e.forEach((function(e){!0===e[1].isPinned?t.push(e):n.push(e)})),t.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})).concat(n.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})))}},{key:"_sortConversationListAndEmitEvent",value:function(){this._conversationMap=new Map(this._sortConversationList(M(this._conversationMap))),this.emitConversationUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t=this;if(0!==e.length){var n=[],o=[],r=this.getModule(og),a=this.getModule(ag);e.forEach((function(e){if(e.type===gr.CONV_C2C)n.push(e.toAccount);else if(e.type===gr.CONV_GROUP){var t=e.toAccount;a.hasLocalGroup(t)?e.groupProfile=a.getLocalGroupProfile(t):o.push(t)}})),Ul.log("".concat(this._className,"._updateUserOrGroupProfile c2cUserIDList:").concat(n," groupIDList:").concat(o)),n.length>0&&r.getUserProfile({userIDList:n}).then((function(e){var n=e.data;Zl(n)?n.forEach((function(e){t._conversationMap.get("C2C".concat(e.userID)).userProfile=e})):t._conversationMap.get("C2C".concat(n.userID)).userProfile=n})),o.length>0&&a.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);cd(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],r=e.filter((function(e){var t=e.lastMsg;return Ql(t)})).filter((function(e){var t=e.type,n=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==n&&"@TLS#ERROR"!==n||2===t})),a=this.getMyUserID(),s=r.map((function(e){if(1===e.type){var r={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(r),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===a&&e.time<=e.c2cPeerReadTime},userProfile:new Sv(r),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:""}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.messageReadSeq+e.unreadCount,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||""}),groupProfile:new Nv({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0}}));o.length>0&&this.getModule(og).onConversationsProfileUpdated(o);return s}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,r=void 0===o?void 0:o,a=n.elements,s=void 0===a?[]:a,i=n.groupTips,c=void 0===i?{}:i;if(!ed(r)&&!Bd(c)){var u=new xM(c);u.setElement({type:gr.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:gr.MSG_GRP_TIP,payload:l}}return{type:s[0]?s[0].type:null,payload:s[0]?s[0].content:null}}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof xM&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){var t=this;Ul.log("".concat(this._className,".onConversationDeleted")),Zl(e)&&e.forEach((function(e){var n=e.type,o=e.userID,r=e.groupID,a="";1===n?a="".concat(gr.CONV_C2C).concat(o):2===n&&(a="".concat(gr.CONV_GROUP).concat(r)),t.deleteLocalConversation(a)}))}},{key:"onConversationPinned",value:function(e){var t=this;if(Zl(e)){var n=!1;e.forEach((function(e){var o,r=e.type,a=e.userID,s=e.groupID;1===r?o=t.getLocalConversation("".concat(gr.CONV_C2C).concat(a)):2===r&&(o=t.getLocalConversation("".concat(gr.CONV_GROUP).concat(s))),o&&(Ul.log("".concat(t._className,".onConversationPinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(Zl(e)){var n=!1;e.forEach((function(e){var o,r=e.type,a=e.userID,s=e.groupID;1===r?o=t.getLocalConversation("".concat(gr.CONV_C2C).concat(a)):2===r&&(o=t.getLocalConversation("".concat(gr.CONV_GROUP).concat(s))),o&&(Ul.log("".concat(t._className,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,r=e.count,a="".concat(this._className,".getMessageList"),s=this.getLocalConversation(n),i="";if(s&&s.groupProfile&&(i=s.groupProfile.type),Id(i))return Ul.log("".concat(a," not available in avchatroom. conversationID:").concat(n)),JM({messageList:[],nextReqMessageID:"",isCompleted:!0});(ed(r)||r>15)&&(r=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var c=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),u=this._completedMap.has(n);if(Ul.log("".concat(a," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(c," count:").concat(r," isCompleted:").concat(u)),this._needGetHistory({conversationID:n,remainingCount:c,count:r}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,r=e.storedMessageList,s=t._completedMap.has(n),i=r;c>0&&(i=t._messageListHandler.getLocalMessageList(n).slice(0,r.length+c));var u={nextReqMessageID:s?"":o,messageList:i,isCompleted:s};return Ul.log("".concat(a," ret.nextReqMessageID:").concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(i.length)),VM(u)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:r});return JM(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,r="".concat(this._className,"._getMessageListFromMemory"),a=this._messageListHandler.getLocalMessageList(t),s=a.length,i=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(i=a.findIndex((function(e){return e.ID===n})))>o?(c.messageList=a.slice(i-o,i),c.nextReqMessageID=a[i-o].ID):(c.messageList=a.slice(0,i),c.isCompleted=!0):s>o?(i=s-o,c.messageList=a.slice(i,s),c.nextReqMessageID=a[i].ID):(c.messageList=a.slice(0,s),c.isCompleted=!0),Ul.log("".concat(r," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(c.messageList.length)),c}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,r=e.count,a=e.direction,s=void 0===a?0:a;if((ed(r)||r>15)&&(r=15),t.startsWith(gr.CONV_C2C)){var i=this.getModule(rg),c=t.replace(gr.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:c,time:o,count:r,direction:s})}if(t.startsWith(gr.CONV_GROUP)){var u=this.getModule(ag),l=t.replace(gr.CONV_GROUP,"");return u.getRoamingMessagesHopping({groupID:l,sequence:n,count:r,direction:s})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),r=o.length;if(!n)return r;var a=0;return Sd(t)?a=o.findIndex((function(e){return e.ID===n})):Ad(t)&&(a=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===a&&(a=0),a}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,r=this.getLocalConversation(t),a="";return r&&r.groupProfile&&(a=r.groupProfile.type),!Dd(t)&&!Id(a)&&(!(Ad(t)&&this._isPagingGetGroupListCompleted()&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(gr.CONV_GROUP,"");return Td(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===gr.CONV_SYSTEM)return JM();var o=15;n>20&&(o=20);var r=null;if(Sd(t)){var a=this._roamingMessageKeyAndTimeMap.has(t);return(r=this.getModule(rg))?r.getRoamingMessage({conversationID:t,peerAccount:t.replace(gr.CONV_C2C,""),count:o,lastMessageTime:a?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:a?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}if(Ad(t)){if(!(r=this.getModule(ag)))return XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE});var s=null;this._conversationMap.has(t)&&(s=this._conversationMap.get(t).lastMessage);var i=0;s&&(i=s.lastSequence);var c=this._roamingMessageSequenceMap.get(t);return r.getRoamingMessage({conversationID:t,groupID:t.replace(gr.CONV_GROUP,""),count:o,sequence:c||i})}return JM()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,r=n.payload;if(Bd(o)||Bd(r)){var a=this._messageListHandler.getLocalMessageList(e);if(0===a.length)return;var s=a[a.length-1];Ul.log("".concat(this._className,".patchConversationLastMessage conversationID:").concat(e," payload:"),s.payload),t.updateLastMessage(s)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=n.startsWith(gr.CONV_C2C)?gr.CONV_C2C:gr.CONV_GROUP,a=null,s=[],i=[],c=0,u=e.length,l=null,d=r===gr.CONV_GROUP,p=this.getModule(_g),g=function(){c=d?e.length-1:0,u=d?0:e.length},_=function(){d?--c:++c},h=function(){return d?c>=u:c<u};for(g();h();_())if(d&&1===e[c].sequence&&o&&this.setCompleted(n),1!==e[c].isPlaceMessage)if((a=new xM(e[c])).to=e[c].to,r!==gr.CONV_GROUP||ed(e[c].topicID)||(a.to=e[c].topicID),a.isSystemMessage=!!e[c].isSystemMessage,a.conversationType=r,4===e[c].event?l={type:gr.MSG_GRP_TIP,content:t(t({},e[c].elements),{},{groupProfile:e[c].groupProfile})}:(e[c].elements=p.parseElements(e[c].elements,e[c].from),l=e[c].elements),d||a.setNickAndAvatar({nick:e[c].nick,avatar:e[c].avatar}),Bd(l)){var f=new Uh(wh.EMPTY_MESSAGE_BODY);f.setMessage("from:".concat(a.from," to:").concat(a.to," sequence:").concat(a.sequence," event:").concat(e[c].event)),f.setNetworkType(this.getNetworkType()).setLevel("warning").end()}else a.setElement(l),a.reInitialize(this.getMyUserID()),s.push(a);return g=_=h=null,o?(this._messageListHandler.unshift(s,i),s=null,i):(i=null,s)}},{key:"findMessage",value:function(e){return this._messageListHandler.findMessage(e)}},{key:"_isNotInCommunity",value:function(e){var t=!1;if(e.startsWith(gr.CONV_GROUP)&&this._isTopicConversation(e)){var n=Fd(e.replace(gr.CONV_GROUP,""));this.getModule(ag).hasLocalGroup(n)||(t=!0)}return t}},{key:"deleteTopicRoamingMessageInfo",value:function(e){var t=this;Ed({groupID:e})&&this._messageListHandler.getTopicConversationIDList(e).forEach((function(e){t._messageListHandler.removeByConversationID(e),t._completedMap.delete(e),t._roamingMessageSequenceMap.delete(e)}))}},{key:"deleteGroupRomaingMessageInfo",value:function(e){var t="".concat(gr.CONV_GROUP).concat(e);this._messageListHandler.removeByConversationID(t),this._completedMap.delete(t),this._roamingMessageSequenceMap.delete(t)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,n=this.getLocalConversation(t);if(Ul.log("".concat(this._className,".setMessageRead conversationID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n)return JM();if(n.type!==gr.CONV_GROUP&&n.type!==gr.CONV_TOPIC||Bd(n.groupAtInfoList)||this.deleteGroupAtTips(t),0===n.unreadCount)return JM();if(n.type===gr.CONV_GROUP&&!this._hasLocalGroup(t))return 0!==n.unreadCount&&(n.unreadCount=0,this.emitConversationUpdate(!0,!1)),JM();var o=this._messageListHandler.getLocalLastMessage(t),r=n.lastMessage.lastTime;o&&r<o.time&&(r=o.time);var a=n.lastMessage.lastSequence;if(o&&a<o.sequence&&(a=o.sequence),n.type===gr.CONV_TOPIC&&ed(o)){var s=this.getModule(cg),i=t.replace(gr.CONV_GROUP,""),c=Fd(i),u=s.getLocalTopic(c,i);u&&(a=u.nextMessageSeq-1)}var l=null;switch(n.type){case gr.CONV_C2C:return(l=this.getModule(rg))?l.setMessageRead({conversationID:t,lastMessageTime:r}):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE});case gr.CONV_GROUP:case gr.CONV_TOPIC:return(l=this.getModule(ag))?l.setMessageRead({conversationID:t,lastMessageSeq:a}):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE});case gr.CONV_SYSTEM:return n.unreadCount=0,this.emitConversationUpdate(!0,!1),JM();default:return JM()}}},{key:"setAllMessageRead",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="".concat(this._className,".setAllMessageRead");t.scope||(t.scope=gr.READ_ALL_MSG),Ul.log("".concat(n," options:"),t);var o=this._createSetAllMessageReadPack(t);if(0===o.readAllC2CMessage&&0===o.groupMessageReadInfoList.length)return JM();var r=new Uh(wh.SET_ALL_MESSAGE_READ);return this.request({protocolName:C_,requestData:o}).then((function(n){var o=n.data,a=e._handleAllMessageRead(o);return r.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(a))).setNetworkType(e.getNetworkType()).end(),JM()})).catch((function(t){return e.probeNetwork().then((function(e){var n=m(e,2),o=n[0],a=n[1];r.setError(t,o,a).end()})),Ul.warn("".concat(n," failed. error:"),t),XM({code:t&&t.code?t.code:yh.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:Ih.MESSAGE_UNREAD_ALL_FAIL})}))}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n<t.sequence&&(n=t.sequence),n}},{key:"_getConversationLastMessageTime",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastTime;return t&&n<t.time&&(n=t.time),n}},{key:"_createSetAllMessageReadPack",value:function(e){var t,n={readAllC2CMessage:0,groupMessageReadInfoList:[]},o=e.scope,r=S(this._conversationMap);try{for(r.s();!(t=r.n()).done;){var a=m(t.value,2)[1];if(a.unreadCount>0)if(a.type===gr.CONV_C2C&&0===n.readAllC2CMessage){if(o===gr.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===gr.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(a.type===gr.CONV_GROUP&&(o===gr.READ_ALL_GROUP_MSG||o===gr.READ_ALL_MSG)){var s=this._getConversationLastMessageSequence(a);n.groupMessageReadInfoList.push({groupID:a.groupProfile.groupID,messageSequence:s})}}}catch(i){r.e(i)}finally{r.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&this.emitConversationUpdate(!0,!1),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n<o;n++){var r=e[n],a=r.groupID,s=r.sequence,i=r.retCode,c=r.lastMessageSeq;ed(i)?this._remoteGroupReadSequenceMap.set(a,c):(this._remoteGroupReadSequenceMap.set(a,s),0!==i&&t.push("".concat(a,"-").concat(s,"-").concat(i)))}return t}},{key:"_updateAllConversationUnreadCount",value:function(e){var t,n=e.readAllC2CMessage,o=0,r=S(this._conversationMap);try{for(r.s();!(t=r.n()).done;){var a=m(t.value,2),s=a[0],i=a[1];if(i.unreadCount>=1){if(1===n&&i.type===gr.CONV_C2C){var c=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:s,lastMessageTime:c})}else if(i.type===gr.CONV_GROUP){var u=s.replace(gr.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(u)){var l=this._remoteGroupReadSequenceMap.get(u),d=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:s,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(u)}}this.updateUnreadCount(s,!1)&&(o+=1)}}}catch(p){r.e(p)}finally{r.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(gr.CONV_GROUP,""),r=!1;if(this._remoteGroupReadSequenceMap.has(o)){var a=this._remoteGroupReadSequenceMap.get(o);n<=a&&(r=!0,Ul.log("".concat(this._className,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(a))),n>=a+10&&this._remoteGroupReadSequenceMap.delete(o)}return r}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,r=this._messageListHandler.getLocalMessageList(t);if(0!==r.length)for(var a,s=r.length-1;s>=0;s--)if(a=r[s],!(o&&a.time>o||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),r=this._messageListHandler.getLocalMessageList(e);if(o){var a=o.unreadCount,s=r.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(a!==s&&(o.unreadCount=s,n=!0,Ul.log("".concat(this._className,".updateUnreadCount from ").concat(a," to ").concat(s,", conversationID:").concat(e)),!0===t&&this.emitConversationUpdate(!0,!1)),n&&o.type===gr.CONV_TOPIC){var i=o.unreadCount,c=this.getModule(cg),u=e.replace(gr.CONV_GROUP,"");c.onConversationProxy({topicID:u,unreadCount:i})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),Ul.log("".concat(this._className,".clearGroupAtInfoList conversationID:").concat(e)),n.type===gr.CONV_TOPIC){var o=n.groupAtInfoList,r=this.getModule(cg),a=e.replace(gr.CONV_GROUP,"");r.onConversationProxy({topicID:a,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,r=e.groupID,a=void 0===r?void 0:r,s=e.readReceiptList;if(!Bd(s)){var i=[];if(ed(o)){if(!ed(a)){var c="".concat(gr.CONV_GROUP).concat(a);s.forEach((function(e){var n=e.tinyID,o=e.clientTime,r=e.random,s=e.readCount,u=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(r),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:a,messageID:l,readCount:0,unreadCount:0};d&&(zl(s)&&(d.readReceiptInfo.readCount=s,p.readCount=s),zl(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),i.push(p))}))}}else{var u="".concat(gr.CONV_C2C).concat(o);s.forEach((function(e){var n=e.tinyID,r=e.clientTime,a=e.random,s="".concat(n,"-").concat(r,"-").concat(a),c=t._messageListHandler.getLocalMessage(u,s);if(c&&!c.isPeerRead){c.isPeerRead=!0;var l={userID:o,messageID:s,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(pr.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var r=o.unreadCount,a=r-n;a<0&&(a=0),o.unreadCount=a,Ul.log("".concat(this._className,".recomputeGroupUnreadCount from ").concat(r," to ").concat(a,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Dd(t.type)){for(var o=[],r=0,a=n.length;r<a;r++)"in"!==n[r].flow?"out"!==n[r].flow||n[r].isRead||n[r].setIsRead(!0):o.push(n[r]);var s=0;if(t.type===gr.CONV_C2C){var i=o.slice(-t.unreadCount).filter((function(e){return e.isRevoked})).length;s=o.length-t.unreadCount-i}else s=o.length-t.unreadCount;for(var c=0;c<s&&!o[c].isRead;c++)o[c].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t=this,n="".concat(this._className,".deleteGroupAtTips");Ul.log("".concat(n));var o=this._conversationMap.get(e);if(!o)return Promise.resolve();var r=o.groupAtInfoList;if(0===r.length)return Promise.resolve();var a=void 0;e.startsWith(gr.CONV_GROUP)&&(a=e.replace(gr.CONV_GROUP,""));var s=M(r);if((Ed({groupID:a})||Td(a))&&0===(s=r.filter((function(e){return!e.atTypeArray.includes(gr.CONV_AT_ALL)}))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var i=this.getMyUserID();return this.request({protocolName:p_,requestData:{messageListToDelete:s.map((function(e){return{from:e.from,to:i,messageSeq:e.__sequence,messageRandom:e.__random,groupID:ed(e.topicID)?e.groupID:e.topicID}}))}}).then((function(){return Ul.log("".concat(n," ok. count:").concat(r.length)),t.clearGroupAtInfoList(e,!1),Promise.resolve()})).catch((function(e){return Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"appendToMessageList",value:function(e){this._messageListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this.singlyLinkedList.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this.singlyLinkedList.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,n){return!(!this._messageListHandler.pushIn(t,n)||this._isMessageFromCurrentInstance(t)&&!n)&&(e.push(t),!0)}},{key:"_isMessageFromCurrentInstance",value:function(e){return this.singlyLinkedList.has(e.random)}},{key:"revoke",value:function(e,t,n){return this._messageListHandler.revoke(e,t,n)}},{key:"getPeerReadTime",value:function(e){return this._peerReadTimeMap.get(e)}},{key:"recordPeerReadTime",value:function(e,t){this._peerReadTimeMap.has(e)?this._peerReadTimeMap.get(e)<t&&this._peerReadTimeMap.set(e,t):this._peerReadTimeMap.set(e,t)}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){if(e.startsWith(gr.CONV_C2C)&&t>0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(pr.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;Bd(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){Ul.log("".concat(this._className,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="".concat(this._className,".getConversationList"),o="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(Ul.log("".concat(n,". ").concat(o)),this._pagingStatus===Fp.REJECTED){var r=new Uh(wh.GET_CONVERSATION_LIST);return r.setMessage(o),this.syncConversationList().then((function(){r.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return VM({conversationList:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}if(0===this._conversationMap.size){var a=new Uh(wh.GET_CONVERSATION_LIST);return a.setMessage(o),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return VM({conversationList:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}var s=this._getConversationList(e);return Ul.log("".concat(n,". returned conversation count:").concat(s.length)),JM({conversationList:s})}},{key:"_getConversationList",value:function(e){var t=this;if(ed(e))return this.getLocalConversationList();if(Zl(e)){var n=[];return e.forEach((function(e){if(t._conversationMap.has(e)){var o=t.getLocalConversation(e);n.push(o)}})),n}}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=S(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],r=n[1];r.type===gr.CONV_C2C&&(Ul.debug("".concat(this._className,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(r.peerReadTime)),this.recordPeerReadTime(o,r.peerReadTime))}}catch(a){t.e(a)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(ag).isPagingGetCompleted()}},{key:"_hasLocalGroup",value:function(e){return this.getModule(ag).hasLocalGroup(e.replace(gr.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new Ov({conversationID:e,type:e.slice(0,3)===gr.CONV_C2C?gr.CONV_C2C:gr.CONV_GROUP}))._isInfoCompleted||t.type===gr.CONV_SYSTEM)return JM({conversation:t});if(Ad(e)&&!this._hasLocalGroup(e))return JM({conversation:t});var o=new Uh(wh.GET_CONVERSATION_PROFILE),r="".concat(this._className,".getConversationProfile");return Ul.log("".concat(r,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(a){o.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(a.data.conversation.unreadCount)).end();var s=n.getModule(sg);if(s&&t.type===gr.CONV_C2C){var i=e.replace(gr.CONV_C2C,"");if(s.isMyFriend(i)){var c=s.getFriendRemark(i);t.remark!==c&&(t.remark=c,Ul.log("".concat(r,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return Ul.log("".concat(r," ok. conversationID:").concat(e)),a})).catch((function(t){return n.probeNetwork().then((function(n){var r=m(n,2),a=r[0],s=r[1];o.setError(t,a,s).setMessage("conversationID:".concat(e)).end()})),Ul.error("".concat(r," failed. error:"),t),XM(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===gr.CONV_C2C?this.getModule(og).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?XM(new YM({code:yh.USER_OR_GROUP_NOT_FOUND,message:Ih.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),JM({conversation:e}))})):this.getModule(ag).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),JM({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Ov&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(M(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(gr.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"deleteConversation",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e)){var o=new YM({code:yh.CONVERSATION_NOT_FOUND,message:Ih.CONVERSATION_NOT_FOUND});return XM(o)}var r=this._conversationMap.get(e).type;if(r===gr.CONV_C2C)n.type=1,n.toAccount=e.replace(gr.CONV_C2C,"");else{if(r!==gr.CONV_GROUP){if(r===gr.CONV_SYSTEM)return this.getModule(ag).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),this.deleteLocalConversation(e),JM({conversationID:e});var a=new YM({code:yh.CONVERSATION_UN_RECORDED_TYPE,message:Ih.CONVERSATION_UN_RECORDED_TYPE});return XM(a)}if(!this._hasLocalGroup(e))return this.deleteLocalConversation(e),JM({conversationID:e});n.type=2,n.toGroupID=e.replace(gr.CONV_GROUP,"")}var s=new Uh(wh.DELETE_CONVERSATION);s.setMessage("conversationID:".concat(e));var i="".concat(this._className,".deleteConversation");return Ul.log("".concat(i,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:l_,requestData:n})})).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(i," ok")),t.deleteLocalConversation(e),JM({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.error("".concat(i," failed. error:"),e),XM(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return XM({code:yh.CONVERSATION_NOT_FOUND,message:Ih.CONVERSATION_NOT_FOUND});var r=this.getLocalConversation(n);if(r.isPinned===o)return JM({conversationID:n});var a=new Uh(wh.PIN_CONVERSATION);a.setMessage("conversationID:".concat(n," isPinned:").concat(o));var s="".concat(this._className,".pinConversation");Ul.log("".concat(s,". conversationID:").concat(n," isPinned:").concat(o));var i=null;return Sd(n)?i={type:1,toAccount:n.replace(gr.CONV_C2C,"")}:Ad(n)&&(i={type:2,groupID:n.replace(gr.CONV_GROUP,"")}),this.request({protocolName:d_,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[i]}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(s," ok")),r.isPinned!==o&&(r.isPinned=o,t._sortConversationListAndEmitEvent()),VM({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.error("".concat(s," failed. error:"),e),XM(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,r=!1,a=this.getLocalConversation(n?"".concat(gr.CONV_C2C).concat(t):"".concat(gr.CONV_GROUP).concat(t));return a&&a.messageRemindType!==o&&(a.messageRemindType=o,r=!0),Ul.debug("".concat(this._className,".patchMessageRemindType options:"),e,"ret:".concat(r)),r}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this;Ul.debug("".concat(this._className,".onC2CMessageRemindTypeSynced options:"),e),e.dataList.forEach((function(e){if(!Bd(e.muteNotificationsSync)){var n,o=e.muteNotificationsSync,r=o.to,a=o.updateSequence,s=o.muteFlag;t._messageRemindHandler.setUpdateSequence(a),0===s?n=gr.MSG_REMIND_ACPT_AND_NOTE:1===s?n=gr.MSG_REMIND_DISCARD:2===s&&(n=gr.MSG_REMIND_ACPT_NOT_NOTE);var i=0;t.patchMessageRemindType({ID:r,isC2CConversation:!0,messageRemindType:n})&&(i+=1),Ul.log("".concat(t._className,".onC2CMessageRemindTypeSynced updateCount:").concat(i)),i>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){Ul.debug("".concat(this._className,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=this._conversationMap.has(e);if(Ul.log("".concat(this._className,".deleteLocalConversation conversationID:").concat(e," has:").concat(t)),t){this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e);var n=!this._isTopicConversation(e);this.emitConversationUpdate(n,!1)}}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(gr.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule(og).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),Ul.log("".concat(this._className,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-n," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){Ul.log("".concat(this._className,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var r=this._conversationMap.get(t).userProfile;Jl(n)&&r.nick!==n&&(r.nick=n),Jl(o)&&r.avatar!==o&&(r.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),r=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),Ul.log("".concat(this._className,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-r," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getGroupLocalLastMessageSequence",value:function(e){return this._messageListHandler.getGroupLocalLastMessageSequence(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(sg);if(!t)return e;var n=M(this._conversationMap.values()).filter((function(e){return e.type===gr.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(gr.CONV_C2C,"");if(t.isMyFriend(n)){var r=t.getFriendRemark(n);e.remark!==r&&(e.remark=r,o+=1)}})),Ul.log("".concat(this._className,".checkAndPatchRemark. c2c conversation count:").concat(n.length,", patched count:").concat(o)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===gr.CONV_C2C?n=this._moduleManager.getModule(rg):t.conversationType===gr.CONV_GROUP&&(n=this._moduleManager.getModule(ag)),n?n.sendReadReceipt(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===gr.CONV_C2C?n=this._moduleManager.getModule(rg):t.conversationType===gr.CONV_GROUP&&(n=this._moduleManager.getModule(ag)),n?n.getReadReceiptList(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._pagingStatus=Fp.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this.resetReady()}}]),r}(Dg),Gv=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),r=e._groupModule.hasLocalGroup(n);Ul.log("".concat(e._className,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(r," checkCount:").concat(o)),r?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){Ul.debug("".concat(this._className,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,r=t.AVChatRoomMessageList;(r.length>0&&this._groupModule.onAVChatRoomMessage(r),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(ug).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(pr.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,r=e.dataList,a=null,s=[],i=[],c={},u=[],l=function(e,l){var d=Md(r[e]),p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,M=void 0,v=2===h&&!Bd(m);if(v){M=gr.CONV_TOPIC,d.to=m;var y=n._groupModule.getModule(cg);y.hasLocalTopic(g,m)||n._getTopicPendingMap.has(m)||(n._getTopicPendingMap.set(m,1),y.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){n._getTopicPendingMap.delete(m)})))}if(2===h&&Bd(m))return"continue";var I=n._groupModule.hasLocalGroup(g);if(!I&&n._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!I&&!v)return n._cacheGroupTipsAndProbe({groupID:g,event:o,item:d}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(g))return d.event=o,u.push(d),"continue";d.currentUser=n._groupModule.getMyUserID(),d.conversationType=gr.CONV_GROUP,(a=new xM(d)).setElement({type:gr.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),a.isSystemMessage=!1;var E=n._groupModule.getModule(ug),T=a,S=T.conversationID,A=T.sequence;if(6===o)a._onlineOnlyFlag=!0,i.push(a);else if(!E.pushIntoNoticeResult(i,a))return"continue";if(6===o&&E.getLocalConversation(S))return"continue";6!==o&&n._groupModule.getModule(Sg).addMessageSequence({key:Rh,message:a});var D=E.isRemoteRead({conversationID:S,sequence:A});if(ed(c[S])){var C=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||D||(C=1)),c[S]=s.push({conversationID:S,unreadCount:C,type:ed(M)?a.conversationType:M,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var N=c[S];s[N].type=a.conversationType,s[N].subType=a.conversationSubType,s[N].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||D||s[N].unreadCount++)}},d=0,p=r.length;d<p;d++)l(d);return{eventDataList:s,result:i,AVChatRoomMessageList:u}}},{key:"handleMessageList",value:function(e){var t=this;e.forEach((function(e){switch(e.payload.operationType){case 1:t._onNewMemberComeIn(e);break;case 2:t._onMemberQuit(e);break;case 3:t._onMemberKickedOut(e);break;case 4:t._onMemberSetAdmin(e);break;case 5:t._onMemberCancelledAdmin(e);break;case 6:t._onGroupProfileModified(e);break;case 7:t._onMemberInfoModified(e);break;case 8:t._onTopicProfileUpdated(e);break;default:Ul.warn("".concat(t._className,".handleMessageList unknown operationType:").concat(e.payload.operationType))}}))}},{key:"_onNewMemberComeIn",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,r=this._groupModule.getLocalGroupProfile(o);r&&zl(n)&&r.memberCount!==n&&(r.memberCount=n,this._updateConversationGroupProfile(r))}},{key:"_onMemberQuit",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,r=this._groupModule.getLocalGroupProfile(o);r&&zl(n)&&r.memberCount!==n&&(r.memberCount=n,this._updateConversationGroupProfile(r)),this._groupModule.getModule(ig).deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,r=this._groupModule.getLocalGroupProfile(o);r&&zl(n)&&r.memberCount!==n&&(r.memberCount=n,this._updateConversationGroupProfile(r)),this._groupModule.getModule(ig).deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_updateConversationGroupProfile",value:function(e){this._groupModule.getModule(ug).updateConversationGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getModule(ig);n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(gr.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getModule(ig);n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(gr.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,n=e.payload,o=n.newGroupProfile,r=n.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(r);Object.keys(o).forEach((function(e){switch(e){case"ownerID":t._ownerChanged(a,o);break;case"muteAllMembers":a.muteAllMembers=o.muteAllMembers;break;case"joinOption":a.joinOption=o.joinOption;break;default:a[e]=o[e]}}));var s=!a.isSupportTopic;this._groupModule.emitGroupListUpdate(!0,s)}},{key:"_ownerChanged",value:function(e,t){var n=e.groupID,o=this._groupModule.getLocalGroupProfile(n),r=this._groupModule.getMyUserID();if(r===t.ownerID){o.updateGroup({selfInfo:{role:gr.GRP_MBR_ROLE_OWNER}});var a=this._groupModule.getModule(ig),s=a.getLocalGroupMemberInfo(n,r),i=this._groupModule.getLocalGroupProfile(n).ownerID,c=a.getLocalGroupMemberInfo(n,i);s&&s.updateRole(gr.GRP_MBR_ROLE_OWNER),c&&c.updateRole(gr.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,r=n.memberList,a=o.groupID;Td(t)&&this._updateTopicMuteTime(e);var s=this._groupModule.getModule(ig);r.forEach((function(e){var t=s.getLocalGroupMemberInfo(a,e.userID);t&&zl(e.muteTime)&&t.updateMuteUntil(e.muteTime)}))}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,r=n.memberList,a=void 0===r?[]:r,s=this._groupModule.getModule(cg),i=o.groupID,c=s.getLocalTopic(i,t);if(c){for(var u=!1,l=0;l<a.length;l++){var d=a[l];if(d.userID===this._groupModule.getMyUserID()&&d.muteTime>=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:i,topic:c})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,r=n.newTopicInfo;this._groupModule.getModule(cg).onTopicProfileUpdated(t({groupID:o,topicID:e.to},r))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Ul.log("".concat(this._className,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,r=e.item;this._cacheGroupTips(n,{event:o,dataList:[r]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===gr.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Ul.log("".concat(this._className,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Pv=function(){function e(t){o(this,e),this._groupModule=t,this._className="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(_v,this._initGroupList,this)}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),r=e._groupModule.hasLocalGroup(n);Ul.log("".concat(e._className,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(r," checkCount:").concat(o)),r?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"_initGroupList",value:function(){var e=this;Ul.log("".concat(this._className,"._initGroupList"));var t=new Uh(wh.GET_GROUP_LIST_IN_STORAGE),n=this._groupModule.getStorageGroupList();if(Zl(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();Ul.log("".concat(this._className,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var t="".concat(this._className,".handleUpdateGroupLastMessage");if(Ul.debug("".concat(t," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var n,o,r,a=!1,s=0,i=e.length;s<i;s++)(n=e[s]).type===gr.CONV_GROUP&&(o=n.conversationID.split(/^GROUP/)[1],(r=this._groupModule.getLocalGroupProfile(o))&&(r.lastMessage=n.lastMessage,a=!0));a&&(this._groupModule.sortLocalGroupList(),this._groupModule.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewGroupMessage",value:function(e){Ul.debug("".concat(this._className,".onNewGroupMessage count:").concat(e.dataList.length));var t=this._newGroupMessageStoredAndSummary(e),n=t.conversationOptionsList,o=t.messageList,r=t.AVChatRoomMessageList;(r.length>0&&this._groupModule.onAVChatRoomMessage(r),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(ug).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));var a=this._groupModule.filterUnmodifiedMessage(o);a.length>0&&this._groupModule.emitOuterEvent(pr.MESSAGE_RECEIVED,a),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,r=e.isInstantMessage,a=null,s=[],i=[],c=[],u={},l=this._groupModule.getModule(_g),d=this._groupModule.getModule(Sg),p=n.length;p>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var p=Md(n[e]),g=p.groupProfile,_=g.groupID,h=g.communityType,f=void 0===h?0:h,m=g.topicID,M=void 0===m?void 0:m,v=void 0,y=2===f&&!Bd(M);if(y){v=gr.CONV_TOPIC,p.to=M;var I=t._groupModule.getModule(cg);I.hasLocalTopic(_,M)||t._getTopicPendingMap.has(M)||(t._getTopicPendingMap.set(M,1),I.getTopicList({groupID:_,topicIDList:[M]}).finally((function(){t._getTopicPendingMap.delete(M)})))}if(2===f&&Bd(M))return"continue";var E=t._groupModule.hasLocalGroup(_);if(!E&&t._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!E&&!y)return t._cacheGroupMessageAndProbe({groupID:_,event:o,item:p}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(_))return p.event=o,c.push(p),"continue";p.currentUser=t._groupModule.getMyUserID(),p.conversationType=gr.CONV_GROUP,p.isSystemMessage=!!p.isSystemMessage,a=new xM(p),p.elements=l.parseElements(p.elements,p.from),a.setElement(p.elements);var T=1===n[e].isModified,S=t._groupModule.getModule(ug);if(S.isMessageSentByCurrentInstance(a)?a.isModified=T:T=!1,1===p.onlineOnlyFlag)a._onlineOnlyFlag=!0,S.isMessageSentByCurrentInstance(a)||i.push(a);else{if(!S.pushIntoMessageList(i,a,T))return"continue";d.addMessageSequence({key:Rh,message:a}),r&&a.clientTime>0&&d.addMessageDelay(a.clientTime);var A=a,D=A.conversationID,C=A.sequence,N=S.isRemoteRead({conversationID:D,sequence:C});if(ed(u[D])){var R=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||N||(R=1)),u[D]=s.push({conversationID:D,unreadCount:R,type:ed(v)?a.conversationType:v,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var O=u[D];s[O].type=ed(v)?a.conversationType:v,s[O].subType=a.conversationSubType,s[O].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||N||s[O].unreadCount++)}}},_=0;_<p;_++)g(_);return{conversationOptionsList:s,messageList:i,AVChatRoomMessageList:c}}},{key:"onGroupMessageRevoked",value:function(e){Ul.debug("".concat(this._className,".onGroupMessageRevoked nums:").concat(e.dataList.length));var t=this._groupModule.getModule(ug),n=[],o=null;e.dataList.forEach((function(e){var r=e.elements.revokedInfos;ed(r)||r.forEach((function(e){var r=ed(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);(o=t.revoke(r,e.sequence,e.random))&&n.push(o)}))})),0!==n.length&&(t.onMessageRevoked(n),this._groupModule.emitOuterEvent(pr.MESSAGE_REVOKED,n))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(M(this._groupModule.getGroupMap())),n=0,o=e.length;n<o;n++)t.delete(e[n].groupID);this._groupModule.hasJoinedAVChatRoom()&&this._groupModule.getJoinedAVChatRoom().forEach((function(e){t.delete(e)}));this._groupModule.getGroupMap().forEach((function(e,n){e.isSupportTopic&&t.delete(n)}));for(var r=M(t.keys()),a=0,s=r.length;a<s;a++)this._groupModule.deleteGroup(r[a])}},{key:"getGroupList",value:function(e){var t=this,n="".concat(this._className,".getGroupList"),o=new Uh(wh.GET_GROUP_LIST);Ul.log("".concat(n));var r={introduction:"Introduction",notification:"Notification",createTime:"CreateTime",ownerID:"Owner_Account",lastInfoTime:"LastInfoTime",memberNum:"MemberNum",maxMemberNum:"MaxMemberNum",joinOption:"ApplyJoinOption",muteAllMembers:"ShutUpAllMember"},a=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime","AtInfoList"],s=[];e&&e.groupProfileFilter&&e.groupProfileFilter.forEach((function(e){r[e]&&a.push(r[e])}));var i=(e||{}).isGroupWithTopicOnly,c=void 0!==i&&i;return this._pagingGetGroupList({limit:50,offset:0,groupBaseInfoFilter:a,groupList:s,isGroupWithTopicOnly:c}).then((function(){Ul.log("".concat(n," ok. count:").concat(s.length," isGroupWithTopicOnly:").concat(c)),c||t._groupListTreeShaking(s),t._groupModule.updateGroupMap(s);var e=t._groupModule.getLocalGroupList().length;o.setNetworkType(t._groupModule.getNetworkType()).setMessage("remote count:".concat(s.length,", after tree shaking, local count:").concat(e,", isGroupWithTopicOnly:").concat(c)).end(),t.tempConversationList&&(Ul.log("".concat(n," update last message with tempConversationList, count:").concat(t.tempConversationList.length)),t.handleUpdateGroupLastMessage({data:t.tempConversationList}),t.tempConversationList=null),t._groupModule.patchGroupMessageRemindType(),t._groupModule.recomputeUnreadCount(),t._groupModule.emitGroupListUpdate(!0,!c);var r=t._groupModule.getLocalGroupList();if(c){var a=r.filter((function(e){return!0===e.isSupportTopic}));return VM({groupList:a})}return t._isPagingGetCompleted=!0,VM({groupList:r})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"isPagingGetCompleted",value:function(){return this._isPagingGetCompleted}},{key:"_pagingGetGroupList",value:function(e){var t=this,n="".concat(this._className,"._pagingGetGroupList"),o=e.isCommunityRelay,r=void 0!==o&&o,a=e.isGroupWithTopicOnly,s=void 0!==a&&a,i=e.limit,c=e.offset,u=e.groupBaseInfoFilter,l=e.groupList;if(s)return this._pagingGetGroupListWithTopic({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l});var d=new Uh(wh.PAGING_GET_GROUP_LIST);return this._groupModule.request({protocolName:g_,requestData:{type:r?gr.GRP_COMMUNITY:void 0,memberAccount:this._groupModule.getMyUserID(),limit:i,offset:c,responseFilter:{groupBaseInfoFilter:u,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then((function(e){var o=e.data,a=o.groups,s=void 0===a?[]:a,p=o.totalCount;l.push.apply(l,M(s)),t._handleGroupAtInfoWithoutTopic(r,s);var g=c+i,_=!(p>g),h="offset:".concat(c," totalCount:").concat(p," isCompleted:").concat(_," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(r);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),r||_?!r&&_?(Ul.log("".concat(n," start to get community list")),c=0,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):r&&!_?(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):(Ul.log("".concat(n," ok. totalCount:").concat(l.length)),VM({groupList:l})):(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];d.setMessage("isCommunityRelay:".concat(r)).setError(e,o,a).end()})),r?(11e3===e.code&&(d=null,Ul.log("".concat(n," ok. community unavailable"))),JM({groupList:l})):XM(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._className,"._pagingGetGroupListWithTopic"),o=e.limit,r=e.offset,a=e.groupBaseInfoFilter,s=e.groupList,i=new Uh(wh.PAGING_GET_GROUP_LIST_WITH_TOPIC);return this._groupModule.request({protocolName:g_,requestData:{type:gr.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:r,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var c=e.data,u=c.groups,l=void 0===u?[]:u,d=c.totalCount;s.push.apply(s,M(l));var p=r+o,g=!(d>p),_="offset:".concat(r," totalCount:").concat(d," isCompleted:").concat(g," ")+"currentCount:".concat(s.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),g?(Ul.log("".concat(n," ok. totalCount:").concat(s.length)),VM({groupList:s})):(r=p,t._pagingGetGroupListWithTopic({limit:o,offset:r,groupBaseInfoFilter:a,groupList:s}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];i.setError(e,o,r).end()})),XM(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),Ul.log("".concat(this._className,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,r=e.item;this._cacheGroupMessage(n,{event:o,dataList:[r]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===gr.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Ul.log("".concat(this._className,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,r=e.groupAtInfoList,a=[];ed(r)||(r.forEach((function(e){a.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(ug).onNewGroupAtTips({dataList:a}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(_v,this._initGroupList,this)}}]),e}(),bv={1:"init",2:"modify",3:"clear",4:"delete"},Uv=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupAttributesHandler",this._groupAttributesMap=new Map,this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(hv,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");ed(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,r=o.mainSequence,a=o.hasChangedAttributeInfo,s=o.groupAttributeList,i=void 0===s?[]:s,c=o.operationType;if(Ul.log("".concat(this._className,".onGroupAttributesUpdated. groupID:").concat(n," hasChangedAttributeInfo:").concat(a," operationType:").concat(c)),!ed(c)){if(1===a){if(4===c){var u=[];i.forEach((function(e){u.push(e.key)})),i=M(u),u=null}return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:r,groupAttributeList:i,operationType:bv[c]}),void this._emitGroupAttributesUpdated(n)}if(this._groupAttributesMap.has(n)){var l=this._groupAttributesMap.get(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),Ul.log("".concat(this._className,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,r=this._checkCachedGroupAttributes({groupID:n,funcName:"initGroupAttributes"});if(!0!==r)return XM(r);var a=this._groupAttributesMap.get(n),s=a.remoteMainSequence,i=a.avChatRoomKey,c=new Uh(wh.INIT_GROUP_ATTRIBUTES);return c.setMessage("groupID:".concat(n," mainSequence:").concat(s," groupAttributes:").concat(JSON.stringify(o))),this._groupModule.request({protocolName:x_,requestData:{groupID:n,avChatRoomKey:i,mainSequence:s,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){var r=e.data,a=r.mainSequence,s=M(r.groupAttributeList);return s.forEach((function(e){e.value=o[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:s,operationType:"init"}),c.setNetworkType(t._groupModule.getNetworkType()).end(),Ul.log("".concat(t._className,".initGroupAttributes ok. groupID:").concat(n)),VM({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];c.setError(e,o,r).end()})),XM(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,r=this._checkCachedGroupAttributes({groupID:n,funcName:"setGroupAttributes"});if(!0!==r)return XM(r);var a=this._groupAttributesMap.get(n),s=a.remoteMainSequence,i=a.avChatRoomKey,c=a.attributes,u=this._transformGroupAttributes(o);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new Uh(wh.SET_GROUP_ATTRIBUTES);return l.setMessage("groupID:".concat(n," mainSequence:").concat(s," groupAttributes:").concat(JSON.stringify(o))),this._groupModule.request({protocolName:V_,requestData:{groupID:n,avChatRoomKey:i,mainSequence:s,groupAttributeList:u}}).then((function(e){var r=e.data,a=r.mainSequence,s=M(r.groupAttributeList);return s.forEach((function(e){e.value=o[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:s,operationType:"modify"}),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ul.log("".concat(t._className,".setGroupAttributes ok. groupID:").concat(n)),VM({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setError(e,o,r).end()})),XM(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,r=void 0===o?[]:o,a=this._checkCachedGroupAttributes({groupID:n,funcName:"deleteGroupAttributes"});if(!0!==a)return XM(a);var s=this._groupAttributesMap.get(n),i=s.remoteMainSequence,c=s.avChatRoomKey,u=s.attributes,l=M(u.keys()),d=H_,p="clear",g={groupID:n,avChatRoomKey:c,mainSequence:i};if(r.length>0){var _=[];l=[],d=B_,p="delete",r.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,l.push(e)),_.push({key:e,sequence:t})})),g.groupAttributeList=_}var h=new Uh(wh.DELETE_GROUP_ATTRIBUTES);return h.setMessage("groupID:".concat(n," mainSequence:").concat(i," keyList:").concat(r," protocolName:").concat(d)),this._groupModule.request({protocolName:d,requestData:g}).then((function(e){var o=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:r,operationType:p}),h.setNetworkType(t._groupModule.getNetworkType()).end(),Ul.log("".concat(t._className,".deleteGroupAttributes ok. groupID:").concat(n)),VM({keyList:l})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];h.setError(e,o,r).end()})),XM(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n=e.groupID,o=this._checkCachedGroupAttributes({groupID:n,funcName:"getGroupAttributes"});if(!0!==o)return XM(o);var r=this._groupAttributesMap.get(n),a=r.avChatRoomKey,s=r.lastUpdateTime,i=r.localMainSequence,c=r.remoteMainSequence,u=new Uh(wh.GET_GROUP_ATTRIBUTES);if(u.setMessage("groupID:".concat(n," localMainSequence:").concat(i," remoteMainSequence:").concat(c," keyList:").concat(e.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||i<c)return this._getGroupAttributes({groupID:n,avChatRoomKey:a}).then((function(o){u.setMoreMessage("get attributes from remote. count:".concat(o.length)).setNetworkType(t._groupModule.getNetworkType()).end(),Ul.log("".concat(t._className,".getGroupAttributes from remote. groupID:").concat(n));var r=t._getLocalGroupAttributes(e);return VM({groupAttributes:r})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];u.setError(e,o,r).end()})),XM(e)}));u.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(),Ul.log("".concat(this._className,".getGroupAttributes from cache. groupID:").concat(n));var l=this._getLocalGroupAttributes(e);return JM({groupAttributes:l})}},{key:"_getGroupAttributes",value:function(e){var n=this;return this._groupModule.request({protocolName:K_,requestData:t({},e)}).then((function(t){var o=t.data,r=o.mainSequence,a=o.groupAttributeList,s=M(a);return ed(r)||n._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:r,groupAttributeList:s,operationType:"get"}),Ul.log("".concat(n._className,"._getGroupAttributes ok. groupID:").concat(e.groupID)),a})).catch((function(e){return XM(e)}))}},{key:"_getLocalGroupAttributes",value:function(e){var t=e.groupID,n=e.keyList,o=void 0===n?[]:n,r={};if(!this._groupAttributesMap.has(t))return r;var a=this._groupAttributesMap.get(t).attributes;if(o.length>0)o.forEach((function(e){a.has(e)&&(r[e]=a.get(e).value)}));else{var s,i=S(a.keys());try{for(i.s();!(s=i.n()).done;){var c=s.value;r[c]=a.get(c).value}}catch(u){i.e(u)}finally{i.f()}}return r}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,o=e.groupAttributeList,r=e.operationType;if(this._groupAttributesMap.has(t)){var a=this._groupAttributesMap.get(t),s=a.localMainSequence;if("get"===r||n-s==1)a.remoteMainSequence=n,a.localMainSequence=n,a.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:a,groupAttributeList:o,operationType:r});else{if(s===n)return;a.remoteMainSequence=n}this._groupAttributesMap.set(t,a);var i="operationType:".concat(r," localMainSequence:").concat(s," remoteMainSequence:").concat(n);Ul.log("".concat(this._className,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;"clear"!==o?"delete"!==o?("init"===o&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,r=e.sequence;t.attributes.set(n,{value:o,sequence:r})}))):n.forEach((function(e){t.attributes.delete(e)})):t.attributes.clear()}},{key:"_checkCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.funcName;if(this._groupModule.hasLocalGroup(t)&&this._groupModule.getLocalGroupProfile(t).type!==gr.GRP_AVCHATROOM){return Ul.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat("非直播群不能使用群属性 API")),new YM({code:yh.CANNOT_USE_GRP_ATTR_NOT_AVCHATROOM,message:"非直播群不能使用群属性 API"})}var o=this._groupAttributesMap.get(t);if(ed(o)){var r="如果 groupID:".concat(t," 是直播群,使用 ").concat(n," 前先使用 joinGroup 接口申请加入群组,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return Ul.warn("".concat(this._className,"._checkCachedGroupAttributes. ").concat(r)),new YM({code:yh.CANNOT_USE_GRP_ATTR_AVCHATROOM_UNJOIN,message:r})}return!0}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getLocalGroupAttributes({groupID:e});this._groupModule.emitOuterEvent(pr.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t})}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this.CACHE_EXPIRE_TIME=3e4}}]),e}(),wv=function(){function e(t){o(this,e);var n=t.manager,r=t.groupID,a=t.onInit,s=t.onSuccess,i=t.onFail;this._className="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=a,this._onSuccess=s,this._onFail=i,this._groupID=r,this._timeoutID=-1,this._isRunning=!1,this._protocolName=b_}return a(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=U_),Ul.log("".concat(this._className,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){Ul.log("".concat(this._className,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}]),e}(),Fv={3:!0,4:!0,5:!0,6:!0,17:!0},qv=function(){function e(t){o(this,e),this._groupModule=t,this._className="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Dv(200),this.messageIDLinkedList=new Dv(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map}return a(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?M(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===M(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq}):t({},n)}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,r=n.nextSeq,a=n.rspMsgList,s=n.errorCode,i=n.nextBroadcastSeq,c=n.broadcastMessageList;if(0!==s){var u=this._pollingRequestInfoMap.get(e),l=new Uh(wh.LONG_POLLING_AV_ERROR),d=u?"".concat(u.key,"-").concat(u.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;Jl(o)&&zl(r)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:r}),zl(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),Zl(a)&&a.length>0?(a.forEach((function(e){e.to=e.groupID})),this.onMessage(a)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(Zl(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(ug),r=this._getModule(Sg),a=e.length;a>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var s=this._getModule(lg),i=0;i<a;i++)if(Fv[e[i].event]){this.receivedMessageCount+=1,t=this.packMessage(e[i],e[i].event);var c=1===e[i].isModified,u=1===e[i].isHistoryMessage;if((s.isUnlimitedAVChatRoom()||!this.sequencesLinkedList.has(t.sequence))&&!this.messageIDLinkedList.has(t.ID)){var l=t.conversationID;if(this.receivedMessageCount%50==0?this._getModule(yg).detectFirstRound(l,this.sequencesLinkedList.data()):this.receivedMessageCount%80==0&&this._getModule(yg).detectSecondRound(l,this.sequencesLinkedList.data()),null!==this.sequencesLinkedList.tail()){var d=this.sequencesLinkedList.tail().value,p=t.sequence-d;p>1&&p<=20?this._getModule(yg).onMessageMaybeLost(l,d+1,p-1):p<-1&&p>=-20&&this._getModule(yg).onMessageMaybeLost(l,t.sequence+1,Math.abs(p)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var g=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(g=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):g=!0,g){if(t.conversationType===gr.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!u&&t.conversationType!==gr.CONV_SYSTEM){var _=t.conversationID.replace(gr.CONV_GROUP,"");this._pollingInstanceMap.has(_)?r.addMessageSequence({key:Lh,message:t}):(t.type!==gr.MSG_GRP_TIP&&t.clientTime>0&&r.addMessageDelay(t.clientTime),r.addMessageSequence({key:Oh,message:t}))}n.push(t)}}}else Ul.warn("".concat(this._className,".onMessage 未处理的 event 类型: ").concat(e[i].event));if(0!==n.length){this._groupModule.filterModifiedMessage(n);var h=this.packConversationOption(n);if(h.length>0)this._getModule(ug).onNewMessage({conversationOptionsList:h,isInstantMessage:!0});Ul.debug("".concat(this._className,".onMessage count:").concat(n.length)),this._checkMessageStacked(n);var f=this._groupModule.filterUnmodifiedMessage(n);f.length>0&&this._groupModule.emitOuterEvent(pr.MESSAGE_RECEIVED,f),n.length=0}}}},{key:"_onGroupDismissed",value:function(e){Ul.log("".concat(this._className,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t=e.length;t>=100&&(Ul.warn("".concat(this._className,"._checkMessageStacked 直播群消息堆积数:").concat(e.length,'!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new Uh(wh.MESSAGE_STACKED).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(t," groupID:").concat(M(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(ug).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?gr.CONV_SYSTEM:gr.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new xM(e),o=this.packElements(e,t);return n.setElement(o),n}},{key:"packElements",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),this._onGroupAttributesUpdated(e),{type:gr.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:gr.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(_g).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var o=e[n],r=o.conversationID;if(t.has(r)){var a=t.get(r);a.lastMessage=o,"in"===o.flow&&a.unreadCount++}else t.set(r,{conversationID:o.conversationID,unreadCount:"out"===o.flow?0:1,type:o.conversationType,subType:o.conversationSubType,lastMessage:o})}return M(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t=e.groupProfile.groupID,n=e.elements.onlineMemberInfo,o=void 0===n?void 0:n;if(!Bd(o)){var r=o.onlineMemberNum,a=void 0===r?0:r,s=o.expireTime,i=void 0===s?this.DEFAULT_EXPIRE_TIME:s,c=this._onlineMemberCountMap.get(t)||{},u=Date.now();Bd(c)?Object.assign(c,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:u,memberCount:a,expireTime:i}):(c.latestUpdateTime=u,c.memberCount=a),Ul.debug("".concat(this._className,"._updateMemberCountByGroupTips info:"),c),this._onlineMemberCountMap.set(t,c)}}},{key:"_onBroadcastMessage",value:function(e){if(!Bd(e)){for(var t=[],n=e.length,o=null,r=0;r<n;r++)Fv[e[r].event]?((o=this.packMessage(e[r],e[r].event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(o.ID)||(t.push(o),this._broadcastMessageIDMap.set(o.ID,1))):Ul.warn("".concat(this._className,"._onBroadcastMessage 未处理的 event 类型: ").concat(e[r].event));t.length>0&&this._groupModule.emitOuterEvent(pr.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new wv({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),Ul.log("".concat(this._className,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,r=o.groupID;return t._joinedGroupMap.set(r,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(r),t._groupModule.emitGroupListUpdate(!0,!1),ed(n)?JM({status:Hl,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,r=e.startSeq,a=void 0===r?0:r,s=o.groupID;return t._pollingRequestInfoMap.set(s,{key:n,startSeq:a}),t.start(s),t._groupModule.isLoggedIn()?JM({status:Hl,group:o}):JM({status:Hl})}))}},{key:"_preCheck",value:function(){if(this._getModule(lg).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===gr.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._className,".joinWithoutAuth"),r=new Uh(wh.JOIN_WITHOUT_AUTH);return this._groupModule.request({protocolName:v_,requestData:e}).then((function(e){var a=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2),o=(t[0],t[1]);r.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(a)).end(!0)})),ed(a))return XM(new YM({code:yh.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN,message:Ih.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN}));Ul.log("".concat(o," ok. groupID:").concat(n)),t._getModule(ug).setCompleted("".concat(gr.CONV_GROUP).concat(n));var s=new Nv({groupID:n});return t.startRunLoop({group:s,longPollingKey:a}),VM({status:Hl})})).catch((function(e){return Ul.error("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];r.setError(e,a,s).setMessage("groupID:".concat(n)).end(!0)})),XM(e)})).finally((function(){t._groupModule.getModule(pg).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return Bd(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return VM({memberCount:e.memberCount})})).catch((function(e){return XM(e)}))):JM({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._className,"._getGroupOnlineMemberCount");return this._groupModule.request({protocolName:w_,requestData:{groupID:e}}).then((function(o){var r=t._onlineMemberCountMap.get(e)||{},a=o.data,s=a.onlineMemberNum,i=void 0===s?0:s,c=a.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;Ul.log("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(u));var l=Date.now();return Bd(r)&&(r.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(r,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:u})),{memberCount:i}})).catch((function(o){return Ul.warn("".concat(n," failed. error:"),o),new Uh(wh.GET_GROUP_ONLINE_MEMBER_COUNT).setCode(o.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:"_onGroupAttributesUpdated",value:function(e){var t=e.groupID,n=e.elements,o=n.operationType,r=n.newGroupProfile;if(6===o){var a=(void 0===r?void 0:r).groupAttributeOption;Bd(a)||this._groupModule.onGroupAttributesUpdated({groupID:t,groupAttributeOption:a})}}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){ed(e)||(zl(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){ed(e)||(zl(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){ed(e)||(zl(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"reset",value:function(e){if(e){Ul.log("".concat(this._className,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{Ul.log("".concat(this._className,".reset all"));var n,o=S(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(r){o.e(r)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),xv=1,Vv=15,Bv=function(){function e(t){o(this,e),this._groupModule=t,this._className="GroupSystemNoticeHandler",this.pendencyMap=new Map}return a(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;Ul.debug("".concat(this._className,".onReceiveSystemNotice count:").concat(t.length));var r=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),a=r.eventDataList,s=r.result;a.length>0&&(this._groupModule.getModule(ug).onNewMessage({conversationOptionsList:a,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:s,isInstantMessage:o}));o?s.length>0&&this._groupModule.emitOuterEvent(pr.MESSAGE_RECEIVED,s):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,r=null,a=n.length,s=0,i=[],c={conversationID:gr.CONV_SYSTEM,unreadCount:0,type:gr.CONV_SYSTEM,subType:null,lastMessage:null};for(s=0;s<a;s++){var u=n[s],l=u.groupProfile,d=l.communityType,p=void 0===d?0:d,g=l.topicID,_=void 0===g?void 0:g,h=u.elements,f=h.topicIDList,m=void 0===f?void 0:f,M=h.operationType;if(!(2!==p||Bd(_)&&Bd(m))){if([17,18,20].includes(M)){this._handleTopicSystemNotice(u);continue}Bd(_)||(u.to=_)}if(u.elements.operationType!==Vv)u.currentUser=this._groupModule.getMyUserID(),u.conversationType=gr.CONV_SYSTEM,u.conversationID=gr.CONV_SYSTEM,(r=new xM(u)).setElement({type:gr.MSG_GRP_SYS_NOTICE,content:t(t({},u.elements),{},{groupProfile:t({},u.groupProfile)})}),r.isSystemMessage=!0,(1===r.sequence&&1===r.random||2===r.sequence&&2===r.random)&&(r.sequence=dd(),r.random=dd(),r.generateMessageID(),Ul.log("".concat(this._className,".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(r.ID))),this._groupModule.getModule(ug).pushIntoNoticeResult(i,r)&&(o?c.unreadCount++:r.setIsRead(!0),c.subType=r.conversationSubType)}return c.lastMessage=i[i.length-1],{eventDataList:i.length>0?[c]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this.getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(ug).getLocalMessageList(gr.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,r=n.operatorID,a=n.operationType,s=n.groupProfile;if(a===xv){var i="".concat(r,"_").concat(s.groupID,"_").concat(s.to),c=e.pendencyMap.get(i);c&&zl(c.handled)&&0!==c.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._className,".deleteGroupSystemNotice");return Zl(e.messageList)&&0!==e.messageList.length?(Ul.log("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:P_,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:gr.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Ul.log("".concat(n," ok"));var o=t._groupModule.getModule(ug);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),VM()})).catch((function(e){return Ul.error("".concat(n," error:"),e),XM(e)}))):JM()}},{key:"getPendencyList",value:function(e){var t=this;return this._groupModule.request({protocolName:G_,requestData:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this._groupModule.getMyUserID()}}).then((function(e){var n=e.data.pendencyList;return 0!==e.data.nextStartTime?t.getPendencyList({startTime:e.data.nextStartTime}).then((function(e){return[].concat(M(n),M(e))})):n}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,r=this._groupModule.getModule(ig).getLocalGroupMemberInfo(o,n);r&&r.updateRole(gr.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,r=this._groupModule.getModule(ig).getLocalGroupMemberInfo(o,n);r&&r.updateRole(gr.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(ug).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,r=e.elements,a=r.operationType,s=r.topicIDList,i=r.messageRemindType,c=this._groupModule.getModule(cg);17===a?c.onTopicCreated({groupID:n,topicID:o}):18===a?c.onTopicDeleted({groupID:n,topicIDList:s}):20===a&&c.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),Hv=["relayFlag"],Kv=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Pv(_(t)),t._groupAttributesHandler=new Uv(_(t)),t._AVChatRoomHandler=new qv(_(t)),t._groupTipsHandler=new Gv(_(t)),t._groupSystemNoticeHandler=new Bv(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(hv,t._onCloudConfigUpdated,_(t)),t}return a(r,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count");this._AVChatRoomHandler&&(Ul.log("".concat(this._className,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===gr.CONV_GROUP){var n=Td(e.to)?Fd(e.to):e.to;return this.hasLocalGroup(n)?JM():this.getGroupProfile({groupID:n}).then((function(o){var r=o.data.group.type;if(Ul.log("".concat(t._className,".guardForAVChatRoom. groupID:").concat(n," type:").concat(r)),r===gr.GRP_AVCHATROOM){var a="userId:".concat(e.from," 未加入群 groupID:").concat(n,"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return Ul.warn("".concat(t._className,".guardForAVChatRoom sendMessage not allowed. ").concat(a)),XM(new YM({code:yh.MESSAGE_SEND_FAIL,message:a,data:{message:e}}))}return JM()}))}return JM()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(Zl(e)){var n=this.getModule(cg);e.forEach((function(e){var o=e.conversationID.replace(gr.CONV_GROUP,"");if(Td(o)){var r=o,a=e.lastMessage.sequence+1;o=Fd(r);var s=n.getLocalTopic(o,r);s&&(s.updateNextMessageSeq(a),s.updateLastMessage(e.lastMessage))}t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!ed(n)){var o=t.getModule(ug);n.forEach((function(e){var n=e.groupID,r=e.topicID,a=void 0===r?void 0:r,s=e.lastMessageSeq;Ul.debug("".concat(t._className,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(s));var i="".concat(gr.CONV_GROUP).concat(n),c=!0;Bd(a)||(i="".concat(gr.CONV_GROUP).concat(a),c=!1),o.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:s}),o.updateUnreadCount(i,c),o.clearGroupAtInfoList(i,c)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;Ul.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,r=n.groupID,a=t.getModule(ug),s=o.readReceiptList;a.updateReadReceiptInfo({groupID:r,readReceiptList:s})}))}},{key:"onGroupMessageModified",value:function(e){Ul.debug("".concat(this._className,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(ug);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:gr.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new Nv(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(ug);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new Nv(e)),o.deleteGroupRomaingMessageInfo(t))}));var r,a=this.getMyUserID(),s=S(this.groupMap);try{for(s.s();!(r=s.n()).done;){m(r.value,2)[1].selfInfo.userID=a}}catch(i){s.e(i)}finally{s.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(dg).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Id(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(dg).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return M(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=M(this.groupMap).filter((function(e){var t=m(e,2);t[0];return!Bd(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(M(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(pr.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),r=this.getModule(ug);r.updateConversationGroupProfile(o)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(ug),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),Ul.log("".concat(this._className,".patchGroupMessageRemindType count:").concat(n))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(ug);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,r=o.excludedUnreadSequenceList,a=o.readedSequence;if(Zl(r)){var s=0;r.forEach((function(t){t>=a&&t<=e.nextMessageSeq-1&&(s+=1)})),s>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(gr.CONV_GROUP).concat(n),count:s})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):JM()}},{key:"getGroupProfile",value:function(e){var t=this,n=new Uh(wh.GET_GROUP_PROFILE),o="".concat(this._className,".getGroupProfile"),r=e.groupID,a=e.groupCustomFieldFilter;Ul.log("".concat(o," groupID:").concat(r));var s={groupIDList:[r],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:a,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(s).then((function(e){var a,s=e.data,i=s.successGroupList,c=s.failureGroupList;if(Ul.log("".concat(o," ok")),c.length>0)return XM(c[0]);(Id(i[0].type)&&!t.hasLocalGroup(r)?a=new Nv(i[0]):(t.updateGroupMap(i),a=t.getLocalGroupProfile(r)),a.isSupportTopic)||t.getModule(ug).updateConversationGroupProfile([a]);return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(r," type:").concat(a.type," muteAllMembers:").concat(a.muteAllMembers," ownerID:").concat(a.ownerID)).end(),VM({group:a})})).catch((function(r){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(r,a,s).setMessage("groupID:".concat(e.groupID)).end()})),Ul.error("".concat(o," failed. error:"),r),XM(r)}))}},{key:"getGroupProfileAdvance",value:function(e){var n=this,o="".concat(this._className,".getGroupProfileAdvance"),r=e.groupIDList;Zl(r)&&r.length>50&&(Ul.warn("".concat(o," 获取群资料的数量不能超过50个")),r.length=50);var a=[],s=[];r.forEach((function(e){Ed({groupID:e})?s.push(e):a.push(e)}));var i=[];if(a.length>0){var c=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:a}));i.push(c)}if(s.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s,relayFlag:a.length>0}));i.push(u)}return Promise.all(i).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,M(e.successGroupList)),n.push.apply(n,M(e.failureGroupList))})),VM({successGroupList:t,failureGroupList:n})})).catch((function(e){return Ul.error("".concat(n._className,"._getGroupProfileAdvance failed. error:"),e),XM(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,r=g(e,Hv);return this.request({protocolName:__,requestData:r}).then((function(e){Ul.log("".concat(t._className,"._getGroupProfileAdvance ok."));var n=e.data.groups;return{successGroupList:n.filter((function(e){return ed(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new YM({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&Ed({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:XM(t)}))}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._className,".createGroup"),r=e.type,a=e.groupID;if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(r))return XM({code:yh.ILLEGAL_GROUP_TYPE,message:Ih.ILLEGAL_GROUP_TYPE});if(!Ed({type:r})){if(!Bd(a)&&Ed({groupID:a}))return XM({code:yh.ILLEGAL_GROUP_ID,message:Ih.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Id(r)&&!ed(e.memberList)&&e.memberList.length>0&&(Ul.warn("".concat(o," 创建 AVChatRoom 时不能添加群成员,自动忽略该字段")),e.memberList=void 0),yd(r)||ed(e.joinOption)||(Ul.warn("".concat(o," 创建 Work/Meeting/AVChatRoom/Community 群时不能设置字段 joinOption自动忽略该字段")),e.joinOption=void 0),Ed({type:r})){if(!Bd(a)&&!Ed({groupID:a}))return XM({code:yh.ILLEGAL_GROUP_ID,message:Ih.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var s=new Uh(wh.CREATE_GROUP);Ul.log("".concat(o," options:"),e);var i=[];return this.request({protocolName:h_,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(r){var a=r.data,c=a.groupID,u=a.overLimitUserIDList,l=void 0===u?[]:u;if(i=l,s.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(l)).end(),Ul.log("".concat(o," ok groupID:").concat(c," overLimitUserIDList:"),l),e.type===gr.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===gr.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});Bd(e.memberList)||Bd(l)||(e.memberList=e.memberList.filter((function(e){return-1===l.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var d=n.getModule(ng),p=d.createCustomMessage({to:c,conversationType:gr.CONV_GROUP,payload:{data:"group_create",extension:"".concat(n.getMyUserID(),"创建群组")}});return d.sendMessageInstance(p),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,r=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:r,messageRemindType:gr.MSG_REMIND_ACPT_AND_NOTE,role:gr.GRP_MBR_ROLE_OWNER}),VM({group:t,overLimitUserIDList:i})})).catch((function(t){return s.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var n=m(e,2),o=n[0],r=n[1];s.setError(t,o,r).end()})),Ul.error("".concat(o," failed. error:"),t),XM(t)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._className,".dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===gr.GRP_WORK)return XM(new YM({code:yh.CANNOT_DISMISS_WORK,message:Ih.CANNOT_DISMISS_WORK}));var o=new Uh(wh.DISMISS_GROUP);return o.setMessage("groupID:".concat(e)),Ul.log("".concat(n," groupID:").concat(e)),this.request({protocolName:f_,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),VM({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(this._className,".updateGroupProfile");!this.hasLocalGroup(e.groupID)||yd(this.getLocalGroupProfile(e.groupID).type)||ed(e.joinOption)||(Ul.warn("".concat(n," Work/Meeting/AVChatRoom/Community 群不能设置字段 joinOption自动忽略该字段")),e.joinOption=void 0),ed(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off");var o=new Uh(wh.UPDATE_GROUP_PROFILE);return o.setMessage(JSON.stringify(e)),Ul.log("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:m_,requestData:e}).then((function(){(o.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return VM({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.log("".concat(n," failed. error:"),e),XM(e)}))}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,r="".concat(this._className,".joinGroup");if(o===gr.GRP_WORK){var a=new YM({code:yh.CANNOT_JOIN_WORK,message:Ih.CANNOT_JOIN_WORK});return XM(a)}if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return JM({status:gr.JOIN_STATUS_ALREADY_IN_GROUP});var s=new Uh(wh.APPLY_JOIN_GROUP);return this.getGroupProfile({groupID:n}).then((function(){return s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(gr.JOIN_STATUS_ALREADY_IN_GROUP)).end(),JM({status:gr.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),Ul.warn("".concat(r," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return Ul.log("".concat(r," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._className,".applyJoinGroup"),r=e.groupID,a=new Uh(wh.APPLY_JOIN_GROUP),s=t({},e),i=this.canIUse(bu.AVCHATROOM_HISTORY_MSG);return i&&(s.historyMessageFlag=1),this.getModule(ug).deleteTopicRoamingMessageInfo(r),this.request({protocolName:M_,requestData:s}).then((function(e){var t=e.data,s=t.joinedStatus,c=t.longPollingKey,u=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,g="groupID:".concat(r," joinedStatus:").concat(s," longPollingKey:").concat(c," startSeq:").concat(u)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(i,",")+" history message count:".concat(Bd(p)?0:p.length);switch(a.setNetworkType(n.getNetworkType()).setMessage("".concat(g)).end(),Ul.log("".concat(o," ok. ").concat(g)),s){case Kl:return VM({status:Kl});case Hl:return n.getGroupProfile({groupID:r}).then((function(e){var t,o=e.data.group,a={status:Hl,group:o};return 1===l?(n.getModule(ug).setCompleted("".concat(gr.CONV_GROUP).concat(r)),n._groupAttributesHandler.initGroupAttributesCache({groupID:r,avChatRoomKey:d}),(t=ed(c)?n._AVChatRoomHandler.handleJoinResult({group:o}):n._AVChatRoomHandler.startRunLoop({longPollingKey:c,group:o,startSeq:u})).then((function(){n._onAVChatRoomHistoryMessage(p)})),t):(n.emitGroupListUpdate(!0,!1),VM(a))}));default:var _=new YM({code:yh.JOIN_GROUP_FAIL,message:Ih.JOIN_GROUP_FAIL});return Ul.error("".concat(o," error:"),_),XM(_)}})).catch((function(t){return a.setMessage("groupID:".concat(e.groupID)),n.probeNetwork().then((function(e){var n=m(e,2),o=n[0],r=n[1];a.setError(t,o,r).end()})),Ul.error("".concat(o," error:"),t),XM(t)}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._className,".quitGroup");Ul.log("".concat(n," groupID:").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e)){var r=new YM({code:yh.MEMBER_NOT_IN_GROUP,message:Ih.MEMBER_NOT_IN_GROUP});return XM(r)}if(o&&!this.isLoggedIn())return Ul.log("".concat(n," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),JM({groupID:e});var a=new Uh(wh.QUIT_GROUP);return a.setMessage("groupID:".concat(e)),this.request({protocolName:y_,requestData:{groupID:e}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),VM({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._className,".searchGroupByID"),o={groupIDList:[e]},r=new Uh(wh.SEARCH_GROUP_BY_ID);return r.setMessage("groupID:".concat(e)),Ul.log("".concat(n," groupID:").concat(e)),this.request({protocolName:I_,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new YM({code:o[0].errorCode,message:o[0].errorInfo});return r.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),VM({group:new Nv(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(this._className,".changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===gr.GRP_AVCHATROOM)return XM(new YM({code:yh.CANNOT_CHANGE_OWNER_IN_AVCHATROOM,message:Ih.CANNOT_CHANGE_OWNER_IN_AVCHATROOM}));if(e.newOwnerID===this.getMyUserID())return XM(new YM({code:yh.CANNOT_CHANGE_OWNER_TO_SELF,message:Ih.CANNOT_CHANGE_OWNER_TO_SELF}));var o=new Uh(wh.CHANGE_GROUP_OWNER);return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),Ul.log("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:E_,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok"));var r=e.groupID,a=e.newOwnerID;t.groupMap.get(r).ownerID=a;var s=t.getModule(ig).getLocalGroupMemberList(r);if(s instanceof Map){var i=s.get(t.getMyUserID());ed(i)||(i.updateRole("Member"),t.groupMap.get(r).selfInfo.role="Member");var c=s.get(a);ed(c)||c.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),VM({group:t.groupMap.get(r)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"handleGroupApplication",value:function(e){var n=this,o="".concat(this._className,".handleGroupApplication"),r=e.message.payload,a=r.groupProfile.groupID,s=r.authentication,i=r.messageKey,c=r.operatorID,u=new Uh(wh.HANDLE_GROUP_APPLICATION);return u.setMessage("groupID:".concat(a)),Ul.log("".concat(o," groupID:").concat(a)),this.request({protocolName:T_,requestData:t(t({},e),{},{applicant:c,groupID:a,authentication:s,messageKey:i})}).then((function(){return u.setNetworkType(n.getNetworkType()).end(),Ul.log("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),VM({group:n.getLocalGroupProfile(a)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];u.setError(e,o,r).end()})),Ul.error("".concat(o," failed. error"),e),XM(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._className,".handleGroupInvitation"),r=e.message.payload,a=r.groupProfile.groupID,s=r.authentication,i=r.messageKey,c=r.operatorID,u=e.handleAction,l=new Uh(wh.HANDLE_GROUP_INVITATION);return l.setMessage("groupID:".concat(a," inviter:").concat(c," handleAction:").concat(u)),Ul.log("".concat(o," groupID:").concat(a," inviter:").concat(c," handleAction:").concat(u)),this.request({protocolName:S_,requestData:t(t({},e),{},{inviter:c,groupID:a,authentication:s,messageKey:i})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),Ul.log("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),VM({group:n.getLocalGroupProfile(a)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setError(e,o,r).end()})),Ul.error("".concat(o," failed. error"),e),XM(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):JM({memberCount:0}):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Ul.log("".concat(this._className,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(ug).deleteLocalConversation("".concat(gr.CONV_GROUP).concat(e));if(Ed({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(cg).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(ig).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";Jl(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var r=[];if(Ql(t)&&Ql(t.messageControlInfo)){var a=t.messageControlInfo,s=a.excludedFromUnreadCount,i=a.excludedFromLastMessage;!0===s&&r.push("NoUnread"),!0===i&&r.push("NoLastMsg")}var c=e.getGroupAtInfoList(),u={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==gr.MSG_TEXT||Bd(c)?void 0:c,onlineOnlyFlag:this.isOnlineMessage(e,t)?1:0,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:r,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1};return Td(e.to)&&(u.groupID=Fd(e.to),u.topicID=e.to),{protocolName:Pg,tjgID:this.generateTjgID(e),requestData:u}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Td(e.to)&&(t.groupID=Fd(e.to),t.topicID=e.to),this.request({protocolName:A_,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;Ul.log("".concat(this._className,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return Td(t)&&(o.groupID=Fd(t),o.topicID=t),this.request({protocolName:F_,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,r=e.type,a=e.version,s=void 0===a?0:a,i=e.cloudCustomData,c=t,u=void 0;Td(t)&&(c=Fd(t),u=t);var l=void 0;return xd(r)&&(l=[]).push({type:r,content:o}),this.request({protocolName:q_,requestData:{groupID:c,topicID:u,sequence:n,version:s,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessage"),o=e.conversationID,r=e.groupID,a=e.sequence,s=new Uh(wh.GET_GROUP_ROAMING_MESSAGES),i=0,c=void 0;return Td(r)&&(r=Fd(c=r)),this._computeLastSequence({groupID:r,topicID:c,sequence:a}).then((function(e){return i=e,Ul.log("".concat(n," groupID:").concat(r," startSequence:").concat(i)),t.request({protocolName:N_,requestData:{groupID:r,count:21,sequence:i,topicID:c}})})).then((function(e){var a=e.data,u=a.messageList,l=a.complete;ed(u)?Ul.log("".concat(n," ok. complete:").concat(l," but messageList is undefined!")):Ul.log("".concat(n," ok. complete:").concat(l," count:").concat(u.length)),s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(r," topicID:").concat(c," startSequence:").concat(i," complete:").concat(l," count:").concat(u?u.length:"undefined")).end();var d=t.getModule(ug);if(2===l||Bd(u))return d.setCompleted(o),{nextReqID:"",storedMessageList:[]};var p=u[u.length-1].sequence-1;d.updateRoamingMessageSequence(o,p);var g=d.onRoamingMessage(u,o);return d.updateIsRead(o),d.patchConversationLastMessage(o),Ul.log("".concat(n," nextReqID:").concat(p," stored message count:").concat(g.length)),{nextReqID:p+"",storedMessageList:g}})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];s.setError(e,o,a).setMessage("groupID:".concat(r," topicID:").concat(c," startSequence:").concat(i)).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(gr.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t=this,n="".concat(this._className,".getReadReceiptList"),o=this._getGroupIDOfMessage(e[0]),r=this.getMyUserID(),a=e.filter((function(e){return e.from===r&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(Ul.log("".concat(n," groupID:").concat(o," sequenceList:").concat(JSON.stringify(a))),0===a.length)return JM({messageList:e});var s=new Uh(wh.GET_READ_RECEIPT);return s.setMessage("groupID:".concat(o)),this.request({protocolName:R_,requestData:{groupID:o,sequenceList:a}}).then((function(t){s.end(),Ul.log("".concat(n," ok"));var o=t.data.readReceiptList;return Zl(o)&&o.forEach((function(t){e.forEach((function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)}))})),VM({messageList:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=this._getGroupIDOfMessage(e[0]),o=new Uh(wh.SEND_READ_RECEIPT);o.setMessage("groupID:".concat(n));var r=this.getMyUserID(),a=e.filter((function(e){return e.from!==r&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(0===a.length)return XM({code:yh.READ_RECEIPT_MESSAGE_LIST_EMPTY,message:Ih.READ_RECEIPT_MESSAGE_LIST_EMPTY});var s="".concat(this._className,".sendReadReceipt");return Ul.log("".concat(s,". sequenceList:").concat(JSON.stringify(a))),this.request({protocolName:O_,requestData:{groupID:n,sequenceList:a}}).then((function(e){return o.end(),Ul.log("".concat(s," ok")),VM()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.warn("".concat(s," failed. error:"),e),XM(e)}))}},{key:"getReadReceiptDetail",value:function(e){var t=this,n=e.message,o=e.filter,r=e.cursor,a=e.count,s=this._getGroupIDOfMessage(n),i=n.ID,c=n.sequence,u="".concat(this._className,".getReadReceiptDetail"),l=this._receiptDetailCompleteMap.get(i)||!1,d=0!==o&&1!==o?0:o,p=Jl(r)?r:"",g=!zl(a)||a<=0||a>=100?100:a,_="groupID:".concat(s," sequence:").concat(c," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);Ul.log("".concat(u," ").concat(_));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new Uh(wh.GET_READ_RECEIPT_DETAIL);return f.setMessage(_),this.request({protocolName:k_,requestData:{groupID:s,sequence:c,flag:d,cursor:p,count:g}}).then((function(e){f.end();var n=e.data,o=n.cursor,r=n.isCompleted,a=n.unreadUserIDList,s=n.readUserIDList;return h.cursor=o,1===r&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===d?h.readUserIDList=s.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=a.map((function(e){return e.userID}))),Ul.log("".concat(u," ok")),VM(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];f.setError(e,o,r).end()})),Ul.warn("".concat(u," failed. error:"),e),XM(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._className,".getRoamingMessagesHopping"),o=new Uh(wh.GET_GROUP_ROAMING_MESSAGES_HOPPING),r=e.groupID,a=e.count,s=e.sequence,i=e.direction,c=s;1===i&&(c=s+a-1);var u=void 0;Td(r)&&(r=Fd(u=r));var l="".concat(u?"topicID:".concat(u):"groupID:".concat(r)," sequence:").concat(s," direction:").concat(i);return Ul.log("".concat(n," ").concat(l)),this.request({protocolName:N_,requestData:{groupID:r,topicID:u,count:a,sequence:c}}).then((function(r){var a=r.data,c=a.messageList,d=a.complete;if(Ul.log("".concat(n," ok. complete:").concat(d," count:").concat(c?c.length:0)),o.setNetworkType(t.getNetworkType()).setMessage("".concat(l," complete:").concat(d," count:").concat(c?c.length:0)).end(),2===d||Bd(c)){var p=t._computeResult();return VM(p)}var g="".concat(gr.CONV_GROUP).concat(e.groupID),_=t.getModule(ug).onRoamingMessage(c,g,!1),h=t._computeResult({direction:i,sequence:s,topicID:u,messageList:c,resultList:_});return VM(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),i=n[0],c=n[1];o.setError(e,i,c).setMessage("groupID:".concat(r," sequence:").concat(s," count:").concat(a)).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(ed(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,r=e.topicID,a=e.messageList,s=void 0===a?[]:a,i=e.resultList,c=void 0===i?[]:i,u=s.length;if(1===n){if(t.nextMessageSeq=s[0].sequence+1,!ed(r)){var l=c.findIndex((function(e){return e.sequence===o}));return-1===l?(c[c.length-1].sequence<o?(t.isCompleted=!0,t.nextMessageSeq=""):t.messageList=M(c),t):(t.messageList=c.slice(l),t)}return t.messageList=M(c),t}return t.nextMessageSeq=s[u-1].sequence-1,t.messageList=M(c),0===t.nextMessageSeq&&(t.isCompleted=!0,t.nextMessageSeq=""),t}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageSeq,r="".concat(this._className,".setMessageRead");Ul.log("".concat(r," conversationID:").concat(n," lastMessageSeq:").concat(o)),zl(o)||Ul.warn("".concat(r," 请勿修改 Conversation.lastMessage.lastSequence否则可能会导致已读上报结果不准确"));var a=new Uh(wh.SET_GROUP_MESSAGE_READ);a.setMessage("".concat(n,"-").concat(o));var s=n.replace(gr.CONV_GROUP,""),i=void 0;return Td(s)&&(s=Fd(i=s)),this.request({protocolName:D_,requestData:{groupID:s,topicID:i,messageReadSeq:o}}).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(r," ok."));var e=t.getModule(ug);e.updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:o});var c=!0;if(!ed(i)){c=!1;var u=t.getModule(cg).getLocalTopic(s,i);u&&u.updateSelfInfo({readedSequence:o})}return e.updateUnreadCount(n,c),VM()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.log("".concat(r," failed. error:"),e),XM(e)}))}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,n=e.topicID,o=void 0===n?void 0:n,r=e.sequence;return r>0?Promise.resolve(r):ed(o)||this.hasLocalGroup(t)?ed(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._className,".getGroupLastSequence"),o=new Uh(wh.GET_GROUP_LAST_SEQUENCE),r=0,a="";if(this.hasLocalGroup(e)){var s=this.getLocalGroupProfile(e),i=s.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return r=i.lastSequence,a="got lastSequence:".concat(r," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),Ul.log("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(r);if(s.nextMessageSeq>1)return r=s.nextMessageSeq-1,a="got lastSequence:".concat(r," from local group profile[nextMessageSeq]. groupID:").concat(e),Ul.log("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(r)}var c="GROUP".concat(e),u=this.getModule(ug).getLocalConversation(c);if(u&&u.lastMessage.lastSequence&&!1===u.lastMessage.onlineOnlyFlag)return r=u.lastMessage.lastSequence,a="got lastSequence:".concat(r," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),Ul.log("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(r);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(s){var i=s.data.successGroupList;return Bd(i)?Ul.log("".concat(n," successGroupList is empty. groupID:").concat(e)):(r=i[0].nextMessageSeq-1,a="got lastSequence:".concat(r," from getGroupProfileAdvance. groupID:").concat(e),Ul.log("".concat(n," ").concat(a))),o.setNetworkType(t.getNetworkType()).setMessage("".concat(a)).end(),r})).catch((function(r){return t.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(r,a,s).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),Ul.warn("".concat(n," failed. error:"),r),XM(r)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,n=e.groupID,o=e.topicID,r="".concat(this._className,".getTopicLastSequence"),a=new Uh(wh.GET_TOPIC_LAST_SEQUENCE),s=0,i="",c=this.getModule(cg);return c.hasLocalTopic(n,o)?(s=c.getLocalTopic(n,o).nextMessageSeq-1,i="get lastSequence:".concat(s," from local topic info[nextMessageSeq]. topicID:").concat(o),Ul.log("".concat(r," ").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(s)):c.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return Bd(n)?Ul.log("".concat(r," successTopicList is empty. topicID:").concat(o)):(s=n[0].nextMessageSeq-1,i="get lastSequence:".concat(s," from getTopicList. topicID:").concat(o),Ul.log("".concat(r," ").concat(i))),a.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),s})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],s=n[1];a.setError(e,r,s).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o)).end()})),Ul.warn("".concat(r," failed. error:"),e),XM(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==gr.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!Bd(e)){Ul.log("".concat(this._className,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new Uh(wh.GET_GROUP_SIMPLIFIED_INFO),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var r=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(r[0].type)).end(),r[0]})).catch((function(o){t.probeNetwork().then((function(t){var r=m(t,2),a=r[0],s=r[1];n.setError(o,a,s).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"onGroupAttributesUpdated",value:function(e){this._groupAttributesHandler&&this._groupAttributesHandler.onGroupAttributesUpdated(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler&&this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),r}(Dg),jv=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return a(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&vd(this.memberCustomField,e.memberCustomField),cd(this,e,["memberCustomField"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){ed(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){ed(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&vd(this.memberCustomField,e)}}]),e}(),Wv=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(fv,t._onProfileUpdated,_(t)),t}return a(r,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},r=0;r<n.length;r++)o(r)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t=this,n=e.groupID,o=e.offset,r=void 0===o?0:o,a=e.count,s=void 0===a?15:a,i="".concat(this._className,".getGroupMemberList"),c=this.getModule(ag).hasLocalGroup(n);if(Ul.log("".concat(i," groupID:").concat(n," offset:").concat(r," count:").concat(s," hasLocalGroup:").concat(c)),!c)return JM({memberList:[],offset:0});var u=new Uh(wh.GET_GROUP_MEMBER_LIST),l=0,d={groupID:n,limit:s>100?100:s};Ed({groupID:n})?d.next="".concat(r):(d.offset=r,l=r+1);var p=[];return this.request({protocolName:j_,requestData:d}).then((function(e){var o=e.data,r=o.members,a=o.memberNum,s=o.next,i=void 0===s?void 0:s;if(ed(i)||(l=Bd(i)?0:i),!Zl(r)||0===r.length)return l=0,Promise.resolve([]);var c=t.getModule(ag);return c.hasLocalGroup(n)&&(c.getLocalGroupProfile(n).memberNum=a),p=t._updateLocalGroupMemberMap(n,r),t.getModule(og).getUserProfile({userIDList:r.map((function(e){return e.userID})),tagList:[Fl.NICK,Fl.AVATAR]})})).then((function(e){var o=e.data;if(!Zl(o)||0===o.length)return JM({memberList:[],offset:l});var r=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,r),u.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," offset:").concat(l," count:").concat(s)).end(),Ul.log("".concat(i," ok.")),VM({memberList:p,offset:l})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];u.setError(e,o,r).end()})),Ul.error("".concat(i," failed. error:"),e),XM(e)}))}},{key:"getGroupMemberProfile",value:function(e){var n=this,o="".concat(this._className,".getGroupMemberProfile"),r=new Uh(wh.GET_GROUP_MEMBER_PROFILE);r.setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),Ul.log("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var a=e.groupID,s=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:s})).then((function(e){var t=e.data.members;return Zl(t)&&0!==t.length?(n._updateLocalGroupMemberMap(a,t),n.getModule(og).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Fl.NICK,Fl.AVATAR]})):JM([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(a,t);var o=s.filter((function(e){return n.hasLocalGroupMember(a,e)})).map((function(e){return n.getLocalGroupMemberInfo(a,e)}));return r.setNetworkType(n.getNetworkType()).end(),VM({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._className,".addGroupMember"),o=e.groupID,r=this.getModule(ag).getLocalGroupProfile(o),a=r.type,s=new Uh(wh.ADD_GROUP_MEMBER);if(s.setMessage("groupID:".concat(o," groupType:").concat(a)),Id(a)){var i=new YM({code:yh.CANNOT_ADD_MEMBER_IN_AVCHATROOM,message:Ih.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return s.setCode(yh.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setError(Ih.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setNetworkType(this.getNetworkType()).end(),XM(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Ul.log("".concat(n," groupID:").concat(o)),this.request({protocolName:Y_,requestData:e}).then((function(o){var a=o.data.members;Ul.log("".concat(n," ok"));var i=a.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),c=a.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),u=a.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=a.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(i,", ")+"failureUserIDList:".concat(c,", ")+"existedUserIDList:".concat(u,", ")+"overLimitUserIDList:".concat(l);return s.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===i.length?VM({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(r.memberCount+=i.length,t._updateConversationGroupProfile(r),VM({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:r}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._className,".deleteGroupMember"),o=e.groupID,r=e.userIDList,a=new Uh(wh.DELETE_GROUP_MEMBER),s="groupID:".concat(o," ").concat(r.length>5?"userIDList.length:".concat(r.length):"userIDList:".concat(r));a.setMessage(s),Ul.log("".concat(n," groupID:").concat(o," userIDList:"),r);var i=this.getModule(ag).getLocalGroupProfile(o);return Id(i.type)?XM(new YM({code:yh.CANNOT_KICK_MEMBER_IN_AVCHATROOM,message:Ih.CANNOT_KICK_MEMBER_IN_AVCHATROOM})):this.request({protocolName:$_,requestData:e}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),i.memberCount-=1,t._updateConversationGroupProfile(i),t.deleteLocalGroupMembers(o,r),VM({group:i,userIDList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(ug).updateConversationGroupProfile([e])}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,r=e.muteTime,a="".concat(this._className,".setGroupMemberMuteTime");if(o===this.getMyUserID())return XM(new YM({code:yh.CANNOT_MUTE_SELF,message:Ih.CANNOT_MUTE_SELF}));Ul.log("".concat(a," groupID:").concat(n," userID:").concat(o));var s=new Uh(wh.SET_GROUP_MEMBER_MUTE_TIME);return s.setMessage("groupID:".concat(n," userID:").concat(o," muteTime:").concat(r)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:r}).then((function(e){s.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(a," ok"));var o=t.getModule(ag);return VM({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.error("".concat(a," failed. error:"),e),XM(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberRole"),o=e.groupID,r=e.userID,a=e.role,s=this.getModule(ag).getLocalGroupProfile(o);if(s.selfInfo.role!==gr.GRP_MBR_ROLE_OWNER)return XM({code:yh.NOT_OWNER,message:Ih.NOT_OWNER});if([gr.GRP_WORK,gr.GRP_AVCHATROOM].includes(s.type))return XM({code:yh.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM,message:Ih.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[gr.GRP_MBR_ROLE_ADMIN,gr.GRP_MBR_ROLE_MEMBER];if(Ed({groupID:o})&&i.push(gr.GRP_MBR_ROLE_CUSTOM),i.indexOf(a)<0)return XM({code:yh.INVALID_MEMBER_ROLE,message:Ih.INVALID_MEMBER_ROLE});if(r===this.getMyUserID())return XM({code:yh.CANNOT_SET_SELF_MEMBER_ROLE,message:Ih.CANNOT_SET_SELF_MEMBER_ROLE});var c=new Uh(wh.SET_GROUP_MEMBER_ROLE);return c.setMessage("groupID:".concat(o," userID:").concat(r," role:").concat(a)),Ul.log("".concat(n," groupID:").concat(o," userID:").concat(r)),this.modifyGroupMemberInfo({groupID:o,userID:r,role:a}).then((function(e){return c.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok")),VM({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];c.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberNameCard"),o=e.groupID,r=e.userID,a=void 0===r?this.getMyUserID():r,s=e.nameCard;Ul.log("".concat(n," groupID:").concat(o," userID:").concat(a));var i=new Uh(wh.SET_GROUP_MEMBER_NAME_CARD);return i.setMessage("groupID:".concat(o," userID:").concat(a," nameCard:").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:a,nameCard:s}).then((function(e){Ul.log("".concat(n," ok")),i.setNetworkType(t.getNetworkType()).end();var r=t.getModule(ag).getLocalGroupProfile(o);return a===t.getMyUserID()&&r&&r.setSelfNameCard(s),VM({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];i.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(this._className,".setGroupMemberCustomField"),o=e.groupID,r=e.userID,a=void 0===r?this.getMyUserID():r,s=e.memberCustomField;Ul.log("".concat(n," groupID:").concat(o," userID:").concat(a));var i=new Uh(wh.SET_GROUP_MEMBER_CUSTOM_FIELD);return i.setMessage("groupID:".concat(o," userID:").concat(a," memberCustomField:").concat(JSON.stringify(s))),this.modifyGroupMemberInfo({groupID:o,userID:a,memberCustomField:s}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(n," ok"));var r=t.getModule(ag).getLocalGroupProfile(o);return VM({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];i.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,r=e.userID,a=void 0;return Td(o)&&(o=Fd(a=o)),this.request({protocolName:z_,requestData:t(t({},e),{},{groupID:o,topicID:a})}).then((function(){if(n.hasLocalGroupMember(o,r)){var t=n.getLocalGroupMemberInfo(o,r);return ed(e.muteTime)||t.updateMuteUntil(e.muteTime),ed(e.role)||t.updateRole(e.role),ed(e.nameCard)||t.updateNameCard(e.nameCard),ed(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[r]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:W_,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return Zl(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new jv(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),r}(Dg),Yv=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],$v=function(e){return Bd(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:""}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:qd(e.type,e.payload),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||""}},zv=function(){function e(t){o(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=$v(t.lastMessage),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:""},this._initTopic(t)}return a(e,[{key:"_initTopic",value:function(e){for(var t in e)Yv.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=$v(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){ed(e.selfInfo)||this.updateSelfInfo(e.selfInfo),ed(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),cd(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers"])}},{key:"updateSelfInfo",value:function(e){return 0!==cd(this.selfInfo,e,[],[""])}}]),e}(),Jv=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(hv,t._onCloudConfigUpdated,_(t)),t}return a(r,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");ed(e)||(this.TOPIC_CACHE_TIME=Number(e)),ed(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(pr.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(pr.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,r=this.getLocalTopic(t,n);if(r){var a=r.updateSelfInfo({messageRemindType:o});a&&this.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:t,topic:r}),Ul.debug("".concat(this._className,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(a))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,r=Fd(t),a=this.getLocalTopic(r,t),s=!1;a&&(ed(n)||a.unreadCount===n||(a.updateUnreadCount(n),s=!0),ed(o)||(a.updateGroupAtInfoList(o),s=!0)),s&&this.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:r,topic:a})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,r=this.getLocalTopic(t,n);r&&(r.nextMessageSeq+=1,r.updateLastMessage(o),this.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:t,topic:r}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,r=e.elements,a=e.cloudCustomData,s=e.messageVersion,i=Fd(t),c=this.getLocalTopic(i,t);if(c){var u=c.lastMessage;Ul.debug("".concat(this._className,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(u),"options:",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===n&&u.lastSequence===o&&u.version!==s)&&(u.type=r[0].type,u.payload=r[0].content,u.messageForShow=qd(u.type,u.payload),u.cloudCustomData=a,u.version=s,u.lastSequence=o,u.lastTime=n,this.emitOuterEvent(pr.TOPIC_UPDATED,{groupID:i,topic:c}))}}},{key:"getJoinedCommunityList",value:function(){return this.getModule(ag).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return VM({groupList:void 0===t?[]:t})})).catch((function(e){return XM(e)}))}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._className,".createTopicInCommunity"),r=e.topicID;if(!ed(r)&&!Td(r))return XM({code:yh.ILLEGAL_TOPIC_ID,message:Ih.ILLEGAL_TOPIC_ID});var a=new Uh(wh.CREATE_TOPIC);return this.request({protocolName:ph,requestData:t({},e)}).then((function(r){var s=r.data.topicID;return a.setMessage("topicID:".concat(s)).setNetworkType(n.getNetworkType()).end(),Ul.log("".concat(o," ok")),n._updateTopicMap([t(t({},e),{},{topicID:s})]),VM({topicID:s})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.error("".concat(o," failed. error:"),e),XM(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._className,".deleteTopicFromCommunity"),o=e.groupID,r=e.topicIDList,a=void 0===r?[]:r,s=new Uh(wh.DELETE_TOPIC);return s.setMessage("groupID:".concat(o," topicIDList:").concat(a)),this.request({protocolName:gh,requestData:{groupID:o,topicIDList:a}}).then((function(e){var n=e.data.resultList,r=[],a=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?r.push({topicID:t}):a.push({topicID:t,code:n,message:o})}));var i="success count:".concat(r.length,", fail count:").concat(a.length);return s.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),Ul.log("".concat(i)),r.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),VM({successTopicList:r,failureTopicList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._className,".updateTopicProfile"),r=new Uh(wh.UPDATE_TOPIC_PROFILE);return r.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),Ul.log("".concat(o," options:"),e),ed(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:_h,requestData:t({},e)}).then((function(){return r.setNetworkType(n.getNetworkType()).end(),Ul.log("".concat(o," ok")),n._updateTopicMap([e]),VM({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.error("".concat(o," failed. error:"),e),XM(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._className,".getTopicList"),r=e.groupID,a=e.topicIDList,s=void 0===a?[]:a,i=0===s.length,c=new Uh(wh.GET_TOPIC_LIST);if(c.setMessage("groupID:".concat(r)),this._getTopicTimeMap.has(r)){var u=this._getTopicTimeMap.get(r),l=u.isGetAll,d=u.time;if((l||!l&&!i)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(r,s);if(i||p.length===s.length)return c.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),Ul.log("".concat(o," groupID:").concat(r," from cache, topic count:").concat(p.length)),JM({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:hh,requestData:{groupID:r,topicIDList:s}}).then((function(e){var a=e.data.topicInfoList,s=[],u=[],l=[];(void 0===a?[]:a).forEach((function(e){var n=e.topic,o=e.selfInfo,r=e.errorCode,a=e.errorInfo,i=n.topicID;0===r?(s.push(t(t({},n),{},{selfInfo:o})),u.push(i)):l.push({topicID:i,code:r,message:a})})),n._updateTopicMap(s),n._handleTopicAtInfo(s);var d="success count:".concat(u.length,", fail count:").concat(l.length);c.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(d)).end(),Ul.log("".concat(o," groupID:").concat(r," from remote, ").concat(d));var p=[];return Bd(u)||(n._getTopicTimeMap.set(r,{time:Date.now(),isGetAll:i}),p=n._getLocalTopicList(r,u)),VM({successTopicList:p,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=m(t,2),o=n[0],r=n[1];c.setError(e,o,r).end()})),Ul.error("".concat(o," failed. error:"),e),XM(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=M(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),Ul.log("".concat(this._className,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,r=e.topicID,a=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(r)?(a=t._topicMap.get(o).get(r)).updateTopic(e):(t._getTopicLastMessage(e),a=new zv(e),t._topicMap.get(o).set(r,a));var s=a.nextMessageSeq-a.selfInfo.readedSequence-1,i=s>0?s:0;a.updateUnreadCount(i),n.push({conversationID:"".concat(gr.CONV_GROUP).concat(r),type:gr.CONV_TOPIC,unreadCount:i})})),n.length>0)&&this.getModule(ug).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;ed(e)?M(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=M(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,r=void 0===n?0:n;Date.now()-1e3*r<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),Ul.log("".concat(this._className,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),r=new Uh(wh.RELAY_GET_TOPIC_LIST);r.setMessage(o),Ul.log("".concat(this._className,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){r.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),o=t[0],a=t[1];r.setError(n,o,a).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,r=e.topicID,a=e.groupAtInfoList,s=[];ed(a)||(a.forEach((function(e){s.push(t(t({},e),{},{groupID:o,topicID:r}))})),n.getModule(ug).onNewGroupAtTips({dataList:s}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!ed(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(ug);n.forEach((function(n){var r=n.topicID;t._deleteLocalTopic(e,r),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(gr.CONV_GROUP).concat(r))}))}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),r}(Dg),Xv=function(){function e(t){o(this,e),this._userModule=t,this._className="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return a(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),n.length>100&&(Ul.warn("".concat(this._className,".getUserProfile 获取用户资料人数不能超过100人")),n.length=100);for(var o,r=[],a=[],s=0,i=n.length;s<i;s++)o=n[s],this._userModule.isMyFriend(o)&&this._containsAccount(o)?a.push(this._getProfileFromMap(o)):r.push(o);if(0===r.length)return JM(a);e.toAccount=r;var c=e.bFromGetMyProfile||!1,u=[];e.toAccount.forEach((function(e){u.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=u;var l=new Uh(wh.GET_USER_PROFILE);return l.setMessage(n.length>5?"userIDList.length:".concat(n.length):"userIDList:".concat(n)),this._userModule.request({protocolName:bg,requestData:e}).then((function(e){l.setNetworkType(t._userModule.getNetworkType()).end(),Ul.info("".concat(t._className,".getUserProfile ok"));var n=t._handleResponse(e).concat(a);return VM(c?n[0]:n)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setError(e,o,r).end()})),Ul.error("".concat(t._className,".getUserProfile failed. error:"),e),XM(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount();if(Ul.log("".concat(this._className,".getMyProfile myAccount:").concat(e)),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return Ul.debug("".concat(this._className,".getMyProfile from cache, myProfile:")+JSON.stringify(t)),JM(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){for(var t,n,o=id.now(),r=e.data.userProfileItem,a=[],s=0,i=r.length;s<i;s++)"@TLS#NOT_FOUND"!==r[s].to&&""!==r[s].to&&(t=r[s].to,n=this._updateMap(t,this._getLatestProfileFromResponse(t,r[s].profileItem)),a.push(n));return Ul.log("".concat(this._className,"._handleResponse cost ").concat(id.now()-o," ms")),a}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={};if(n.userID=e,n.profileCustomField=[],!Bd(t))for(var o=0,r=t.length;o<r;o++)if(t[o].tag.indexOf("Tag_Profile_Custom")>-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case Fl.NICK:n.nick=t[o].value;break;case Fl.GENDER:n.gender=t[o].value;break;case Fl.BIRTHDAY:n.birthday=t[o].value;break;case Fl.LOCATION:n.location=t[o].value;break;case Fl.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Fl.ALLOWTYPE:n.allowType=t[o].value;break;case Fl.LANGUAGE:n.language=t[o].value;break;case Fl.AVATAR:n.avatar=t[o].value;break;case Fl.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Fl.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Fl.LEVEL:n.level=t[o].value;break;case Fl.ROLE:n.role=t[o].value;break;default:Ul.warn("".concat(this._className,"._handleResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._className,".updateMyProfile"),o=new Uh(wh.UPDATE_MY_PROFILE);o.setMessage(JSON.stringify(e));var r=(new Sv).validate(e);if(!r.valid)return o.setCode(yh.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("".concat(n," info:").concat(r.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Ul.error("".concat(n," info:").concat(r.tips,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),XM({code:yh.UPDATE_PROFILE_INVALID_PARAM,message:Ih.UPDATE_PROFILE_INVALID_PARAM});var a=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&("profileCustomField"===s?e.profileCustomField.forEach((function(e){a.push({tag:e.key,value:e.value})})):a.push({tag:Fl[s.toUpperCase()],value:e[s]}));return 0===a.length?(o.setCode(yh.UPDATE_PROFILE_NO_KEY).setMoreMessage(Ih.UPDATE_PROFILE_NO_KEY).setNetworkType(this._userModule.getNetworkType()).end(),Ul.error("".concat(n," info:").concat(Ih.UPDATE_PROFILE_NO_KEY,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#updateMyProfile")),XM({code:yh.UPDATE_PROFILE_NO_KEY,message:Ih.UPDATE_PROFILE_NO_KEY})):this._userModule.request({protocolName:Ug,requestData:{fromAccount:this._userModule.getMyAccount(),profileItem:a}}).then((function(r){o.setNetworkType(t._userModule.getNetworkType()).end(),Ul.info("".concat(n," ok"));var a=t._updateMap(t._userModule.getMyAccount(),e);return t._userModule.emitOuterEvent(pr.PROFILE_UPDATED,[a]),JM(a)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!Bd(t)){var n,o,r=t.length;Ul.debug("".concat(this._className,".onProfileModified count:").concat(r," dataList:"),e.dataList);for(var a=[],s=0;s<r;s++)n=t[s].userID,o=this._updateMap(n,this._getLatestProfileFromResponse(n,t[s].profileList)),a.push(o);a.length>0&&(this._userModule.emitInnerEvent(fv,a),this._userModule.emitOuterEvent(pr.PROFILE_UPDATED,a))}}},{key:"_fillMap",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n<o;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);Ul.log("".concat(this._className,"._fillMap from cache, map.size:").concat(this.accountProfileMap.size))}}},{key:"_updateMap",value:function(e,t){var n,o=Date.now();return this._containsAccount(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&vd(n.profileCustomField,t.profileCustomField),cd(n,t,["profileCustomField"]),n.lastUpdatedTime=o):(n=new Sv(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=o,this.accountProfileMap.set(e,n))),this._flushMap(e===this._userModule.getMyAccount()),n}},{key:"_flushMap",value:function(e){var t=M(this.accountProfileMap.values()),n=this._userModule.getStorageModule();Ul.debug("".concat(this._className,"._flushMap length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_containsAccount",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return Bd(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,o,r=[],a=0,s=e.length;a<s;a++)n=(t=e[a]).userID,this._userModule.isMyFriend(n)||(this._containsAccount(n)?(o=this._getProfileFromMap(n),cd(o,t)>0&&r.push(n)):r.push(t.userID));0!==r.length&&(Ul.info("".concat(this._className,".onConversationsProfileUpdated toAccountList:").concat(r)),this.getUserProfile({userIDList:r}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._containsAccount(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flushMap(!0),this.accountProfileMap.clear()}}]),e}(),Qv=a((function e(t){o(this,e),Bd||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),Zv=function(){function e(t){o(this,e),this._userModule=t,this._className="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return a(e,[{key:"getLocalBlacklist",value:function(){return M(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._className,".getBlacklist"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new Uh(wh.GET_BLACKLIST);return this._userModule.request({protocolName:wg,requestData:n}).then((function(n){var r=n.data,a=r.blackListItem,s=r.currentSequence,i=Bd(a)?0:a.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("blackList count:".concat(i)).end(),Ul.info("".concat(t," ok")),e.currentSequence=s,e._handleResponse(a,!0),e._userModule.emitOuterEvent(pr.BLACKLIST_UPDATED,M(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),r=t[0],a=t[1];o.setError(n,r,a).end()})),Ul.error("".concat(t," failed. error:"),n),XM(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n="".concat(this._className,".addBlacklist"),o=new Uh(wh.ADD_TO_BLACKLIST);if(!Zl(e.userIDList))return o.setCode(yh.ADD_BLACKLIST_INVALID_PARAM).setMessage(Ih.ADD_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),Ul.error("".concat(n," options.userIDList 必需是数组")),XM({code:yh.ADD_BLACKLIST_INVALID_PARAM,message:Ih.ADD_BLACKLIST_INVALID_PARAM});var r=this._userModule.getMyAccount();return 1===e.userIDList.length&&e.userIDList[0]===r?(o.setCode(yh.CANNOT_ADD_SELF_TO_BLACKLIST).setMessage(Ih.CANNOT_ADD_SELF_TO_BLACKLIST).setNetworkType(this._userModule.getNetworkType()).end(),Ul.error("".concat(n," 不能把自己拉黑")),XM({code:yh.CANNOT_ADD_SELF_TO_BLACKLIST,message:Ih.CANNOT_ADD_SELF_TO_BLACKLIST})):(e.userIDList.includes(r)&&(e.userIDList=e.userIDList.filter((function(e){return e!==r})),Ul.warn("".concat(n," 不能把自己拉黑,已过滤"))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Fg,requestData:e}).then((function(r){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ul.info("".concat(n," ok")),t._handleResponse(r.resultItem,!0),VM(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)})))}},{key:"_handleResponse",value:function(e,t){if(!Bd(e))for(var n,o,r,a=0,s=e.length;a<s;a++)o=e[a].to,r=e[a].resultCode,(ed(r)||0===r)&&(t?((n=this._blacklistMap.has(o)?this._blacklistMap.get(o):new Qv).userID=o,!Bd(e[a].addBlackTimeStamp)&&(n.timeStamp=e[a].addBlackTimeStamp),this._blacklistMap.set(o,n)):this._blacklistMap.has(o)&&(n=this._blacklistMap.get(o),this._blacklistMap.delete(o)));Ul.log("".concat(this._className,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(t))}},{key:"deleteBlacklist",value:function(e){var t=this,n="".concat(this._className,".deleteBlacklist"),o=new Uh(wh.REMOVE_FROM_BLACKLIST);return Zl(e.userIDList)?(e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:qg,requestData:e}).then((function(r){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ul.info("".concat(n," ok")),t._handleResponse(r.data.resultItem,!1),VM(M(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(e,r,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))):(o.setCode(yh.DEL_BLACKLIST_INVALID_PARAM).setMessage(Ih.DEL_BLACKLIST_INVALID_PARAM).setNetworkType(this._userModule.getNetworkType()).end(),Ul.error("".concat(n," options.userIDList 必需是数组")),XM({code:yh.DEL_BLACKLIST_INVALID_PARAM,message:Ih.DEL_BLACKLIST_INVALID_PARAM}))}},{key:"onAccountDeleted",value:function(e){for(var t,n=[],o=0,r=e.length;o<r;o++)t=e[o],this._blacklistMap.has(t)&&(this._blacklistMap.delete(t),n.push(t));n.length>0&&(Ul.log("".concat(this._className,".onAccountDeleted count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(pr.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,r=e.length;o<r;o++)t=e[o],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new Qv({userID:t})),n.push(t));n.length>0&&(Ul.log("".concat(this._className,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(pr.BLACKLIST_UPDATED,M(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),ey=Er("splice"),ty=O.TypeError,ny=Math.max,oy=Math.min;nn({target:"Array",proto:!0,forced:!ey},{splice:function(e,t){var n,o,r,a,s,i,c=De(this),u=bt(c),l=kt(e,u),d=arguments.length;if(0===d?n=o=0:1===d?(n=0,o=u-l):(n=d-2,o=oy(ny(Rt(t),0),u-l)),u+n-o>9007199254740991)throw ty("Maximum allowed length exceeded");for(r=Jn(c,o),a=0;a<o;a++)(s=l+a)in c&&Mo(r,a,c[s]);if(r.length=o,n<o){for(a=l;a<u-o;a++)i=a+n,(s=a+o)in c?c[i]=c[s]:delete c[i];for(a=u;a>u-o+n;a--)delete c[a-1]}else if(n>o)for(a=u-o;a>l;a--)i=a+n-1,(s=a+o-1)in c?c[i]=c[s]:delete c[i];for(a=0;a<n;a++)c[a+l]=arguments[a+2];return c.length=u-o+n,r}});var ry=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return Ul.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),"";for(var o,r,a=0,s=0;r=t.charAt(s++);~r&&(o=a%4?64*o+r:r,a++%4)?n+=String.fromCharCode(255&o>>(-2*a&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);try{return decodeURIComponent(escape(n))}catch(FS){return Ul.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),""}},ay=function(){function e(t){o(this,e),this._userModule=t,this._className="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(hv,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),n=this._userModule.getCloudConfig("status_unsub_count");Ul.log("".concat(this._className,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),ed(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),ed(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),ed(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(lg),r=t.map((function(e){var t=e.to,r=e.statusType,a=e.customStatus,s=ry(a);return t===n&&o.setCustomStatus(s),{userID:t,statusType:r,customStatus:s}}));this._userModule.emitOuterEvent(pr.USER_STATUS_UPDATED,r)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._className,".setSelfStatus"),o=e.customStatus,r=new Uh(wh.SET_SELF_STATUS);return this._userModule.request({protocolName:fh,requestData:{customStatus:o}}).then((function(e){return r.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(o)).end(),Ul.log("".concat(n," ok. customStatus:").concat(o)),t._userModule.getModule(lg).setCustomStatus(o),VM({userID:t._userModule.getMyUserID(),statusType:1,customStatus:o})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._className,".getUserStatus"),o=e.userIDList,r=void 0===o?[]:o,a=this._userModule.getMyUserID(),s=M(r),i=void 0,c=s.indexOf(a);if(c>-1){s.splice(c,1);var u=this._userModule.getModule(lg).getCustomStatus();i={userID:a,statusType:1,customStatus:u}}if(0===s.length)return JM({successUserList:[i],failureUserList:[]});if(!this._canIUseUserStatus())return XM({code:yh.CANNOT_USE_COMMERCIAL_ABILITY,message:Ih.CANNOT_USE_COMMERCIAL_ABILITY});s.length>this.MAX_QUERY_USER_COUNT&&(Ul.warn("".concat(n," 查询用户状态单次请求不能超过").concat(this.MAX_QUERY_USER_COUNT,"个用户")),s=r.slice(0,this.MAX_QUERY_USER_COUNT));var l=new Uh(wh.GET_USER_STATUS);return this._userModule.request({protocolName:mh,requestData:{userIDList:s}}).then((function(e){var o=e.data,a=o.successUserList,s=void 0===a?[]:a,c=o.failureUserList,u=void 0===c?[]:c,d=s.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:ry(o)}})),p=u.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,r=e.errorInfo;return{userID:Bd(n)?t:n,code:o,message:r}}));ed(i)||d.unshift(i);var g="userID count:".concat(r.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),Ul.log("".concat(n," ok. ").concat(g,".")),VM({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];l.setMessage("userID count:".concat(r.length)).setError(e,o,a).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return XM({code:yh.CANNOT_USE_COMMERCIAL_ABILITY,message:Ih.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".subscribeUserStatus"),o=e.userIDList,r=void 0===o?[]:o,a=M(r);a.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ul.warn("".concat(n," 订阅用户状态单次请求不能超过").concat(this.MAX_SUBSCRIBE_USER_COUNT,"个用户")),a=r.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var s=new Uh(wh.SUBSCRIBE_USER_STATUS),i="userID count:".concat(r.length);return Ul.log("".concat(n," ").concat(i)),this._userModule.request({protocolName:Mh,requestData:{userIDList:a}}).then((function(e){var o=e.data.failureUserList,r=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,r=e.errorInfo;return{userID:Bd(n)?t:n,code:o,message:r}}));return s.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(r.length)).end(),Ul.log("".concat(n," ok. fail count:").concat(r.length,".")),VM({failureUserList:r})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setMessage("".concat(i)).setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._canIUseUserStatus())return XM({code:yh.CANNOT_USE_COMMERCIAL_ABILITY,message:Ih.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".unsubscribeUserStatus"),o=(e||{}).userIDList,r=void 0===o?[]:o,a=M(r);r.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ul.warn("".concat(n," 取消订阅用户状态单次请求不能超过").concat(this.MAX_UNSUBSCRIBE_USER_COUNT,"个用户")),a=r.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var s=new Uh(wh.UNSUBSCRIBE_USER_STATUS),i="userID count:".concat(r.length);Ul.log("".concat(n," ").concat(i));var c={userIDList:a};return 0===a.length&&(c.userIDList=void 0,c.unsubscribeAll=1),this._userModule.request({protocolName:vh,requestData:c}).then((function(e){var o=e.data.failureUserList,r=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,r=e.errorInfo;return{userID:Bd(n)?t:n,code:o,message:r}}));return s.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(r.length)).end(),Ul.log("".concat(n," ok. fail count:").concat(r.length,".")),VM({failureUserList:r})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setMessage("".concat(i)).setError(e,o,r).end()})),Ul.error("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_canIUseUserStatus",value:function(){return this._userModule.getModule(Ag).hasPurchasedFeature(bu.USER_STATUS)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),sy=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="UserModule",r._profileHandler=new Xv(_(r)),r._blacklistHandler=new Zv(_(r)),r._userStatusHandler=new ay(_(r)),r.getInnerEmitterInstance().on(_v,r.onContextUpdated,_(r)),r}return a(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!Bd(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,M(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,M(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(dg)}},{key:"isMyFriend",value:function(e){var t=this.getModule(sg);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return JM(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(Dg),iy=function(){function e(t,n){o(this,e),this._moduleManager=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="2.21.0",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer}return a(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,r=[];Ku&&(r=Object.keys(Wu)),ju&&(r=Hu?Object.keys(uni):Object.keys(window));for(var a=0,s=r.length;a<s;a++)if(r[a].toLowerCase().includes("uikit")){e=!0;break}if(r=null,Ku&&nd(getApp)){var i=getApp().globalData;Ql(i)&&!0===i.isTUIKit&&(t=!0)}!0===this._moduleManager.getModule(dg).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(n=!0);var c=null;if(wu&&!qu&&"undefined"==typeof uni&&__wxConfig&&(c=__wxConfig.pages),Fu&&"undefined"==typeof uni&&__qqConfig&&(c=__qqConfig.pages),Zl(c)&&c.length>0){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){o=!0;break}c=null}return e||t||n||o}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),e}(),cy=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="SignModule",r._helloInterval=120,r._lastLoginTs=0,r._lastWsHelloTs=0,mv.mixin(_(r)),r}return a(n,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"login",value:function(e){if(this.isLoggedIn()){var t="您已经登录帐号".concat(e.userID,"!如需切换帐号登录,请先调用 logout 接口登出,再调用 login 接口登录。");return Ul.warn(t),JM({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return Ul.warn("您正在尝试登录帐号".concat(e.userID,"!请勿重复登录。")),XM({code:yh.REPEAT_LOGIN,message:Ih.REPEAT_LOGIN});Ul.log("".concat(this._className,".login userID:").concat(e.userID));var n=this._checkLoginInfo(e);if(0!==n.code)return XM(n);var o=this.getModule(lg),r=e.userID,a=e.userSig;return o.setUserID(r),o.setUserSig(a),this.getModule(Mg).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var e=this,t=this.getModule(lg),n=t.getScene(),o=new Uh(wh.LOGIN);return o.setMessage("".concat(n)).setMoreMessage("identifier:".concat(this.getMyUserID())),Hu?"tuikit"===n?o.setUIPlatform(4):o.setUIPlatform(3):Ku?"tuikit"===n?o.setUIPlatform(12):o.setUIPlatform(11):ju&&(pl?"tuikit"===n?o.setUIPlatform(17):o.setUIPlatform(16):"tuikit"===n?o.setUIPlatform(14):o.setUIPlatform(13)),this._lastLoginTs=Date.now(),this.request({protocolName:Cg}).then((function(r){e._lastLoginTs=0;var a=Date.now(),s=null,i=r.data,c=i.a2Key,u=i.tinyID,l=i.helloInterval,d=i.instanceID,p=i.timeStamp,g=i.customStatus,_=void 0===g?"":g;Ul.log("".concat(e._className,".login ok. scene:").concat(n," helloInterval:").concat(l," instanceID:").concat(d," timeStamp:").concat(p));var h=1e3*p,f=a-o.getStartTs(),m=h+parseInt(f/2)-a,M=o.getStartTs()+m;if(o.start(M),function(e,t){Rl=t;var n=new Date;n.setTime(e),Ul.info("baseTime from server: ".concat(n," offset: ").concat(Rl))}(h,m),!u)throw s=new YM({code:yh.NO_TINYID,message:Ih.NO_TINYID}),o.setError(s,!0,e.getNetworkType()).end(),s;if(!c)throw s=new YM({code:yh.NO_A2KEY,message:Ih.NO_A2KEY}),o.setError(s,!0,e.getNetworkType()).end(),s;o.setNetworkType(e.getNetworkType()).setMoreMessage("helloInterval:".concat(l," instanceID:").concat(d," offset:").concat(m)).end(),t.setA2Key(c),t.setTinyID(u),t.setStatusInstanceID(d);var v=ry(_);return t.setCustomStatus(v),e.getModule(Mg).updateProtocolConfig(),e.emitInnerEvent(_v),e._helloInterval=l,e.triggerReady(),e._fetchCloudControlConfig(),r})).catch((function(t){return e.probeNetwork().then((function(e){var n=m(e,2),r=n[0],a=n[1];o.setError(t,r,a).end(!0)})),e._moduleManager.setNotReadyReason(yh.LOGIN_FAILED),Ul.error("".concat(e._className,".login failed. error:"),t),e._lastLoginTs=0,e._moduleManager.onLoginFailed(),XM(t)}))}},{key:"logout",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return XM({code:yh.USER_NOT_LOGGED_IN,message:Ih.USER_NOT_LOGGED_IN});var n=new Uh(wh.LOGOUT);return n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0),Ul.info("".concat(this._className,".logout type:").concat(t)),0===t&&this._moduleManager.setNotReadyReason(yh.LOGGED_OUT),this.request({protocolName:Ng,requestData:{type:t}}).then((function(){return e.resetReady(),JM({})})).catch((function(t){return Ul.error("".concat(e._className,"._logout error:"),t),e.resetReady(),JM({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(Ig).fetchConfig()}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:Rg}).catch((function(t){Ul.warn("".concat(e._className,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0,n="";return Bd(this.getModule(lg).getSDKAppID())?(t=yh.NO_SDKAPPID,n=Ih.NO_SDKAPPID):Bd(e.userID)?(t=yh.NO_IDENTIFIER,n=Ih.NO_IDENTIFIER):Bd(e.userSig)&&(t=yh.NO_USERSIG,n=Ih.NO_USERSIG),{code:t,message:n}}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new Uh(wh.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(gr.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ul.warn("".concat(this._className,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(pr.KICKED_OUT,{type:gr.KICKED_OUT_MULT_ACCOUNT}),t._moduleManager.setNotReadyReason(yh.KICKED_OUT_MULT_ACCOUNT),t._moduleManager.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new Uh(wh.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(gr.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ul.warn("".concat(this._className,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(pr.KICKED_OUT,{type:gr.KICKED_OUT_MULT_DEVICE}),t._moduleManager.setNotReadyReason(yh.KICKED_OUT_MULT_DEVICE),t._moduleManager.reset()}))}},{key:"onUserSigExpired",value:function(){new Uh(wh.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(gr.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ul.warn("".concat(this._className,".onUserSigExpired: userSig 签名过期被踢下线")),0!==this.getModule(lg).getStatusInstanceID()&&(this.emitOuterEvent(pr.KICKED_OUT,{type:gr.KICKED_OUT_USERSIG_EXPIRED}),this._moduleManager.setNotReadyReason(yh.KICKED_OUT_USERSIG_EXPIRED),this._moduleManager.reset())}},{key:"onRestApiKickedOut",value:function(e){(new Uh(wh.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(gr.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ul.warn("".concat(this._className,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(lg).getStatusInstanceID())&&(this.emitOuterEvent(pr.KICKED_OUT,{type:gr.KICKED_OUT_REST_API}),this._moduleManager.setNotReadyReason(yh.KICKED_OUT_REST_API),this._moduleManager.reset(),this.getModule(vg).onRestApiKickedOut())}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0}}]),n}(Dg),uy=nt.f;function ly(){return null}nn({target:"Object",stat:!0,forced:Object.defineProperty!==uy,sham:!k},{defineProperty:uy});var dy=function(){function e(t){o(this,e),this._moduleManager=t,this._className="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return a(e,[{key:"_errorTolerantHandle",value:function(){Ku||!ed(window)&&!ed(window.localStorage)||(this.getItem=ly,this.setItem=ly,this.removeItem=ly,this.clear=ly)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=S(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],r=n[1];this._setStorageSync(this._getKey(o),r)}}catch(a){t.e(a)}finally{t.f()}this._storageQueue.clear()}catch(FS){Ul.warn("".concat(this._className,"._doFlush error:"),FS)}}},{key:"_getPrefix",value:function(){var e=this._moduleManager.getModule(lg);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(FS){return Ul.warn("".concat(this._className,".getItem error:"),FS),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var r=o?this._getKey(e):e;this._setStorageSync(r,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{Ku?Wu.clearStorageSync():localStorage&&localStorage.clear()}catch(FS){Ul.warn("".concat(this._className,".clear error:"),FS)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(FS){Ul.warn("".concat(this._className,".removeItem error:"),FS)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),Ku&&(o.limitSize=1024*Wu.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(Ku){var r=Wu.getStorageInfoSync(),a=r.keys;a.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(localStorage)for(var s in localStorage)localStorage.hasOwnProperty(s)&&(o.size+=localStorage.getItem(s).length+s.length);return this._convertUnit(o)}catch(FS){Ul.warn("".concat(this._className," error:"),FS)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){Ku?Vu?my.setStorageSync({key:e,data:t}):Wu.setStorageSync(e,t):localStorage&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return Ku?Vu?my.getStorageSync({key:e}).data:Wu.getStorageSync(e):localStorage?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){Ku?Vu?my.removeStorageSync({key:e}):Wu.removeStorageSync(e):localStorage&&localStorage.removeItem(e)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._doFlush()}}]),e}(),py=function(){function e(t){o(this,e),this._className="SSOLogBody",this._report=[]}return a(e,[{key:"pushIn",value:function(e){Ul.debug("".concat(this._className,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;Zl(e)&&0!==e.length&&(Ul.debug("".concat(this._className,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,M(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),gy=function(e){var t=e.getModule(lg);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Ol()}},_y=function(e){i(r,e);var n=f(r);function r(e){var t;o(this,r),(t=n.call(this,e))._className="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new py,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var a=t.getInnerEmitterInstance();return a.on(_v,t._onLoginSuccess,_(t)),a.on(hv,t._onCloudConfigUpdated,_(t)),t}return a(r,[{key:"reportAtOnce",value:function(){Ul.debug("".concat(this._className,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(dg),n=t.getItem(this.TAG,!1);!Bd(n)&&nd(n.forEach)&&(Ul.log("".concat(this._className,"._onLoginSuccess get ssolog in storage, count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),r=this.getCloudConfig("evt_rpt_tinyid_wl");ed(e)||(this.MIN_THRESHOLD=Number(e)),ed(t)||(this.WAITING_TIME=Number(t)),ed(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),ed(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),ed(r)||(this.REPORT_TINYID_WHITELIST=r.split(","))}},{key:"pushIn",value:function(e){e instanceof Uh&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}},{key:"_filterLogs",value:function(e){var t=this,n=this.getModule(lg),o=n.getSDKAppID(),r=n.getTinyID();return Ud(this.REPORT_SDKAPPID_BLACKLIST,o)&&!wd(this.REPORT_TINYID_WHITELIST,r)?[]:e.filter((function(e){return t.REPORT_LEVEL.includes(e.level)}))}},{key:"_report",value:function(){var e=this;if(!this._reportBody.isEmpty()){var n=this._reportBody.getLogsInMemory(),o=this._filterLogs(n);if(0!==o.length){var r={header:gy(this),event:o};this.request({protocolName:Z_,requestData:t({},r)}).then((function(){e._lastReportTime=Date.now()})).catch((function(t){Ul.warn("".concat(e._className,".report failed. networkType:").concat(e.getNetworkType()," error:"),t),e._reportBody.backfill(n),e._reportBody.getLogsNumInMemory()>e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(dg),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory();if(Bd(t))Ul.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var o=n.concat(t);o.length>this.MAX_THRESHOLD&&(o=o.slice(0,this.MAX_THRESHOLD)),Ul.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1)}}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),r}(Dg),hy="none",fy="online",My=[yh.OVER_FREQUENCY_LIMIT,yh.OPEN_SERVICE_OVERLOAD_ERROR],vy=function(){function e(t){o(this,e),this._moduleManager=t,this._networkType="",this._className="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return a(e,[{key:"start",value:function(){var e=this;Ku?(Wu.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===hy?Ul.warn("".concat(e._className,".start no network, please check!")):Ul.info("".concat(e._className,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),Wu.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=fy,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:fy})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:hy})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o=!1;t?(Ul.info("".concat(this._className,"._onNetworkStatusChange previousNetworkType:").concat(this._networkType," currentNetworkType:").concat(n)),this._networkType!==n&&(o=!0,this._moduleManager.getModule(vg).reConnect(!0))):this._networkType!==n&&(o=!0,Ul.warn("".concat(this._className,"._onNetworkStatusChange no network, please check!")),this._moduleManager.getModule(vg).offline());o&&(new Uh(wh.NETWORK_CHANGE).setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(n)).end(),this._networkType=n)}},{key:"probe",value:function(e){var t=this;return!ed(e)&&My.includes(e.code)?Promise.resolve([!0,this._networkType]):new Promise((function(e,n){if(Ku)Wu.getNetworkType({success:function(n){t._networkType=n.networkType,n.networkType===hy?(Ul.warn("".concat(t._className,".probe no network, please check!")),e([!1,n.networkType])):(Ul.info("".concat(t._className,".probe networkType:").concat(n.networkType)),e([!0,n.networkType]))}});else if(window&&window.fetch)fetch("".concat(fd(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())).then((function(t){t.ok?e([!0,fy]):e([!1,hy])})).catch((function(t){e([!1,hy])}));else{var o=new XMLHttpRequest,r=setTimeout((function(){Ul.warn("".concat(t._className,".probe fetch timeout. Probably no network, please check!")),o.abort(),t._networkType=hy,e([!1,hy])}),t.MAX_WAIT_TIME);o.onreadystatechange=function(){4===o.readyState&&(clearTimeout(r),200===o.status||304===o.status||514===o.status?(this._networkType=fy,e([!0,fy])):(Ul.warn("".concat(this.className,".probe fetch status:").concat(o.status,". Probably no network, please check!")),this._networkType=hy,e([!1,hy])))},o.open("GET","".concat(fd(),"//web.sdk.qcloud.com/im/assets/speed.xml?random=").concat(Math.random())),o.send()}}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),Ku?null!==this._mpNetworkStatusCallback&&(Wu.offNetworkStatusChange&&(Bu||qu?Wu.offNetworkStatusChange(this._mpNetworkStatusCallback):Wu.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}(),yy=D((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,o,a,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var i=new r(o,a||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],i]:e._events[c].push(i):(e._events[c]=i,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},i.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,a=o.length,s=new Array(a);r<a;r++)s[r]=o[r].fn;return s},i.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},i.prototype.emit=function(e,t,o,r,a,s){var i=n?n+e:e;if(!this._events[i])return!1;var c,u,l=this._events[i],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,r),!0;case 5:return l.fn.call(l.context,t,o,r,a),!0;case 6:return l.fn.call(l.context,t,o,r,a,s),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,g=l.length;for(u=0;u<g;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,r);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];l[u].fn.apply(l[u].context,c)}}return!0},i.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},i.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},i.prototype.removeListener=function(e,t,o,r){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var i=this._events[a];if(i.fn)i.fn!==t||r&&!i.once||o&&i.context!==o||s(this,a);else{for(var c=0,u=[],l=i.length;c<l;c++)(i[c].fn!==t||r&&!i[c].once||o&&i[c].context!==o)&&u.push(i[c]);u.length?this._events[a]=1===u.length?u[0]:u:s(this,a)}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=n,i.EventEmitter=i,e.exports=i})),Iy=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="BigDataChannelModule",r.FILETYPE={SOUND:2106,FILE:2107,VIDEO:2113},r._bdh_download_server="grouptalk.c2c.qq.com",r._BDHBizID=10001,r._authKey="",r._expireTime=0,r.getInnerEmitterInstance().on(_v,r._getAuthKey,_(r)),r}return a(n,[{key:"_getAuthKey",value:function(){var e=this;this.request({protocolName:kg}).then((function(t){t.data.authKey&&(e._authKey=t.data.authKey,e._expireTime=parseInt(t.data.expireTime))}))}},{key:"_isFromOlderVersion",value:function(e){return!(!e.content||2===e.content.downloadFlag)}},{key:"parseElements",value:function(e,t){if(!Zl(e)||!t)return[];for(var n=[],o=null,r=0;r<e.length;r++)o=e[r],this._needParse(o)?n.push(this._parseElement(o,t)):n.push(e[r]);return n}},{key:"_needParse",value:function(e){return!e.cloudCustomData&&!(!this._isFromOlderVersion(e)||e.type!==gr.MSG_AUDIO&&e.type!==gr.MSG_FILE&&e.type!==gr.MSG_VIDEO)}},{key:"_parseElement",value:function(e,t){switch(e.type){case gr.MSG_AUDIO:return this._parseAudioElement(e,t);case gr.MSG_FILE:return this._parseFileElement(e,t);case gr.MSG_VIDEO:return this._parseVideoElement(e,t)}}},{key:"_parseAudioElement",value:function(e,t){return e.content.url=this._genAudioUrl(e.content.uuid,t),e}},{key:"_parseFileElement",value:function(e,t){return e.content.url=this._genFileUrl(e.content.uuid,t,e.content.fileName),e}},{key:"_parseVideoElement",value:function(e,t){return e.content.url=this._genVideoUrl(e.content.uuid,t),e}},{key:"_genAudioUrl",value:function(e,t){if(""===this._authKey)return Ul.warn("".concat(this._className,"._genAudioUrl no authKey!")),"";var n=this.getModule(lg).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(n,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.SOUND,"&openid=").concat(t,"&ver=0")}},{key:"_genFileUrl",value:function(e,t,n){if(""===this._authKey)return Ul.warn("".concat(this._className,"._genFileUrl no authKey!")),"";n||(n="".concat(Math.floor(1e5*Math.random()),"-").concat(Date.now()));var o=this.getModule(lg).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.FILE,"&openid=").concat(t,"&ver=0&filename=").concat(encodeURIComponent(n))}},{key:"_genVideoUrl",value:function(e,t){if(""===this._authKey)return Ul.warn("".concat(this._className,"._genVideoUrl no authKey!")),"";var n=this.getModule(lg).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(n,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.VIDEO,"&openid=").concat(t,"&ver=0")}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._authKey="",this.expireTime=0}}]),n}(Dg),Ey=["requestSnapshotUrl"],Ty=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="UploadModule",t.TIMUploadPlugin=null,t.timUploadPlugin=null,t.COSSDK=null,t._cosUploadMethod=null,t.expiredTimeLimit=600,t.appid=0,t.bucketName="",t.ciUrl="",t.directory="",t.downloadUrl="",t.uploadUrl="",t.region="ap-shanghai",t.cos=null,t.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},t.uploadFileType="",t.duration=900,t.tryCount=0,t.getInnerEmitterInstance().on(_v,t._init,_(t)),t}return a(r,[{key:"_init",value:function(){var e="".concat(this._className,"._init"),t=this.getModule(fg);if(this.TIMUploadPlugin=t.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var n=Ku?"cos-wx-sdk":"cos-js-sdk";this.COSSDK=t.getPlugin(n),this.COSSDK?(this._getAuthorizationKey(),Ul.warn("".concat(e," v2.9.2起推荐使用 tim-upload-plugin 代替 ").concat(n,",上传更快更安全。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin"))):Ul.warn("".concat(e," 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin"))}}},{key:"_getAuthorizationKey",value:function(){var e=this,t=new Uh(wh.GET_COS_AUTH_KEY),n=Math.ceil(Date.now()/1e3);this.request({protocolName:J_,requestData:{duration:this.expiredTimeLimit}}).then((function(o){var r=o.data;Ul.log("".concat(e._className,"._getAuthorizationKey ok. data:"),r);var a=r.expiredTime-n;t.setMessage("requestId:".concat(r.requestId," requestTime:").concat(n," expiredTime:").concat(r.expiredTime," diff:").concat(a,"s")).setNetworkType(e.getNetworkType()).end(),!Ku&&r.region&&(e.region=r.region),e.appid=r.appid,e.bucketName=r.bucketName,e.ciUrl=r.ciUrl,e.directory=r.directory,e.downloadUrl=r.downloadUrl,e.uploadUrl=r.uploadUrl,e.cosOptions={secretId:r.secretId,secretKey:r.secretKey,sessionToken:r.sessionToken,expiredTime:r.expiredTime},Ul.log("".concat(e._className,"._getAuthorizationKey ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()})).catch((function(n){e.probeNetwork().then((function(e){var o=m(e,2),r=o[0],a=o[1];t.setError(n,r,a).end()})),Ul.warn("".concat(e._className,"._getAuthorizationKey failed. error:"),n)}))}},{key:"_getCosPreSigUrl",value:function(e){var t=this,n="".concat(this._className,"._getCosPreSigUrl"),o=Math.ceil(Date.now()/1e3),r=new Uh(wh.GET_COS_PRE_SIG_URL);return this.request({protocolName:X_,requestData:{fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration}}).then((function(e){t.tryCount=0;var a=e.data||{},s=a.expiredTime-o;return Ul.log("".concat(n," ok. data:"),a),r.setMessage("requestId:".concat(a.requestId," expiredTime:").concat(a.expiredTime," diff:").concat(s,"s")).setNetworkType(t.getNetworkType()).end(),a})).catch((function(o){return-1===o.code&&(o.code=yh.COS_GET_SIG_FAIL),t.probeNetwork().then((function(e){var t=m(e,2),n=t[0],a=t[1];r.setError(o,n,a).end()})),Ul.warn("".concat(n," failed. error:"),o),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,XM({code:yh.COS_GET_SIG_FAIL,message:Ih.COS_GET_SIG_FAIL}))}))}},{key:"_initUploaderMethod",value:function(){var e=this;if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=function(t,n){e.timUploadPlugin.uploadFile(t,n)});this.appid&&(this.cos=Ku?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=Ku?function(t,n){e.cos.postObject(t,n)}:function(t,n){e.cos.uploadFiles(t,n)})}},{key:"onCheckTimer",value:function(e){this.COSSDK&&(this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule(Sg);switch(e.type){case gr.MSG_IMAGE:return t.addTotalCount(Nh),this._uploadImage(e);case gr.MSG_FILE:return t.addTotalCount(Nh),this._uploadFile(e);case gr.MSG_AUDIO:return t.addTotalCount(Nh),this._uploadAudio(e);case gr.MSG_VIDEO:return t.addTotalCount(Nh),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(ng),r=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:a.payload.file,to:a.to,onProgress:function(e){if(r.updatePercent(e),nd(a.onProgress))try{a.onProgress(e)}catch(t){return XM({code:yh.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Ih.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=o.fileType,i=o.fileSize,c=o.width,u=o.height,l=n.isPrivateNetWork()?a:md(a);r.updateImageFormat(s);var d=kd({originUrl:l,originWidth:c,originHeight:u,min:198}),p=kd({originUrl:l,originWidth:c,originHeight:u,min:720});return r.updateImageInfoArray([{size:i,url:l,width:c,height:u},t({},p),t({},d)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(ng),o=e.getElements()[0],r=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:r.payload.file,to:r.to,onProgress:function(e){if(o.updatePercent(e),nd(r.onProgress))try{r.onProgress(e)}catch(t){return XM({code:yh.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Ih.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var r=n.location,a=t.isPrivateNetWork()?r:md(r);return o.updateFileUrl(a),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(ng),o=e.getElements()[0],r=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:r.payload.file,to:r.to,onProgress:function(e){if(o.updatePercent(e),nd(r.onProgress))try{r.onProgress(e)}catch(t){return XM({code:yh.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Ih.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var r=n.location,a=t.isPrivateNetWork()?r:md(r);return o.updateAudioUrl(a),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(ng),o=e.getElements()[0],r=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:r.payload.file,to:r.to,onProgress:function(e){if(o.updatePercent(e),nd(r.onProgress))try{r.onProgress(e)}catch(t){return XM({code:yh.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:Ih.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var r=n.location,a=n.snapshotInfo,s=t.isPrivateNetWork()?r:md(r);return o.updateVideoUrl(s),Bd(a)||o.updateSnapshotInfo(a),e}))}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return XM({code:yh.MESSAGE_IMAGE_SELECT_FILE_FIRST,message:Ih.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var r=null;return this._setUploadFileType(yv),this.uploadByCOS(e).then((function(e){return r=e,t.isPrivateNetWork()?Nd(e.location):Nd("https://".concat(e.location))})).then((function(e){return r.width=e.width,r.height=e.height,Promise.resolve(r)}))}},{key:"_checkImageType",value:function(e){var t="";return t=Ku?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),Mv.indexOf(t.toLowerCase())>=0||XM({code:yh.MESSAGE_IMAGE_TYPES_LIMIT,message:Ih.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=Ku?e.size:e.files[0].size)?XM({code:yh.MESSAGE_FILE_IS_EMPTY,message:"".concat(Ih.MESSAGE_FILE_IS_EMPTY)}):t<20971520||XM({code:yh.MESSAGE_IMAGE_SIZE_LIMIT,message:"".concat(Ih.MESSAGE_IMAGE_SIZE_LIMIT)})}},{key:"doUploadFile",value:function(e){var t=null;return e.file?e.file.files[0].size>104857600?XM(t={code:yh.MESSAGE_FILE_SIZE_LIMIT,message:Ih.MESSAGE_FILE_SIZE_LIMIT}):0===e.file.files[0].size?(t={code:yh.MESSAGE_FILE_IS_EMPTY,message:"".concat(Ih.MESSAGE_FILE_IS_EMPTY)},XM(t)):(this._setUploadFileType(Tv),this.uploadByCOS(e)):XM(t={code:yh.MESSAGE_FILE_SELECT_FILE_FIRST,message:Ih.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>104857600?XM({code:yh.MESSAGE_VIDEO_SIZE_LIMIT,message:"".concat(Ih.MESSAGE_VIDEO_SIZE_LIMIT)}):0===e.file.videoFile.size?XM({code:yh.MESSAGE_FILE_IS_EMPTY,message:"".concat(Ih.MESSAGE_FILE_IS_EMPTY)}):-1===vv.indexOf(e.file.videoFile.type)?XM({code:yh.MESSAGE_VIDEO_TYPES_LIMIT,message:"".concat(Ih.MESSAGE_VIDEO_TYPES_LIMIT)}):(this._setUploadFileType(Iv),Ku?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ju?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new YM({code:yh.MESSAGE_VIDEO_UPLOAD_FAIL,message:Ih.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>20971520?XM(new YM({code:yh.MESSAGE_AUDIO_SIZE_LIMIT,message:"".concat(Ih.MESSAGE_AUDIO_SIZE_LIMIT)})):0===e.file.size?XM(new YM({code:yh.MESSAGE_FILE_IS_EMPTY,message:"".concat(Ih.MESSAGE_FILE_IS_EMPTY)})):(this._setUploadFileType(Ev),this.uploadByCOS(e)):XM(new YM({code:yh.MESSAGE_AUDIO_UPLOAD_FAIL,message:Ih.MESSAGE_AUDIO_UPLOAD_FAIL}))}},{key:"uploadByCOS",value:function(e){var t=this,n="".concat(this._className,".uploadByCOS");if(!nd(this._cosUploadMethod))return Ul.warn("".concat(n," 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin")),XM({code:yh.COS_UNDETECTED,message:Ih.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var o=new Uh(wh.UPLOAD),r=Date.now(),a=this._getFile(e);return new Promise((function(s,i){var c=Ku?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),u=t;t._cosUploadMethod(c,(function(e,c){var l=Object.create(null);if(c){if(e||Zl(c.files)&&c.files[0].error){var d=new YM({code:yh.MESSAGE_FILE_UPLOAD_FAIL,message:Ih.MESSAGE_FILE_UPLOAD_FAIL});return o.setError(d,!0,t.getNetworkType()).end(),Ul.log("".concat(n," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&(Ul.warn("".concat(n," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void i(d)}l.fileName=a.name,l.fileSize=a.size,l.fileType=a.type.slice(a.type.indexOf("/")+1).toLowerCase(),l.location=Ku?c.Location:c.files[0].data.Location;var p=Date.now()-r,g=u._formatFileSize(a.size),_=u._formatSpeed(1e3*a.size/p),h="size:".concat(g," time:").concat(p,"ms speed:").concat(_);Ul.log("".concat(n," success. name:").concat(a.name," ").concat(h)),s(l);var f=t.getModule(Sg);return f.addCost(Nh,p),f.addFileSize(Nh,a.size),void o.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new YM({code:yh.MESSAGE_FILE_UPLOAD_FAIL,message:Ih.MESSAGE_FILE_UPLOAD_FAIL});o.setError(m,!0,u.getNetworkType()).end(),Ul.warn("".concat(n," failed. error:"),e),403===e.statusCode&&(Ul.warn("".concat(n," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(m)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._className,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(r,a){var s=new Uh(wh.UPLOAD),i=e.requestSnapshotUrl,c=void 0===i?void 0:i,u=g(e,Ey),l=Date.now();t._cosUploadMethod(u,(function(e,i){var u=Object.create(null);if(e||403===i.statusCode){var d=new YM({code:yh.MESSAGE_FILE_UPLOAD_FAIL,message:Ih.MESSAGE_FILE_UPLOAD_FAIL});return s.setError(d,!0,t.getNetworkType()).end(),Ul.log("".concat(n," failed, error:"),e),void a(d)}var p=i.data.location||"";t.isPrivateNetWork()||0!==p.indexOf("https://")&&0!==p.indexOf("http://")||(p=p.split("//")[1]),u.fileName=o.name,u.fileSize=o.size,u.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),u.location=p;var g=Date.now()-l,_=t._formatFileSize(o.size),h=t._formatSpeed(1e3*o.size/g),f="size:".concat(_,",time:").concat(g,"ms,speed:").concat(h," res:").concat(JSON.stringify(i.data));Ul.log("".concat(n," success name:").concat(o.name,",").concat(f)),s.setNetworkType(t.getNetworkType()).setMessage(f).end();var m=t.getModule(Sg);if(m.addCost(Nh,g),m.addFileSize(Nh,o.size),!Bd(c))return t._getSnapshotInfoByUrl(c).then((function(e){u.snapshotInfo=e,r(u)}));r(u)}))}))}))}},{key:"_getFile",value:function(e){var t=null;return Ku?t=wu||Fu||Bu&&Zl(e.file.files)?e.file.files[0]:e.file:ju&&(t=e.file.files[0]),t}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?bd(e/1024,1)+"KB/s":bd(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=e.file.files[0].name,n=t.slice(t.lastIndexOf(".")),o=this._genFileName("".concat(dd(999999)).concat(n));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(o),Body:e.file.files[0]}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ul.warn("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:o,onProgress:function(t){if(Ul.log(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ul.warn("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",r=0;if(Ku){var a=this._getFile(e);n=this._genFileName(a.name),o=a.url,r=1}else{var s=e.file.files[0].name,i=s.slice(s.lastIndexOf("."));n=this._genFileName("".concat(dd(999999)).concat(i)),o=e.file.files[0],r=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:r,duration:this.duration}).then((function(r){var a=r.uploadUrl,s=r.downloadUrl,i=r.requestSnapshotUrl,c=void 0===i?void 0:i;return{url:a,fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:s,requestSnapshotUrl:c,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ul.warn("onProgress callback error:",n),Ul.error(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Rd(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e){var t=this,n=new Uh(wh.GET_SNAPSHOT_INFO);return this.request({protocolName:Q_,requestData:{platform:this.getPlatform(),coverName:this._genFileName(dd(99999)),requestSnapshotUrl:e}}).then((function(e){var t=(e.data||{}).snapshotUrl;return n.setMessage("snapshotUrl:".concat(t)).end(),Bd(t)?{}:Nd(t).then((function(e){return{snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Ul.warn("".concat(t._className,"._getSnapshotInfoByUrl failed. error:"),e),n.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset"))}}]),r}(Dg),Sy=["downloadKey","pbDownloadKey","messageList"],Ay=function(){function e(t){o(this,e),this._className="MergerMessageHandler",this._messageModule=t}return a(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this;Ul.debug("".concat(this._className,".uploadMergerMessage message:"),e,"messageBytes:".concat(t));var o=e.payload.messageList,r=o.length,a=new Uh(wh.UPLOAD_MERGER_MESSAGE);return this._messageModule.request({protocolName:ah,requestData:{messageList:o}}).then((function(e){Ul.debug("".concat(n._className,".uploadMergerMessage ok. response:"),e.data);var o=e.data,s=o.pbDownloadKey,i=o.downloadKey,c={pbDownloadKey:s,downloadKey:i,messageNumber:r};return a.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(r,"-").concat(t,"-").concat(i)).end(),c})).catch((function(e){throw Ul.warn("".concat(n._className,".uploadMergerMessage failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this;Ul.debug("".concat(this._className,".downloadMergerMessage message:"),e);var o=e.payload.downloadKey,r=new Uh(wh.DOWNLOAD_MERGER_MESSAGE);return r.setMessage("downloadKey:".concat(o)),this._messageModule.request({protocolName:sh,requestData:{downloadKey:o}}).then((function(o){if(Ul.debug("".concat(n._className,".downloadMergerMessage ok. response:"),o.data),nd(e.clearElement)){var a=e.payload,s=(a.downloadKey,a.pbDownloadKey,a.messageList,g(a,Sy));e.clearElement(),e.setElement({type:e.type,content:t({messageList:o.data.messageList},s)})}else{var i=[];o.data.messageList.forEach((function(e){if(!Bd(e)){var t=new wM(e);i.push(t)}})),e.payload.messageList=i,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return r.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Ul.warn("".concat(n._className,".downloadMergerMessage failed. key:").concat(o," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===gr.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var r="";Jl(e.cloudCustomData)&&e.cloudCustomData.length>0&&(r=e.cloudCustomData);var a=n.pbDownloadKey,s=n.downloadKey,i=n.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(rg);return{protocolName:Gg,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:a,downloadKey:s,title:u,abstractList:l,compatibleText:d,messageNumber:i}}],cloudCustomData:r,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:p&&p.isOnlineMessage(e,t)?0:void 0,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var r="";Jl(e.cloudCustomData)&&e.cloudCustomData.length>0&&(r=e.cloudCustomData);var a=n.pbDownloadKey,s=n.downloadKey,i=n.messageNumber,c=e.payload,u=c.title,l=c.abstractList,d=c.compatibleText,p=this._messageModule.getModule(ag);return{protocolName:Pg,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:a,downloadKey:s,title:u,abstractList:l,compatibleText:d,messageNumber:i}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:r,onlineOnlyFlag:p&&p.isOnlineMessage(e,t)?1:0,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||p.isMessageFromOrToAVChatroom(e.to)?0:1}}}}]),e}(),Dy={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Cy=[yh.MESSAGE_ONPROGRESS_FUNCTION_ERROR,yh.MESSAGE_IMAGE_SELECT_FILE_FIRST,yh.MESSAGE_IMAGE_TYPES_LIMIT,yh.MESSAGE_FILE_IS_EMPTY,yh.MESSAGE_IMAGE_SIZE_LIMIT,yh.MESSAGE_FILE_SELECT_FILE_FIRST,yh.MESSAGE_FILE_SIZE_LIMIT,yh.MESSAGE_VIDEO_SIZE_LIMIT,yh.MESSAGE_VIDEO_TYPES_LIMIT,yh.MESSAGE_AUDIO_UPLOAD_FAIL,yh.MESSAGE_AUDIO_SIZE_LIMIT,yh.COS_UNDETECTED];var Ny,Ry=function(e){i(r,e);var n=f(r);function r(e){var t;return o(this,r),(t=n.call(this,e))._className="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Ay(_(t)),t}return a(r,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new xM(e),o="string"==typeof e.payload?e.payload:e.payload.text,r=new Hh({text:o}),a=this._getNickAndAvatarByUserID(t);return n.setElement(r),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new xM(e);if(Ku){var o=e.payload.file;if($l(o))return void Ul.warn("小程序环境下调用 createImageMessage 接口时payload.file 不支持传入 File 对象");var r=o.tempFilePaths[0],a={url:r,name:r.slice(r.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:r.slice(r.lastIndexOf(".")+1).toLowerCase()};e.payload.file=a}else if(ju)if($l(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(Ql(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var c=new IM({imageFormat:wl.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return n.setElement(c),n.setNickAndAvatar(u),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){if(Ku){var t=e.payload.file;if(Ku){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var r=new xM(e),a=new TM({second:Math.floor(t.duration/1e3),size:t.fileSize,url:t.tempFilePath,uuid:this._generateUUID()}),s=this._getNickAndAvatarByUserID(o);return r.setElement(a),r.setNickAndAvatar(s),r.setNameCard(this._getNameCardByGroupID(r)),this._messageOptionsMap.set(r.clientSequence,e),r}Ul.warn("createAudioMessage 目前只支持小程序环境下发语音消息")}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="https://web.sdk.qcloud.com/im/assets/images/transparent.png",e.payload.file.thumbSize=1668;var n={};if(Ku){if(Vu)return void Ul.warn("createVideoMessage 不支持在支付宝小程序环境下使用");if($l(e.payload.file))return void Ul.warn("小程序环境下调用 createVideoMessage 接口时payload.file 不支持传入 File 对象");var o=e.payload.file;n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size,n.second=o.duration,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ju){if($l(e.payload.file)){var r=e.payload.file;e.payload.file.files=[r]}else if(Ql(e.payload.file)&&"undefined"!=typeof uni){var a=e.payload.file.tempFile;e.payload.file.files=[a]}var s=e.payload.file;n.url=window.URL.createObjectURL(s.files[0]),n.name=s.files[0].name,n.size=s.files[0].size,n.second=s.files[0].duration||0,n.type=s.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var i=new xM(e),c=new bM({videoFormat:n.type,videoSecond:bd(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(),thumbUUID:this._generateUUID(),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),u=this._getNickAndAvatarByUserID(t);return i.setElement(c),i.setNickAndAvatar(u),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new xM(e),o=new PM({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),r=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(r),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new xM(e),o=new EM(e.payload),r=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(r),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new xM(e),r=new FM(e.payload);return o.setElement(r),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,r=e.payload,a=e.needReadReceipt,s=this.getMyUserID(),i=this._getNickAndAvatarByUserID(s);if(r.type===gr.MSG_GRP_TIP)return XM(new YM({code:yh.MESSAGE_FORWARD_TYPE_INVALID,message:Ih.MESSAGE_FORWARD_TYPE_INVALID}));var c={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:wp.UNSEND,currentUser:s,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||r.cloudCustomData||"",needReadReceipt:a},u=new xM(c);return u.setElement(r.getElements()[0]),u.setNickAndAvatar(i),u.setNameCard(this._getNameCardByGroupID(r)),u.setRelayFlag(!0),u}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(Ku){var n,o="createFileMessage 接口不可用!";if(!wu&&!Fu&&!Bu)return void Ul.warn("小程序目前不支持选择文件,".concat(o));var r=Wu.getSystemInfoSync().SDKVersion;if(wu&&Ld(r,n="2.5.0")<0)return void Ul.warn("wx.chooseMessageFile 需要基础库".concat(n,"或更高版本,").concat(o));if(Fu&&Ld(r,n="1.18.0")<0)return void Ul.warn("qq.chooseMessageFile 需要基础库".concat(n,"或更高版本,").concat(o))}if(ju||Bu){if($l(e.payload.file)){var a=e.payload.file;e.payload.file={files:[a]}}else if(Ql(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file,i=s.tempFiles,c=s.files,u=null;Zl(i)?u=i[0]:Zl(c)&&(u=c[0]),e.payload.file={files:[u]}}}else if(wu||Fu){var l=e.payload.file.tempFiles,d=t(t({},l[0]),{},{url:l[0].path});e.payload.file={files:[d]}}var p=this.getMyUserID();e.currentUser=p,e.senderTinyID=this.getMyTinyID();var g=new xM(e),_=new GM({uuid:this._generateUUID(),file:e.payload.file}),h=this._getNickAndAvatarByUserID(p);return g.setElement(_),g.setNickAndAvatar(h),g.setNameCard(this._getNameCardByGroupID(g)),this._messageOptionsMap.set(g.clientSequence,e),g}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new xM(e),o=new UM(e.payload),r=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(r),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n,o=this,r=null;switch(e.conversationType){case gr.CONV_C2C:if(!(r=this.getModule(rg)))return this._onCannotFindModule();break;case gr.CONV_GROUP:if(!(r=this.getModule(ag)))return this._onCannotFindModule();if(Ed({groupID:e.to})){var a=r.getLocalGroupProfile(e.to);if(a&&a.isSupportTopic)return XM({code:yh.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL,message:Ih.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL});if(!ed(t)&&!ed(t.messageControlInfo))return XM({code:yh.MESSAGE_CONTROL_INFO_FAIL,message:Ih.MESSAGE_CONTROL_INFO_FAIL})}break;default:return XM({code:yh.MESSAGE_SEND_INVALID_CONVERSATION_TYPE,message:Ih.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var s=this.getModule(hg),i=this.getModule(ag);return s.upload(e).then((function(){o._getSendMessageSpecifiedKey(e)===Ch&&o.getModule(Sg).addSuccessCount(Nh);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return XM({code:yh.MESSAGE_FILE_URL_IS_EMPTY,message:Ih.MESSAGE_FILE_URL_IS_EMPTY});o._addSendMessageTotalCount(e),n=Date.now();var a=function(e){var t="utf-8";ju&&document&&(t=document.charset.toLowerCase());var n,o,r=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var a=0;a<o;a++)(n=e.codePointAt(a))<=127?r+=1:n<=2047?r+=2:n<=65535?r+=3:(r+=4,a++);else if("utf-16"===t||"utf16"===t)for(var s=0;s<o;s++)(n=e.codePointAt(s))<=65535?r+=2:(r+=4,s++);else r=e.replace(/[^\x00-\xff]/g,"aa").length;return r}(JSON.stringify(e));return e.type===gr.MSG_MERGER&&a>7e3?o._mergerMessageHandler.uploadMergerMessage(e,a).then((function(n){var r=o._mergerMessageHandler.createMergerMessagePack(e,t,n);return o.request(r)})):(o.getModule(ug).setMessageRandom(e),e.conversationType===gr.CONV_C2C||e.conversationType===gr.CONV_GROUP?r.sendMessage(e,t):void 0)})).then((function(a){var s=a.data,i=s.time,c=s.sequence,u=s.readReceiptCode;zl(u)&&0!==u&&(new Uh(wh.SEND_MESSAGE_WITH_RECEIPT).setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(c," readReceiptCode:").concat(u)).end(),Ul.warn("".concat(o._className,".sendMessageInstance readReceiptCode:").concat(u," message:").concat(WM[u])));o._addSendMessageSuccessCount(e,n),o._messageOptionsMap.delete(e.clientSequence);var l=o.getModule(ug);e.status=wp.SUCCESS,e.time=i;var d=!1;if(e.conversationType===gr.CONV_GROUP)e.sequence=c;else if(e.conversationType===gr.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,_=p.avatar;g===e.nick&&_===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),r.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;Ql(t)&&Ql(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Td(e.to))f=gr.CONV_TOPIC,o.getModule(cg).onMessageSent({groupID:Fd(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||Gd(e.payload.imageInfoArray),VM({message:e})}))})).catch((function(t){return o._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=wp.FAIL,this.getModule(ug).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new Uh(wh.SEND_MESSAGE);return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var o=m(e,2),r=o[0],a=o[1];n.setError(t,r,a).end()})),Ul.error("".concat(this._className,"._onSendMessageFailed error:"),t),XM(new YM({code:t&&t.code?t.code:yh.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:Ih.MESSAGE_SEND_FAIL,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([gr.MSG_IMAGE,gr.MSG_AUDIO,gr.MSG_VIDEO,gr.MSG_FILE].includes(e.type))return Ch;if(e.conversationType===gr.CONV_C2C)return Sh;if(e.conversationType===gr.CONV_GROUP){var t=this.getModule(ag).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Id(n)?Dh:Ah}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(Sg).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var r=this.getModule(Sg);r.addSuccessCount(o),r.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,r=t.code,a=void 0===r?-1:r,s=this.getModule(Sg),i=this._getSendMessageSpecifiedKey(e);i===Ch&&(n=a,o=!1,Cy.includes(n)&&(o=!0),o)?s.addFailedCountOfUserSide(Nh):function(e){var t=!1;return Object.values(Dy).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}(a)&&i&&s.addFailedCountOfUserSide(i)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=wp.UNSEND,e.random=dd(),e.clientTime=kl(),e.generateMessageID(),this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===gr.CONV_C2C){if(!(n=this.getModule(rg)))return this._onCannotFindModule()}else if(e.conversationType===gr.CONV_GROUP&&!(n=this.getModule(ag)))return this._onCannotFindModule();var o=new Uh(wh.REVOKE_MESSAGE);return o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),n.revokeMessage(e).then((function(n){var r=n.data.recallRetList;if(!Bd(r)&&0!==r[0].retCode){var a=new YM({code:r[0].retCode,message:WM[r[0].retCode]||Ih.MESSAGE_REVOKE_FAIL,data:{message:e}});return o.setCode(a.code).setMoreMessage(a.message).end(),XM(a)}return Ul.info("".concat(t._className,".revokeMessage ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(ug).onMessageRevoked([e]),VM({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),r=t[0],a=t[1];o.setError(n,r,a).end()}));var r=new YM({code:n&&n.code?n.code:yh.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:Ih.MESSAGE_REVOKE_FAIL,data:{message:e}});return Ul.warn("".concat(t._className,".revokeMessage failed. error:"),n),XM(r)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],r=o.conversationID,a="",s=[],i=[];if(o.conversationType===gr.CONV_C2C)n=this.getModule(rg),a=r.replace(gr.CONV_C2C,""),e.forEach((function(e){e&&e.status===wp.SUCCESS&&e.conversationID===r&&(e._onlineOnlyFlag||s.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(o.conversationType===gr.CONV_GROUP)n=this.getModule(ag),a=r.replace(gr.CONV_GROUP,""),e.forEach((function(e){e&&e.status===wp.SUCCESS&&e.conversationID===r&&(e._onlineOnlyFlag||s.push("".concat(e.sequence)),i.push(e))}));else if(o.conversationType===gr.CONV_SYSTEM)return XM({code:yh.CANNOT_DELETE_GROUP_SYSTEM_NOTICE,message:Ih.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===s.length)return this._onMessageDeleted(i);s.length>30&&(s=s.slice(0,30),i=i.slice(0,30));var c=new Uh(wh.DELETE_MESSAGE);return c.setMessage("to:".concat(a," count:").concat(s.length)),n.deleteMessage({to:a,keyList:s}).then((function(e){return c.end(),Ul.info("".concat(t._className,".deleteMessage ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];c.setError(e,o,r).end()})),Ul.warn("".concat(t._className,".deleteMessage failed. error:"),e);var n=new YM({code:e&&e.code?e.code:yh.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:Ih.MESSAGE_DELETE_FAIL});return XM(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(ug).onMessageDeleted(e),JM({messageList:e})}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,r=e.to;if(this.getModule(ag).isMessageFromOrToAVChatroom(r))return XM({code:yh.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,message:Ih.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});o===gr.CONV_C2C?n=this.getModule(rg):o===gr.CONV_GROUP&&(n=this.getModule(ag));var a=new Uh(wh.MODIFY_MESSAGE);return a.setMessage("to:".concat(r)),n.modifyRemoteMessage(e).then((function(n){a.end(),Ul.info("".concat(t._className,".modifyRemoteMessage ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return VM({message:o})})).catch((function(n){if(a.setCode(n.code).setMoreMessage(n.message).end(),Ul.warn("".concat(t._className,".modifyRemoteMessage failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return XM({code:yh.MESSAGE_MODIFY_CONFLICT,message:Ih.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return XM({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){Ul.debug("".concat(this._className,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,r=e.to,a=e.random,s=e.sequence,i=e.time,c=t.elements,u=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(ug).onMessageModified({conversationType:n,from:o,to:r,time:i,random:a,sequence:s,elements:c,cloudCustomData:d,messageVersion:u})}},{key:"_generateUUID",value:function(){var e=this.getModule(lg);return"".concat(e.getSDKAppID(),"-").concat(e.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=pd[Math.floor(Math.random()*gd)];return e}())}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(og).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===gr.CONV_GROUP){var t=this.getModule(ag);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._messageOptionsMap.clear()}}]),r}(Dg),Oy=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="PluginModule",r.plugins={},r}return a(n,[{key:"registerPlugin",value:function(e){var t=this;Object.keys(e).forEach((function(n){t.plugins[n]=e[n]})),new Uh(wh.REGISTER_PLUGIN).setMessage("key=".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset"))}}]),n}(Dg),Ly=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="SyncUnreadMessageModule",r._cookie="",r._onlineSyncFlag=!1,r.getInnerEmitterInstance().on(_v,r._onLoginSuccess,_(r)),r}return a(n,[{key:"_onLoginSuccess",value:function(e){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var t=this,n=e.cookie,o=e.syncFlag,r=e.isOnlineSync;Ul.log("".concat(this._className,"._startSync cookie:").concat(n," syncFlag:").concat(o," isOnlineSync:").concat(r)),this.request({protocolName:Lg,requestData:{cookie:n,syncFlag:o,isOnlineSync:r}}).then((function(e){var n=e.data,o=n.cookie,r=n.syncFlag,a=n.eventArray,s=n.messageList,i=n.C2CRemainingUnreadList,c=n.C2CPairUnreadList;if(t._cookie=o,Bd(o));else if(0===r||1===r){if(a)t.getModule(Mg).onMessage({head:{},body:{eventArray:a,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!1}});t.getModule(rg).onNewC2CMessage({dataList:s,isInstantMessage:!1,C2CRemainingUnreadList:i,C2CPairUnreadList:c}),t._startSync({cookie:o,syncFlag:r,isOnlineSync:0})}else if(2===r){if(a)t.getModule(Mg).onMessage({head:{},body:{eventArray:a,isInstantMessage:t._onlineSyncFlag,isSyncingEnded:!0}});t.getModule(rg).onNewC2CMessage({dataList:s,isInstantMessage:t._onlineSyncFlag,C2CRemainingUnreadList:i,C2CPairUnreadList:c})}})).catch((function(e){Ul.error("".concat(t._className,"._startSync failed. error:"),e)}))}},{key:"startOnlineSync",value:function(){Ul.log("".concat(this._className,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){Ul.log("".concat(this._className,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),n}(Dg),ky={request:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",fileUrl:"Url",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic"},response:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"hasChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence"},ignoreKeyWord:["C2C","ID","USP"]},Gy=At.PROPER,Py=Mn.trim;function by(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");t=Object.assign({pascalCase:!1},t);var n;return 0===(e=Array.isArray(e)?e.map((function(e){return e.trim()})).filter((function(e){return e.length})).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=Uy(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(e,t){return t.toUpperCase()})).replace(/\d+(\w|$)/g,(function(e){return e.toUpperCase()})),n=e,t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n)}nn({target:"String",proto:!0,forced:(Ny="trim",L((function(){return!!pn[Ny]()||"…"!=="…"[Ny]()||Gy&&pn[Ny].name!==Ny})))},{trim:function(){return Py(this)}});var Uy=function(e){for(var t=!1,n=!1,o=!1,r=0;r<e.length;r++){var a=e[r];t&&/[a-zA-Z]/.test(a)&&a.toUpperCase()===a?(e=e.slice(0,r)+"-"+e.slice(r),t=!1,o=n,n=!0,r++):n&&o&&/[a-zA-Z]/.test(a)&&a.toLowerCase()===a?(e=e.slice(0,r-1)+"-"+e.slice(r-1),o=n,n=!1,t=!0):(t=a.toLowerCase()===a&&a.toUpperCase()!==a,o=n,n=a.toUpperCase()===a&&a.toLowerCase()!==a)}return e};function wy(e,t){var n=0;return function e(t,o){if(++n>100)return n--,t;if(Zl(t)){var r=t.map((function(t){return Xl(t)?e(t,o):t}));return n--,r}if(Xl(t)){var a=(s=t,i=function(e,t){if(!ad(t))return!1;if((r=t)!==by(r))for(var n=0;n<ky.ignoreKeyWord.length&&!t.includes(ky.ignoreKeyWord[n]);n++);var r;return ed(o[t])?function(e){return"OPPOChannelID"===e?e:e[0].toUpperCase()+by(e).slice(1)}(t):o[t]},c=Object.create(null),Object.keys(s).forEach((function(e){var t=i(s[e],e);t&&(c[t]=s[e])})),c);return a=Cd(a,(function(t,n){return Zl(t)||Xl(t)?e(t,o):t})),n--,a}var s,i,c}(e,t)}function Fy(e,t){if(Zl(e))return e.map((function(e){return Xl(e)?Fy(e,t):e}));if(Xl(e)){var n=(o=e,r=function(e,n){return ed(t[n])?by(n):t[n]},a={},Object.keys(o).forEach((function(e){a[r(o[e],e)]=o[e]})),a);return n=Cd(n,(function(e){return Zl(e)||Xl(e)?Fy(e,t):e}))}var o,r,a}var qy="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,xy=O.RangeError,Vy=function(e){if(void 0===e)return 0;var t=Rt(e),n=Pt(t);if(t!==n)throw xy("Wrong length or index");return n},By=O.Array,Hy=Math.abs,Ky=Math.pow,jy=Math.floor,Wy=Math.log,Yy=Math.LN2,$y=function(e,t,n){var o,r,a,s=By(n),i=8*n-t-1,c=(1<<i)-1,u=c>>1,l=23===t?Ky(2,-24)-Ky(2,-77):0,d=e<0||0===e&&1/e<0?1:0,p=0;for((e=Hy(e))!=e||Infinity===e?(r=e!=e?1:0,o=c):(o=jy(Wy(e)/Yy),e*(a=Ky(2,-o))<1&&(o--,a*=2),(e+=o+u>=1?l/a:l*Ky(2,1-u))*a>=2&&(o++,a/=2),o+u>=c?(r=0,o=c):o+u>=1?(r=(e*a-1)*Ky(2,t),o+=u):(r=e*Ky(2,u-1)*Ky(2,t),o=0));t>=8;)s[p++]=255&r,r/=256,t-=8;for(o=o<<t|r,i+=t;i>0;)s[p++]=255&o,o/=256,i-=8;return s[--p]|=128*d,s},zy=function(e,t){var n,o=e.length,r=8*o-t-1,a=(1<<r)-1,s=a>>1,i=r-7,c=o-1,u=e[c--],l=127&u;for(u>>=7;i>0;)l=256*l+e[c--],i-=8;for(n=l&(1<<-i)-1,l>>=-i,i+=t;i>0;)n=256*n+e[c--],i-=8;if(0===l)l=1-s;else{if(l===a)return n?NaN:u?-Infinity:Infinity;n+=Ky(2,t),l-=s}return(u?-1:1)*n*Ky(2,l-t)},Jy=function(e){for(var t=De(this),n=bt(t),o=arguments.length,r=kt(o>1?arguments[1]:void 0,n),a=o>2?arguments[2]:void 0,s=void 0===a?n:kt(a,n);s>r;)t[r++]=e;return t},Xy=Ht.f,Qy=nt.f,Zy=At.PROPER,eI=At.CONFIGURABLE,tI=It.get,nI=It.set,oI=O.ArrayBuffer,rI=oI,aI=rI&&rI.prototype,sI=O.DataView,iI=sI&&sI.prototype,cI=Object.prototype,uI=O.Array,lI=O.RangeError,dI=K(Jy),pI=K([].reverse),gI=$y,_I=zy,hI=function(e){return[255&e]},fI=function(e){return[255&e,e>>8&255]},mI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},MI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},vI=function(e){return gI(e,23,4)},yI=function(e){return gI(e,52,8)},II=function(e,t){Qy(e.prototype,t,{get:function(){return tI(this)[t]}})},EI=function(e,t,n,o){var r=Vy(n),a=tI(e);if(r+t>a.byteLength)throw lI("Wrong index");var s=tI(a.buffer).bytes,i=r+a.byteOffset,c=ci(s,i,i+t);return o?c:pI(c)},TI=function(e,t,n,o,r,a){var s=Vy(n),i=tI(e);if(s+t>i.byteLength)throw lI("Wrong index");for(var c=tI(i.buffer).bytes,u=s+i.byteOffset,l=o(+r),d=0;d<t;d++)c[u+d]=l[a?d:t-d-1]};if(qy){var SI=Zy&&"ArrayBuffer"!==oI.name;if(L((function(){oI(1)}))&&L((function(){new oI(-1)}))&&!L((function(){return new oI,new oI(1.5),new oI(NaN),SI&&!eI})))SI&&eI&&ot(oI,"name","ArrayBuffer");else{(rI=function(e){return ki(this,aI),new oI(Vy(e))}).prototype=aI;for(var AI,DI=Xy(oI),CI=0;DI.length>CI;)(AI=DI[CI++])in rI||ot(rI,AI,oI[AI]);aI.constructor=rI}tr&&Ho(iI)!==cI&&tr(iI,cI);var NI=new sI(new rI(2)),RI=K(iI.setInt8);NI.setInt8(0,2147483648),NI.setInt8(1,2147483649),!NI.getInt8(0)&&NI.getInt8(1)||Ni(iI,{setInt8:function(e,t){RI(this,e,t<<24>>24)},setUint8:function(e,t){RI(this,e,t<<24>>24)}},{unsafe:!0})}else aI=(rI=function(e){ki(this,aI);var t=Vy(e);nI(this,{bytes:dI(uI(t),0),byteLength:t}),k||(this.byteLength=t)}).prototype,iI=(sI=function(e,t,n){ki(this,iI),ki(e,aI);var o=tI(e).byteLength,r=Rt(t);if(r<0||r>o)throw lI("Wrong offset");if(r+(n=void 0===n?o-r:Pt(n))>o)throw lI("Wrong length");nI(this,{buffer:e,byteLength:n,byteOffset:r}),k||(this.buffer=e,this.byteLength=n,this.byteOffset=r)}).prototype,k&&(II(rI,"byteLength"),II(sI,"buffer"),II(sI,"byteLength"),II(sI,"byteOffset")),Ni(iI,{getInt8:function(e){return EI(this,1,e)[0]<<24>>24},getUint8:function(e){return EI(this,1,e)[0]},getInt16:function(e){var t=EI(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=EI(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return MI(EI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return MI(EI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return _I(EI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return _I(EI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){TI(this,1,e,hI,t)},setUint8:function(e,t){TI(this,1,e,hI,t)},setInt16:function(e,t){TI(this,2,e,fI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){TI(this,2,e,fI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){TI(this,4,e,mI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){TI(this,4,e,mI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){TI(this,4,e,vI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){TI(this,8,e,yI,t,arguments.length>2?arguments[2]:void 0)}});zo(rI,"ArrayBuffer"),zo(sI,"DataView");var OI={ArrayBuffer:rI,DataView:sI},LI=OI.ArrayBuffer,kI=OI.DataView,GI=kI.prototype,PI=K(LI.prototype.slice),bI=K(GI.getUint8),UI=K(GI.setUint8),wI=L((function(){return!new LI(2).slice(1,void 0).byteLength}));nn({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:wI},{slice:function(e,t){if(PI&&void 0===t)return PI(Xe(this),e);for(var n=Xe(this).byteLength,o=kt(e,n),r=kt(void 0===t?n:t,n),a=new(xi(this,LI))(Pt(r-o)),s=new kI(this),i=new kI(a),c=0;o<r;)UI(i,c++,bI(s,o++));return a}});var FI,qI,xI,VI=nt.f,BI=O.Int8Array,HI=BI&&BI.prototype,KI=O.Uint8ClampedArray,jI=KI&&KI.prototype,WI=BI&&Ho(BI),YI=HI&&Ho(HI),$I=Object.prototype,zI=O.TypeError,JI=we("toStringTag"),XI=ke("TYPED_ARRAY_TAG"),QI=ke("TYPED_ARRAY_CONSTRUCTOR"),ZI=qy&&!!tr&&"Opera"!==un(O.opera),eE=!1,tE={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},nE={BigInt64Array:8,BigUint64Array:8},oE=function(e){if(!te(e))return!1;var t=un(e);return Ne(tE,t)||Ne(nE,t)};for(FI in tE)(xI=(qI=O[FI])&&qI.prototype)?ot(xI,QI,qI):ZI=!1;for(FI in nE)(xI=(qI=O[FI])&&qI.prototype)&&ot(xI,QI,qI);if((!ZI||!ee(WI)||WI===Function.prototype)&&(WI=function(){throw zI("Incorrect invocation")},ZI))for(FI in tE)O[FI]&&tr(O[FI],WI);if((!ZI||!YI||YI===$I)&&(YI=WI.prototype,ZI))for(FI in tE)O[FI]&&tr(O[FI].prototype,YI);if(ZI&&Ho(jI)!==YI&&tr(jI,YI),k&&!Ne(YI,JI))for(FI in eE=!0,VI(YI,JI,{get:function(){return te(this)?this[XI]:void 0}}),tE)O[FI]&&ot(O[FI],XI,FI);var rE={NATIVE_ARRAY_BUFFER_VIEWS:ZI,TYPED_ARRAY_CONSTRUCTOR:QI,TYPED_ARRAY_TAG:eE&&XI,aTypedArray:function(e){if(oE(e))return e;throw zI("Target is not a typed array")},aTypedArrayConstructor:function(e){if(ee(e)&&(!tr||re(WI,e)))return e;throw zI(fe(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,o){if(k){if(n)for(var r in tE){var a=O[r];if(a&&Ne(a.prototype,e))try{delete a.prototype[e]}catch(FS){try{a.prototype[e]=t}catch(s){}}}YI[e]&&!n||Dt(YI,e,n?t:ZI&&HI[e]||t,o)}},exportTypedArrayStaticMethod:function(e,t,n){var o,r;if(k){if(tr){if(n)for(o in tE)if((r=O[o])&&Ne(r,e))try{delete r[e]}catch(FS){}if(WI[e]&&!n)return;try{return Dt(WI,e,n?t:ZI&&WI[e]||t)}catch(FS){}}for(o in tE)!(r=O[o])||r[e]&&!n||Dt(r,e,t)}},isView:function(e){if(!te(e))return!1;var t=un(e);return"DataView"===t||Ne(tE,t)||Ne(nE,t)},isTypedArray:oE,TypedArray:WI,TypedArrayPrototype:YI},aE=rE.NATIVE_ARRAY_BUFFER_VIEWS,sE=O.ArrayBuffer,iE=O.Int8Array,cE=!aE||!L((function(){iE(1)}))||!L((function(){new iE(-1)}))||!Ro((function(e){new iE,new iE(null),new iE(1.5),new iE(e)}),!0)||L((function(){return 1!==new iE(new sE(2),1,void 0).length})),uE=Math.floor,lE=Number.isInteger||function(e){return!te(e)&&isFinite(e)&&uE(e)===e},dE=O.RangeError,pE=O.RangeError,gE=function(e,t){var n=function(e){var t=Rt(e);if(t<0)throw dE("The argument can't be less than 0");return t}(e);if(n%t)throw pE("Wrong offset");return n},_E=rE.aTypedArrayConstructor,hE=function(e){var t,n,o,r,a,s,i=Fi(this),c=De(e),u=arguments.length,l=u>1?arguments[1]:void 0,d=void 0!==l,p=yo(c);if(p&&!mo(p))for(s=(a=Eo(c,p)).next,c=[];!(r=b(s,a)).done;)c.push(r.value);for(d&&u>2&&(l=wn(l,arguments[2])),n=bt(c),o=new(_E(i))(n),t=0;n>t;t++)o[t]=d?l(c[t],t):c[t];return o};D((function(e){var t=Ht.f,n=Zn.forEach,o=It.get,r=It.set,a=nt.f,s=Ye.f,i=Math.round,c=O.RangeError,u=OI.ArrayBuffer,l=u.prototype,d=OI.DataView,p=rE.NATIVE_ARRAY_BUFFER_VIEWS,g=rE.TYPED_ARRAY_CONSTRUCTOR,_=rE.TYPED_ARRAY_TAG,h=rE.TypedArray,f=rE.TypedArrayPrototype,m=rE.aTypedArrayConstructor,M=rE.isTypedArray,v=function(e,t){m(e);for(var n=0,o=t.length,r=new e(o);o>n;)r[n]=t[n++];return r},y=function(e,t){a(e,t,{get:function(){return o(this)[t]}})},I=function(e){var t;return re(l,e)||"ArrayBuffer"==(t=un(e))||"SharedArrayBuffer"==t},E=function(e,t){return M(e)&&!_e(t)&&t in e&&lE(+t)&&t>=0},T=function(e,t){return t=Ve(t),E(e,t)?q(2,e[t]):s(e,t)},S=function(e,t,n){return t=Ve(t),!(E(e,t)&&te(n)&&Ne(n,"value"))||Ne(n,"get")||Ne(n,"set")||n.configurable||Ne(n,"writable")&&!n.writable||Ne(n,"enumerable")&&!n.enumerable?a(e,t,n):(e[t]=n.value,e)};k?(p||(Ye.f=T,nt.f=S,y(f,"buffer"),y(f,"byteOffset"),y(f,"byteLength"),y(f,"length")),nn({target:"Object",stat:!0,forced:!p},{getOwnPropertyDescriptor:T,defineProperty:S}),e.exports=function(e,s,l){var m=e.match(/\d+$/)[0]/8,y=e+(l?"Clamped":"")+"Array",E="get"+e,T="set"+e,S=O[y],A=S,D=A&&A.prototype,C={},N=function(e,t){a(e,t,{get:function(){return function(e,t){var n=o(e);return n.view[E](t*m+n.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var r=o(e);l&&(n=(n=i(n))<0?0:n>255?255:255&n),r.view[T](t*m+r.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};p?cE&&(A=s((function(e,t,n,o){return ki(e,D),Fr(te(t)?I(t)?void 0!==o?new S(t,gE(n,m),o):void 0!==n?new S(t,gE(n,m)):new S(t):M(t)?v(A,t):b(hE,A,t):new S(Vy(t)),e,A)})),tr&&tr(A,h),n(t(S),(function(e){e in A||ot(A,e,S[e])})),A.prototype=D):(A=s((function(e,t,n,o){ki(e,D);var a,s,i,l=0,p=0;if(te(t)){if(!I(t))return M(t)?v(A,t):b(hE,A,t);a=t,p=gE(n,m);var g=t.byteLength;if(void 0===o){if(g%m)throw c("Wrong length");if((s=g-p)<0)throw c("Wrong length")}else if((s=Pt(o)*m)+p>g)throw c("Wrong length");i=s/m}else i=Vy(t),a=new u(s=i*m);for(r(e,{buffer:a,byteOffset:p,byteLength:s,length:i,view:new d(a)});l<i;)N(e,l++)})),tr&&tr(A,h),D=A.prototype=bn(f)),D.constructor!==A&&ot(D,"constructor",A),ot(D,g,A),_&&ot(D,_,y),C[y]=A,nn({global:!0,forced:A!=S,sham:!p},C),"BYTES_PER_ELEMENT"in A||ot(A,"BYTES_PER_ELEMENT",m),"BYTES_PER_ELEMENT"in D||ot(D,"BYTES_PER_ELEMENT",m),Oi(y)}):e.exports=function(){}}))("Uint8",(function(e){return function(t,n,o){return e(this,t,n,o)}}));var fE=Math.min,mE=K([].copyWithin||function(e,t){var n=De(this),o=bt(n),r=kt(e,o),a=kt(t,o),s=arguments.length>2?arguments[2]:void 0,i=fE((void 0===s?o:kt(s,o))-a,o-r),c=1;for(a<r&&r<a+i&&(c=-1,a+=i-1,r+=i-1);i-- >0;)a in n?n[r]=n[a]:delete n[r],r+=c,a+=c;return n}),ME=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("copyWithin",(function(e,t){return mE(ME(this),e,t,arguments.length>2?arguments[2]:void 0)}));var vE=Zn.every,yE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("every",(function(e){return vE(yE(this),e,arguments.length>1?arguments[1]:void 0)}));var IE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return b(Jy,IE(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var EE=rE.TYPED_ARRAY_CONSTRUCTOR,TE=rE.aTypedArrayConstructor,SE=function(e){return TE(xi(e,e[EE]))},AE=function(e,t){return function(e,t){for(var n=0,o=bt(t),r=new e(o);o>n;)r[n]=t[n++];return r}(SE(e),t)},DE=Zn.filter,CE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("filter",(function(e){var t=DE(CE(this),e,arguments.length>1?arguments[1]:void 0);return AE(this,t)}));var NE=Zn.find,RE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("find",(function(e){return NE(RE(this),e,arguments.length>1?arguments[1]:void 0)}));var OE=Zn.findIndex,LE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("findIndex",(function(e){return OE(LE(this),e,arguments.length>1?arguments[1]:void 0)}));var kE=Zn.forEach,GE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("forEach",(function(e){kE(GE(this),e,arguments.length>1?arguments[1]:void 0)}));var PE=wt.includes,bE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("includes",(function(e){return PE(bE(this),e,arguments.length>1?arguments[1]:void 0)}));var UE=wt.indexOf,wE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("indexOf",(function(e){return UE(wE(this),e,arguments.length>1?arguments[1]:void 0)}));var FE=we("iterator"),qE=O.Uint8Array,xE=K(Bs.values),VE=K(Bs.keys),BE=K(Bs.entries),HE=rE.aTypedArray,KE=rE.exportTypedArrayMethod,jE=qE&&qE.prototype,WE=!L((function(){jE[FE].call([1])})),YE=!!jE&&jE.values&&jE[FE]===jE.values&&"values"===jE.values.name,$E=function(){return xE(HE(this))};KE("entries",(function(){return BE(HE(this))}),WE),KE("keys",(function(){return VE(HE(this))}),WE),KE("values",$E,WE||!YE,{name:"values"}),KE(FE,$E,WE||!YE,{name:"values"});var zE=rE.aTypedArray,JE=rE.exportTypedArrayMethod,XE=K([].join);JE("join",(function(e){return XE(zE(this),e)}));var QE=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Es(kM,QE(this),t>1?[e,arguments[1]]:[e])}));var ZE=Zn.map,eT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("map",(function(e){return ZE(eT(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(SE(e))(t)}))}));var tT=O.TypeError,nT=function(e){return function(t,n,o,r){Me(n);var a=De(t),s=J(a),i=bt(a),c=e?i-1:0,u=e?-1:1;if(o<2)for(;;){if(c in s){r=s[c],c+=u;break}if(c+=u,e?c<0:i<=c)throw tT("Reduce of empty array with no initial value")}for(;e?c>=0:i>c;c+=u)c in s&&(r=n(r,s[c],c,a));return r}},oT={left:nT(!1),right:nT(!0)},rT=oT.left,aT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return rT(aT(this),e,t,t>1?arguments[1]:void 0)}));var sT=oT.right,iT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return sT(iT(this),e,t,t>1?arguments[1]:void 0)}));var cT=rE.aTypedArray,uT=rE.exportTypedArrayMethod,lT=Math.floor;uT("reverse",(function(){for(var e,t=cT(this).length,n=lT(t/2),o=0;o<n;)e=this[o],this[o++]=this[--t],this[t]=e;return this}));var dT=O.RangeError,pT=O.Int8Array,gT=pT&&pT.prototype,_T=gT&&gT.set,hT=rE.aTypedArray,fT=rE.exportTypedArrayMethod,mT=!L((function(){var e=new Uint8ClampedArray(2);return b(_T,e,{length:1,0:3},1),3!==e[1]})),MT=mT&&rE.NATIVE_ARRAY_BUFFER_VIEWS&&L((function(){var e=new pT(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));fT("set",(function(e){hT(this);var t=gE(arguments.length>1?arguments[1]:void 0,1),n=De(e);if(mT)return b(_T,this,n,t);var o=this.length,r=bt(n),a=0;if(r+t>o)throw dT("Wrong length");for(;a<r;)this[t+a]=n[a++]}),!mT||MT);var vT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("slice",(function(e,t){for(var n=_r(vT(this),e,t),o=SE(this),r=0,a=n.length,s=new o(a);a>r;)s[r]=n[r++];return s}),L((function(){new Int8Array(1).slice()})));var yT=Zn.some,IT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("some",(function(e){return yT(IT(this),e,arguments.length>1?arguments[1]:void 0)}));var ET=O.Array,TT=rE.aTypedArray,ST=rE.exportTypedArrayMethod,AT=O.Uint16Array,DT=AT&&K(AT.prototype.sort),CT=!(!DT||L((function(){DT(new AT(2),null)}))&&L((function(){DT(new AT(2),{})}))),NT=!!DT&&!L((function(){if(le)return le<74;if(ev)return ev<67;if(tv)return!0;if(ov)return ov<602;var e,t,n=new AT(516),o=ET(516);for(e=0;e<516;e++)t=e%4,n[e]=515-e,o[e]=e-2*t+3;for(DT(n,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(n[e]!==o[e])return!0}));ST("sort",(function(e){return void 0!==e&&Me(e),NT?DT(this,e):mf(TT(this),function(e){return function(t,n){return void 0!==e?+e(t,n)||0:n!=n?-1:t!=t?1:0===t&&0===n?1/t>0&&1/n<0?1:-1:t>n}}(e))}),!NT||CT);var RT=rE.aTypedArray;(0,rE.exportTypedArrayMethod)("subarray",(function(e,t){var n=RT(this),o=n.length,r=kt(e,o);return new(SE(n))(n.buffer,n.byteOffset+r*n.BYTES_PER_ELEMENT,Pt((void 0===t?o:kt(t,o))-r))}));var OT=O.Int8Array,LT=rE.aTypedArray,kT=rE.exportTypedArrayMethod,GT=[].toLocaleString,PT=!!OT&&L((function(){GT.call(new OT(1))}));kT("toLocaleString",(function(){return Es(GT,PT?_r(LT(this)):LT(this),_r(arguments))}),L((function(){return[1,2].toLocaleString()!=new OT([1,2]).toLocaleString()}))||!L((function(){OT.prototype.toLocaleString.call([1,2])})));var bT=rE.exportTypedArrayMethod,UT=O.Uint8Array,wT=UT&&UT.prototype||{},FT=[].toString,qT=K([].join);L((function(){FT.call({})}))&&(FT=function(){return qT(this)});var xT=wT.toString!=FT;bT("toString",FT,xT);var VT=O.RangeError,BT=String.fromCharCode,HT=String.fromCodePoint,KT=K([].join),jT=!!HT&&1!=HT.length;nn({target:"String",stat:!0,forced:jT},{fromCodePoint:function(e){for(var t,n=[],o=arguments.length,r=0;o>r;){if(t=+arguments[r++],kt(t,1114111)!==t)throw VT(t+" is not a valid code point");n[r]=t<65536?BT(t):BT(55296+((t-=65536)>>10),t%1024+56320)}return KT(n,"")}});var WT=String.fromCharCode,YT=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){var n=0|e.charCodeAt(1);if(56320<=n&&n<=57343){if((t=(t<<10)+n-56613888|0)>65535)return WT(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?WT(192|t>>>6,128|63&t):WT(224|t>>>12,128|t>>>6&63,128|63&t)},$T=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,YT),n=0|t.length,o=new Uint8Array(n),r=0;r<n;r=r+1|0)o[r]=0|t.charCodeAt(r);return o},zT=function(e){for(var t=new Uint8Array(e),n="",o=0,r=t.length;o<r;){var a=t[o],s=0,i=0;if(a<=127?(s=0,i=255&a):a<=223?(s=1,i=31&a):a<=239?(s=2,i=15&a):a<=244&&(s=3,i=7&a),r-o-s>0)for(var c=0;c<s;)i=i<<6|63&(a=t[o+c+1]),c+=1;else i=65533,s=r-o;n+=String.fromCodePoint(i),o+=s+1}return n},JT=function(){function e(t){o(this,e),this._handler=t;var n=t.getURL();if(this._socket=null,this._workerSocket=null,this._id=dd(),this._handler.getIsWorkerEnabled()){var r=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen" }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'],{type:"application/javascript; charset=utf-8"}));this._workerSocket=new Worker(r);var a=this;this._workerSocket.onmessage=function(e){var t=e.data,n=t.callback,o=t.e;"onOpen"===n?a._onOpen():"onClose"===n?a._onClose(o):"onError"===n?a._onError(o):"onMessage"===n&&a._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:n})}else Ku?Vu?(Wu.connectSocket({url:n,header:{"content-type":"application/json"}}),Wu.onSocketClose(this._onClose.bind(this)),Wu.onSocketOpen(this._onOpen.bind(this)),Wu.onSocketMessage(this._onMessage.bind(this)),Wu.onSocketError(this._onError.bind(this))):(this._socket=Wu.connectSocket({url:n,header:{"content-type":"application/json"},complete:function(){}}),this._socket.onClose(this._onClose.bind(this)),this._socket.onOpen(this._onOpen.bind(this)),this._socket.onMessage(this._onMessage.bind(this)),this._socket.onError(this._onError.bind(this))):ju&&(this._socket=new WebSocket(n),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this));this._canIUseBinaryFrame=t.canIUseBinaryFrame()}return a(e,[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(){this._handler.onOpen({id:this._id})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e:e})}},{key:"_onMessage",value:function(e){this._handler.onMessage({data:this._canIUseBinaryFrame?zT(e.data):e.data})}},{key:"_onError",value:function(e){this._handler.onError({id:this._id,e:e})}},{key:"setIsWorkerEnabled",value:function(e){this._isWorkerEnabled=!0}},{key:"close",value:function(e){if(this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),Vu)return Wu.offSocketClose(),Wu.offSocketMessage(),Wu.offSocketOpen(),Wu.offSocketError(),void Wu.closeSocket();this._socket&&(Ku?(this._socket.onClose((function(){})),this._socket.onOpen((function(){})),this._socket.onMessage((function(){})),this._socket.onError((function(){}))):ju&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),xu?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){if(this._workerSocket)this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?$T(e.data).buffer:e.data});else{if(Vu)return void Wu.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}});this._socket&&(Ku?this._socket.send({data:this._canIUseBinaryFrame?$T(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):ju&&this._socket.send(this._canIUseBinaryFrame?$T(e.data).buffer:e.data))}}}]),e}(),XT=4e3,QT=4001,ZT=["keyMap"],eS=["keyMap"],tS="connected",nS="connecting",oS="disconnected",rS=function(){function e(t){o(this,e),this._channelModule=t,this._className="SocketHandler",this._promiseMap=new Map,this._readyState=oS,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=dd(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._setWebsocketHost(),this._initConnection()}return a(e,[{key:"_setWebsocketHost",value:function(){var e=this._channelModule.getModule(lg),t=Nu;this._channelModule.isOversea()&&(t=Ru),e.isSingaporeSite()?t=Ou:e.isKoreaSite()?t=Lu:e.isGermanySite()?t=ku:e.isIndiaSite()&&(t=Gu),Pu.HOST.setCurrent(t)}},{key:"_initConnection",value:function(){ed(Pu.HOST.CURRENT.BACKUP)||""===this._url?this._url=Pu.HOST.CURRENT.DEFAULT:this._url===Pu.HOST.CURRENT.DEFAULT?this._url=Pu.HOST.CURRENT.BACKUP:this._url===Pu.HOST.CURRENT.BACKUP&&(this._url=Pu.HOST.CURRENT.DEFAULT);var e=this._channelModule.getModule(lg).getProxyServer();Bd(e)||(this._url=e),this._connect(),this._nextPingTs=0}},{key:"onCheckTimer",value:function(e){e%1==0&&this._checkPromiseMap()}},{key:"_checkPromiseMap",value:function(){var e=this;0!==this._promiseMap.size&&this._promiseMap.forEach((function(t,n){var o=t.reject,r=t.timestamp,a=15e3;-1!==n.indexOf(Cg)&&(a=9e4),Date.now()-r>=a&&(Ul.log("".concat(e._className,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new YM({code:yh.NETWORK_TIMEOUT,message:Ih.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=Date.now()-this._startTs;Ul.log("".concat(this._className,"._onOpen cost ").concat(n," ms. socketID:").concat(t)),new Uh(wh.WS_ON_OPEN).setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=tS,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new Uh(wh.WS_ON_CLOSE),n=e.id,o=e.e,r="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),a=0;0!==this._onOpenTs&&(a=Date.now()-this._onOpenTs),t.setMessage(a).setCostTime(a).setMoreMessage(r).setCode(o.code).end(),Ul.log("".concat(this._className,"._onClose ").concat(r," onlineTime:").concat(a)),n===this._socketID&&(this._readyState=oS,a<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,n=e.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new Uh(wh.WS_ON_ERROR).setMessage(n.errMsg||ud(n)).setMoreMessage(o).setLevel("error").end(),Ul.warn("".concat(this._className,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(FS){new Uh(wh.JSON_PARSE_ERROR).setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=Pd(t.head),r=Fy(t.body,this._getResponseKeyMap(o));if(Ul.debug("".concat(this._className,".onMessage ret:").concat(JSON.stringify(r)," requestID:").concat(n," has:").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var a=this._promiseMap.get(n),s=a.resolve,i=a.reject,c=a.timestamp;return this._promiseMap.delete(n),this._calcRTT(c),void(r.errorCode&&0!==r.errorCode?(this._channelModule.onErrorCodeNotZero(r),i(new YM({code:r.errorCode,message:r.errorInfo||"",data:{elements:r.elements,messageVersion:r.messageVersion,cloudCustomData:r.cloudCustomData}}))):s(VM(r)))}this._channelModule.onMessage({head:t.head,body:r})}}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(Sg).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new JT(this),this._socketID=this._socket.getID(),this._readyState=nS,Ul.log("".concat(this._className,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new Uh(wh.WS_CONNECT).setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){var e=this._channelModule.getModule(lg);e.isDevMode()&&(this._canIUseBinaryFrame=!1);var t=Od();(Vu||wu&&"windows"===t||Bu)&&(this._canIUseBinaryFrame=!1);var n=-1;"ios"===t?n=el||-1:"android"===t&&(n=nl||-1);var o=this._channelModule.getPlatform(),r=e.getSDKAppID(),a=e.getInstanceID();return this._canIUseBinaryFrame?"".concat(this._url,"/binfo?sdkappid=").concat(r,"&instanceid=").concat(a,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(t,"&version=").concat(n):"".concat(this._url,"/info?sdkappid=").concat(r,"&instanceid=").concat(a,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(t,"&version=").concat(n)}},{key:"_closeConnection",value:function(e){Ul.log("".concat(this._className,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=oS)}},{key:"_resend",value:function(){var e=this;if(Ul.log("".concat(this._className,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,r=t.resolve,a=t.reject;e._promiseMap.set(n,{resolve:r,reject:a,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=S(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=m(t.value,2),r=o[0],a=o[1];this._execute(r,a)}}catch(s){n.e(s)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var n=g(e,ZT),o=this._getRequestIDFromHead(e.head),r=JSON.stringify(n);return new Promise((function(e,a){(t._promiseMap.set(o,{resolve:e,reject:a,timestamp:Date.now(),uplinkData:r}),Ul.debug("".concat(t._className,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==tS)?t._reConnect():(t._execute(o,r),t._channelModule.getModule(Sg).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var t=g(e,eS),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==tS?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(n,o):Ul.log("".concat(this._className,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(n,o)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:Ku?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){Ul.log("".concat(this._className,"._onSendFail requestID:").concat(e))}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=dd()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResponseKeyMap",value:function(e){var n=this._channelModule.getKeyMap(e);return t(t({},ky.response),n.response)}},{key:"_reConnect",value:function(){this._readyState!==tS&&this._readyState!==nS&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e=this;Ul.log("".concat(this._className,".forcedReconnect count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(QT),this._initConnection()):(this._reConnectCount=0,this._channelModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0];n[1];o?(Ul.warn("".concat(e._className,".forcedReconnect disconnected from wsserver but network is ok, continue...")),e._closeConnection(QT),e._initConnection()):e._channelModule.onReconnectFailed()})))}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===tS}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"setIsWorkerEnabled",value:function(e){Ul.log("".concat(this._className,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&dl}},{key:"_getRandom",value:function(){return 0===this._random&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"close",value:function(){Ul.log("".concat(this._className,".close")),this._closeConnection(XT),this._promiseMap.clear(),this._startSequence=dd(),this._readyState=oS,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),e}(),aS=function(e){i(n,e);var t=f(n);function n(e){var r;if(o(this,n),(r=t.call(this,e))._className="ChannelModule",r._socketHandler=new rS(_(r)),r._probing=!1,r._isAppShowing=!0,r._previousState=gr.NET_STATE_CONNECTED,Ku&&"function"==typeof Wu.onAppShow&&"function"==typeof Wu.onAppHide){var a=r._onAppHide.bind(_(r)),s=r._onAppShow.bind(_(r));"function"==typeof Wu.offAppHide&&Wu.offAppHide(a),"function"==typeof Wu.offAppShow&&Wu.offAppShow(s),Wu.onAppHide(a),Wu.onAppShow(s)}return r._timerForNotLoggedIn=-1,r._timerForNotLoggedIn=setInterval(r.onCheckTimer.bind(_(r)),1e3),r._fatalErrorFlag=!1,r}return a(n,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(this._timerForNotLoggedIn>0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(Mg).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(Mg).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==gr.NET_STATE_CONNECTED&&e.head.servcmd.includes(Z_)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=Pu.HOST.CURRENT.STAT;return new Promise((function(n,o){var r="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),a=JSON.stringify(e.body),s="application/x-www-form-urlencoded;charset=UTF-8";if(Ku)Wu.request({url:r,data:a,method:"POST",timeout:3e3,header:{"content-type":s},success:function(){n()},fail:function(){o(new YM({code:yh.NETWORK_ERROR,message:Ih.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,c=setTimeout((function(){i.abort(),o(new YM({code:yh.NETWORK_TIMEOUT,message:Ih.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(c),200===i.status||304===i.status?n():o(new YM({code:yh.NETWORK_ERROR,message:Ih.NETWORK_ERROR})))},i.open("POST",r,!0),i.setRequestHeader("Content-type",s),i.send(a)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){Ku&&!Bu&&Ul.error("".concat(this._className,".onError 从v2.11.2起SDK 支持了 WebSocket如您未添加相关受信域名请先添加(如已添加请忽略),升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html")),this._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(Mg).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){Ul.log("".concat(this._className,".onReconnected")),this.getModule(Mg).onReconnected(),this._emitNetStateChangeEvent(gr.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){Ul.log("".concat(this._className,".onReconnectFailed")),this._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(Ul.log("".concat(this._className,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===gr.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(gr.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(Ul.log("".concat(this._className,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(pr.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(Mg).getProtocolData({protocolName:eh});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Ul.warn("".concat(e._className,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new Uh(wh.ERROR).setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(gg).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];Ul.log("".concat(e._className,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(r)),o?e.reConnect():e._emitNetStateChangeEvent(gr.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._previousState=gr.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(Dg),sS=["a2","tinyid"],iS=["a2","tinyid"],cS=function(){function e(t){o(this,e),this._className="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return a(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead();this._configMap.set(Cg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.LOGIN)}),body:{state:"Online"},keyMap:{response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(Ng,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(Rg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.HELLO)}),body:{},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Og,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.STAT_SERVICE,".").concat(Pu.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(J_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_COS_SIGN,".").concat(Pu.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(X_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.CUSTOM_UPLOAD,".").concat(Pu.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(Q_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.CUSTOM_UPLOAD,".").concat(Pu.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(uh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_CONFIG_MANAGER,".").concat(Pu.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(lh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_CONFIG_MANAGER,".").concat(Pu.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(ih,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_CONFIG_MANAGER,".").concat(Pu.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(ch,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_CONFIG_MANAGER,".").concat(Pu.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(dh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OVERLOAD_PUSH,".").concat(Pu.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(Lg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"groupID",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),this._configMap.set(kg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(Gg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(Pg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(e_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(A_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(r_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt"}}}}(e)),this._configMap.set(i_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(N_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID"}}}}(e)),this._configMap.set(t_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(n_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(o_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(D_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(C_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(s_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(F_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(q_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(R_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(L_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(O_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(k_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(a_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(u_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.RECENT_CONTACT,".").concat(Pu.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(c_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.RECENT_CONTACT,".").concat(Pu.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex"}}}}(e)),this._configMap.set(l_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.RECENT_CONTACT,".").concat(Pu.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0,clearHistoryMessage:1},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble"}}}}(e)),this._configMap.set(d_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.RECENT_CONTACT,".").concat(Pu.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(p_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(bg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.PROFILE,".").concat(Pu.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Ug,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.PROFILE,".").concat(Pu.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:Fl.NICK,value:""},{tag:Fl.GENDER,value:""},{tag:Fl.ALLOWTYPE,value:""},{tag:Fl.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(wg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Fg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(qg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(fh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(mh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(Mh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(vh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(xg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.GET_FRIEND_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{response:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}}(e)),this._configMap.set(Kg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.ADD_FRIEND)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{request:{source:"AddSource",wording:"AddWording",type:"AddType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(jg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.UPDATE_FRIEND)}),body:{fromAccount:"",updateItem:void 0},keyMap:{request:{snsItem:"SnsItem"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Hg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.DELETE_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"DeleteType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Vg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.GET_FRIEND_PROFILE)}),body:{fromAccount:"",userIDList:void 0,tagList:void 0},keyMap:{response:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}}(e)),this._configMap.set(Bg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.CHECK_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"CheckType"},response:{InfoItem:"resultList"}}}}(e)),this._configMap.set(Yg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.GET_FRIEND_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{response:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}}(e)),this._configMap.set(Wg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.RESPOND_FRIEND_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{request:{tag:"TagName",action:"ResponseAction"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set($g,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.DELETE_FRIEND_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{request:{type:"PendencyType",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(zg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.REPORT_FRIEND_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{request:{latestTimeStamp:"LatestPendencyTimeStamp"}}}}(e)),this._configMap.set(Xg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.CREATE_FRIEND_GROUP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{request:{groupName:"GroupName",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Qg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.DELETE_FRIEND_GROUP)}),body:{fromAccount:"",nameList:void 0},keyMap:{request:{nameList:"GroupName"}}}}(e)),this._configMap.set(Jg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.GET_FRIEND_GROUP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{response:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}}(e)),this._configMap.set(Zg,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.FRIEND,".").concat(Pu.CMD.UPDATE_FRIEND_GROUP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{request:{oldName:"GroupOldName",newName:"GroupNewName"},response:{UpdateType:"type",ResultItem:"resultList"}}}}(e)),this._configMap.set(g_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence"}}}}(e)),this._configMap.set(__,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(h_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(f_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(m_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,maxMemberNum:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0},keyMap:{request:{maxMemberNum:"MaxMemberCount",groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(M_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(v_,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,sS)),{},{servcmd:"".concat(Pu.NAME.BIG_GROUP_NO_AUTH,".").concat(Pu.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(y_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(I_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(E_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(T_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(S_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(G_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"}}}}(e)),this._configMap.set(P_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(b_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.BIG_GROUP_LONG_POLLING,".").concat(Pu.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(U_,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,iS)),{},{servcmd:"".concat(Pu.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(Pu.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID"}}}}(e)),this._configMap.set(w_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(x_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(V_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(B_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(H_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(K_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP_ATTR,".").concat(Pu.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(ph,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP_COMMUNITY,".").concat(Pu.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(gh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP_COMMUNITY,".").concat(Pu.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(_h,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP_COMMUNITY,".").concat(Pu.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(hh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP_COMMUNITY,".").concat(Pu.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}}(e)),this._configMap.set(j_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(W_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Y_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set($_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(z_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.GROUP,".").concat(Pu.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(Z_,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STAT,".").concat(Pu.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(eh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.HEARTBEAT,".").concat(Pu.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(th,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_PUSH,".").concat(Pu.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(nh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_PUSH,".").concat(Pu.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(oh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.OPEN_IM,".").concat(Pu.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(rh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_OPEN_STATUS,".").concat(Pu.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(sh,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_LONG_MESSAGE,".").concat(Pu.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(ah,function(e){return{head:t(t({},e),{},{servcmd:"".concat(Pu.NAME.IM_LONG_MESSAGE,".").concat(Pu.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Ul.warn("".concat(this._className,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),r=null;if(n){var a=this._simpleDeepCopy(o),s=this._updateService(n,a),i=s.body,c=Object.create(null);for(var u in i)if(Object.prototype.hasOwnProperty.call(i,u)){if(c[u]=i[u],void 0===n[u])continue;c[u]=n[u]}s.body=c,r=this._getUplinkData(s)}else r=this._getUplinkData(o);return r}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=Pd(t.head),o=wy(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=Pd(t.head);if(t.head.servcmd.includes(Pu.NAME.GROUP)){var o=e.type,r=e.groupID,a=void 0===r?void 0:r,s=e.groupIDList,i=void 0===s?[]:s;ed(a)&&(a=i[0]||""),Ed({type:o,groupID:a})&&(t.head.servcmd="".concat(Pu.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},ky.request),n.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&ad(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},r=0,a=n.length;r<a;r++)t=n[r],Zl(e[t])?o[t]=Array.from(e[t]):Xl(e[t])?o[t]=this._simpleDeepCopy(e[t]):o[t]=e[t];return o}}]),e}(),uS=[oh],lS=function(){function e(t){o(this,e),this._sessionModule=t,this._className="DownlinkHandler",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._c2cMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._groupMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupTips",this._groupTipsHandler.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._C2CNotifyMessageArrayHandler.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._C2CReadReceiptArrayHandler.bind(this)),this._eventHandlerMap.set("profileModify",this._profileHandler.bind(this)),this._eventHandlerMap.set("friendListMod",this._relationChainHandler.bind(this)),this._eventHandlerMap.set("recentContactMod",this._recentContactHandler.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._allMessageReadHandler.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._c2cMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._groupMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("userStatusList",this._userStatusListHandler.bind(this)),this._keys=M(this._eventHandlerMap.keys())}return a(e,[{key:"_c2cMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(rg);if(t){if(e.dataList.forEach((function(e){if(1===e.isSyncMessage){var t=e.from;e.from=e.to,e.to=t}})),1===e.needSync)this._sessionModule.getModule(mg).startOnlineSync();t.onNewC2CMessage({dataList:e.dataList,isInstantMessage:!0})}}},{key:"_c2cMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(rg);t&&t.onC2CMessageModified(e)}},{key:"_groupMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(ag);t&&t.onNewGroupMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_groupMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(ag);t&&t.onGroupMessageModified(e)}},{key:"_groupTipsHandler",value:function(e){var t=this._sessionModule.getModule(ag);if(t){var n=e.event,o=e.dataList,r=e.isInstantMessage,a=void 0===r||r,s=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:o});break;case 5:o.forEach((function(e){Zl(e.elements.revokedInfos)?t.onGroupMessageRevoked({dataList:o}):Zl(e.elements.groupMessageReadNotice)?t.onGroupMessageReadNotice({dataList:o}):Zl(e.elements.readReceiptList)?t.onReadReceiptList({dataList:o}):t.onNewGroupSystemNotice({dataList:o,isInstantMessage:a,isSyncingEnded:s})}));break;case 12:this._sessionModule.getModule(ug).onNewGroupAtTips({dataList:o});break;default:Ul.log("".concat(this._className,"._groupTipsHandler unknown event:").concat(n," dataList:"),o)}}}},{key:"_C2CNotifyMessageArrayHandler",value:function(e){var t=this,n=e.dataList;if(Zl(n)){var o=this._sessionModule.getModule(rg);n.forEach((function(e){if(Ql(e))if(e.hasOwnProperty("kickoutMsgNotify")){var r=e.kickoutMsgNotify,a=r.kickType,s=r.newInstanceInfo,i=void 0===s?{}:s;1===a?t._sessionModule.onMultipleAccountKickedOut(i):2===a?t._sessionModule.onMultipleDeviceKickedOut(i):3===a&&t._sessionModule.onRestApiKickedOut(i)}else if(e.hasOwnProperty("c2cMessageRevokedNotify"))o&&o.onC2CMessageRevoked({dataList:n});else if(e.hasOwnProperty("c2cMessageReadReceipt"))o&&o.onC2CMessageReadReceipt({dataList:n});else if(e.hasOwnProperty("c2cMessageReadNotice"))o&&o.onC2CMessageReadNotice({dataList:n});else if(e.hasOwnProperty("muteNotificationsSync")){t._sessionModule.getModule(ug).onC2CMessageRemindTypeSynced({dataList:n})}}))}}},{key:"_C2CReadReceiptArrayHandler",value:function(e){this._sessionModule.getModule(rg).onReadReceiptList(e)}},{key:"_profileHandler",value:function(e){this._sessionModule.getModule(og).onProfileModified({dataList:e.dataList});var t=this._sessionModule.getModule(sg);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_relationChainHandler",value:function(e){this._sessionModule.getModule(og).onRelationChainModified({dataList:e.dataList});var t=this._sessionModule.getModule(sg);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_recentContactHandler",value:function(e){var t=e.dataList;if(Zl(t)){var n=this._sessionModule.getModule(ug);n&&t.forEach((function(e){var t=e.pushType,o=e.recentContactTopItem,r=e.recentContactDeleteItem;1===t?n.onConversationDeleted(r.recentContactList):2===t?n.onConversationPinned(o.recentContactList):3===t&&n.onConversationUnpinned(o.recentContactList)}))}}},{key:"_allMessageReadHandler",value:function(e){var t=e.dataList,n=this._sessionModule.getModule(ug);n&&n.onPushedAllMessageRead(t)}},{key:"_userStatusListHandler",value:function(e){this._sessionModule.getModule(og).onUserStatusUpdated(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMessageFromIMOpenPush(e)){var o=n.eventArray,r=n.isInstantMessage,a=n.isSyncingEnded,s=n.needSync;if(Zl(o))for(var i=null,c=null,u=0,l=0,d=o.length;l<d;l++){u=(i=o[l]).event;var p=Object.keys(i).find((function(e){return-1!==t._keys.indexOf(e)}));p?(c=14===u?{readAllC2CMessage:i[p],groupMessageReadInfoList:i.groupMessageReadNotice||[]}:16===u?{userID:i.userID,readReceiptList:i[p]}:i[p],this._eventHandlerMap.get(p)({event:u,dataList:c,isInstantMessage:r,isSyncingEnded:a,needSync:s})):Ul.log("".concat(this._className,".onMessage unknown eventItem:").concat(i))}}}},{key:"_filterMessageFromIMOpenPush",value:function(e){var t=e.head,n=e.body,o=t.servcmd,r=!1;if(ed(o)||(r=o.includes(Pu.NAME.IM_CONFIG_MANAGER)||o.includes(Pu.NAME.OVERLOAD_PUSH)||o.includes(Pu.NAME.STAT_SERVICE)),!r)return!0;if(o.includes(Pu.CMD.PUSHED_CLOUD_CONTROL_CONFIG))this._sessionModule.getModule(Ig).onPushedCloudControlConfig(n);else if(o.includes(Pu.CMD.PUSHED_COMMERCIAL_CONFIG)){this._sessionModule.getModule(Ag).onPushedConfig(n)}else if(o.includes(Pu.CMD.OVERLOAD_NOTIFY))this._sessionModule.onPushedServerOverload(n);else if(o.includes(Pu.CMD.KICK_OTHER)){var a=Date.now();this._sessionModule.reLoginOnKickOther();var s=new Uh(wh.KICK_OTHER),i=this._sessionModule.getModule(tg).getLastWsHelloTs(),c=a-i;s.setMessage("last wshello time:".concat(i," diff:").concat(c,"ms")).setNetworkType(this._sessionModule.getNetworkType()).end()}return!1}}]),e}(),dS=[{cmd:Pu.CMD.GET_GROUP_INFO,interval:1,count:20},{cmd:Pu.CMD.GET_TOPIC_LIST,interval:1,count:10},{cmd:Pu.CMD.SET_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Pu.CMD.MODIFY_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Pu.CMD.DELETE_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Pu.CMD.CLEAR_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Pu.CMD.GET_GROUP_ATTRIBUTES,interval:5,count:20},{cmd:Pu.CMD.SET_ALL_MESSAGE_READ,interval:1,count:1},{cmd:Pu.CMD.GET_USER_STATUS,interval:5,count:20},{cmd:Pu.CMD.SUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:Pu.CMD.UNSUBSCRIBE_USER_STATUS,interval:5,count:20}],pS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="SessionModule",r._platform=r.getPlatform(),r._protocolHandler=new cS(_(r)),r._messageDispatcher=new lS(_(r)),r._commandFrequencyLimitMap=new Map,r._commandRequestInfoMap=new Map,r._serverOverloadInfoMap=new Map,r._init(),r.getInnerEmitterInstance().on(hv,r._onCloudConfigUpdated,_(r)),r}return a(n,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(dS)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");ed(e)||(e=JSON.parse(e),this._updateCommandFrequencyLimitMap(e))}},{key:"_updateCommandFrequencyLimitMap",value:function(e){var t=this;e.forEach((function(e){t._commandFrequencyLimitMap.set(e.cmd,{interval:e.interval,count:e.count})}))}},{key:"updateProtocolConfig",value:function(){this._protocolHandler.update()}},{key:"request",value:function(e){Ul.debug("".concat(this._className,".request options:"),e);var t=e.protocolName,n=e.tjgID;if(!this._protocolHandler.has(t))return Ul.warn("".concat(this._className,".request unknown protocol:").concat(t)),XM({code:yh.CANNOT_FIND_PROTOCOL,message:Ih.CANNOT_FIND_PROTOCOL});var o=this.getProtocolData(e),r=o.head.servcmd;if(this._isFrequencyOverLimit(r))return XM({code:yh.OVER_FREQUENCY_LIMIT,message:Ih.OVER_FREQUENCY_LIMIT});if(this._isServerOverload(r))return XM({code:yh.OPEN_SERVICE_OVERLOAD_ERROR,message:Ih.OPEN_SERVICE_OVERLOAD_ERROR});Bd(n)||(o.head.tjgID=n);var a=this.getModule(vg);return uS.includes(t)?a.simplySend(o):a.send(o)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.getModule(lg);return{ver:"v4",platform:this._platform,websdkappid:Cu,websdkversion:Du,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:3635,tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.getModule(lg);return{ver:"v4",platform:this._platform,websdkappid:Cu,websdkversion:Du,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:3635}}},{key:"genSSOReportHead",value:function(){var e=this.getModule(lg);return{ver:"v4",platform:this._platform,websdkappid:Cu,websdkversion:Du,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:3635}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"onErrorCodeNotZero",value:function(e){var t=e.errorCode;if(t===yh.HELLO_ANSWER_KICKED_OUT){var n=e.kickType,o=e.newInstanceInfo,r=void 0===o?{}:o;1===n?this.onMultipleAccountKickedOut(r):2===n?this.onMultipleDeviceKickedOut(r):3===n&&this.onRestApiKickedOut(r)}t!==yh.MESSAGE_A2KEY_EXPIRED&&t!==yh.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.getModule(vg).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,n=t.needAck,o=void 0===n?0:n,r=t.sessionData;1===o&&this._sendACK(r),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(){this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){Ul.log("".concat(this._className,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){Ul.log("".concat(this._className,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e=this;this.isLoggedIn()&&this.request({protocolName:Cg}).then((function(t){var n=t.data.instanceID;e.getModule(lg).setStatusInstanceID(n),Ul.log("".concat(e._className,"._reLogin ok. start to sync unread messages")),e.getModule(mg).startSyncOnReconnected(),e.getModule(ug).syncConversationList(),e.getModule(Tg).startPull(),e.getModule(ag).updateLocalMainSequenceOnReconnected();var o=e.getModule(cg);o.resetGetTopicTime(),o.getTopicListOnReconnected()}))}},{key:"onMultipleAccountKickedOut",value:function(e){this.getModule(tg).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.getModule(tg).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.getModule(tg).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.getModule(tg).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.request({protocolName:oh,requestData:{sessionData:e}})}},{key:"_isFrequencyOverLimit",value:function(e){var t=e.split(".")[1];if(!this._commandFrequencyLimitMap.has(t))return!1;if(!this._commandRequestInfoMap.has(t))return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;var n=this._commandFrequencyLimitMap.get(t),o=n.count,r=n.interval,a=this._commandRequestInfoMap.get(t),s=a.startTime,i=a.requestCount;if(Date.now()-s>1e3*r)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:s,requestCount:i});var c=!1;return i>o&&(c=!0),c}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,r=!1;return Date.now()-n<=1e3*o?r=!0:(this._serverOverloadInfoMap.delete(e),r=!1),r}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),Ul.warn("".concat(this._className,".onPushedServerOverload waitingTime:").concat(n,"s"))}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._updateCommandFrequencyLimitMap(dS),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),n}(Dg),gS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="MessageLossDetectionModule",r._maybeLostSequencesMap=new Map,r._firstRoundRet=[],r}return a(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),r=0;r<n;r++)-1===o.indexOf(t+r)&&o.push(t+r)}},{key:"detectFirstRound",value:function(e,t){var n=this._maybeLostSequencesMap.get(e);if(!Bd(n)&&!Bd(t)){var o=n.filter((function(e){return-1===t.indexOf(e)}));0===o.length?Ul.info("".concat(this._className,".detectFirstRound no message loss. conversationID:").concat(e)):this._firstRoundRet=this._firstRoundRet.concat(o),n.length=0}}},{key:"detectSecondRound",value:function(e,t){if(!Bd(this._firstRoundRet)&&!Bd(t)){var n=this._firstRoundRet.filter((function(e){return-1===t.indexOf(e)}));this._firstRoundRet.length=0;var o,r=n.length;if(0!==r)r<=5?o=e+"-"+n.join("-"):(n.sort((function(e,t){return e-t})),o=e+" start:"+n[0]+" end:"+n[r-1]+" count:"+r),new Uh(wh.MESSAGE_LOSS).setMessage(o).setNetworkType(this.getNetworkType()).setLevel("warning").end(),Ul.info("".concat(this._className,".detectSecondRound message loss detected. conversationID:").concat(e," lostSequences:").concat(n))}}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._maybeLostSequencesMap.clear(),this._firstRoundRet.length=0}}]),n}(Dg),_S=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="CloudControlModule",r._cloudConfig=new Map,r._expiredTime=0,r._version=0,r._isFetching=!1,r}return a(n,[{key:"getCloudConfig",value:function(e){return ed(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"_canFetchConfig",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(Ul.log("".concat(this._className,".fetchConfig canFetchConfig:").concat(t)),t){var n=new Uh(wh.FETCH_CLOUD_CONTROL_CONFIG),o=this.getModule(lg).getSDKAppID();this._isFetching=!0,this.request({protocolName:ih,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),Ul.log("".concat(e._className,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=m(e,2),r=o[0],a=o[1];n.setError(t,r,a).end()})),Ul.log("".concat(e._className,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){Ul.log("".concat(this._className,".onPushedCloudControlConfig")),new Uh(wh.PUSHED_CLOUD_CONTROL_CONFIG).setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._className,"._parseCloudControlConfig"),o=e.errorCode,r=e.errorMessage,a=e.cloudControlConfig,s=e.version,i=e.expiredTime;if(0===o){if(this._version!==s){var c=null;try{c=JSON.parse(a)}catch(FS){Ul.error("".concat(n," JSON parse error:").concat(a))}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=s,this.emitInnerEvent(hv))}this._expiredTime=Date.now()+1e3*i}else ed(o)?(Ul.log("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ul.error("".concat(n," errorCode:").concat(o," errorMessage:").concat(r)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(Dg),hS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="PullGroupMessageModule",r._remoteLastMessageSequenceMap=new Map,r.PULL_LIMIT_COUNT=15,r}return a(n,[{key:"startPull",value:function(){var e=this,t=this._getNeedPullConversationList();this._getRemoteLastMessageSequenceList().then((function(){var n=e.getModule(ug);t.forEach((function(t){var o=t.conversationID,r=o.replace(gr.CONV_GROUP,""),a=n.getGroupLocalLastMessageSequence(o),s=e._remoteLastMessageSequenceMap.get(r)||0,i=s-a;Ul.log("".concat(e._className,".startPull groupID:").concat(r," localLastMessageSequence:").concat(a," ")+"remoteLastMessageSequence:".concat(s," diff:").concat(i)),a>0&&i>=1&&i<300&&e._pullMissingMessage({groupID:r,localLastMessageSequence:a,remoteLastMessageSequence:s,diff:i})}))}))}},{key:"_getNeedPullConversationList",value:function(){return this.getModule(ug).getLocalConversationList().filter((function(e){return e.type===gr.CONV_GROUP&&e.groupProfile.type!==gr.GRP_AVCHATROOM}))}},{key:"_getRemoteLastMessageSequenceList",value:function(){var e=this;return this.getModule(ag).getGroupList().then((function(t){for(var n=t.data.groupList,o=void 0===n?[]:n,r=0;r<o.length;r++){var a=o[r],s=a.groupID,i=a.nextMessageSeq;if(a.type!==gr.GRP_AVCHATROOM){var c=i-1;e._remoteLastMessageSequenceMap.set(s,c)}}}))}},{key:"_pullMissingMessage",value:function(e){var t=this,n=e.localLastMessageSequence,o=e.remoteLastMessageSequence,r=e.diff;e.count=r>this.PULL_LIMIT_COUNT?this.PULL_LIMIT_COUNT:r,e.sequence=r>this.PULL_LIMIT_COUNT?n+this.PULL_LIMIT_COUNT:n+r,this._getGroupMissingMessage(e).then((function(a){a.length>0&&(a[0].sequence+1<=o&&(e.localLastMessageSequence=n+t.PULL_LIMIT_COUNT,e.diff=r-t.PULL_LIMIT_COUNT,t._pullMissingMessage(e)),t.getModule(ag).onNewGroupMessage({dataList:a,isInstantMessage:!1}))}))}},{key:"_getGroupMissingMessage",value:function(e){var t=this,n=new Uh(wh.GET_GROUP_MISSING_MESSAGE);return this.request({protocolName:N_,requestData:{groupID:e.groupID,count:e.count,sequence:e.sequence}}).then((function(o){var r=o.data.messageList,a=void 0===r?[]:r;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e.groupID," count:").concat(e.count," sequence:").concat(e.sequence," messageList length:").concat(a.length)).end(),a})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),r=o[0],a=o[1];n.setError(e,r,a).end()}))}))}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._remoteLastMessageSequenceMap.clear()}}]),n}(Dg),fS=function(){function e(){o(this,e),this._className="AvgE2EDelay",this._e2eDelayArray=[]}return a(e,[{key:"addMessageDelay",value:function(e){var t=kl()-e;t>=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),bd(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e<o})).length}},{key:"_calcPercent",value:function(e,t){var n=bd(e/t*100,2);return n>100&&(n=100),n}},{key:"_checkE2EDelayException",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,r=Math.min.apply(Math,M(n)),a=Math.max.apply(Math,M(n)),s=this._calcAvg(n,o),i=bd(o/e.length*100,2);if(i>50)new Uh(wh.MESSAGE_E2E_DELAY_EXCEPTION).setMessage("message e2e delay exception. count:".concat(o," min:").concat(r," max:").concat(a," avg:").concat(s," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=M(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),r=this._calcPercent(n,e),a=this._calcPercent(o,e),s=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:r,countLessThan3Second:o,percentOfCountLessThan3Second:a,avgDelay:s}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),mS=function(){function e(){o(this,e),this._className="AvgRTT",this._requestCount=0,this._rttArray=[]}return a(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var n=bd(e/t*100,2);return n>100&&(n=100),n}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,M(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,M(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=M(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),r=this._calcAvg(t,n);return Ul.log("".concat(this._className,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(r)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:r}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),MS=function(){function e(){o(this,e),this._map=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(ed(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(ed(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(ed(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(ed(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(ed(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(ed(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=bd(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(ed(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=bd(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return ed(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return ed(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(ed(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return ed(e)||!this._map.has(e)?-1:e===Nh?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),r=this._calcSuccessCountOfPlatform(e),a=this._calcSuccessRateOfPlatform(e),s=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:r,successRateOfPlatform:a,avgValue:s}}},{key:"reset",value:function(e){ed(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),vS=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(ed(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,r=n.sequence,a=o.replace(gr.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(a)){var s=this._lastMap.get(t).get(a),i=s.length-1;r>s[0]&&r<s[i]?(s.push(r),s.sort(),this._lastMap.get(t).set(a,s)):this._addCurrentMap(e)}else this._addCurrentMap(e);return!0}},{key:"_addCurrentMap",value:function(e){var t=e.key,n=e.message,o=n.conversationID,r=n.sequence,a=o.replace(gr.CONV_GROUP,"");this._currentMap.get(t).has(a)||this._currentMap.get(t).set(a,[]),this._currentMap.get(t).get(a).push(r)}},{key:"_copyData",value:function(e){if(!ed(e)){this._lastMap.set(e,new Map);var t,n=this._lastMap.get(e),o=S(this._currentMap.get(e));try{for(o.s();!(t=o.n()).done;){var r=m(t.value,2),a=r[0],s=r[1];n.set(a,s)}}catch(i){o.e(i)}finally{o.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){if(ed(this._currentMap.get(e))||ed(this._lastMap.get(e)))return null;if(0===this._lastMap.get(e).size)return this._copyData(e),null;var t=0,n=0;if(this._lastMap.get(e).forEach((function(e,o){var r=M(e.values()),a=r.length,s=r[a-1]-r[0]+1;t+=s,n+=a})),0===t)return null;var o=bd(n/t*100,2);return o>100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),yS=function(e){i(r,e);var n=f(r);function r(e){var t;o(this,r),(t=n.call(this,e))._className="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[Eh,Th,Sh,Ah,Dh,Ch,Nh,Rh,Oh,Lh],t._messageSentItems=[Sh,Ah,Dh,Ch,Nh],t._messageReceivedItems=[Rh,Oh,Lh],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new mS,t._avgE2EDelay=new fS,t._rateMessageSent=new MS,t._rateMessageReceived=new vS;var a=t.getInnerEmitterInstance();return a.on(_v,t._onLoginSuccess,_(t)),a.on(hv,t._onCloudConfigUpdated,_(t)),t}return a(r,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(dg),n=t.getItem(this.TAG,!1);!Bd(n)&&nd(n.forEach)&&(Ul.log("".concat(this._className,"._onLoginSuccess.get quality stat log in storage, nums=").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");ed(e)||(this.REPORT_INTERVAL=Number(e)),ed(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),ed(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||Ul.warn("".concat(this._className,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||Ul.warn("".concat(this._className,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ul.warn("".concat(this._className,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||Ul.warn("".concat(this._className,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Ul.warn("".concat(this._className,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Ul.warn("".concat(this._className,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Ph[this.getNetworkType()];ed(o)&&(o=8);var r={qualityType:kh[e],timestamp:Ol(),networkType:o,extension:""};switch(e){case Eh:n=this._avgRTT.getStatResult();break;case Th:n=this._avgE2EDelay.getStatResult();break;case Sh:case Ah:case Dh:case Ch:case Nh:n=this._rateMessageSent.getStatResult(e);break;case Rh:case Oh:case Lh:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},r),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;ed(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),Ul.debug("".concat(this._className,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var r=this.getModule(lg),a=r.getSDKAppID(),s=r.getTinyID();Ud(this.REPORT_SDKAPPID_BLACKLIST,a)&&!wd(this.REPORT_TINYID_WHITELIST,s)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:gy(this),quality:e};this.request({protocolName:Z_,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){Ul.warn("".concat(n._className,"._doReport, online:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(dg),t=e.getItem(this.TAG,!1),n=this._statInfoArr;if(Bd(t))Ul.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var o=n.concat(t);o.length>10&&(o=o.slice(0,10)),Ul.log("".concat(this.className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),r}(Dg),IS=a((function e(t){o(this,e),Bd(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.time=t.time||0,this.source=t.source||"",this.wording=t.wording||"",this.type=t.type||"")})),ES=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}return a(e,[{key:"getLocalFriendApplicationList",value:function(){return{friendApplicationList:M(this._friendApplicationMap.values()),unreadCount:this._unreadCount}}},{key:"_onFriendApplicationListUpdated",value:function(){this._snsModule.emitOuterEvent(pr.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:M(this._friendApplicationMap.values()),unreadCount:this._unreadCount})}},{key:"onFriendApplicationRead",value:function(){this._unreadCount=0,this._onFriendApplicationListUpdated()}},{key:"onFriendApplicationAdded",value:function(e,n){var o=this;if(!Bd(e)){var r="";r=n===this._snsModule.getMyUserID()?gr.SNS_APPLICATION_SENT_BY_ME:gr.SNS_APPLICATION_SENT_TO_ME;var a=!1;e.forEach((function(e){var n="".concat(e.userID,"_").concat(r);r!==gr.SNS_APPLICATION_SENT_TO_ME||o._friendApplicationMap.has(n)||(o._unreadCount+=1),o._friendApplicationMap.set(n,new IS(t(t({},e),{},{type:r}))),a=!0})),a&&this._onFriendApplicationListUpdated()}}},{key:"onFriendApplicationDeleted",value:function(e){Bd(e)||this.getFriendApplicationList()}},{key:"getFriendApplicationList",value:function(){var e=this,t=new Uh(wh.GET_FRIEND_APPLICATION_LIST),n="".concat(this._className,".getFriendApplicationList");return this._snsModule.request({protocolName:Yg,requestData:{applicationType:gr.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsModule.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then((function(o){var r=o.data,a=r.resultList,s=r.unreadCount,i=r.startTime,c=r.currentSequence;e._startTime=i,e._currentSequence=c,e._unreadCount=s;var u=Zl(a)?a.length:0;t.setNetworkType(e._snsModule.getNetworkType()).setMessage("applicationCount:".concat(u," unreadCount:").concat(s)).end(),Ul.info("".concat(n," ok. applicationCount:").concat(u," unreadCount:").concat(s)),e._friendApplicationMap.clear(),Zl(a)&&a.forEach((function(t){var n=t.userID,o=t.type,r=new IS(t);e._friendApplicationMap.set("".concat(n,"_").concat(o),r)})),e._onFriendApplicationListUpdated()})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var n=m(e,2),r=n[0],a=n[1];t.setError(o,r,a).end()})),Ul.warn("".concat(n," failed. error:"),o),XM(o)}))}},{key:"deleteFriendApplication",value:function(e){var t=this,n="".concat(this._className,".deleteFriendApplication"),o=e.userID,r=e.type;if((!r||r!==gr.SNS_APPLICATION_SENT_BY_ME&&r!==gr.SNS_APPLICATION_SENT_TO_ME)&&(r=gr.SNS_APPLICATION_SENT_TO_ME),!this._friendApplicationMap.has("".concat(o,"_").concat(r)))return XM({code:yh.FRIEND_APPLICATION_NOT_EXIST,message:Ih.FRIEND_APPLICATION_NOT_EXIST});var a=new Uh(wh.DELETE_FRIEND_APPLICATION);return a.setMessage("userID:".concat(o," type:").concat(r)),this._snsModule.request({protocolName:$g,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:[o],type:r}}).then((function(e){var s=e.data.resultList,i=s[0],c=i.to,u=i.resultCode,l=i.resultInfo;return a.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(s))).end(),Ul.info("".concat(n," ok. userID:").concat(o," type:").concat(r)),0===u?VM():XM({userID:c,code:u,message:l})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"acceptFriendApplication",value:function(e){var t=this,n="".concat(this._className,".acceptFriendApplication"),o=e.userID,r=e.remark,a=e.tag,s=e.type;(!s||s!==gr.SNS_APPLICATION_AGREE&&s!==gr.SNS_APPLICATION_AGREE_AND_ADD)&&(s=gr.SNS_APPLICATION_AGREE_AND_ADD);var i=new Uh(wh.ACCEPT_FRIEND_APPLICATION);return i.setMessage("userID:".concat(o," type:").concat(s)),this._snsModule.request({protocolName:Wg,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,remark:r,tag:a,action:s}]}}).then((function(e){i.setNetworkType(t._snsModule.getNetworkType()).end();var r=e.data.resultList[0],a=r.resultCode,c=r.resultInfo;if(0!==a)return XM({code:a,message:c});Ul.info("".concat(n," ok. userID:").concat(o," type:").concat(s))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];i.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"refuseFriendApplication",value:function(e){var t=this,n="".concat(this._className,".refuseFriendApplication"),o=e.userID,r=new Uh(wh.REFUSE_FRIEND_APPLICATION);return r.setMessage("userID:".concat(o)),this._snsModule.request({protocolName:Wg,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,action:"Response_Action_Reject"}]}}).then((function(e){r.setNetworkType(t._snsModule.getNetworkType()).end();var a=e.data.resultList[0],s=a.resultCode,i=a.resultInfo;if(0!==s)return XM({code:s,message:i});Ul.info("".concat(n," ok. userID:").concat(o))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_onFriendApplicationProcessed",value:function(e){var t=this;if(0!==e.length){var n=!1;e.forEach((function(e){var o="".concat(e.to,"_").concat(gr.SNS_APPLICATION_SENT_TO_ME);t._friendApplicationMap.has(o)&&(t._friendApplicationMap.delete(o),t._unreadCount-=1,n=!0)})),this._unreadCount<0&&(this._unreadCount=0),n&&this._onFriendApplicationListUpdated()}}},{key:"setFriendApplicationRead",value:function(){var e=this,t="".concat(this._className,".setFriendApplicationRead"),n=new Uh(wh.SET_FRIEND_APPLICATION_READ);return this._snsModule.request({protocolName:zg,requestData:{fromAccount:this._snsModule.getMyUserID(),latestTimeStamp:bd(Ol()/1e3,0)}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end(),Ul.info("".concat(t," ok")),e._unreadCount=0})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=m(e,2),r=t[0],a=t[1];n.setError(o,r,a).end()})),Ul.warn("".concat(t," failed. error:"),o),XM(o)}))}},{key:"reset",value:function(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}]),e}(),TS=function(){function e(t,n){o(this,e),this.userID=t,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var r={};if(r.userID=t,!Bd(n))for(var a="",s="",i=0,c=n.length;i<c;i++)if(a=n[i].tag,s=n[i].value,a.indexOf("Tag_SNS_Custom")>-1)this.friendCustomField.push({key:a,value:s});else switch(a){case Fl.NICK:r.nick=s;break;case Fl.GENDER:r.gender=s;break;case Fl.BIRTHDAY:r.birthday=s;break;case Fl.LOCATION:r.location=s;break;case Fl.SELFSIGNATURE:r.selfSignature=s;break;case Fl.ALLOWTYPE:r.allowType=s;break;case Fl.LANGUAGE:r.language=s;break;case Fl.AVATAR:r.avatar=s;break;case Fl.MESSAGESETTINGS:r.messageSettings=s;break;case Fl.ADMINFORBIDTYPE:r.adminForbidType=s;break;case Fl.LEVEL:r.level=s;break;case Fl.ROLE:r.role=s;break;case ql.REMARK:this.remark=s;break;case ql.ADDTIME:this.addTime=s;break;case ql.GROUP:this.groupList=JSON.parse(JSON.stringify(s));break;case ql.ADDSOURCE:this.source=s;break;case ql.ADDWORDING:break;default:Ul.log("snsProfileItem unkown tag->",n[i].tag)}this.profile=new Sv(r)}return a(e,[{key:"validate",value:function(e){var t=!0,n="";if(Bd(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,r=null,a=0;a<o;a++){if(r=e.profileCustomField[a],!Jl(r.key)||-1===r.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"自定义资料字段的前缀必须是 Tag_Profile_Custom"};if(!Jl(r.value))return{valid:!1,tips:"自定义资料字段的 value 必须是字符串"}}for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if("profileCustomField"===s)continue;if(Bd(e[s])&&!Jl(e[s])&&!zl(e[s])){n="key:"+s+", invalid value:"+e[s],t=!1;continue}switch(s){case"nick":Jl(e[s])||(n="nick should be a string",t=!1),ld(e[s])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(ld(e[s])," bytes"),t=!1);break;case"gender":_d(xl,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":zl(e.birthday)||(n="birthday should be a number",t=!1);break;case"location":Jl(e.location)||(n="location should be a string",t=!1);break;case"selfSignature":Jl(e.selfSignature)||(n="selfSignature should be a string",t=!1);break;case"allowType":_d(Bl,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":zl(e.language)||(n="language should be a number",t=!1);break;case"avatar":Jl(e.avatar)||(n="avatar should be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings should be 0 or 1",t=!1);break;case"adminForbidType":_d(Vl,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":zl(e.level)||(n="level should be a number",t=!1);break;case"role":zl(e.role)||(n="role should be a number",t=!1);break;default:n="unknown key:"+s+" "+e[s],t=!1}}return{valid:t,tips:n}}},{key:"update",value:function(e){for(var t="",n="",o=0,r=e.length;o<r;o++)if(t=e[o].tag,n=e[o].value,t.indexOf("Tag_SNS_Custom")>-1)this.friendCustomField.forEach((function(e){e.key===t&&(e.value=n)}));else if(t.indexOf("Tag_Profile_Custom")>-1)this.profile.profileCustomField.forEach((function(e){e.key===t&&(e.value=n)}));else switch(t){case Fl.NICK:this.profile.nick=n;break;case Fl.GENDER:this.profile.gender=n;break;case Fl.BIRTHDAY:this.profile.birthday=n;break;case Fl.LOCATION:this.profile.location=n;break;case Fl.SELFSIGNATURE:this.profile.selfSignature=n;break;case Fl.ALLOWTYPE:this.profile.allowType=n;break;case Fl.LANGUAGE:this.profile.language=n;break;case Fl.AVATAR:this.profile.avatar=n;break;case Fl.MESSAGESETTINGS:this.profile.messageSettings=n;break;case Fl.ADMINFORBIDTYPE:this.profile.adminForbidType=n;break;case Fl.LEVEL:this.profile.level=n;break;case Fl.ROLE:this.profile.role=n;break;case ql.REMARK:this.remark=n;break;case ql.ADDTIME:this.addTime=n;break;case ql.GROUP:this.groupList=JSON.parse(JSON.stringify(n));break;case ql.ADDSOURCE:this.source=n;break;case ql.ADDWORDING:break;default:Ul.log("snsProfileItem unkown tag->",e[o].tag)}this.timestamp=Date.now()}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){var t=this.groupList.indexOf(e);t>-1&&(this.groupList.splice(t,1),this.count=this.groupList.length)}}]),e}(),SS=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}return a(e,[{key:"getLocalFriendList",value:function(){return M(this._friendMap.values())}},{key:"getFriendRemark",value:function(e){return this._friendMap.has(e)?this._friendMap.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var t=this,n=e.dataList;if(!Bd(n)){var o=this._snsModule.getModule(ug);n.forEach((function(e){var n=e.userID,r=e.profileList;if(t.isMyFriend(n)){Ul.log("".concat(t._className,".onFriendProfileModified. friend userID:").concat(n));var a=t._friendMap.get(n);a.update(r),o.modifyMessageSentByPeer({conversationID:"".concat(gr.CONV_C2C).concat(n),latestNick:a.profile.nick,latestAvatar:a.profile.avatar})}}))}}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(Ul.log("".concat(this._className,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._friendMap.set(e,new TS(e))})),this.getFriendProfile({userIDList:e}).then((function(n){e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendAdded({nameList:n.groupList,userID:e})})),t._onFriendListUpdated()})))}},{key:"onFriendDeleted",value:function(e){var t=this;0!==e.length&&(Ul.log("".concat(this._className,".onFriendDeleted userIDList:").concat(e)),e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendDeleted({nameList:n.groupList,userID:e}),t._friendMap.delete(e)})),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsModule.emitOuterEvent(pr.FRIEND_LIST_UPDATED),this._snsModule.getModule(ug).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var t=this,n="".concat(this._className,".getFriendProfile"),o=e.userIDList,r=[],a=[],s=[];if(o.forEach((function(e){if(t._friendMap.has(e)){var n=t._friendMap.get(e);Date.now()-n.timestamp<t._expirationTime?a.push(n):s.push(e)}else r.push({userID:e,code:yh.NOT_MY_FRIEND,message:Ih.NOT_MY_FRIEND})})),0===s.length)return Ul.info("".concat(n," newUserIDList is empty")),JM({friendList:a,failureUserIDList:r});var i=new Uh(wh.GET_FRIEND_PROFILE);i.setMessage("userIDList:".concat(s)),Ul.info("".concat(n," userIDList:").concat(s));var c=Object.values(ql).concat(Object.values(Fl));return this._snsModule.request({protocolName:Vg,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:s,tagList:c}}).then((function(e){return i.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.info("".concat(n," ok")),e.data.resultList.forEach((function(e){var n,o=e.to,s=e.resultCode,i=e.resultInfo,c=e.tagValueList;ed(s)||0===s?(t._friendMap.has(o)?(n=t._friendMap.get(o)).update(c):(n=new TS(o,c),t._friendMap.set(o,n)),a.push(n)):r.push({userID:o,code:s,message:i})})),VM({friendList:a,failureUserIDList:r})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];i.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"isMyFriend",value:function(e){return this._friendMap.has(e)}},{key:"pagingGetFriendList",value:function(){var e=this,t=new Uh(wh.GET_FRIEND_LIST),n="".concat(this._className,".getFriendList"),o=Date.now();this._snsModule.request({protocolName:xg,requestData:{fromAccount:this._snsModule.getMyUserID(),startIndex:this._startIndex,standardSequence:this._standardSequence,customSequence:this._customSequence}}).then((function(r){var a=r.data,s=a.friendCount,i=a.resultList,c=a.nextStartIndex,u=a.standardSequence,l=a.customSequence,d=a.completeFlag;e._startIndex=c,e._standardSequence=u,e._customSequence=l;var p=Date.now()-o,g="friendCount:".concat(s," nextStartIndex:").concat(c," standardSequence:").concat(u," ")+"customSequence:".concat(l," completeFlag:").concat(d," cost ").concat(p," ms");t.setNetworkType(e._snsModule.getNetworkType()).setMessage(g).end(),Ul.info("".concat(n," ok."),g),Bd(i)||i.forEach((function(t){var n=t.to,o=t.tagValueList;e._friendMap.set(n,new TS(n,o))})),0===d?e.pagingGetFriendList():(e._snsModule.emitOuterEvent(pr.FRIEND_LIST_UPDATED),e._pagingGetFriendProfile())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var n=m(e,2),r=n[0],a=n[1];t.setError(o,r,a).end()})),Ul.warn("".concat(n," failed. error:"),o),XM(o)}))}},{key:"_pagingGetFriendProfile",value:function(){var e=this,t=M(this._friendMap.keys()),n=this._snsModule.getModule(og),o=t.length,r=o<=100?1:Math.ceil(o/100);Ul.log("".concat(this._className,"._pagingGetFriendProfile friendCount:").concat(o," pageCount:").concat(r));for(var a=0;a<r;a++)n.getUserProfile({userIDList:t.slice(100*a,100*(a+1))}).then((function(t){t.data.forEach((function(t){var n=e._friendMap.get(t.userID);n&&n.updateProfile(t)})),e._onFriendListUpdated()}))}},{key:"addFriend",value:function(e){var t=this,n="".concat(this._className,".addFriend"),o=e.to,r=e.source,a=e.type,s=e.wording,i=e.remark,c=e.groupName;if(this._friendMap.has(o))return XM({code:yh.ALREADY_MY_FRIEND,message:Ih.ALREADY_MY_FRIEND});var u=a;(!u||u!==gr.SNS_ADD_TYPE_SINGLE&&u!==gr.SNS_ADD_TYPE_BOTH)&&(u=gr.SNS_ADD_TYPE_BOTH);var l=new Uh(wh.ADD_FRIEND);return l.setMessage("to:".concat(o," source:").concat(r," type:").concat(u)),this._snsModule.request({protocolName:Kg,requestData:{fromAccount:this._snsModule.getMyUserID(),addFriendItem:[{to:o,source:r,wording:s,remark:i,groupName:c}],type:u}}).then((function(e){var o=e.data.resultList;l.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(o))).end();var r=o[0],a=r.to,s=r.resultCode,i=r.resultInfo;return Ul.info("".concat(n," ok. to:").concat(a," type:").concat(u," code:").concat(s)),ed(s)||0===s?VM({userID:a,code:0}):30539===s?VM({userID:a,code:s,message:WM[s]}):XM({userID:a,code:s,message:WM[s]||i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"deleteFriend",value:function(e){var t=this,n="".concat(this._className,".deleteFriend"),o=e.userIDList,r=e.type;o.length>1e3&&(Ul.warn("".concat(n," 删除好友人数不能超过1000人")),o.length=1e3);var a=[],s=[],i=[];if(o.forEach((function(e){t._friendMap.has(e)?i.push(e):a.push({userID:e,code:yh.NOT_MY_FRIEND,message:Ih.NOT_MY_FRIEND})})),0===i.length)return JM({successUserIDList:s,failureUserIDList:a});var c=r;(!c||c!==gr.SNS_DELETE_TYPE_SINGLE&&c!==gr.SNS_DELETE_TYPE_BOTH)&&(c=gr.SNS_DELETE_TYPE_BOTH);var u=new Uh(wh.DELETE_FRIEND);return u.setMessage("userIDList:".concat(i," type:").concat(c)),this._snsModule.request({protocolName:Hg,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:i,type:c}}).then((function(e){u.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.info("".concat(n," ok"));var o=e.data.resultList;return Bd(o)||o.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;ed(n)||0===n?s.push({userID:t}):a.push({userID:t,code:n,message:o})})),VM({successUserIDList:s,failureUserIDList:a})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];u.setError(e,o,r).end()})),Ul.warn("".concat(n," error:"),e),XM(e)}))}},{key:"updateFriend",value:function(e){var t=this,n=e.userID,o=e.remark,r=e.friendCustomField;if(!this._friendMap.has(n))return XM({code:yh.NOT_MY_FRIEND,message:Ih.NOT_MY_FRIEND});var a=new Uh(wh.UPDATE_FRIEND);a.setMessage("userID:".concat(n," remark:").concat(o," friendCustomField:").concat(r));var s="".concat(this._className,".updateFriend"),i=[];return ed(o)||i.push({tag:ql.REMARK,value:o}),Zl(r)&&r.length>0&&r.forEach((function(e){i.push({tag:e.key,value:e.value})})),this._snsModule.request({protocolName:jg,requestData:{fromAccount:this._snsModule.getMyUserID(),updateItem:[{to:n,snsItem:i}]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.info("".concat(s," ok"));var n=e.data.resultList[0],i=n.to,c=n.resultCode,u=n.resultInfo;if(ed(c)||0===c){var l=t._friendMap.get(i);return l&&(ed(o)||(l.remark=o),Zl(r)&&r.length>0&&vd(l.friendCustomField,r),t._onFriendListUpdated()),VM(l)}return XM({code:c,message:u})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(s," failed. error:"),e),XM(e)}))}},{key:"checkFriend",value:function(e){var t=this,n="".concat(this._className,".checkFriend"),o=e.userIDList,r=e.type;(!r||r!==gr.SNS_CHECK_TYPE_SINGLE&&r!==gr.SNS_CHECK_TYPE_BOTH)&&(r=gr.SNS_CHECK_TYPE_BOTH);var a=new Uh(wh.CHECK_FRIEND);return a.setMessage("userIDList:".concat(o," type:").concat(r)),this._snsModule.request({protocolName:Bg,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:o,type:r}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.info("".concat(n," ok. userIDList:").concat(o," type:").concat(r));var s=[],i=[],c=e.data.resultList;return Zl(c)&&c.forEach((function(e){var t=e.to,n=e.relation,o=e.resultCode,r=e.resultInfo;ed(o)||0===o?s.push({userID:t,code:0,relation:n}):i.push({userID:t,code:o,message:r})})),VM({successUserIDList:s,failureUserIDList:i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"updateWhenAddedToFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;Ul.log("".concat(this._className,".updateWhenAddedToFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!Bd(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).addToGroupList(n)}))}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;Ul.log("".concat(this._className,".updateWhenRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!Bd(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).removeFromGroupList(n)}))}},{key:"reset",value:function(){this._friendMap.clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}}]),e}(),AS=function(){function e(t){o(this,e),Bd(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)}return a(e,[{key:"addToUserIDList",value:function(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){var t=this.userIDList.indexOf(e);t>-1&&(this.userIDList.splice(t,1),this.count=this.userIDList.length)}}]),e}(),DS=function(){function e(t){o(this,e),this._snsModule=t,this._className="FriendGroupHandler",this._friendGroupMap=new Map}return a(e,[{key:"getLocalFriendGroupList",value:function(){return M(this._friendGroupMap.values())}},{key:"_emitFriendGroupListUpdated",value:function(){var e=M(this._friendGroupMap.values());this._snsModule.emitOuterEvent(pr.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getFriendGroupList",value:function(){var e=this,t=new Uh(wh.GET_FRIEND_GROUP_LIST),n="".concat(this._className,".getFriendGroupList");return this._snsModule.request({protocolName:Jg,requestData:{fromAccount:this._snsModule.getMyUserID()}}).then((function(o){t.setNetworkType(e._snsModule.getNetworkType()).end();var r=o.data.resultList;Bd(r)?Ul.info("".concat(n," ok. friend group count:0")):(Ul.info("".concat(n," ok. friend group count:").concat(r.length)),e._friendGroupMap.clear(),r.forEach((function(t){var n=new AS(t);e._friendGroupMap.set(t.name,n)})),e._emitFriendGroupListUpdated())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var n=m(e,2),r=n[0],a=n[1];t.setError(o,r,a).end()})),Ul.warn("".concat(n," error:"),o),XM(o)}))}},{key:"createFriendGroup",value:function(e){var t=this,n="".concat(this._className,".createFriendGroup"),o=e.name,r=e.userIDList;if(this._friendGroupMap.has(o))return Ul.warn("".concat(n," 好友分组 ").concat(o," 已经存在!")),XM({code:yh.FRIEND_GROUP_EXISTED,message:Ih.FRIEND_GROUP_EXISTED});var a=new Uh(wh.CREATE_FRIEND_GROUP);return a.setMessage("name:".concat(o," userIDList:").concat(r)),this._snsModule.request({protocolName:Xg,requestData:{fromAccount:this._snsModule.getMyUserID(),groupName:[o],userIDList:Zl(r)?r:void 0}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.log("".concat(n," ok. name:").concat(o," userIDList:").concat(r));var s=e.data.resultList,i=[],c=[];s&&s.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;if(ed(n)||0===n)i.push(t);else{var r={userID:e.to,code:n,message:o};c.push(r)}}));var u=new AS({name:o,userIDList:i});return t._friendGroupMap.set(o,u),t._snsModule.updateWhenAddedToFriendGroup({name:o,userIDList:i}),t._emitFriendGroupListUpdated(),VM({friendGroup:u,failureUserIDList:c})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"deleteFriendGroup",value:function(e){var t=this,n="".concat(this._className,".deleteFriendGroup"),o=e.name;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var r=new Uh(wh.DELETE_FRIEND_GROUP);return r.setMessage("name:".concat(o)),this._snsModule.request({protocolName:Qg,requestData:{fromAccount:this._snsModule.getMyUserID(),nameList:[o]}}).then((function(e){r.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.log("".concat(n," ok. name:").concat(o));var a=t._friendGroupMap.get(o);return a&&(t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:a.userIDList}),t._friendGroupMap.delete(o),a.userIDList.length=0),t._emitFriendGroupListUpdated(),VM(a)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_onFriendGroupNotExist",value:function(e){return Ul.warn("".concat(this._className,"._onFriendGroupNotExist 好友分组 ").concat(e," 不存在!")),XM({code:yh.FRIEND_GROUP_NOT_EXIST,message:Ih.FRIEND_GROUP_NOT_EXIST})}},{key:"renameFriendGroup",value:function(e){var t=this,n="".concat(this._className,".renameFriendGroup"),o=e.oldName,r=e.newName;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist();var a=new Uh(wh.RENAME_FRIEND_GROUP).setMessage("oldName:".concat(o," newName:").concat(r));return this._snsModule.request({protocolName:Zg,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,newName:r}}).then((function(){if(a.setNetworkType(t._snsModule.getNetworkType()).end(),Ul.log("".concat(n," ok. oldName:").concat(o," newName:").concat(r)),t._friendGroupMap.has(o)){var e=t._friendGroupMap.get(o);return e.name=r,t._friendGroupMap.delete(o),t._friendGroupMap.set(r,e),t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:e.userIDList}),t._snsModule.updateWhenAddedToFriendGroup({name:r,userIDList:e.userIDList}),t._emitFriendGroupListUpdated(),VM(e)}return VM()})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"addToFriendGroup",value:function(e){var t=this,n="".concat(this._className,".addToFriendGroup"),o=e.name,r=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var a=new Uh(wh.ADD_TO_FRIEND_GROUP);return a.setMessage("name:".concat(o," userIDList:").concat(r)),Ul.log("".concat(this._className,".addToFriendGroup name:").concat(o," userIDList:").concat(r)),this._snsModule.request({protocolName:Zg,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:r.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Add"}}))}}).then((function(e){return a.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"removeFromFriendGroup",value:function(e){var t=this,n="".concat(this._className,".removeFromFriendGroup"),o=e.name,r=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var a=new Uh(wh.REMOVE_FROM_FRIEND_GROUP);return a.setMessage("name:".concat(o," userIDList:").concat(r)),Ul.log("".concat(n," name:").concat(o," userIDList:").concat(r)),this._snsModule.request({protocolName:Zg,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:r.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Delete"}}))}}).then((function(e){return a.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).end()})),Ul.warn("".concat(n," failed. error:"),e),XM(e)}))}},{key:"_onFriendGroupUpdated",value:function(e,t){var n=t.data.resultList,o=this._friendGroupMap.get(e),r=[],a=[],s=[];return Zl(n)&&n.forEach((function(e){var t=e.to,n=e.resultCode,i=e.resultInfo,c=e.type;0===n?"Update_Type_Add"===c?o&&(o.addToUserIDList(t),a.push(t)):"Update_Type_Delete"===c&&o&&(o.removeFromUserIDList(t),s.push(t)):r.push({to:e.to,code:n,message:i})})),Ul.log("".concat(this._className,"._onFriendGroupUpdated name:").concat(e," userIDList:").concat(o.userIDList)),a.length>0&&this._snsModule.updateWhenAddedToFriendGroup({name:e,userIDList:a}),s.length>0&&this._snsModule.updateWhenRemovedFromFriendGroup({name:e,userIDList:s}),VM({friendGroup:o,failureUserIDList:r})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,o=e.userID;Ul.log("".concat(this._className,".updateWhenFriendAdded userID:").concat(o," nameList:").concat(n)),Bd(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).addToUserIDList(o)}))}},{key:"updateWhenFriendDeleted",value:function(e){var t=this,n=e.nameList,o=e.userID;Ul.log("".concat(this._className,".updateWhenFriendDeleted userID:").concat(o," nameList:").concat(n)),Bd(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).removeFromUserIDList(o)}))}},{key:"reset",value:function(){this._friendGroupMap.clear()}}]),e}(),CS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="SnsModule",r._friendHandler=new SS(_(r)),r._friendApplicationHandler=new ES(_(r)),r._friendGroupHandler=new DS(_(r)),r.getInnerEmitterInstance().on(_v,r.onContextUpdated,_(r)),r}return a(n,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getFriendGroupList(),this._friendApplicationHandler.getFriendApplicationList()}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!Bd(t)){var n=[],o=[],r=[],a=[],s=!1,i="";t.forEach((function(e){3!==e.pushType&&4!==e.pushType||!e.from||(i=e.from),e.friendAddAccount&&(n.push.apply(n,M(e.friendAddAccount)),a.push.apply(a,M(e.friendAddAccount))),e.friendDelAccount&&o.push.apply(o,M(e.friendDelAccount)),e.friendApplicationAdded&&r.push.apply(r,M(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&a.push.apply(a,M(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(s=!0)})),s&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(r,i),this._friendApplicationHandler.onFriendApplicationDeleted(a),this._friendHandler.onFriendAdded(n),this._friendHandler.onFriendDeleted(o)}}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this._friendHandler.getLocalFriendList();return e?JM(t):t}},{key:"getFriendRemark",value:function(e){return this._friendHandler.getFriendRemark(e)}},{key:"getFriendList",value:function(){return this._friendHandler.pagingGetFriendList()}},{key:"addFriend",value:function(e){return this._friendHandler.addFriend(e)}},{key:"deleteFriend",value:function(e){return this._friendHandler.deleteFriend(e)}},{key:"checkFriend",value:function(e){return this._friendHandler.checkFriend(e)}},{key:"getFriendProfile",value:function(e){return this._friendHandler.getFriendProfile(e)}},{key:"updateFriend",value:function(e){return this._friendHandler.updateFriend(e)}},{key:"updateWhenAddedToFriendGroup",value:function(e){this._friendHandler.updateWhenAddedToFriendGroup(e)}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){this._friendHandler.updateWhenRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){var e=this._friendApplicationHandler.getLocalFriendApplicationList();return JM(e)}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteFriendApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseFriendApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptFriendApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setFriendApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){var e=this._friendGroupHandler.getLocalFriendGroupList();return JM(e)}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createFriendGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteFriendGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToFriendGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromFriendGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameFriendGroup(e)}},{key:"onAddToFriendGroup",value:function(e){return this._friendGroupHandler.onAddToFriendGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}]),n}(Dg),NS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="WorkerTimerModule",r._isWorkerEnabled=!0,r._workerTimer=null,r._init(),r.getInnerEmitterInstance().on(hv,r._onCloudConfigUpdated,_(r)),r}return a(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&dl}},{key:"startWorkerTimer",value:function(){Ul.log("".concat(this._className,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){Ul.log("".concat(this._className,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(dl){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000) } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(){t._moduleManager.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");Ul.log("".concat(this._className,"._onCloudConfigUpdated enableWorker:").concat(e)),ed(e)||"1"===e?!this._isWorkerEnabled&&dl&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._moduleManager.onWorkerTimerEnabled()):this._isWorkerEnabled&&dl&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._moduleManager.onWorkerTimerDisabled())}},{key:"terminate",value:function(){Ul.log("".concat(this._className,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset"))}}]),n}(Dg),RS=function(){function e(){o(this,e),this._className="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return a(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){var t="".concat(this._className,".parsePurchaseBits");if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var n=Object.values(bu),o=null,r=e.length-1,a=0;r>=0;r--,a++)o=a<32?new Tu(0,Math.pow(2,a)).toString():new Tu(Math.pow(2,a-32),0).toString(),-1!==n.indexOf(o)&&("1"===e[r]?this._purchasedFeatureMap.set(o,!0):this._purchasedFeatureMap.set(o,!1))}else Ul.warn("".concat(t," invalid purchase bits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),OS=function(e){i(n,e);var t=f(n);function n(e){var r;return o(this,n),(r=t.call(this,e))._className="CommercialConfigModule",r._expiredTime=0,r._isFetching=!1,r._purchasedFeatureHandler=new RS,r}return a(n,[{key:"_canFetch",value:function(){return this.isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),n="".concat(this._className,".fetchConfig");if(Ul.log("".concat(n," canFetch:").concat(t)),t){var o=new Uh(wh.FETCH_COMMERCIAL_CONFIG);o.setNetworkType(this.getNetworkType());var r=this.getModule(lg).getSDKAppID();this._isFetching=!0,this.request({protocolName:uh,requestData:{SDKAppID:r}}).then((function(t){o.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),Ul.log("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){e.probeNetwork().then((function(e){var n=m(e,2),r=n[0],a=n[1];o.setError(t,r,a).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._className,".onPushedConfig");Ul.log("".concat(t)),new Uh(wh.PUSHED_COMMERCIAL_CONFIG).setNetworkType(this.getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._className,"._parseConfig"),n=e.errorCode,o=e.errorMessage,r=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(r),this._expiredTime=Date.now()+1e3*a):ed(n)?(Ul.log("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ul.error("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"hasPurchasedFeature",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),n}(Dg),LS=function(){function e(t){o(this,e);var n=new Uh(wh.SDK_CONSTRUCT);this._className="ModuleManager",this._isReady=!1,this._reason=yh.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(lg,new iy(this,t)),this._moduleMap.set(Ag,new OS(this)),this._moduleMap.set(Ig,new _S(this)),this._moduleMap.set(Eg,new NS(this)),this._moduleMap.set(Sg,new yS(this)),this._moduleMap.set(vg,new aS(this)),this._moduleMap.set(Mg,new pS(this)),this._moduleMap.set(tg,new cy(this)),this._moduleMap.set(ng,new Ry(this)),this._moduleMap.set(og,new sy(this)),this._moduleMap.set(rg,new QM(this)),this._moduleMap.set(ug,new kv(this)),this._moduleMap.set(ag,new Kv(this)),this._moduleMap.set(ig,new Wv(this)),this._moduleMap.set(cg,new Jv(this)),this._moduleMap.set(dg,new dy(this)),this._moduleMap.set(pg,new _y(this)),this._moduleMap.set(gg,new vy(this)),this._moduleMap.set(_g,new Iy(this)),this._moduleMap.set(hg,new Ty(this)),this._moduleMap.set(fg,new Oy(this)),this._moduleMap.set(mg,new Ly(this)),this._moduleMap.set(yg,new gS(this)),this._moduleMap.set(Tg,new hS(this)),this._moduleMap.set(sg,new CS(this)),this._eventThrottleMap=new Map;var r=t.instanceID,a=t.oversea,s=t.SDKAppID,i="instanceID:".concat(r," SDKAppID:").concat(s," host:").concat(Od()," oversea:").concat(a," inBrowser:").concat(ju," inMiniApp:").concat(Ku)+" workerAvailable:".concat(dl," UserAgent:").concat($u);Uh.bindEventStatModule(this._moduleMap.get(pg)),n.setMessage("".concat(i," ").concat(function(){var e="";if(Ku)try{var t=Wu.getSystemInfoSync(),n=t.model,o=t.version,r=t.system,a=t.platform,s=t.SDKVersion;e="model:".concat(n," version:").concat(o," system:").concat(r," platform:").concat(a," SDKVersion:").concat(s)}catch(FS){e=""}return e}())).end(),Ul.info("SDK ".concat(i)),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return a(e,[{key:"_startTimer",value:function(){var e=this._moduleMap.get(Eg),t=e.isWorkerEnabled();Ul.log("".concat(this._className,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){Ul.log("".concat(this._className,"._startMainThreadTimer")),this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3))}},{key:"stopTimer",value:function(){var e=this._moduleMap.get(Eg),t=e.isWorkerEnabled();Ul.log("".concat(this._className,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){Ul.log("".concat(this._className,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){Ul.log("".concat(this._className,"._stopMainThreadSocket"));var e=this._moduleMap.get(vg);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){Ul.log("".concat(this._className,"._startMainThreadSocket"));var e=this._moduleMap.get(vg);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){Ul.log("".concat(this._className,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){Ul.log("".concat(this._className,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=S(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(tg),this._moduleMap.get(ug)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(pr.SDK_READY);var t=Date.now()-this._startLoginTs;Ul.warn("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(gg).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Rl;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Ll(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(gg).start(),this._ssoLogForReady=new Uh(wh.SDK_READY),this._reason=yh.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new yy,zM(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===pr.CONVERSATION_LIST_UPDATED||e===pr.FRIEND_LIST_UPDATED||e===pr.GROUP_LIST_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),r=this._eventThrottleMap.get(e);o-r.last<1e3?(r.timeoutID&&clearTimeout(r.timeoutID),r.timeoutID=setTimeout((function(){r.last=o,n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),500)):(r.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===pr.CONVERSATION_LIST_UPDATED?this._moduleMap.get(ug).getLocalConversationList():e===pr.FRIEND_LIST_UPDATED?this._moduleMap.get(sg).getLocalFriendList(!1):e===pr.GROUP_LIST_UPDATED?this._moduleMap.get(ag).getLocalGroupList():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new yy,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;Ql(arguments[1])&&arguments[1].data?(Ul.warn("inner eventData has data property, please check!"),n=[e,{name:arguments[0],data:arguments[1].data}]):n=[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"isReady",value:function(){return this._isReady}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"onError",value:function(e){Ul.warn("Oops! code:".concat(e.code," message:").concat(e.message)),new Uh(wh.ERROR).setMessage("code:".concat(e.code," message:").concat(e.message)).setNetworkType(this.getModule(gg).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(pr.ERROR,e)}},{key:"reset",value:function(){Ul.log("".concat(this._className,".reset")),Ll();var e,t=S(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.reset&&n.reset()}}catch(s){t.e(s)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(pr.SDK_NOT_READY);var o,r=S(this._eventThrottleMap);try{for(r.s();!(o=r.n()).done;){var a=m(o.value,2)[1];a.timeoutID&&clearTimeout(a.timeoutID)}}catch(s){r.e(s)}finally{r.f()}this._eventThrottleMap.clear()}}]),e}(),kS=function(){function e(){o(this,e),this._funcMap=new Map}return a(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)?this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(Ul.log("SafetyCallback.find: 找不到 func —— ".concat(e,"/").concat(""!==t.name?t.name:"[anonymous]")),null):(Ul.log("SafetyCallback.find: 找不到 eventName-".concat(e," 对应的 func")),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){return function(){try{t.apply(n,Array.from(arguments))}catch(s){var o=Object.values(pr).indexOf(e);if(-1!==o){var r=Object.keys(pr)[o];Ul.warn("接入侧事件 TIM.EVENT.".concat(r," 对应的回调函数逻辑存在问题,请检查!"),s)}var a=new Uh(wh.CALLBACK_FUNCTION_ERROR);a.setMessage("eventName:".concat(e)).setMoreMessage(s.message).end()}}}}]),e}(),GS=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Rd(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0};this._moduleManager=new LS(n),this._safetyCallbackFactory=new kS}return a(e,[{key:"onError",value:function(e){this._moduleManager.onError(e)}},{key:"login",value:function(e){return this._moduleManager.login(),this._moduleManager.getModule(tg).login(e)}},{key:"logout",value:function(){var e=this;return this._moduleManager.getModule(tg).logout().then((function(t){return e._moduleManager.reset(),t}))}},{key:"isReady",value:function(){return this._moduleManager.isReady()}},{key:"getNotReadyReason",value:function(){return this._moduleManager.getNotReadyReason()}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._moduleManager.stopTimer(),e._moduleManager.getModule(Eg).terminate(),e._moduleManager.getModule(vg).dealloc();var t=e._moduleManager.getOuterEmitterInstance(),n=e._moduleManager.getModule(lg);t.emit(pr.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){e===pr.GROUP_SYSTEM_NOTICE_RECEIVED&&Ul.warn("TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知详细请参考https://web.sdk.qcloud.com/im/doc/zh-cn/Message.html#.GroupSystemNoticePayload"),Ul.debug("on","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){Ul.debug("once","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){Ul.debug("off","eventName:".concat(e));var r=this._safetyCallbackFactory.find(e,t);null!==r&&(this._moduleManager.getOuterEmitterInstance().off(e,r,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){this._moduleManager.getModule(fg).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){console.log([""," ________ ______ __ __ __ __ ________ _______","| \\| \\| \\ / \\| \\ _ | \\| \\| \\"," \\$$$$$$$$ \\$$$$$$| $$\\ / $$| $$ / \\ | $$| $$$$$$$$| $$$$$$$\\"," | $$ | $$ | $$$\\ / $$$| $$/ $\\| $$| $$__ | $$__/ $$"," | $$ | $$ | $$$$\\ $$$$| $$ $$$\\ $$| $$ \\ | $$ $$"," | $$ | $$ | $$\\$$ $$ $$| $$ $$\\$$\\$$| $$$$$ | $$$$$$$\\"," | $$ _| $$_ | $$ \\$$$| $$| $$$$ \\$$$$| $$_____ | $$__/ $$"," | $$ | $$ \\| $$ \\$ | $$| $$$ \\$$$| $$ \\| $$ $$"," \\$$ \\$$$$$$ \\$$ \\$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$$","",""].join("\n")),console.log("%cIM 智能客服,随时随地解决您的问题 →_→ https://cloud.tencent.com/act/event/smarty-service?from=im-doc","color:#006eff"),console.log("%c从v2.11.2起SDK 支持了 WebSocket小程序需要添加受信域名升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html","color:#ff0000");console.log(["","参考以下文档,会更快解决问题哦!(#^.^#)\n","SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n","SDK 接口文档: https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html\n","常见问题: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-01-faq.html\n","反馈问题?戳我提 issue: https://github.com/tencentyun/TIMSDK/issues\n","如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\n"].join("\n"))}Ul.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._moduleManager.getModule(ng).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._moduleManager.getModule(ng).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._moduleManager.getModule(ng).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._moduleManager.getModule(ng).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._moduleManager.getModule(ng).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._moduleManager.getModule(ng).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._moduleManager.getModule(ng).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._moduleManager.getModule(ng).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._moduleManager.getModule(ng).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._moduleManager.getModule(ng).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==gr.MSG_MERGER?XM(new YM({code:yh.MESSAGE_MERGER_TYPE_INVALID,message:Ih.MESSAGE_MERGER_TYPE_INVALID})):Bd(e.payload.downloadKey)?XM(new YM({code:yh.MESSAGE_MERGER_KEY_INVALID,message:Ih.MESSAGE_MERGER_KEY_INVALID})):this._moduleManager.getModule(ng).downloadMergerMessage(e).catch((function(e){return XM(new YM({code:yh.MESSAGE_MERGER_DOWNLOAD_FAIL,message:Ih.MESSAGE_MERGER_DOWNLOAD_FAIL}))}))}},{key:"createForwardMessage",value:function(e){return this._moduleManager.getModule(ng).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof xM?this._moduleManager.getModule(ng).sendMessageInstance(e,t):XM(new YM({code:yh.MESSAGE_SEND_NEED_MESSAGE_INSTANCE,message:Ih.MESSAGE_SEND_NEED_MESSAGE_INSTANCE}))}},{key:"callExperimentalAPI",value:function(e,t){return"handleGroupInvitation"===e?this._moduleManager.getModule(ag).handleGroupInvitation(t):XM(new YM({code:yh.INVALID_OPERATION,message:Ih.INVALID_OPERATION}))}},{key:"revokeMessage",value:function(e){return this._moduleManager.getModule(ng).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._moduleManager.getModule(ng).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._moduleManager.getModule(ng).deleteMessage(e)}},{key:"modifyMessage",value:function(e){return this._moduleManager.getModule(ng).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._moduleManager.getModule(ug).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._moduleManager.getModule(ug).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._moduleManager.getModule(ug).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._moduleManager.getModule(ug).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._moduleManager.getModule(ag).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._moduleManager.getModule(ug).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._moduleManager.getModule(ug).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._moduleManager.getModule(ug).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._moduleManager.getModule(ug).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._moduleManager.getModule(ug).deleteConversation(e)}},{key:"pinConversation",value:function(e){return this._moduleManager.getModule(ug).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._moduleManager.getModule(ug).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._moduleManager.getModule(ug).setMessageRemindType(e)}},{key:"getMyProfile",value:function(){return this._moduleManager.getModule(og).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._moduleManager.getModule(og).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._moduleManager.getModule(og).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._moduleManager.getModule(og).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._moduleManager.getModule(og).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._moduleManager.getModule(og).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._moduleManager.getModule(og).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._moduleManager.getModule(og).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._moduleManager.getModule(og).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._moduleManager.getModule(og).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._moduleManager.getModule(sg);return e?e.getLocalFriendList():XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.addFriend(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.deleteFriend(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.checkFriend(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.getFriendProfile(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.updateFriend(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._moduleManager.getModule(sg);return e?e.getLocalFriendApplicationList():XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.acceptFriendApplication(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.refuseFriendApplication(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.deleteFriendApplication(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._moduleManager.getModule(sg);return e?e.setFriendApplicationRead():XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._moduleManager.getModule(sg);return e?e.getLocalFriendGroupList():XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.createFriendGroup(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.deleteFriendGroup(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.addToFriendGroup(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.removeFromFriendGroup(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._moduleManager.getModule(sg);return t?t.renameFriendGroup(e):XM({code:yh.CANNOT_FIND_MODULE,message:Ih.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._moduleManager.getModule(ag).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._moduleManager.getModule(ag).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._moduleManager.getModule(ag).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._moduleManager.getModule(ag).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._moduleManager.getModule(ag).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._moduleManager.getModule(ag).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._moduleManager.getModule(ag).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._moduleManager.getModule(ag).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._moduleManager.getModule(ag).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._moduleManager.getModule(ag).changeGroupOwner(e)}},{key:"handleGroupApplication",value:function(e){return this._moduleManager.getModule(ag).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._moduleManager.getModule(ag).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._moduleManager.getModule(ag).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._moduleManager.getModule(ag).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._moduleManager.getModule(ag).getGroupAttributes(e)}},{key:"getGroupMemberList",value:function(e){return this._moduleManager.getModule(ig).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._moduleManager.getModule(ig).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._moduleManager.getModule(ig).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._moduleManager.getModule(ig).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._moduleManager.getModule(ig).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._moduleManager.getModule(ig).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._moduleManager.getModule(ig).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._moduleManager.getModule(ig).setGroupMemberCustomField(e)}},{key:"getJoinedCommunityList",value:function(){return this._moduleManager.getModule(cg).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._moduleManager.getModule(cg).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._moduleManager.getModule(cg).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._moduleManager.getModule(cg).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._moduleManager.getModule(cg).getTopicList(e)}}]),e}(),PS={login:"login",logout:"logout",destroy:"destroy",on:"on",off:"off",ready:"ready",setLogLevel:"setLogLevel",joinGroup:"joinGroup",quitGroup:"quitGroup",registerPlugin:"registerPlugin",getGroupOnlineMemberCount:"getGroupOnlineMemberCount"};function bS(e,t){if(e.isReady()||void 0!==PS[t])return!0;var n=e.getNotReadyReason(),o="";Object.getOwnPropertyNames(yh).forEach((function(e){yh[e]===n&&(o=Ih[e])}));var r={code:n,message:"".concat(o,"导致 sdk not ready。").concat(t," ").concat(Ih.SDK_IS_NOT_READY,",请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/module-EVENT.html#.SDK_READY")};return e.onError(r),r}var US={},wS={};return wS.create=function(e){var n=0;if(zl(e.SDKAppID))n=e.SDKAppID;else if(Ul.warn("TIM.create SDKAppID 的类型应该为 Number请修改"),n=parseInt(e.SDKAppID),isNaN(n))return Ul.error("TIM.create failed. 解析 SDKAppID 失败,请检查传参!"),null;if(n&&US[n])return US[n];Ul.log("TIM.create");var o=new GS(t(t({},e),{},{SDKAppID:n}));o.on(pr.SDK_DESTROY,(function(e){US[e.data.SDKAppID]=null,delete US[e.data.SDKAppID]}));var r=function(e){var t=Object.create(null);return Object.keys(Wp).forEach((function(n){if(e[n]){var o=Wp[n],r=new Ar;t[o]=function(){var t=Array.from(arguments);return r.use((function(t,o){var r=bS(e,n);return!0===r?o():XM(r)})).use((function(e,t){if(!0===Hd(e,jp[n],o))return t()})).use((function(t,o){return e[n].apply(e,t)})),r.run(t)}}})),t}(o);return US[n]=r,Ul.log("TIM.create ok"),r},wS.TYPES=gr,wS.EVENT=pr,wS.VERSION="2.21.0",Ul.log("TIM.VERSION: ".concat(wS.VERSION)),wS}));