-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtim-js.js
1 lines (1 loc) · 405 KB
/
tim-js.js
1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t:"function"==typeof define&&define.amd?define(t):(e=e||self).TIMC=t}(this,(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e},r=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),o=function(e){try{return!!e()}catch(t){return!0}},i=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),a={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,u={f:s&&!a.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:a},c=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},l={}.toString,p=function(e){return l.call(e).slice(8,-1)},f="".split,h=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==p(e)?f.call(e,""):Object(e)}:Object,d=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},g=function(e){return h(d(e))},m=function(e){return"object"==typeof e?null!==e:"function"==typeof e},v=function(e,t){if(!m(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!m(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!m(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!m(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},y={}.hasOwnProperty,_=function(e,t){return y.call(e,t)},I=r.document,M=m(I)&&m(I.createElement),C=function(e){return M?I.createElement(e):{}},S=!i&&!o((function(){return 7!=Object.defineProperty(C("div"),"a",{get:function(){return 7}}).a})),E=Object.getOwnPropertyDescriptor,T={f:i?E:function(e,t){if(e=g(e),t=v(t,!0),S)try{return E(e,t)}catch(n){}if(_(e,t))return c(!u.f.call(e,t),e[t])}},D=function(e){if(!m(e))throw TypeError(String(e)+" is not an object");return e},k=Object.defineProperty,A={f:i?k:function(e,t,n){if(D(e),t=v(t,!0),D(n),S)try{return k(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},O=i?function(e,t,n){return A.f(e,t,c(1,n))}:function(e,t,n){return e[t]=n,e},R=function(e,t){try{O(r,e,t)}catch(n){r[e]=t}return t},N=r["__core-js_shared__"]||R("__core-js_shared__",{}),L=Function.toString;"function"!=typeof N.inspectSource&&(N.inspectSource=function(e){return L.call(e)});var w,b,P,G=N.inspectSource,U=r.WeakMap,x="function"==typeof U&&/native code/.test(G(U)),q=t((function(e){(e.exports=function(e,t){return N[e]||(N[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),F=0,V=Math.random(),j=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++F+V).toString(36)},B=q("keys"),K=function(e){return B[e]||(B[e]=j(e))},H={},$=r.WeakMap;if(x){var z=new $,W=z.get,Y=z.has,J=z.set;w=function(e,t){return J.call(z,e,t),t},b=function(e){return W.call(z,e)||{}},P=function(e){return Y.call(z,e)}}else{var X=K("state");H[X]=!0,w=function(e,t){return O(e,X,t),t},b=function(e){return _(e,X)?e[X]:{}},P=function(e){return _(e,X)}}var Q,Z,ee={set:w,get:b,has:P,enforce:function(e){return P(e)?b(e):w(e,{})},getterFor:function(e){return function(t){var n;if(!m(t)||(n=b(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},te=t((function(e){var t=ee.get,n=ee.enforce,o=String(String).split("String");(e.exports=function(e,t,i,a){var s=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,c=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof t||_(i,"name")||O(i,"name",t),n(i).source=o.join("string"==typeof t?t:"")),e!==r?(s?!c&&e[t]&&(u=!0):delete e[t],u?e[t]=i:O(e,t,i)):u?e[t]=i:R(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||G(this)}))})),ne=r,re=function(e){return"function"==typeof e?e:void 0},oe=function(e,t){return arguments.length<2?re(ne[e])||re(r[e]):ne[e]&&ne[e][t]||r[e]&&r[e][t]},ie=Math.ceil,ae=Math.floor,se=function(e){return isNaN(e=+e)?0:(e>0?ae:ie)(e)},ue=Math.min,ce=function(e){return e>0?ue(se(e),9007199254740991):0},le=Math.max,pe=Math.min,fe=function(e,t){var n=se(e);return n<0?le(n+t,0):pe(n,t)},he=function(e){return function(t,n,r){var o,i=g(t),a=ce(i.length),s=fe(r,a);if(e&&n!=n){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},de={includes:he(!0),indexOf:he(!1)},ge=de.indexOf,me=function(e,t){var n,r=g(e),o=0,i=[];for(n in r)!_(H,n)&&_(r,n)&&i.push(n);for(;t.length>o;)_(r,n=t[o++])&&(~ge(i,n)||i.push(n));return i},ve=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ye=ve.concat("length","prototype"),_e={f:Object.getOwnPropertyNames||function(e){return me(e,ye)}},Ie={f:Object.getOwnPropertySymbols},Me=oe("Reflect","ownKeys")||function(e){var t=_e.f(D(e)),n=Ie.f;return n?t.concat(n(e)):t},Ce=function(e,t){for(var n=Me(t),r=A.f,o=T.f,i=0;i<n.length;i++){var a=n[i];_(e,a)||r(e,a,o(t,a))}},Se=/#|\.prototype\./,Ee=function(e,t){var n=De[Te(e)];return n==Ae||n!=ke&&("function"==typeof t?o(t):!!t)},Te=Ee.normalize=function(e){return String(e).replace(Se,".").toLowerCase()},De=Ee.data={},ke=Ee.NATIVE="N",Ae=Ee.POLYFILL="P",Oe=Ee,Re=T.f,Ne=function(e,t){var n,o,i,a,s,u=e.target,c=e.global,l=e.stat;if(n=c?r:l?r[u]||R(u,{}):(r[u]||{}).prototype)for(o in t){if(a=t[o],i=e.noTargetGet?(s=Re(n,o))&&s.value:n[o],!Oe(c?o:u+(l?".":"#")+o,e.forced)&&void 0!==i){if(typeof a==typeof i)continue;Ce(a,i)}(e.sham||i&&i.sham)&&O(a,"sham",!0),te(n,o,a,e)}},Le=Array.isArray||function(e){return"Array"==p(e)},we=function(e){return Object(d(e))},be=function(e,t,n){var r=v(t);r in e?A.f(e,r,c(0,n)):e[r]=n},Pe=!!Object.getOwnPropertySymbols&&!o((function(){return!String(Symbol())})),Ge=Pe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ue=q("wks"),xe=r.Symbol,qe=Ge?xe:xe&&xe.withoutSetter||j,Fe=function(e){return _(Ue,e)||(Pe&&_(xe,e)?Ue[e]=xe[e]:Ue[e]=qe("Symbol."+e)),Ue[e]},Ve=Fe("species"),je=function(e,t){var n;return Le(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Le(n.prototype)?m(n)&&null===(n=n[Ve])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Be=oe("navigator","userAgent")||"",Ke=r.process,He=Ke&&Ke.versions,$e=He&&He.v8;$e?Z=(Q=$e.split("."))[0]+Q[1]:Be&&(!(Q=Be.match(/Edge\/(\d+)/))||Q[1]>=74)&&(Q=Be.match(/Chrome\/(\d+)/))&&(Z=Q[1]);var ze=Z&&+Z,We=Fe("species"),Ye=function(e){return ze>=51||!o((function(){var t=[];return(t.constructor={})[We]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Je=Fe("isConcatSpreadable"),Xe=ze>=51||!o((function(){var e=[];return e[Je]=!1,e.concat()[0]!==e})),Qe=Ye("concat"),Ze=function(e){if(!m(e))return!1;var t=e[Je];return void 0!==t?!!t:Le(e)};Ne({target:"Array",proto:!0,forced:!Xe||!Qe},{concat:function(e){var t,n,r,o,i,a=we(this),s=je(a,0),u=0;for(t=-1,r=arguments.length;t<r;t++)if(Ze(i=-1===t?a:arguments[t])){if(u+(o=ce(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<o;n++,u++)n in i&&be(s,u,i[n])}else{if(u>=9007199254740991)throw TypeError("Maximum allowed index exceeded");be(s,u++,i)}return s.length=u,s}});var et=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},nt=function(e,t,n){if(et(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}},rt=[].push,ot=function(e){var t=1==e,n=2==e,r=3==e,o=4==e,i=6==e,a=5==e||i;return function(s,u,c,l){for(var p,f,d=we(s),g=h(d),m=nt(u,c,3),v=ce(g.length),y=0,_=l||je,I=t?_(s,v):n?_(s,0):void 0;v>y;y++)if((a||y in g)&&(f=m(p=g[y],y,d),e))if(t)I[y]=f;else if(f)switch(e){case 3:return!0;case 5:return p;case 6:return y;case 2:rt.call(I,p)}else if(o)return!1;return i?-1:r||o?o:I}},it={forEach:ot(0),map:ot(1),filter:ot(2),some:ot(3),every:ot(4),find:ot(5),findIndex:ot(6)},at=function(e,t){var n=[][e];return!!n&&o((function(){n.call(null,t||function(){throw 1},1)}))},st=Object.defineProperty,ut={},ct=function(e){throw e},lt=function(e,t){if(_(ut,e))return ut[e];t||(t={});var n=[][e],r=!!_(t,"ACCESSORS")&&t.ACCESSORS,a=_(t,0)?t[0]:ct,s=_(t,1)?t[1]:void 0;return ut[e]=!!n&&!o((function(){if(r&&!i)return!0;var e={length:-1};r?st(e,1,{enumerable:!0,get:ct}):e[1]=1,n.call(e,a,s)}))},pt=it.forEach,ft=at("forEach"),ht=lt("forEach"),dt=ft&&ht?[].forEach:function(e){return pt(this,e,arguments.length>1?arguments[1]:void 0)};Ne({target:"Array",proto:!0,forced:[].forEach!=dt},{forEach:dt});var gt=function(e,t,n,r){try{return r?t(D(n)[0],n[1]):t(n)}catch(i){var o=e.return;throw void 0!==o&&D(o.call(e)),i}},mt={},vt=Fe("iterator"),yt=Array.prototype,_t=function(e){return void 0!==e&&(mt.Array===e||yt[vt]===e)},It={};It[Fe("toStringTag")]="z";var Mt="[object z]"===String(It),Ct=Fe("toStringTag"),St="Arguments"==p(function(){return arguments}()),Et=Mt?p:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=Object(e),Ct))?n:St?p(t):"Object"==(r=p(t))&&"function"==typeof t.callee?"Arguments":r},Tt=Fe("iterator"),Dt=function(e){if(null!=e)return e[Tt]||e["@@iterator"]||mt[Et(e)]},kt=function(e){var t,n,r,o,i,a,s=we(e),u="function"==typeof this?this:Array,c=arguments.length,l=c>1?arguments[1]:void 0,p=void 0!==l,f=Dt(s),h=0;if(p&&(l=nt(l,c>2?arguments[2]:void 0,2)),null==f||u==Array&&_t(f))for(n=new u(t=ce(s.length));t>h;h++)a=p?l(s[h],h):s[h],be(n,h,a);else for(i=(o=f.call(s)).next,n=new u;!(r=i.call(o)).done;h++)a=p?gt(o,l,[r.value,h],!0):r.value,be(n,h,a);return n.length=h,n},At=Fe("iterator"),Ot=!1;try{var Rt=0,Nt={next:function(){return{done:!!Rt++}},return:function(){Ot=!0}};Nt[At]=function(){return this},Array.from(Nt,(function(){throw 2}))}catch(C_){}var Lt=function(e,t){if(!t&&!Ot)return!1;var n=!1;try{var r={};r[At]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(C_){}return n},wt=!Lt((function(e){Array.from(e)}));Ne({target:"Array",stat:!0,forced:wt},{from:kt});var bt,Pt=Object.keys||function(e){return me(e,ve)},Gt=i?Object.defineProperties:function(e,t){D(e);for(var n,r=Pt(t),o=r.length,i=0;o>i;)A.f(e,n=r[i++],t[n]);return e},Ut=oe("document","documentElement"),xt=K("IE_PROTO"),qt=function(){},Ft=function(e){return"<script>"+e+"<\/script>"},Vt=function(){try{bt=document.domain&&new ActiveXObject("htmlfile")}catch(C_){}var e,t;Vt=bt?function(e){e.write(Ft("")),e.close();var t=e.parentWindow.Object;return e=null,t}(bt):((t=C("iframe")).style.display="none",Ut.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Ft("document.F=Object")),e.close(),e.F);for(var n=ve.length;n--;)delete Vt.prototype[ve[n]];return Vt()};H[xt]=!0;var jt=Object.create||function(e,t){var n;return null!==e?(qt.prototype=D(e),n=new qt,qt.prototype=null,n[xt]=e):n=Vt(),void 0===t?n:Gt(n,t)};Ne({target:"Object",stat:!0,sham:!i},{create:jt});var Bt=o((function(){Pt(1)}));Ne({target:"Object",stat:!0,forced:Bt},{keys:function(e){return Pt(we(e))}});var Kt,Ht,$t,zt=function(e){return function(t,n){var r,o,i=String(d(t)),a=se(n),s=i.length;return a<0||a>=s?e?"":void 0:(r=i.charCodeAt(a))<55296||r>56319||a+1===s||(o=i.charCodeAt(a+1))<56320||o>57343?e?i.charAt(a):r:e?i.slice(a,a+2):o-56320+(r-55296<<10)+65536}},Wt={codeAt:zt(!1),charAt:zt(!0)},Yt=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Jt=K("IE_PROTO"),Xt=Object.prototype,Qt=Yt?Object.getPrototypeOf:function(e){return e=we(e),_(e,Jt)?e[Jt]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Xt:null},Zt=Fe("iterator"),en=!1;[].keys&&("next"in($t=[].keys())?(Ht=Qt(Qt($t)))!==Object.prototype&&(Kt=Ht):en=!0),null==Kt&&(Kt={}),_(Kt,Zt)||O(Kt,Zt,(function(){return this}));var tn={IteratorPrototype:Kt,BUGGY_SAFARI_ITERATORS:en},nn=A.f,rn=Fe("toStringTag"),on=function(e,t,n){e&&!_(e=n?e:e.prototype,rn)&&nn(e,rn,{configurable:!0,value:t})},an=tn.IteratorPrototype,sn=function(){return this},un=function(e,t,n){var r=t+" Iterator";return e.prototype=jt(an,{next:c(1,n)}),on(e,r,!1),mt[r]=sn,e},cn=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(C_){}return function(n,r){return D(n),function(e){if(!m(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),ln=tn.IteratorPrototype,pn=tn.BUGGY_SAFARI_ITERATORS,fn=Fe("iterator"),hn=function(){return this},dn=function(e,t,n,r,o,i,a){un(n,t,r);var s,u,c,l=function(e){if(e===o&&g)return g;if(!pn&&e in h)return h[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},p=t+" Iterator",f=!1,h=e.prototype,d=h[fn]||h["@@iterator"]||o&&h[o],g=!pn&&d||l(o),m="Array"==t&&h.entries||d;if(m&&(s=Qt(m.call(new e)),ln!==Object.prototype&&s.next&&(Qt(s)!==ln&&(cn?cn(s,ln):"function"!=typeof s[fn]&&O(s,fn,hn)),on(s,p,!0))),"values"==o&&d&&"values"!==d.name&&(f=!0,g=function(){return d.call(this)}),h[fn]!==g&&O(h,fn,g),mt[t]=g,o)if(u={values:l("values"),keys:i?g:l("keys"),entries:l("entries")},a)for(c in u)(pn||f||!(c in h))&&te(h,c,u[c]);else Ne({target:t,proto:!0,forced:pn||f},u);return u},gn=Wt.charAt,mn=ee.set,vn=ee.getterFor("String Iterator");dn(String,"String",(function(e){mn(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=vn(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=gn(n,r),t.index+=e.length,{value:e,done:!1})}));var yn={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};for(var _n in yn){var In=r[_n],Mn=In&&In.prototype;if(Mn&&Mn.forEach!==dt)try{O(Mn,"forEach",dt)}catch(C_){Mn.forEach=dt}}var Cn={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",PROFILE_UPDATED:"onProfileUpdated",BLACKLIST_UPDATED:"blacklistUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},Sn={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_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",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_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",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",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",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__"},En=it.map,Tn=Ye("map"),Dn=lt("map");Ne({target:"Array",proto:!0,forced:!Tn||!Dn},{map:function(e){return En(this,e,arguments.length>1?arguments[1]:void 0)}});var kn=[].slice,An={},On=function(e,t,n){if(!(t in An)){for(var r=[],o=0;o<t;o++)r[o]="a["+o+"]";An[t]=Function("C,a","return new C("+r.join(",")+")")}return An[t](e,n)},Rn=Function.bind||function(e){var t=et(this),n=kn.call(arguments,1),r=function(){var o=n.concat(kn.call(arguments));return this instanceof r?On(t,o.length,o):t.apply(e,o)};return m(t.prototype)&&(r.prototype=t.prototype),r};function Nn(e){return(Nn="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 Ln(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function bn(e,t,n){return t&&wn(e.prototype,t),n&&wn(e,n),e}function Pn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Un(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gn(Object(n),!0).forEach((function(t){Pn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xn(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}}),t&&Fn(e,t)}function qn(e){return(qn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fn(e,t){return(Fn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Vn(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function jn(e,t,n){return(jn=Vn()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Fn(o,n.prototype),o}).apply(null,arguments)}function Bn(e){var t="function"==typeof Map?new Map:void 0;return(Bn=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,r)}function r(){return jn(e,arguments,qn(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Fn(r,e)})(e)}function Kn(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Hn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $n(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Hn(e):t}function zn(e){var t=Vn();return function(){var n,r=qn(e);if(t){var o=qn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return $n(this,n)}}function Wn(e,t){return Jn(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(u){o=!0,i=u}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||Qn(e,t)||er()}function Yn(e){return function(e){if(Array.isArray(e))return Zn(e)}(e)||Xn(e)||Qn(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 Jn(e){if(Array.isArray(e))return e}function Xn(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function Qn(e,t){if(e){if("string"==typeof e)return Zn(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)?Zn(e,t):void 0}}function Zn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function er(){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 tr(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=Qn(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}Ne({target:"Function",proto:!0},{bind:Rn});var nr=function(){function e(){Ln(this,e),this.cache=[],this.options=null}return bn(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}(),rr=A.f,or=Function.prototype,ir=or.toString,ar=/^\s*function ([^ (]*)/;i&&!("name"in or)&&rr(or,"name",{configurable:!0,get:function(){try{return ir.call(this).match(ar)[1]}catch(C_){return""}}});var sr=t((function(t,n){var r,o,i,a,s,u,c,l,p,f,h,d,g,m,v,y,_,I;t.exports=(r="function"==typeof Promise,o="object"==typeof self?self:e,i="undefined"!=typeof Symbol,a="undefined"!=typeof Map,s="undefined"!=typeof Set,u="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,l="undefined"!=typeof DataView,p=i&&void 0!==Symbol.iterator,f=i&&void 0!==Symbol.toStringTag,h=s&&"function"==typeof Set.prototype.entries,d=a&&"function"==typeof Map.prototype.entries,g=h&&Object.getPrototypeOf((new Set).entries()),m=d&&Object.getPrototypeOf((new Map).entries()),v=p&&"function"==typeof Array.prototype[Symbol.iterator],y=v&&Object.getPrototypeOf([][Symbol.iterator]()),_=p&&"function"==typeof String.prototype[Symbol.iterator],I=_&&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===f||!(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 n=f&&e[Symbol.toStringTag];if("string"==typeof n)return n;var i=Object.getPrototypeOf(e);return i===RegExp.prototype?"RegExp":i===Date.prototype?"Date":r&&i===Promise.prototype?"Promise":s&&i===Set.prototype?"Set":a&&i===Map.prototype?"Map":c&&i===WeakSet.prototype?"WeakSet":u&&i===WeakMap.prototype?"WeakMap":l&&i===DataView.prototype?"DataView":a&&i===m?"Map Iterator":s&&i===g?"Set Iterator":v&&i===y?"Array Iterator":_&&i===I?"String Iterator":null===i?"Object":Object.prototype.toString.call(e).slice(8,-1)})}));Ne({target:"Array",stat:!0},{isArray:Le});var ur=Fe("unscopables"),cr=Array.prototype;null==cr[ur]&&A.f(cr,ur,{configurable:!0,value:jt(null)});var lr=function(e){cr[ur][e]=!0},pr=it.find,fr=!0,hr=lt("find");"find"in[]&&Array(1).find((function(){fr=!1})),Ne({target:"Array",proto:!0,forced:fr||!hr},{find:function(e){return pr(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("find");var dr=de.includes,gr=lt("indexOf",{ACCESSORS:!0,1:0});Ne({target:"Array",proto:!0,forced:!gr},{includes:function(e){return dr(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("includes");var mr=de.indexOf,vr=[].indexOf,yr=!!vr&&1/[1].indexOf(1,-0)<0,_r=at("indexOf"),Ir=lt("indexOf",{ACCESSORS:!0,1:0});Ne({target:"Array",proto:!0,forced:yr||!_r||!Ir},{indexOf:function(e){return yr?vr.apply(this,arguments)||0:mr(this,e,arguments.length>1?arguments[1]:void 0)}});var Mr=ee.set,Cr=ee.getterFor("Array Iterator"),Sr=dn(Array,"Array",(function(e,t){Mr(this,{type:"Array Iterator",target:g(e),index:0,kind:t})}),(function(){var e=Cr(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");mt.Arguments=mt.Array,lr("keys"),lr("values"),lr("entries");var Er=[].join,Tr=h!=Object,Dr=at("join",",");Ne({target:"Array",proto:!0,forced:Tr||!Dr},{join:function(e){return Er.call(g(this),void 0===e?",":e)}});var kr=Ye("slice"),Ar=lt("slice",{ACCESSORS:!0,0:0,1:2}),Or=Fe("species"),Rr=[].slice,Nr=Math.max;Ne({target:"Array",proto:!0,forced:!kr||!Ar},{slice:function(e,t){var n,r,o,i=g(this),a=ce(i.length),s=fe(e,a),u=fe(void 0===t?a:t,a);if(Le(i)&&("function"!=typeof(n=i.constructor)||n!==Array&&!Le(n.prototype)?m(n)&&null===(n=n[Or])&&(n=void 0):n=void 0,n===Array||void 0===n))return Rr.call(i,s,u);for(r=new(void 0===n?Array:n)(Nr(u-s,0)),o=0;s<u;s++,o++)s in i&&be(r,o,i[s]);return r.length=o,r}}),Ne({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var Lr="".repeat||function(e){var t=String(d(this)),n="",r=se(e);if(r<0||Infinity==r)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},wr=Math.ceil,br=function(e){return function(t,n,r){var o,i,a=String(d(t)),s=a.length,u=void 0===r?" ":String(r),c=ce(n);return c<=s||""==u?a:(o=c-s,(i=Lr.call(u,wr(o/u.length))).length>o&&(i=i.slice(0,o)),e?a+i:i+a)}},Pr={start:br(!1),end:br(!0)}.start,Gr=Math.abs,Ur=Date.prototype,xr=Ur.getTime,qr=Ur.toISOString,Fr=o((function(){return"0385-07-25T07:06:39.999Z"!=qr.call(new Date(-50000000000001))}))||!o((function(){qr.call(new Date(NaN))}))?function(){if(!isFinite(xr.call(this)))throw RangeError("Invalid time value");var e=this.getUTCFullYear(),t=this.getUTCMilliseconds(),n=e<0?"-":e>9999?"+":"";return n+Pr(Gr(e),n?6:4,0)+"-"+Pr(this.getUTCMonth()+1,2,0)+"-"+Pr(this.getUTCDate(),2,0)+"T"+Pr(this.getUTCHours(),2,0)+":"+Pr(this.getUTCMinutes(),2,0)+":"+Pr(this.getUTCSeconds(),2,0)+"."+Pr(t,3,0)+"Z"}:qr;Ne({target:"Date",proto:!0,forced:Date.prototype.toISOString!==Fr},{toISOString:Fr});var Vr=Date.prototype,jr=Vr.toString,Br=Vr.getTime;new Date(NaN)+""!="Invalid Date"&&te(Vr,"toString",(function(){var e=Br.call(this);return e==e?jr.call(this):"Invalid Date"}));var Kr=function(e,t,n){var r,o;return cn&&"function"==typeof(r=t.constructor)&&r!==n&&m(o=r.prototype)&&o!==n.prototype&&cn(e,o),e},Hr="\t\n\v\f\r \u2028\u2029\ufeff",$r="["+Hr+"]",zr=RegExp("^"+$r+$r+"*"),Wr=RegExp($r+$r+"*$"),Yr=function(e){return function(t){var n=String(d(t));return 1&e&&(n=n.replace(zr,"")),2&e&&(n=n.replace(Wr,"")),n}},Jr={start:Yr(1),end:Yr(2),trim:Yr(3)},Xr=_e.f,Qr=T.f,Zr=A.f,eo=Jr.trim,to=r.Number,no=to.prototype,ro="Number"==p(jt(no)),oo=function(e){var t,n,r,o,i,a,s,u,c=v(e,!1);if("string"==typeof c&&c.length>2)if(43===(t=(c=eo(c)).charCodeAt(0))||45===t){if(88===(n=c.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+c}for(a=(i=c.slice(2)).length,s=0;s<a;s++)if((u=i.charCodeAt(s))<48||u>o)return NaN;return parseInt(i,r)}return+c};if(Oe("Number",!to(" 0o1")||!to("0b1")||to("+0x1"))){for(var io,ao=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof ao&&(ro?o((function(){no.valueOf.call(n)})):"Number"!=p(n))?Kr(new to(oo(t)),n,ao):oo(t)},so=i?Xr(to):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),uo=0;so.length>uo;uo++)_(to,io=so[uo])&&!_(ao,io)&&Zr(ao,io,Qr(to,io));ao.prototype=no,no.constructor=ao,te(r,"Number",ao)}var co=_e.f,lo={}.toString,po="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],fo={f:function(e){return po&&"[object Window]"==lo.call(e)?function(e){try{return co(e)}catch(C_){return po.slice()}}(e):co(g(e))}},ho=fo.f,go=o((function(){return!Object.getOwnPropertyNames(1)}));Ne({target:"Object",stat:!0,forced:go},{getOwnPropertyNames:ho});var mo=o((function(){Qt(1)}));Ne({target:"Object",stat:!0,forced:mo,sham:!Yt},{getPrototypeOf:function(e){return Qt(we(e))}});var vo=Mt?{}.toString:function(){return"[object "+Et(this)+"]"};Mt||te(Object.prototype,"toString",vo,{unsafe:!0});var yo=Jr.trim,_o=r.parseInt,Io=/^[+-]?0[Xx]/,Mo=8!==_o(Hr+"08")||22!==_o(Hr+"0x16")?function(e,t){var n=yo(String(e));return _o(n,t>>>0||(Io.test(n)?16:10))}:_o;Ne({global:!0,forced:parseInt!=Mo},{parseInt:Mo});var Co,So,Eo,To=r.Promise,Do=function(e,t,n){for(var r in t)te(e,r,t[r],n);return e},ko=Fe("species"),Ao=function(e){var t=oe(e),n=A.f;i&&t&&!t[ko]&&n(t,ko,{configurable:!0,get:function(){return this}})},Oo=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},Ro=t((function(e){var t=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,n,r,o,i){var a,s,u,c,l,p,f,h=nt(n,r,o?2:1);if(i)a=e;else{if("function"!=typeof(s=Dt(e)))throw TypeError("Target is not iterable");if(_t(s)){for(u=0,c=ce(e.length);c>u;u++)if((l=o?h(D(f=e[u])[0],f[1]):h(e[u]))&&l instanceof t)return l;return new t(!1)}a=s.call(e)}for(p=a.next;!(f=p.call(a)).done;)if("object"==typeof(l=gt(a,h,f.value,o))&&l&&l instanceof t)return l;return new t(!1)}).stop=function(e){return new t(!0,e)}})),No=Fe("species"),Lo=function(e,t){var n,r=D(e).constructor;return void 0===r||null==(n=D(r)[No])?t:et(n)},wo=/(iphone|ipod|ipad).*applewebkit/i.test(Be),bo=r.location,Po=r.setImmediate,Go=r.clearImmediate,Uo=r.process,xo=r.MessageChannel,qo=r.Dispatch,Fo=0,Vo={},jo=function(e){if(Vo.hasOwnProperty(e)){var t=Vo[e];delete Vo[e],t()}},Bo=function(e){return function(){jo(e)}},Ko=function(e){jo(e.data)},Ho=function(e){r.postMessage(e+"",bo.protocol+"//"+bo.host)};Po&&Go||(Po=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return Vo[++Fo]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},Co(Fo),Fo},Go=function(e){delete Vo[e]},"process"==p(Uo)?Co=function(e){Uo.nextTick(Bo(e))}:qo&&qo.now?Co=function(e){qo.now(Bo(e))}:xo&&!wo?(Eo=(So=new xo).port2,So.port1.onmessage=Ko,Co=nt(Eo.postMessage,Eo,1)):!r.addEventListener||"function"!=typeof postMessage||r.importScripts||o(Ho)||"file:"===bo.protocol?Co="onreadystatechange"in C("script")?function(e){Ut.appendChild(C("script")).onreadystatechange=function(){Ut.removeChild(this),jo(e)}}:function(e){setTimeout(Bo(e),0)}:(Co=Ho,r.addEventListener("message",Ko,!1)));var $o,zo,Wo,Yo,Jo,Xo,Qo,Zo,ei={set:Po,clear:Go},ti=T.f,ni=ei.set,ri=r.MutationObserver||r.WebKitMutationObserver,oi=r.process,ii=r.Promise,ai="process"==p(oi),si=ti(r,"queueMicrotask"),ui=si&&si.value;ui||($o=function(){var e,t;for(ai&&(e=oi.domain)&&e.exit();zo;){t=zo.fn,zo=zo.next;try{t()}catch(C_){throw zo?Yo():Wo=void 0,C_}}Wo=void 0,e&&e.enter()},ai?Yo=function(){oi.nextTick($o)}:ri&&!wo?(Jo=!0,Xo=document.createTextNode(""),new ri($o).observe(Xo,{characterData:!0}),Yo=function(){Xo.data=Jo=!Jo}):ii&&ii.resolve?(Qo=ii.resolve(void 0),Zo=Qo.then,Yo=function(){Zo.call(Qo,$o)}):Yo=function(){ni.call(r,$o)});var ci,li,pi,fi,hi=ui||function(e){var t={fn:e,next:void 0};Wo&&(Wo.next=t),zo||(zo=t,Yo()),Wo=t},di=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=et(t),this.reject=et(n)},gi={f:function(e){return new di(e)}},mi=function(e,t){if(D(e),m(t)&&t.constructor===e)return t;var n=gi.f(e);return(0,n.resolve)(t),n.promise},vi=function(e){try{return{error:!1,value:e()}}catch(C_){return{error:!0,value:C_}}},yi=ei.set,_i=Fe("species"),Ii="Promise",Mi=ee.get,Ci=ee.set,Si=ee.getterFor(Ii),Ei=To,Ti=r.TypeError,Di=r.document,ki=r.process,Ai=oe("fetch"),Oi=gi.f,Ri=Oi,Ni="process"==p(ki),Li=!!(Di&&Di.createEvent&&r.dispatchEvent),wi=Oe(Ii,(function(){if(!(G(Ei)!==String(Ei))){if(66===ze)return!0;if(!Ni&&"function"!=typeof PromiseRejectionEvent)return!0}if(ze>=51&&/native code/.test(Ei))return!1;var e=Ei.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[_i]=t,!(e.then((function(){}))instanceof t)})),bi=wi||!Lt((function(e){Ei.all(e).catch((function(){}))})),Pi=function(e){var t;return!(!m(e)||"function"!=typeof(t=e.then))&&t},Gi=function(e,t,n){if(!t.notified){t.notified=!0;var r=t.reactions;hi((function(){for(var o=t.value,i=1==t.state,a=0;r.length>a;){var s,u,c,l=r[a++],p=i?l.ok:l.fail,f=l.resolve,h=l.reject,d=l.domain;try{p?(i||(2===t.rejection&&Fi(e,t),t.rejection=1),!0===p?s=o:(d&&d.enter(),s=p(o),d&&(d.exit(),c=!0)),s===l.promise?h(Ti("Promise-chain cycle")):(u=Pi(s))?u.call(s,f,h):f(s)):h(o)}catch(C_){d&&!c&&d.exit(),h(C_)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&xi(e,t)}))}},Ui=function(e,t,n){var o,i;Li?((o=Di.createEvent("Event")).promise=t,o.reason=n,o.initEvent(e,!1,!0),r.dispatchEvent(o)):o={promise:t,reason:n},(i=r["on"+e])?i(o):"unhandledrejection"===e&&function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},xi=function(e,t){yi.call(r,(function(){var n,r=t.value;if(qi(t)&&(n=vi((function(){Ni?ki.emit("unhandledRejection",r,e):Ui("unhandledrejection",e,r)})),t.rejection=Ni||qi(t)?2:1,n.error))throw n.value}))},qi=function(e){return 1!==e.rejection&&!e.parent},Fi=function(e,t){yi.call(r,(function(){Ni?ki.emit("rejectionHandled",e):Ui("rejectionhandled",e,t.value)}))},Vi=function(e,t,n,r){return function(o){e(t,n,o,r)}},ji=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,Gi(e,t,!0))},Bi=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw Ti("Promise can't be resolved itself");var o=Pi(n);o?hi((function(){var r={done:!1};try{o.call(n,Vi(Bi,e,r,t),Vi(ji,e,r,t))}catch(C_){ji(e,r,C_,t)}})):(t.value=n,t.state=1,Gi(e,t,!1))}catch(C_){ji(e,{done:!1},C_,t)}}};wi&&(Ei=function(e){Oo(this,Ei,Ii),et(e),ci.call(this);var t=Mi(this);try{e(Vi(Bi,this,t),Vi(ji,this,t))}catch(C_){ji(this,t,C_)}},(ci=function(e){Ci(this,{type:Ii,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Do(Ei.prototype,{then:function(e,t){var n=Si(this),r=Oi(Lo(this,Ei));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=Ni?ki.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Gi(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),li=function(){var e=new ci,t=Mi(e);this.promise=e,this.resolve=Vi(Bi,e,t),this.reject=Vi(ji,e,t)},gi.f=Oi=function(e){return e===Ei||e===pi?new li(e):Ri(e)},"function"==typeof To&&(fi=To.prototype.then,te(To.prototype,"then",(function(e,t){var n=this;return new Ei((function(e,t){fi.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof Ai&&Ne({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return mi(Ei,Ai.apply(r,arguments))}}))),Ne({global:!0,wrap:!0,forced:wi},{Promise:Ei}),on(Ei,Ii,!1),Ao(Ii),pi=oe(Ii),Ne({target:Ii,stat:!0,forced:wi},{reject:function(e){var t=Oi(this);return t.reject.call(void 0,e),t.promise}}),Ne({target:Ii,stat:!0,forced:wi},{resolve:function(e){return mi(this,e)}}),Ne({target:Ii,stat:!0,forced:bi},{all:function(e){var t=this,n=Oi(t),r=n.resolve,o=n.reject,i=vi((function(){var n=et(t.resolve),i=[],a=0,s=1;Ro(e,(function(e){var u=a++,c=!1;i.push(void 0),s++,n.call(t,e).then((function(e){c||(c=!0,i[u]=e,--s||r(i))}),o)})),--s||r(i)}));return i.error&&o(i.value),n.promise},race:function(e){var t=this,n=Oi(t),r=n.reject,o=vi((function(){var o=et(t.resolve);Ro(e,(function(e){o.call(t,e).then(n.resolve,r)}))}));return o.error&&r(o.value),n.promise}});var Ki=function(){var e=D(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};function Hi(e,t){return RegExp(e,t)}var $i,zi,Wi={UNSUPPORTED_Y:o((function(){var e=Hi("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:o((function(){var e=Hi("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},Yi=RegExp.prototype.exec,Ji=String.prototype.replace,Xi=Yi,Qi=($i=/a/,zi=/b*/g,Yi.call($i,"a"),Yi.call(zi,"a"),0!==$i.lastIndex||0!==zi.lastIndex),Zi=Wi.UNSUPPORTED_Y||Wi.BROKEN_CARET,ea=void 0!==/()??/.exec("")[1];(Qi||ea||Zi)&&(Xi=function(e){var t,n,r,o,i=this,a=Zi&&i.sticky,s=Ki.call(i),u=i.source,c=0,l=e;return a&&(-1===(s=s.replace("y","")).indexOf("g")&&(s+="g"),l=String(e).slice(i.lastIndex),i.lastIndex>0&&(!i.multiline||i.multiline&&"\n"!==e[i.lastIndex-1])&&(u="(?: "+u+")",l=" "+l,c++),n=new RegExp("^(?:"+u+")",s)),ea&&(n=new RegExp("^"+u+"$(?!\\s)",s)),Qi&&(t=i.lastIndex),r=Yi.call(a?n:i,l),a?r?(r.input=r.input.slice(c),r[0]=r[0].slice(c),r.index=i.lastIndex,i.lastIndex+=r[0].length):i.lastIndex=0:Qi&&r&&(i.lastIndex=i.global?r.index+r[0].length:t),ea&&r&&r.length>1&&Ji.call(r[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r});var ta=Xi;Ne({target:"RegExp",proto:!0,forced:/./.exec!==ta},{exec:ta});var na=RegExp.prototype,ra=na.toString,oa=o((function(){return"/a/b"!=ra.call({source:"a",flags:"b"})})),ia="toString"!=ra.name;(oa||ia)&&te(RegExp.prototype,"toString",(function(){var e=D(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in na)?Ki.call(e):n)}),{unsafe:!0});var aa=Fe("match"),sa=function(e){var t;return m(e)&&(void 0!==(t=e[aa])?!!t:"RegExp"==p(e))},ua=function(e){if(sa(e))throw TypeError("The method doesn't accept regular expressions");return e},ca=Fe("match"),la=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[ca]=!1,"/./"[e](t)}catch(r){}}return!1};Ne({target:"String",proto:!0,forced:!la("includes")},{includes:function(e){return!!~String(d(this)).indexOf(ua(e),arguments.length>1?arguments[1]:void 0)}});var pa=Fe("species"),fa=!o((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),ha="$0"==="a".replace(/./,"$0"),da=Fe("replace"),ga=!!/./[da]&&""===/./[da]("a","$0"),ma=!o((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]})),va=function(e,t,n,r){var i=Fe(e),a=!o((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),s=a&&!o((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[pa]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return t=!0,null},n[i](""),!t}));if(!a||!s||"replace"===e&&(!fa||!ha||ga)||"split"===e&&!ma){var u=/./[i],c=n(i,""[e],(function(e,t,n,r,o){return t.exec===ta?a&&!o?{done:!0,value:u.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:ha,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:ga}),l=c[0],p=c[1];te(String.prototype,e,l),te(RegExp.prototype,i,2==t?function(e,t){return p.call(e,this,t)}:function(e){return p.call(e,this)})}r&&O(RegExp.prototype[i],"sham",!0)},ya=Wt.charAt,_a=function(e,t,n){return t+(n?ya(e,t).length:1)},Ia=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==p(e))throw TypeError("RegExp#exec called on incompatible receiver");return ta.call(e,t)};va("match",1,(function(e,t,n){return[function(t){var n=d(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var o=D(e),i=String(this);if(!o.global)return Ia(o,i);var a=o.unicode;o.lastIndex=0;for(var s,u=[],c=0;null!==(s=Ia(o,i));){var l=String(s[0]);u[c]=l,""===l&&(o.lastIndex=_a(i,ce(o.lastIndex),a)),c++}return 0===c?null:u}]}));var Ma=Math.max,Ca=Math.min,Sa=Math.floor,Ea=/\$([$&'`]|\d\d?|<[^>]*>)/g,Ta=/\$([$&'`]|\d\d?)/g;va("replace",2,(function(e,t,n,r){var o=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,i=r.REPLACE_KEEPS_$0,a=o?"$":"$0";return[function(n,r){var o=d(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,o,r):t.call(String(o),n,r)},function(e,r){if(!o&&i||"string"==typeof r&&-1===r.indexOf(a)){var u=n(t,e,this,r);if(u.done)return u.value}var c=D(e),l=String(this),p="function"==typeof r;p||(r=String(r));var f=c.global;if(f){var h=c.unicode;c.lastIndex=0}for(var d=[];;){var g=Ia(c,l);if(null===g)break;if(d.push(g),!f)break;""===String(g[0])&&(c.lastIndex=_a(l,ce(c.lastIndex),h))}for(var m,v="",y=0,_=0;_<d.length;_++){g=d[_];for(var I=String(g[0]),M=Ma(Ca(se(g.index),l.length),0),C=[],S=1;S<g.length;S++)C.push(void 0===(m=g[S])?m:String(m));var E=g.groups;if(p){var T=[I].concat(C,M,l);void 0!==E&&T.push(E);var k=String(r.apply(void 0,T))}else k=s(I,l,M,C,E,r);M>=y&&(v+=l.slice(y,M)+k,y=M+I.length)}return v+l.slice(y)}];function s(e,n,r,o,i,a){var s=r+e.length,u=o.length,c=Ta;return void 0!==i&&(i=we(i),c=Ea),t.call(a,c,(function(t,a){var c;switch(a.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(s);case"<":c=i[a.slice(1,-1)];break;default:var l=+a;if(0===l)return t;if(l>u){var p=Sa(l/10);return 0===p?t:p<=u?void 0===o[p-1]?a.charAt(1):o[p-1]+a.charAt(1):t}c=o[l-1]}return void 0===c?"":c}))}}));var Da=Fe("iterator"),ka=Fe("toStringTag"),Aa=Sr.values;for(var Oa in yn){var Ra=r[Oa],Na=Ra&&Ra.prototype;if(Na){if(Na[Da]!==Aa)try{O(Na,Da,Aa)}catch(C_){Na[Da]=Aa}if(Na[ka]||O(Na,ka,Oa),yn[Oa])for(var La in Sr)if(Na[La]!==Sr[La])try{O(Na,La,Sr[La])}catch(C_){Na[La]=Sr[La]}}}var wa=Jr.trim,ba=r.parseFloat,Pa=1/ba(Hr+"-0")!=-Infinity?function(e){var t=wa(String(e)),n=ba(t);return 0===n&&"-"==t.charAt(0)?-0:n}:ba;Ne({global:!0,forced:parseFloat!=Pa},{parseFloat:Pa});var Ga,Ua,xa,qa="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync,Fa="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync,Va="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync,ja="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync,Ba="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync,Ka=qa||Fa||Va||ja||Ba,Ha="undefined"!=typeof window&&!Ka,$a=Fa?qq:Va?tt:ja?swan:Ba?my:qa?wx:{},za=(Ga="web",ss?Ga="wechat":Fa?Ga="qqmp":Va?Ga="ttmp":ja?Ga="baidump":Ba?Ga="alipaymp":qa&&(Ga="wxmp"),Ga),Wa=Ha&&window.navigator&&window.navigator.userAgent||"",Ya=/AppleWebKit\/([\d.]+)/i.exec(Wa),Ja=(Ya&&parseFloat(Ya.pop()),/iPad/i.test(Wa)),Xa=/iPhone/i.test(Wa)&&!Ja,Qa=/iPod/i.test(Wa),Za=Xa||Ja||Qa,es=(function(){var e=Wa.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),/Android/i.test(Wa)),ts=function(){var e=Wa.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}(),ns=(es&&/webkit/i.test(Wa),/Firefox/i.test(Wa),/Edge/i.test(Wa)),rs=!ns&&/Chrome/i.test(Wa),os=(function(){var e=Wa.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(Wa)),is=(/MSIE\s8\.0/.test(Wa),function(){var e=/MSIE\s(\d+)\.\d/.exec(Wa),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(Wa)&&/rv:11.0/.test(Wa)&&(t=11),t}()),as=(/Safari/i.test(Wa),/TBS\/\d+/i.test(Wa)),ss=(function(){var e=Wa.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}(),!as&&/MQQBrowser\/\d+/i.test(Wa),!as&&/ QQBrowser\/\d+/i.test(Wa),/(micromessenger|webbrowser)/i.test(Wa)),us=/Windows/i.test(Wa),cs=/MAC OS X/i.test(Wa),ls=(/MicroMessenger/i.test(Wa),!o((function(){return Object.isExtensible(Object.preventExtensions({}))}))),ps=t((function(e){var t=A.f,n=j("meta"),r=0,o=Object.isExtensible||function(){return!0},i=function(e){t(e,n,{value:{objectID:"O"+ ++r,weakData:{}}})},a=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!m(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!_(e,n)){if(!o(e))return"F";if(!t)return"E";i(e)}return e[n].objectID},getWeakData:function(e,t){if(!_(e,n)){if(!o(e))return!0;if(!t)return!1;i(e)}return e[n].weakData},onFreeze:function(e){return ls&&a.REQUIRED&&o(e)&&!_(e,n)&&i(e),e}};H[n]=!0})),fs=(ps.REQUIRED,ps.fastKey,ps.getWeakData,ps.onFreeze,A.f),hs=ps.fastKey,ds=ee.set,gs=ee.getterFor,ms=(function(e,t,n){var i=-1!==e.indexOf("Map"),a=-1!==e.indexOf("Weak"),s=i?"set":"add",u=r[e],c=u&&u.prototype,l=u,p={},f=function(e){var t=c[e];te(c,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(a&&!m(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return a&&!m(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(a&&!m(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(Oe(e,"function"!=typeof u||!(a||c.forEach&&!o((function(){(new u).entries().next()})))))l=n.getConstructor(t,e,i,s),ps.REQUIRED=!0;else if(Oe(e,!0)){var h=new l,d=h[s](a?{}:-0,1)!=h,g=o((function(){h.has(1)})),v=Lt((function(e){new u(e)})),y=!a&&o((function(){for(var e=new u,t=5;t--;)e[s](t,t);return!e.has(-0)}));v||((l=t((function(t,n){Oo(t,l,e);var r=Kr(new u,t,l);return null!=n&&Ro(n,r[s],r,i),r}))).prototype=c,c.constructor=l),(g||y)&&(f("delete"),f("has"),i&&f("get")),(y||d)&&f(s),a&&c.clear&&delete c.clear}p[e]=l,Ne({global:!0,forced:l!=u},p),on(l,e),a||n.setStrong(l,e,i)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,r){var o=e((function(e,a){Oo(e,o,t),ds(e,{type:t,index:jt(null),first:void 0,last:void 0,size:0}),i||(e.size=0),null!=a&&Ro(a,e[r],e,n)})),a=gs(t),s=function(e,t,n){var r,o,s=a(e),c=u(e,t);return c?c.value=n:(s.last=c={index:o=hs(t,!0),key:t,value:n,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=c),r&&(r.next=c),i?s.size++:e.size++,"F"!==o&&(s.index[o]=c)),e},u=function(e,t){var n,r=a(e),o=hs(t);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==t)return n};return Do(o.prototype,{clear:function(){for(var e=a(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,i?e.size=0:this.size=0},delete:function(e){var t=a(this),n=u(this,e);if(n){var r=n.next,o=n.previous;delete t.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),t.first==n&&(t.first=r),t.last==n&&(t.last=o),i?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=a(this),r=nt(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),Do(o.prototype,n?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),i&&fs(o.prototype,"size",{get:function(){return a(this).size}}),o},setStrong:function(e,t,n){var r=t+" Iterator",o=gs(t),i=gs(r);dn(e,t,(function(e,t){ds(this,{type:r,target:e,state:o(e),kind:t,last:void 0})}),(function(){for(var e=i(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),Ao(t)}}),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});Ua="undefined"!=typeof console?console:void 0!==ms&&ms.console?ms.console:"undefined"!=typeof window&&window.console?window.console:{};for(var vs=function(){},ys=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],_s=ys.length;_s--;)xa=ys[_s],console[xa]||(Ua[xa]=vs);Ua.methods=ys;var Is=Ua,Ms=0,Cs=new Map;function Ss(){var e=new Date;return"TIM "+e.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}(e.getMilliseconds())+":"}var Es={arguments2String:function(e){var t;if(1===e.length)t=Ss()+e[0];else{t=Ss();for(var n=0,r=e.length;n<r;n++)Ls(e[n])?bs(e[n])?t+=Fs(e[n]):t+=JSON.stringify(e[n]):t+=e[n],t+=" "}return t},debug:function(){if(Ms<=-1){var e=this.arguments2String(arguments);Is.debug(e)}},log:function(){if(Ms<=0){var e=this.arguments2String(arguments);Is.log(e)}},info:function(){if(Ms<=1){var e=this.arguments2String(arguments);Is.info(e)}},warn:function(){if(Ms<=2){var e=this.arguments2String(arguments);Is.warn(e)}},error:function(){if(Ms<=3){var e=this.arguments2String(arguments);Is.error(e)}},time:function(e){Cs.set(e,xs.now())},timeEnd:function(e){if(Cs.has(e)){var t=xs.now()-Cs.get(e);return Cs.delete(e),t}return Is.warn("未找到对应label: ".concat(e,", 请在调用 logger.timeEnd 前,调用 logger.time")),0},setLevel:function(e){e<4&&Is.log(Ss()+"set level from "+Ms+" to "+e),Ms=e}},Ts=function(e){return"file"===Ps(e)},Ds=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"===Nn(e)&&e.constructor===Number)},ks=function(e){return"string"==typeof e},As=function(e){return null!==e&&"object"===Nn(e)},Os=function(e){if("object"!==Nn(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n},Rs=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===Ps(e)},Ns=function(e){return void 0===e},Ls=function(e){return Rs(e)||As(e)},ws=function(e){return"function"==typeof e},bs=function(e){return e instanceof Error},Ps=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},Gs=function(e){if("string"!=typeof e)return!1;var t=e[0];return!/[^a-zA-Z0-9]/.test(t)},Us=0;Date.now||(Date.now=function(){return(new Date).getTime()});var xs={now:function(){0===Us&&(Us=Date.now()-1);var e=Date.now()-Us;return e>4294967295?(Us+=4294967295,Date.now()-Us):e},utc:function(){return Math.round(Date.now()/1e3)}},qs=function e(t,n,r,o){if(!Ls(t)||!Ls(n))return 0;for(var i,a=0,s=Object.keys(n),u=0,c=s.length;u<c;u++)if(i=s[u],!(Ns(n[i])||r&&r.includes(i)))if(Ls(t[i])&&Ls(n[i]))a+=e(t[i],n[i],r,o);else{if(o&&o.includes(n[i]))continue;t[i]!==n[i]&&(t[i]=n[i],a+=1)}return a},Fs=function(e){return JSON.stringify(e,["message","code"])},Vs=function(){var e=new Date,t=e.toISOString(),n=e.getTimezoneOffset()/60,r="";return r=n<0?n>-10?"+0"+Math.abs(100*n):"+"+Math.abs(100*n):n>=10?"-"+100*n:"-0"+100*n,t.replace("Z",r)},js=function(e){if(0===e.length)return 0;for(var t=0,n=0,r="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)n+=e[t++].charCodeAt[t]<=255?1:!1===r?3:2;return n},Bs=function(e){var t=e||99999999;return Math.round(Math.random()*t)},Ks="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Hs=Ks.length,$s=function(e,t){for(var n in e)if(e[n]===t)return!0;return!1},zs={},Ws=function(){if(Ka)return"https:";var e=window.location.protocol;return["http:","https:"].indexOf(e)<0&&(e="http:"),e},Ys=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")};function Js(e,t){Rs(e)&&Rs(t)?t.forEach((function(t){var n=t.key,r=t.value,o=e.find((function(e){return e.key===n}));o?o.value=r:e.push({key:n,value:r})})):Es.warn("updateCustomField target 或 source 不是数组,忽略此次更新。")}var Xs=function(e){return e===Sn.GRP_WORK},Qs=function(e){return e===Sn.GRP_PUBLIC},Zs=function(e){return e===Sn.GRP_MEETING},eu=function(e){return e===Sn.GRP_AVCHATROOM},tu=function(e){return ks(e)&&e===Sn.CONV_SYSTEM};function nu(e,t){var n={};return Object.keys(e).forEach((function(r){n[r]=t(e[r],r)})),n}function ru(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function ou(){return"".concat(ru()+ru()).concat(ru()).concat(ru()).concat(ru()).concat(ru()).concat(ru()).concat(ru())}function iu(e){var t=e.originUrl,n=void 0===t?void 0:t,r=e.originWidth,o=e.originHeight,i=e.min,a=void 0===i?198:i,s=parseInt(r),u=parseInt(o),c={url:void 0,width:0,height:0};return(s<=u?s:u)<=a?(c.url=n,c.width=s,c.height=u):(u<=s?(c.width=Math.ceil(s*a/u),c.height=a):(c.width=a,c.height=Math.ceil(u*a/s)),n&&n.indexOf("?")>=0?c.url="".concat(n,198===a?"&imageView2/3/w/198/h/198":"&imageView2/3/w/720/h/720"):c.url="".concat(n,198===a?"?imageView2/3/w/198/h/198":"?imageView2/3/w/720/h/720")),Ns(n)?Kn(c,["url"]):c}function au(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n<e.length;n++)e[n].setSizeType(n+1),e[n].setType(n)}var su=Object.prototype.hasOwnProperty;function uu(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(Os(e)){for(var t in e)if(su.call(e,t))return!1;return!0}return!("map"!==Ps(e)&&!function(e){return"set"===Ps(e)}(e)&&!Ts(e))&&0===e.size}function cu(e,t,n){if(void 0===t)return!0;var r=!0;if("object"===sr(t).toLowerCase())Object.keys(t).forEach((function(o){var i=1===e.length?e[0][o]:void 0;r=!!lu(i,t[o],n,o)&&r}));else if("array"===sr(t).toLowerCase())for(var o=0;o<t.length;o++)r=!!lu(e[o],t[o],n,t[o].name)&&r;if(r)return r;throw new Error("Params validate failed.")}function lu(e,t,n,r){if(void 0===t)return!0;var o=!0;return t.required&&uu(e)&&(Is.error("TIM [".concat(n,'] Missing required params: "').concat(r,'".')),o=!1),uu(e)||sr(e).toLowerCase()===t.type.toLowerCase()||(Is.error("TIM [".concat(n,'] Invalid params: type check failed for "').concat(r,'".Expected ').concat(t.type,".")),o=!1),t.validator&&!t.validator(e)&&(Is.error("TIM [".concat(n,"] Invalid params: custom validator check failed for params.")),o=!1),o}var pu={f:Fe},fu=A.f,hu=it.forEach,du=K("hidden"),gu=Fe("toPrimitive"),mu=ee.set,vu=ee.getterFor("Symbol"),yu=Object.prototype,_u=r.Symbol,Iu=oe("JSON","stringify"),Mu=T.f,Cu=A.f,Su=fo.f,Eu=u.f,Tu=q("symbols"),Du=q("op-symbols"),ku=q("string-to-symbol-registry"),Au=q("symbol-to-string-registry"),Ou=q("wks"),Ru=r.QObject,Nu=!Ru||!Ru.prototype||!Ru.prototype.findChild,Lu=i&&o((function(){return 7!=jt(Cu({},"a",{get:function(){return Cu(this,"a",{value:7}).a}})).a}))?function(e,t,n){var r=Mu(yu,t);r&&delete yu[t],Cu(e,t,n),r&&e!==yu&&Cu(yu,t,r)}:Cu,wu=function(e,t){var n=Tu[e]=jt(_u.prototype);return mu(n,{type:"Symbol",tag:e,description:t}),i||(n.description=t),n},bu=Ge?function(e){return"symbol"==typeof e}:function(e){return Object(e)instanceof _u},Pu=function(e,t,n){e===yu&&Pu(Du,t,n),D(e);var r=v(t,!0);return D(n),_(Tu,r)?(n.enumerable?(_(e,du)&&e[du][r]&&(e[du][r]=!1),n=jt(n,{enumerable:c(0,!1)})):(_(e,du)||Cu(e,du,c(1,{})),e[du][r]=!0),Lu(e,r,n)):Cu(e,r,n)},Gu=function(e,t){D(e);var n=g(t),r=Pt(n).concat(Fu(n));return hu(r,(function(t){i&&!Uu.call(n,t)||Pu(e,t,n[t])})),e},Uu=function(e){var t=v(e,!0),n=Eu.call(this,t);return!(this===yu&&_(Tu,t)&&!_(Du,t))&&(!(n||!_(this,t)||!_(Tu,t)||_(this,du)&&this[du][t])||n)},xu=function(e,t){var n=g(e),r=v(t,!0);if(n!==yu||!_(Tu,r)||_(Du,r)){var o=Mu(n,r);return!o||!_(Tu,r)||_(n,du)&&n[du][r]||(o.enumerable=!0),o}},qu=function(e){var t=Su(g(e)),n=[];return hu(t,(function(e){_(Tu,e)||_(H,e)||n.push(e)})),n},Fu=function(e){var t=e===yu,n=Su(t?Du:g(e)),r=[];return hu(n,(function(e){!_(Tu,e)||t&&!_(yu,e)||r.push(Tu[e])})),r};if(Pe||(te((_u=function(){if(this instanceof _u)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,t=j(e),n=function(e){this===yu&&n.call(Du,e),_(this,du)&&_(this[du],t)&&(this[du][t]=!1),Lu(this,t,c(1,e))};return i&&Nu&&Lu(yu,t,{configurable:!0,set:n}),wu(t,e)}).prototype,"toString",(function(){return vu(this).tag})),te(_u,"withoutSetter",(function(e){return wu(j(e),e)})),u.f=Uu,A.f=Pu,T.f=xu,_e.f=fo.f=qu,Ie.f=Fu,pu.f=function(e){return wu(Fe(e),e)},i&&(Cu(_u.prototype,"description",{configurable:!0,get:function(){return vu(this).description}}),te(yu,"propertyIsEnumerable",Uu,{unsafe:!0}))),Ne({global:!0,wrap:!0,forced:!Pe,sham:!Pe},{Symbol:_u}),hu(Pt(Ou),(function(e){!function(e){var t=ne.Symbol||(ne.Symbol={});_(t,e)||fu(t,e,{value:pu.f(e)})}(e)})),Ne({target:"Symbol",stat:!0,forced:!Pe},{for:function(e){var t=String(e);if(_(ku,t))return ku[t];var n=_u(t);return ku[t]=n,Au[n]=t,n},keyFor:function(e){if(!bu(e))throw TypeError(e+" is not a symbol");if(_(Au,e))return Au[e]},useSetter:function(){Nu=!0},useSimple:function(){Nu=!1}}),Ne({target:"Object",stat:!0,forced:!Pe,sham:!i},{create:function(e,t){return void 0===t?jt(e):Gu(jt(e),t)},defineProperty:Pu,defineProperties:Gu,getOwnPropertyDescriptor:xu}),Ne({target:"Object",stat:!0,forced:!Pe},{getOwnPropertyNames:qu,getOwnPropertySymbols:Fu}),Ne({target:"Object",stat:!0,forced:o((function(){Ie.f(1)}))},{getOwnPropertySymbols:function(e){return Ie.f(we(e))}}),Iu){var Vu=!Pe||o((function(){var e=_u();return"[null]"!=Iu([e])||"{}"!=Iu({a:e})||"{}"!=Iu(Object(e))}));Ne({target:"JSON",stat:!0,forced:Vu},{stringify:function(e,t,n){for(var r,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=t,(m(t)||void 0!==e)&&!bu(e))return Le(t)||(t=function(e,t){if("function"==typeof r&&(t=r.call(this,e,t)),!bu(t))return t}),o[1]=t,Iu.apply(null,o)}})}_u.prototype[gu]||O(_u.prototype,gu,_u.prototype.valueOf),on(_u,"Symbol"),H[du]=!0;var ju=A.f,Bu=r.Symbol;if(i&&"function"==typeof Bu&&(!("description"in Bu.prototype)||void 0!==Bu().description)){var Ku={},Hu=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),t=this instanceof Hu?new Bu(e):void 0===e?Bu():Bu(e);return""===e&&(Ku[t]=!0),t};Ce(Hu,Bu);var $u=Hu.prototype=Bu.prototype;$u.constructor=Hu;var zu=$u.toString,Wu="Symbol(test)"==String(Bu("test")),Yu=/^Symbol\((.*)\)[^)]+$/;ju($u,"description",{configurable:!0,get:function(){var e=m(this)?this.valueOf():this,t=zu.call(e);if(_(Ku,e))return"";var n=Wu?t.slice(7,-1):t.replace(Yu,"$1");return""===n?void 0:n}}),Ne({global:!0,forced:!0},{Symbol:Hu})}var Ju=u.f,Xu=function(e){return function(t){for(var n,r=g(t),o=Pt(r),a=o.length,s=0,u=[];a>s;)n=o[s++],i&&!Ju.call(r,n)||u.push(e?[n,r[n]]:r[n]);return u}},Qu={entries:Xu(!0),values:Xu(!1)}.values;Ne({target:"Object",stat:!0},{values:function(e){return Qu(e)}});var Zu={SUCCESS:"JoinedSuccess",WAIT_APPROVAL:"WaitAdminApproval"},ec={SUCCESS:0},tc={IS_LOGIN:1,IS_NOT_LOGIN:0},nc={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},rc={NOT_START:"notStart",PENDING:"pengding",RESOLVED:"resolved",REJECTED:"rejected"},oc=function(){function e(t){Ln(this,e),this.type=Sn.MSG_TEXT,this.content={text:t.text||""}}return bn(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),ic=Object.assign,ac=Object.defineProperty,sc=!ic||o((function(){if(i&&1!==ic({b:1},ic(ac({},"a",{enumerable:!0,get:function(){ac(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!=ic({},e)[n]||"abcdefghijklmnopqrst"!=Pt(ic({},t)).join("")}))?function(e,t){for(var n=we(e),r=arguments.length,o=1,a=Ie.f,s=u.f;r>o;)for(var c,l=h(arguments[o++]),p=a?Pt(l).concat(a(l)):Pt(l),f=p.length,d=0;f>d;)c=p[d++],i&&!s.call(l,c)||(n[c]=l[c]);return n}:ic;Ne({target:"Object",stat:!0,forced:Object.assign!==sc},{assign:sc});var uc=Fe("iterator"),cc=!o((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,r){t.delete("b"),n+=r+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[uc]||"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})),lc=/[^\0-\u007E]/,pc=/[.\u3002\uFF0E\uFF61]/g,fc="Overflow: input needs wider integers to process",hc=Math.floor,dc=String.fromCharCode,gc=function(e){return e+22+75*(e<26)},mc=function(e,t,n){var r=0;for(e=n?hc(e/700):e>>1,e+=hc(e/t);e>455;r+=36)e=hc(e/35);return hc(r+36*e/(e+38))},vc=function(e){var t,n,r=[],o=(e=function(e){for(var t=[],n=0,r=e.length;n<r;){var o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){var i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),n--)}else t.push(o)}return t}(e)).length,i=128,a=0,s=72;for(t=0;t<e.length;t++)(n=e[t])<128&&r.push(dc(n));var u=r.length,c=u;for(u&&r.push("-");c<o;){var l=2147483647;for(t=0;t<e.length;t++)(n=e[t])>=i&&n<l&&(l=n);var p=c+1;if(l-i>hc((2147483647-a)/p))throw RangeError(fc);for(a+=(l-i)*p,i=l,t=0;t<e.length;t++){if((n=e[t])<i&&++a>2147483647)throw RangeError(fc);if(n==i){for(var f=a,h=36;;h+=36){var d=h<=s?1:h>=s+26?26:h-s;if(f<d)break;var g=f-d,m=36-d;r.push(dc(gc(d+g%m))),f=hc(g/m)}r.push(dc(gc(f))),s=mc(a,p,c==u),a=0,++c}}++a,++i}return r.join("")},yc=function(e){var t=Dt(e);if("function"!=typeof t)throw TypeError(String(e)+" is not iterable");return D(t.call(e))},_c=oe("fetch"),Ic=oe("Headers"),Mc=Fe("iterator"),Cc=ee.set,Sc=ee.getterFor("URLSearchParams"),Ec=ee.getterFor("URLSearchParamsIterator"),Tc=/\+/g,Dc=Array(4),kc=function(e){return Dc[e-1]||(Dc[e-1]=RegExp("((?:%[\\da-f]{2}){"+e+"})","gi"))},Ac=function(e){try{return decodeURIComponent(e)}catch(C_){return e}},Oc=function(e){var t=e.replace(Tc," "),n=4;try{return decodeURIComponent(t)}catch(C_){for(;n;)t=t.replace(kc(n--),Ac);return t}},Rc=/[!'()~]|%20/g,Nc={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Lc=function(e){return Nc[e]},wc=function(e){return encodeURIComponent(e).replace(Rc,Lc)},bc=function(e,t){if(t)for(var n,r,o=t.split("&"),i=0;i<o.length;)(n=o[i++]).length&&(r=n.split("="),e.push({key:Oc(r.shift()),value:Oc(r.join("="))}))},Pc=function(e){this.entries.length=0,bc(this.entries,e)},Gc=function(e,t){if(e<t)throw TypeError("Not enough arguments")},Uc=un((function(e,t){Cc(this,{type:"URLSearchParamsIterator",iterator:yc(Sc(e).entries),kind:t})}),"Iterator",(function(){var e=Ec(this),t=e.kind,n=e.iterator.next(),r=n.value;return n.done||(n.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),n})),xc=function(){Oo(this,xc,"URLSearchParams");var e,t,n,r,o,i,a,s,u,c=arguments.length>0?arguments[0]:void 0,l=this,p=[];if(Cc(l,{type:"URLSearchParams",entries:p,updateURL:function(){},updateSearchParams:Pc}),void 0!==c)if(m(c))if("function"==typeof(e=Dt(c)))for(n=(t=e.call(c)).next;!(r=n.call(t)).done;){if((a=(i=(o=yc(D(r.value))).next).call(o)).done||(s=i.call(o)).done||!i.call(o).done)throw TypeError("Expected sequence with length 2");p.push({key:a.value+"",value:s.value+""})}else for(u in c)_(c,u)&&p.push({key:u,value:c[u]+""});else bc(p,"string"==typeof c?"?"===c.charAt(0)?c.slice(1):c:c+"")},qc=xc.prototype;Do(qc,{append:function(e,t){Gc(arguments.length,2);var n=Sc(this);n.entries.push({key:e+"",value:t+""}),n.updateURL()},delete:function(e){Gc(arguments.length,1);for(var t=Sc(this),n=t.entries,r=e+"",o=0;o<n.length;)n[o].key===r?n.splice(o,1):o++;t.updateURL()},get:function(e){Gc(arguments.length,1);for(var t=Sc(this).entries,n=e+"",r=0;r<t.length;r++)if(t[r].key===n)return t[r].value;return null},getAll:function(e){Gc(arguments.length,1);for(var t=Sc(this).entries,n=e+"",r=[],o=0;o<t.length;o++)t[o].key===n&&r.push(t[o].value);return r},has:function(e){Gc(arguments.length,1);for(var t=Sc(this).entries,n=e+"",r=0;r<t.length;)if(t[r++].key===n)return!0;return!1},set:function(e,t){Gc(arguments.length,1);for(var n,r=Sc(this),o=r.entries,i=!1,a=e+"",s=t+"",u=0;u<o.length;u++)(n=o[u]).key===a&&(i?o.splice(u--,1):(i=!0,n.value=s));i||o.push({key:a,value:s}),r.updateURL()},sort:function(){var e,t,n,r=Sc(this),o=r.entries,i=o.slice();for(o.length=0,n=0;n<i.length;n++){for(e=i[n],t=0;t<n;t++)if(o[t].key>e.key){o.splice(t,0,e);break}t===n&&o.push(e)}r.updateURL()},forEach:function(e){for(var t,n=Sc(this).entries,r=nt(e,arguments.length>1?arguments[1]:void 0,3),o=0;o<n.length;)r((t=n[o++]).value,t.key,this)},keys:function(){return new Uc(this,"keys")},values:function(){return new Uc(this,"values")},entries:function(){return new Uc(this,"entries")}},{enumerable:!0}),te(qc,Mc,qc.entries),te(qc,"toString",(function(){for(var e,t=Sc(this).entries,n=[],r=0;r<t.length;)e=t[r++],n.push(wc(e.key)+"="+wc(e.value));return n.join("&")}),{enumerable:!0}),on(xc,"URLSearchParams"),Ne({global:!0,forced:!cc},{URLSearchParams:xc}),cc||"function"!=typeof _c||"function"!=typeof Ic||Ne({global:!0,enumerable:!0,forced:!0},{fetch:function(e){var t,n,r,o=[e];return arguments.length>1&&(m(t=arguments[1])&&(n=t.body,"URLSearchParams"===Et(n)&&((r=t.headers?new Ic(t.headers):new Ic).has("content-type")||r.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),t=jt(t,{body:c(0,String(n)),headers:c(0,r)}))),o.push(t)),_c.apply(this,o)}});var Fc,Vc={URLSearchParams:xc,getState:Sc},jc=Wt.codeAt,Bc=r.URL,Kc=Vc.URLSearchParams,Hc=Vc.getState,$c=ee.set,zc=ee.getterFor("URL"),Wc=Math.floor,Yc=Math.pow,Jc=/[A-Za-z]/,Xc=/[\d+-.A-Za-z]/,Qc=/\d/,Zc=/^(0x|0X)/,el=/^[0-7]+$/,tl=/^\d+$/,nl=/^[\dA-Fa-f]+$/,rl=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,ol=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,il=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,al=/[\u0009\u000A\u000D]/g,sl=function(e,t){var n,r,o;if("["==t.charAt(0)){if("]"!=t.charAt(t.length-1))return"Invalid host";if(!(n=cl(t.slice(1,-1))))return"Invalid host";e.host=n}else if(vl(e)){if(t=function(e){var t,n,r=[],o=e.toLowerCase().replace(pc,".").split(".");for(t=0;t<o.length;t++)n=o[t],r.push(lc.test(n)?"xn--"+vc(n):n);return r.join(".")}(t),rl.test(t))return"Invalid host";if(null===(n=ul(t)))return"Invalid host";e.host=n}else{if(ol.test(t))return"Invalid host";for(n="",r=kt(t),o=0;o<r.length;o++)n+=gl(r[o],pl);e.host=n}},ul=function(e){var t,n,r,o,i,a,s,u=e.split(".");if(u.length&&""==u[u.length-1]&&u.pop(),(t=u.length)>4)return e;for(n=[],r=0;r<t;r++){if(""==(o=u[r]))return e;if(i=10,o.length>1&&"0"==o.charAt(0)&&(i=Zc.test(o)?16:8,o=o.slice(8==i?1:2)),""===o)a=0;else{if(!(10==i?tl:8==i?el:nl).test(o))return e;a=parseInt(o,i)}n.push(a)}for(r=0;r<t;r++)if(a=n[r],r==t-1){if(a>=Yc(256,5-t))return null}else if(a>255)return null;for(s=n.pop(),r=0;r<n.length;r++)s+=n[r]*Yc(256,3-r);return s},cl=function(e){var t,n,r,o,i,a,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,p=0,f=function(){return e.charAt(p)};if(":"==f()){if(":"!=e.charAt(1))return;p+=2,l=++c}for(;f();){if(8==c)return;if(":"!=f()){for(t=n=0;n<4&&nl.test(f());)t=16*t+parseInt(f(),16),p++,n++;if("."==f()){if(0==n)return;if(p-=n,c>6)return;for(r=0;f();){if(o=null,r>0){if(!("."==f()&&r<4))return;p++}if(!Qc.test(f()))return;for(;Qc.test(f());){if(i=parseInt(f(),10),null===o)o=i;else{if(0==o)return;o=10*o+i}if(o>255)return;p++}u[c]=256*u[c]+o,2!=++r&&4!=r||c++}if(4!=r)return;break}if(":"==f()){if(p++,!f())return}else if(f())return;u[c++]=t}else{if(null!==l)return;p++,l=++c}}if(null!==l)for(a=c-l,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[l+a-1],u[l+--a]=s;else if(8!=c)return;return u},ll=function(e){var t,n,r,o;if("number"==typeof e){for(t=[],n=0;n<4;n++)t.unshift(e%256),e=Wc(e/256);return t.join(".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,n=1,r=null,o=0,i=0;i<8;i++)0!==e[i]?(o>n&&(t=r,n=o),r=null,o=0):(null===r&&(r=i),++o);return o>n&&(t=r,n=o),t}(e),n=0;n<8;n++)o&&0===e[n]||(o&&(o=!1),r===n?(t+=n?":":"::",o=!0):(t+=e[n].toString(16),n<7&&(t+=":")));return"["+t+"]"}return e},pl={},fl=sc({},pl,{" ":1,'"':1,"<":1,">":1,"`":1}),hl=sc({},fl,{"#":1,"?":1,"{":1,"}":1}),dl=sc({},hl,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),gl=function(e,t){var n=jc(e,0);return n>32&&n<127&&!_(t,e)?e:encodeURIComponent(e)},ml={ftp:21,file:null,http:80,https:443,ws:80,wss:443},vl=function(e){return _(ml,e.scheme)},yl=function(e){return""!=e.username||""!=e.password},_l=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},Il=function(e,t){var n;return 2==e.length&&Jc.test(e.charAt(0))&&(":"==(n=e.charAt(1))||!t&&"|"==n)},Ml=function(e){var t;return e.length>1&&Il(e.slice(0,2))&&(2==e.length||"/"===(t=e.charAt(2))||"\\"===t||"?"===t||"#"===t)},Cl=function(e){var t=e.path,n=t.length;!n||"file"==e.scheme&&1==n&&Il(t[0],!0)||t.pop()},Sl=function(e){return"."===e||"%2e"===e.toLowerCase()},El={},Tl={},Dl={},kl={},Al={},Ol={},Rl={},Nl={},Ll={},wl={},bl={},Pl={},Gl={},Ul={},xl={},ql={},Fl={},Vl={},jl={},Bl={},Kl={},Hl=function(e,t,n,r){var o,i,a,s,u,c=n||El,l=0,p="",f=!1,h=!1,d=!1;for(n||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,t=t.replace(il,"")),t=t.replace(al,""),o=kt(t);l<=o.length;){switch(i=o[l],c){case El:if(!i||!Jc.test(i)){if(n)return"Invalid scheme";c=Dl;continue}p+=i.toLowerCase(),c=Tl;break;case Tl:if(i&&(Xc.test(i)||"+"==i||"-"==i||"."==i))p+=i.toLowerCase();else{if(":"!=i){if(n)return"Invalid scheme";p="",c=Dl,l=0;continue}if(n&&(vl(e)!=_(ml,p)||"file"==p&&(yl(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=p,n)return void(vl(e)&&ml[e.scheme]==e.port&&(e.port=null));p="","file"==e.scheme?c=Ul:vl(e)&&r&&r.scheme==e.scheme?c=kl:vl(e)?c=Nl:"/"==o[l+1]?(c=Al,l++):(e.cannotBeABaseURL=!0,e.path.push(""),c=jl)}break;case Dl:if(!r||r.cannotBeABaseURL&&"#"!=i)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==i){e.scheme=r.scheme,e.path=r.path.slice(),e.query=r.query,e.fragment="",e.cannotBeABaseURL=!0,c=Kl;break}c="file"==r.scheme?Ul:Ol;continue;case kl:if("/"!=i||"/"!=o[l+1]){c=Ol;continue}c=Ll,l++;break;case Al:if("/"==i){c=wl;break}c=Vl;continue;case Ol:if(e.scheme=r.scheme,i==Fc)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query;else if("/"==i||"\\"==i&&vl(e))c=Rl;else if("?"==i)e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query="",c=Bl;else{if("#"!=i){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.path.pop(),c=Vl;continue}e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,e.path=r.path.slice(),e.query=r.query,e.fragment="",c=Kl}break;case Rl:if(!vl(e)||"/"!=i&&"\\"!=i){if("/"!=i){e.username=r.username,e.password=r.password,e.host=r.host,e.port=r.port,c=Vl;continue}c=wl}else c=Ll;break;case Nl:if(c=Ll,"/"!=i||"/"!=p.charAt(l+1))continue;l++;break;case Ll:if("/"!=i&&"\\"!=i){c=wl;continue}break;case wl:if("@"==i){f&&(p="%40"+p),f=!0,a=kt(p);for(var g=0;g<a.length;g++){var m=a[g];if(":"!=m||d){var v=gl(m,dl);d?e.password+=v:e.username+=v}else d=!0}p=""}else if(i==Fc||"/"==i||"?"==i||"#"==i||"\\"==i&&vl(e)){if(f&&""==p)return"Invalid authority";l-=kt(p).length+1,p="",c=bl}else p+=i;break;case bl:case Pl:if(n&&"file"==e.scheme){c=ql;continue}if(":"!=i||h){if(i==Fc||"/"==i||"?"==i||"#"==i||"\\"==i&&vl(e)){if(vl(e)&&""==p)return"Invalid host";if(n&&""==p&&(yl(e)||null!==e.port))return;if(s=sl(e,p))return s;if(p="",c=Fl,n)return;continue}"["==i?h=!0:"]"==i&&(h=!1),p+=i}else{if(""==p)return"Invalid host";if(s=sl(e,p))return s;if(p="",c=Gl,n==Pl)return}break;case Gl:if(!Qc.test(i)){if(i==Fc||"/"==i||"?"==i||"#"==i||"\\"==i&&vl(e)||n){if(""!=p){var y=parseInt(p,10);if(y>65535)return"Invalid port";e.port=vl(e)&&y===ml[e.scheme]?null:y,p=""}if(n)return;c=Fl;continue}return"Invalid port"}p+=i;break;case Ul:if(e.scheme="file","/"==i||"\\"==i)c=xl;else{if(!r||"file"!=r.scheme){c=Vl;continue}if(i==Fc)e.host=r.host,e.path=r.path.slice(),e.query=r.query;else if("?"==i)e.host=r.host,e.path=r.path.slice(),e.query="",c=Bl;else{if("#"!=i){Ml(o.slice(l).join(""))||(e.host=r.host,e.path=r.path.slice(),Cl(e)),c=Vl;continue}e.host=r.host,e.path=r.path.slice(),e.query=r.query,e.fragment="",c=Kl}}break;case xl:if("/"==i||"\\"==i){c=ql;break}r&&"file"==r.scheme&&!Ml(o.slice(l).join(""))&&(Il(r.path[0],!0)?e.path.push(r.path[0]):e.host=r.host),c=Vl;continue;case ql:if(i==Fc||"/"==i||"\\"==i||"?"==i||"#"==i){if(!n&&Il(p))c=Vl;else if(""==p){if(e.host="",n)return;c=Fl}else{if(s=sl(e,p))return s;if("localhost"==e.host&&(e.host=""),n)return;p="",c=Fl}continue}p+=i;break;case Fl:if(vl(e)){if(c=Vl,"/"!=i&&"\\"!=i)continue}else if(n||"?"!=i)if(n||"#"!=i){if(i!=Fc&&(c=Vl,"/"!=i))continue}else e.fragment="",c=Kl;else e.query="",c=Bl;break;case Vl:if(i==Fc||"/"==i||"\\"==i&&vl(e)||!n&&("?"==i||"#"==i)){if(".."===(u=(u=p).toLowerCase())||"%2e."===u||".%2e"===u||"%2e%2e"===u?(Cl(e),"/"==i||"\\"==i&&vl(e)||e.path.push("")):Sl(p)?"/"==i||"\\"==i&&vl(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&Il(p)&&(e.host&&(e.host=""),p=p.charAt(0)+":"),e.path.push(p)),p="","file"==e.scheme&&(i==Fc||"?"==i||"#"==i))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==i?(e.query="",c=Bl):"#"==i&&(e.fragment="",c=Kl)}else p+=gl(i,hl);break;case jl:"?"==i?(e.query="",c=Bl):"#"==i?(e.fragment="",c=Kl):i!=Fc&&(e.path[0]+=gl(i,pl));break;case Bl:n||"#"!=i?i!=Fc&&("'"==i&&vl(e)?e.query+="%27":e.query+="#"==i?"%23":gl(i,pl)):(e.fragment="",c=Kl);break;case Kl:i!=Fc&&(e.fragment+=gl(i,fl))}l++}},$l=function(e){var t,n,r=Oo(this,$l,"URL"),o=arguments.length>1?arguments[1]:void 0,a=String(e),s=$c(r,{type:"URL"});if(void 0!==o)if(o instanceof $l)t=zc(o);else if(n=Hl(t={},String(o)))throw TypeError(n);if(n=Hl(s,a,null,t))throw TypeError(n);var u=s.searchParams=new Kc,c=Hc(u);c.updateSearchParams(s.query),c.updateURL=function(){s.query=String(u)||null},i||(r.href=Wl.call(r),r.origin=Yl.call(r),r.protocol=Jl.call(r),r.username=Xl.call(r),r.password=Ql.call(r),r.host=Zl.call(r),r.hostname=ep.call(r),r.port=tp.call(r),r.pathname=np.call(r),r.search=rp.call(r),r.searchParams=op.call(r),r.hash=ip.call(r))},zl=$l.prototype,Wl=function(){var e=zc(this),t=e.scheme,n=e.username,r=e.password,o=e.host,i=e.port,a=e.path,s=e.query,u=e.fragment,c=t+":";return null!==o?(c+="//",yl(e)&&(c+=n+(r?":"+r:"")+"@"),c+=ll(o),null!==i&&(c+=":"+i)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+a.join("/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},Yl=function(){var e=zc(this),t=e.scheme,n=e.port;if("blob"==t)try{return new URL(t.path[0]).origin}catch(C_){return"null"}return"file"!=t&&vl(e)?t+"://"+ll(e.host)+(null!==n?":"+n:""):"null"},Jl=function(){return zc(this).scheme+":"},Xl=function(){return zc(this).username},Ql=function(){return zc(this).password},Zl=function(){var e=zc(this),t=e.host,n=e.port;return null===t?"":null===n?ll(t):ll(t)+":"+n},ep=function(){var e=zc(this).host;return null===e?"":ll(e)},tp=function(){var e=zc(this).port;return null===e?"":String(e)},np=function(){var e=zc(this),t=e.path;return e.cannotBeABaseURL?t[0]:t.length?"/"+t.join("/"):""},rp=function(){var e=zc(this).query;return e?"?"+e:""},op=function(){return zc(this).searchParams},ip=function(){var e=zc(this).fragment;return e?"#"+e:""},ap=function(e,t){return{get:e,set:t,configurable:!0,enumerable:!0}};if(i&&Gt(zl,{href:ap(Wl,(function(e){var t=zc(this),n=String(e),r=Hl(t,n);if(r)throw TypeError(r);Hc(t.searchParams).updateSearchParams(t.query)})),origin:ap(Yl),protocol:ap(Jl,(function(e){var t=zc(this);Hl(t,String(e)+":",El)})),username:ap(Xl,(function(e){var t=zc(this),n=kt(String(e));if(!_l(t)){t.username="";for(var r=0;r<n.length;r++)t.username+=gl(n[r],dl)}})),password:ap(Ql,(function(e){var t=zc(this),n=kt(String(e));if(!_l(t)){t.password="";for(var r=0;r<n.length;r++)t.password+=gl(n[r],dl)}})),host:ap(Zl,(function(e){var t=zc(this);t.cannotBeABaseURL||Hl(t,String(e),bl)})),hostname:ap(ep,(function(e){var t=zc(this);t.cannotBeABaseURL||Hl(t,String(e),Pl)})),port:ap(tp,(function(e){var t=zc(this);_l(t)||(""==(e=String(e))?t.port=null:Hl(t,e,Gl))})),pathname:ap(np,(function(e){var t=zc(this);t.cannotBeABaseURL||(t.path=[],Hl(t,e+"",Fl))})),search:ap(rp,(function(e){var t=zc(this);""==(e=String(e))?t.query=null:("?"==e.charAt(0)&&(e=e.slice(1)),t.query="",Hl(t,e,Bl)),Hc(t.searchParams).updateSearchParams(t.query)})),searchParams:ap(op),hash:ap(ip,(function(e){var t=zc(this);""!=(e=String(e))?("#"==e.charAt(0)&&(e=e.slice(1)),t.fragment="",Hl(t,e,Kl)):t.fragment=null}))}),te(zl,"toJSON",(function(){return Wl.call(this)}),{enumerable:!0}),te(zl,"toString",(function(){return Wl.call(this)}),{enumerable:!0}),Bc){var sp=Bc.createObjectURL,up=Bc.revokeObjectURL;sp&&te($l,"createObjectURL",(function(e){return sp.apply(Bc,arguments)})),up&&te($l,"revokeObjectURL",(function(e){return up.apply(Bc,arguments)}))}on($l,"URL"),Ne({global:!0,forced:!cc,sham:!i},{URL:$l});var cp={JSON:{TYPE:{C2C:{NOTICE:1,COMMON:9,EVENT:10},GROUP:{COMMON:3,TIP:4,SYSTEM:5,TIP2:6},FRIEND:{NOTICE:7},PROFILE:{NOTICE:8}},SUBTYPE:{C2C:{COMMON:0,READED:92,KICKEDOUT:96},GROUP:{COMMON:0,LOVEMESSAGE:1,TIP:2,REDPACKET:3}},OPTIONS:{GROUP:{JOIN:1,QUIT:2,KICK:3,SET_ADMIN:4,CANCEL_ADMIN:5,MODIFY_GROUP_INFO:6,MODIFY_MEMBER_INFO:7}}},PROTOBUF:{},IMAGE_TYPES:{ORIGIN:1,LARGE:2,SMALL:3},IMAGE_FORMAT:{JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255}},lp=1,pp=2,fp=3,hp=4,dp=5,gp=7,mp=8,vp=9,yp=10,_p=15,Ip=255,Mp=2,Cp=0,Sp=1,Ep={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"},Tp={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},Dp={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},kp={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Ap=function(){function e(t){Ln(this,e),this._imageMemoryURL="",this._file=t.file,Ka?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=Sn.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||cp.IMAGE_FORMAT.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 bn(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=Bs(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,r=null;t<=2;)r=Ns(e)||Ns(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(r)).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,r=0;r<n;r++)t=this.content.imageInfoArray[r],e[r].size&&(t.size=e[r].size),e[r].url&&t.setImageUrl(e[r].url),e[r].width&&(t.width=e[r].width),e[r].height&&(t.height=e[r].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",n="",r=["http","https"],o=null,i=0;i<e;i++)this.content.imageInfoArray[i].url&&""!==(o=this.content.imageInfoArray[i]).imageUrl&&(n=o.imageUrl.slice(0,o.imageUrl.indexOf("://")+1),t=o.imageUrl.slice(o.imageUrl.indexOf("://")+1),r.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[i].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=cp.IMAGE_FORMAT[e.toUpperCase()]||cp.IMAGE_FORMAT.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,r=void 0===n?0:n,o=t.height,i=void 0===o?0:o;0!==r&&0!==i&&(au(e),Object.assign(e[2],iu({originWidth:r,originHeight:i,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),Op=function(){function e(t){Ln(this,e),this.type=Sn.MSG_FACE,this.content=t||null}return bn(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Rp=function(){function e(t){Ln(this,e),this.type=Sn.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:t.url,remoteAudioUrl:"",uuid:t.uuid}}return bn(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}();Ne({target:"Object",stat:!0,forced:!i,sham:!i},{defineProperty:A.f});var Np={from:!0,groupID:!0,groupName:!0,to:!0},Lp=function(){function e(t){Ln(this,e),this.type=Sn.MSG_GRP_TIP,this.content={},this._initContent(t)}return bn(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":case"memberInfoList":break;case"msgMemberInfo":t.content.memberList=e[n],Object.defineProperty(t.content,"msgMemberInfo",{get:function(){return Es.warn("!!! 禁言的群提示消息中的 payload.msgMemberInfo 属性即将废弃,请使用 payload.memberList 属性替代。 \n","msgMemberInfo 中的 shutupTime 属性对应更改为 memberList 中的 muteTime 属性,表示禁言时长。 \n","参考:群提示消息 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/Message.html#.GroupTipPayload"),t.content.memberList.map((function(e){return{userID:e.userID,shutupTime:e.muteTime}}))}});break;case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=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 r=t[n];Np[r]&&(this.content.groupProfile[r]=e[r])}}}]),e}(),wp={from:!0,groupID:!0,name:!0,to:!0},bp=function(){function e(t){Ln(this,e),this.type=Sn.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return bn(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 r=t[n];wp[r]&&(this.content.groupProfile[r]=e[r])}}}]),e}(),Pp=Math.min,Gp=[].lastIndexOf,Up=!!Gp&&1/[1].lastIndexOf(1,-0)<0,xp=at("lastIndexOf"),qp=lt("indexOf",{ACCESSORS:!0,1:0}),Fp=Up||!xp||!qp?function(e){if(Up)return Gp.apply(this,arguments)||0;var t=g(this),n=ce(t.length),r=n-1;for(arguments.length>1&&(r=Pp(r,se(arguments[1]))),r<0&&(r=n+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Gp;Ne({target:"Array",proto:!0,forced:Fp!==[].lastIndexOf},{lastIndexOf:Fp});var Vp="https://cloud.tencent.com/document/product/",jp="您可以在即时通信 IM 控制台的【开发辅助工具(https://console.cloud.tencent.com/im-detail/tool-usersig)】页面校验 UserSig。",Bp="UserSig 非法,请使用官网提供的 API 重新生成 UserSig(".concat(Vp,"269/32688)。"),Kp={70001:"UserSig 已过期,请重新生成。建议 UserSig 有效期设置不小于24小时。",70002:"UserSig 长度为0,请检查传入的 UserSig 是否正确。",70003:Bp,70005:Bp,70009:"UserSig 验证失败,可能因为生成 UserSig 时混用了其他 SDKAppID 的私钥或密钥导致,请使用对应 SDKAppID 下的私钥或密钥重新生成 UserSig(".concat(Vp,"269/32688)。"),70013:"请求中的 UserID 与生成 UserSig 时使用的 UserID 不匹配。".concat(jp),70014:"请求中的 SDKAppID 与生成 UserSig 时使用的 SDKAppID 不匹配。".concat(jp),70016:"密钥不存在,UserSig 验证失败,请在即时通信 IM 控制台获取密钥(".concat(Vp,"269/32578#.E8.8E.B7.E5.8F.96.E5.AF.86.E9.92.A5)。"),70020:"SDKAppID 未找到,请在即时通信 IM 控制台确认应用信息。",70050:"UserSig 验证次数过于频繁。请检查 UserSig 是否正确,并于1分钟后重新验证。".concat(jp),70051:"帐号被拉入黑名单。",70052:"UserSig 已经失效,请重新生成,再次尝试。",70107:"因安全原因被限制登录,请不要频繁登录。",70169:"请求的用户帐号不存在。",70114:"".concat("服务端内部超时,请稍后重试。"),70202:"".concat("服务端内部超时,请稍后重试。"),70206:"请求中批量数量不合法。",70402:"参数非法,请检查必填字段是否填充,或者字段的填充是否满足协议要求。",70403:"请求失败,需要 App 管理员权限。",70398:"帐号数超限。如需创建多于100个帐号,请将应用升级为专业版,具体操作指引请参见购买指引(".concat(Vp,"269/32458)。"),70500:"".concat("服务端内部错误,请重试。"),71e3:"删除帐号失败。仅支持删除体验版帐号,您当前应用为专业版,暂不支持帐号删除。",20001:"请求包非法。",20002:"UserSig 或 A2 失效。",20003:"消息发送方或接收方 UserID 无效或不存在,请检查 UserID 是否已导入即时通信 IM。",20004:"网络异常,请重试。",20005:"".concat("服务端内部错误,请重试。"),20006:"触发发送".concat("单聊消息","之前回调,App 后台返回禁止下发该消息。"),20007:"发送".concat("单聊消息",",被对方拉黑,禁止发送。消息发送状态默认展示为失败,您可以登录控制台修改该场景下的消息发送状态展示结果,具体操作请参见消息保留设置(").concat(Vp,"269/38656)。"),20009:"消息发送双方互相不是好友,禁止发送(配置".concat("单聊消息","校验好友关系才会出现)。"),20010:"发送".concat("单聊消息",",自己不是对方的好友(单向关系),禁止发送。"),20011:"发送".concat("单聊消息",",对方不是自己的好友(单向关系),禁止发送。"),20012:"发送方被禁言,该条消息被禁止发送。",20016:"消息撤回超过了时间限制(默认2分钟)。",20018:"删除漫游内部错误。",90001:"JSON 格式解析失败,请检查请求包是否符合 JSON 规范。",90002:"".concat("JSON 格式请求包体","中 MsgBody 不符合消息格式描述,或者 MsgBody 不是 Array 类型,请参考 TIMMsgElement 对象的定义(").concat(Vp,"269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。"),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(Vp,"269/2720#.E6.B6.88.E6.81.AF.E5.85.83.E7.B4.A0-timmsgelement)。"),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(Vp,"269/11673)购买预付费套餐“IM直播群”。"),10037:"单个用户可创建和加入的".concat("群组","数量超过了限制,请参考价格说明(").concat(Vp,"269/11673)购买或升级预付费套餐“单人可创建与加入").concat("群组","数”。"),10038:"群成员数量超过限制,请参考价格说明(".concat(Vp,"269/11673)购买或升级预付费套餐“扩展群人数上限”。"),10041:"该应用(SDKAppID)已配置不支持群消息撤回。"},Hp=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this)).code=e.code,r.message=Kp[e.code]||e.message,r.data=e.data||{},r}return n}(Bn(Error)),$p={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,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_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,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_Work:2622,MEMBER_NOT_IN_GROUP:2623,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,DEL_FRIEND_INVALID_PARAM:2700,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,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,SDK_IS_NOT_READY:2999,LONG_POLL_KICK_OUT:91101,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,LONG_POLL_API_PARAM_ERROR:90001},zp="无 SDKAppID",Wp="无 accountType",Yp="无 userID",Jp="无 userSig",Xp="无 tinyID",Qp="无 a2key",Zp="用户未登录",ef="未检测到 COS 上传插件",tf="获取 COS 预签名 URL 失败",nf="消息发送失败",rf="MessageController.constructor() 需要参数 options",of="需要 Message 的实例",af='Message.conversationType 只能为 "C2C" 或 "GROUP"',sf="无法发送空文件",uf="回调函数运行时遇到错误,请检查接入侧代码",cf="消息撤回失败",lf="请先选择一个图片",pf="只允许上传 jpg png jpeg gif bmp格式的图片",ff="图片大小超过20M,无法发送",hf="语音上传失败",df="语音大小大于20M,无法发送",gf="视频上传失败",mf="视频大小超过100M,无法发送",vf="只允许上传 mp4 格式的视频",yf="文件上传失败",_f="请先选择一个文件",If="文件大小超过100M,无法发送 ",Mf="缺少必要的参数文件 URL",Cf="没有找到相应的会话,请检查传入参数",Sf="没有找到相应的用户或群组,请检查传入参数",Ef="未记录的会话类型",Tf="非法的群类型,请检查传入参数",Df="不能加入 Work 类型的群组",kf="AVChatRoom 类型的群组不能转让群主",Af="不能把群主转让给自己",Of="不能解散 Work 类型的群组",Rf="用户不在该群组内",Nf="加群失败,请检查传入参数或重试",Lf="AVChatRoom 类型的群不支持邀请群成员",wf="非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群",bf="不能在 AVChatRoom 类型的群组踢人",Pf="你不是群主,只有群主才有权限操作",Gf="不能在 Work / AVChatRoom 类型的群中设置群成员身份",Uf="不合法的群成员身份,请检查传入参数",xf="不能设置自己的群成员身份,请检查传入参数",qf="不能将自己禁言,请检查传入参数",Ff="传入 deleteFriend 接口的参数无效",Vf="传入 updateMyProfile 接口的参数无效",jf="updateMyProfile 无标配资料字段或自定义资料字段",Bf="传入 addToBlacklist 接口的参数无效",Kf="传入 removeFromBlacklist 接口的参数无效",Hf="不能拉黑自己",$f="网络层初始化错误,缺少 URL 参数",zf="打包错误,未定义的 serverName",Wf="未定义的 packageConfig",Yf="未连接到网络",Jf="不规范的参数名称",Xf="_syncOffset 丢失",Qf="获取 longpolling id 失败",Zf="无效操作,如调用了未定义或者未实现的方法等",eh="接口需要 SDK 处于 ready 状态后才能调用",th=["jpg","jpeg","gif","png","bmp"],nh=["mp4"],rh=1,oh=2,ih=3,ah=255,sh=function(){function e(t){Ln(this,e);var n=this._check(t);if(n instanceof Hp)throw n;this.type=Sn.MSG_FILE,this._percent=0;var r=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:t.url||"",uuid:t.uuid,fileName:r.name||"",fileSize:r.size||0}}return bn(e,[{key:"_getFileInfo",value:function(e){if(e.fileName&&e.fileSize)return{size:e.fileSize,name:e.fileName};if(Ka)return{};var t=e.file.files[0];return{size:t.size,name:t.name,type:t.type.slice(t.type.lastIndexOf("/")+1).toLowerCase()}}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"_check",value:function(e){if(e.size>104857600)return new Hp({code:$p.MESSAGE_FILE_SIZE_LIMIT,message:"".concat(If,": ").concat(104857600," bytes")})}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),uh=function(){function e(t){Ln(this,e),this.type=Sn.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return bn(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}(),ch=function(){function e(t){Ln(this,e),this.type=Sn.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl,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,thumbHeight:t.thumbHeight,thumbSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:t.thumbUrl}}return bn(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:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),lh=function e(t){Ln(this,e),this.type=Sn.MSG_GEO,this.content=t},ph={1:Sn.MSG_PRIORITY_HIGH,2:Sn.MSG_PRIORITY_NORMAL,3:Sn.MSG_PRIORITY_LOW,4:Sn.MSG_PRIORITY_LOWEST},fh=function(){function e(t){Ln(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||Sn.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||Bs(),this.priority=this._computePriority(t.priority),this.nick="",this.avatar="",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.geo={},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||nc.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this.atUserList=[],this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t)}return bn(e,[{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){ks(e.nick)&&(this.nick=e.nick),ks(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;Os(t)&&ks(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!==Sn.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(Sn.MSG_AT_ALL))})),Rs(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){1===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):2===e.groupAtAllFlag&&t.atUserList.push(Sn.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this.payload=this._elements[0].content,this.type=this._elements[0].type}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?nc.SUCCESS:nc.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initielizeSequence(e),this._concactConversationID(e),this.generateMessageID(e)}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"!=typeof this._elements[0].sendable?(Es.warn("".concat(this._elements[0].type,' need "boolean : sendable()" method')),!1):this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===Sn.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initielizeSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return Es.error("autoincrementIndex(string: key) need key parameter"),!1;if(void 0===zs[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),r="0".concat(t.getMinutes()).slice(-2),o="0".concat(t.getSeconds()).slice(-2);zs[e]=parseInt([n,r,o,"0001"].join("")),n=null,r=null,o=null,Es.warn("utils.autoincrementIndex() create new sequence : ".concat(e," = ").concat(zs[e]))}return zs[e]++}(e)),0===this.sequence&&this.conversationType===Sn.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(e){var t=e===this.from?1:0,n=this.sequence>0?this.sequence:this.clientSequence;this.ID="".concat(this.conversationID,"-").concat(n,"-").concat(this.random,"-").concat(t)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concactConversationID",value:function(e){var t=this.to,n="",r=this.conversationType;r!==Sn.CONV_SYSTEM?(n=r===Sn.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID="".concat(r).concat(n)):this.conversationID=Sn.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof oc||e instanceof Ap||e instanceof Op||e instanceof Rp||e instanceof sh||e instanceof ch||e instanceof Lp||e instanceof bp||e instanceof uh||e instanceof lh}},{key:"setElement",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var n=function(e){switch(e.type){case Sn.MSG_TEXT:t.setTextElement(e.content);break;case Sn.MSG_IMAGE:t.setImageElement(e.content);break;case Sn.MSG_AUDIO:t.setAudioElement(e.content);break;case Sn.MSG_FILE:t.setFileElement(e.content);break;case Sn.MSG_VIDEO:t.setVideoElement(e.content);break;case Sn.MSG_CUSTOM:t.setCustomElement(e.content);break;case Sn.MSG_GEO:t.setGEOElement(e.content);break;case Sn.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case Sn.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case Sn.MSG_FACE:t.setFaceElement(e.content);break;default:Es.warn(e.type,e.content,"no operation......")}};if(Rs(e))for(var r=0;r<e.length;r++)n(e[r]);else n(e);this._initProxy()}},{key:"setTextElement",value:function(e){var t="string"==typeof e?e:e.text,n=new oc({text:t});this._elements.push(n)}},{key:"setImageElement",value:function(e){var t=new Ap(e);this._elements.push(t)}},{key:"setAudioElement",value:function(e){var t=new Rp(e);this._elements.push(t)}},{key:"setFileElement",value:function(e){var t=new sh(e);this._elements.push(t)}},{key:"setVideoElement",value:function(e){var t=new ch(e);this._elements.push(t)}},{key:"setGEOElement",value:function(e){var t=new lh(e);this._elements.push(t)}},{key:"setCustomElement",value:function(e){var t=new uh(e);this._elements.push(t)}},{key:"setGroupTipElement",value:function(e){var t={},n=e.operationType;uu(e.memberInfoList)||n!==Sn.GRP_TIP_MBR_JOIN&&n!==Sn.GRP_TIP_MBR_KICKED_OUT?e.operatorInfo&&(t=e.operatorInfo):t=e.memberInfoList[0];var r=t,o=r.nick,i=r.avatar;ks(o)&&(this.nick=o),ks(i)&&(this.avatar=i);var a=new Lp(e);this._elements.push(a)}},{key:"setGroupSystemNoticeElement",value:function(e){var t=new bp(e);this._elements.push(t)}},{key:"setFaceElement",value:function(e){var t=new Op(e);this._elements.push(t)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setOnlineOnlyFlag",value:function(e){this._onlineOnlyFlag=e}},{key:"getOnlineOnlyFlag",value:function(){return this._onlineOnlyFlag}},{key:"_computePriority",value:function(e){if(Ns(e))return Sn.MSG_PRIORITY_NORMAL;if(ks(e)&&-1!==Object.values(ph).indexOf(e))return e;if(Ds(e)){var t=""+e;if(-1!==Object.keys(ph).indexOf(t))return ph[t]}return Sn.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,n=e.avatar;ks(t)&&(this.nick=t),ks(n)&&(this.avatar=n)}},{key:"elements",get:function(){return Es.warn("!!!Message 实例的 elements 属性即将废弃,请尽快修改。使用 type 和 payload 属性处理单条消息,兼容组合消息使用 _elements 属性!!!"),this._elements}}]),e}(),hh=function(e){return!!e&&(!!(function(e){return ks(e)&&e.slice(0,3)===Sn.CONV_C2C}(e)||function(e){return ks(e)&&e.slice(0,5)===Sn.CONV_GROUP}(e)||tu(e))||(console.warn("非法的会话 ID:".concat(e,"。会话 ID 组成方式:C2C + userID(单聊)GROUP + groupID(群聊)@TIM#SYSTEM(系统通知会话)")),!1))},dh="请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#",gh=function(e){return e.param?"".concat(e.api," ").concat(e.param," ").concat(e.desc,"。").concat(dh).concat(e.api):"".concat(e.api," ").concat(e.desc,"。").concat(dh).concat(e.api)},mh={type:"String",required:!0},vh={type:"Array",required:!0},yh={type:"Object",required:!0},_h={login:{userID:mh,userSig:mh},addToBlacklist:{userIDList:vh},on:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(console.warn(gh({api:"on",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(gh({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(gh({api:"once",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(gh({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(gh({api:"off",param:"eventName",desc:"类型必须为 String,且不能为空"})),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(console.warn(gh({api:"off",param:"handler",desc:"参数必须为 Function"})),!1):(""===e.name&&console.warn("off 接口无法为匿名函数取消监听事件。"),!0)}}],sendMessage:[Un({name:"message"},yh)],getMessageList:{conversationID:Un(Un({},mh),{},{validator:function(e){return hh(e)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e){return!(!Ns(e)&&!/^[1-9][0-9]*$/.test(e))||(console.warn(gh({api:"getMessageList",param:"count",desc:"必须为正整数"})),!1)}}},setMessageRead:{conversationID:Un(Un({},mh),{},{validator:function(e){return hh(e)}})},getConversationProfile:[Un(Un({name:"conversationID"},mh),{},{validator:function(e){return hh(e)}})],deleteConversation:[Un(Un({name:"conversationID"},mh),{},{validator:function(e){return hh(e)}})],getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:mh,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:vh},createGroup:{name:mh},joinGroup:{groupID:mh,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[Un({name:"groupID"},mh)],handleApplication:{message:yh,handleAction:mh,handleMessage:{type:"String"}},changeGroupOwner:{groupID:mh,newOwnerID:mh},updateGroupProfile:{groupID:mh,muteAllMembers:{type:"Boolean"}},dismissGroup:[Un({name:"groupID"},mh)],searchGroupByID:[Un({name:"groupID"},mh)],getGroupMemberList:{groupID:mh,offset:{type:"Number"},count:{type:"Number"}},getGroupMemberProfile:{groupID:mh,userIDList:vh,memberCustomFieldFilter:{type:"Array"}},addGroupMemeber:{groupID:mh,userIDList:vh},setGroupMemberRole:{groupID:mh,userID:mh,role:mh},setGroupMemberMuteTime:{groupID:mh,userID:mh,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:mh,userID:{type:"String"},nameCard:Un(Un({},mh),{},{validator:function(e){return!0!==/^\s+$/.test(e)}})},setMessageRemindType:{groupID:mh,messageRemindType:mh},setGroupMemberCustomField:{groupID:mh,userID:{type:"String"},memberCustomField:vh},deleteGroupMember:{groupID:mh},createTextMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){return Os(e)?ks(e.text)?0!==e.text.length||(console.warn(gh({api:"createTextMessage",desc:"消息内容不能为空"})),!1):(console.warn(gh({api:"createTextMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(gh({api:"createTextMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createTextAtMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){return Os(e)?ks(e.text)?0===e.text.length?(console.warn(gh({api:"createTextAtMessage",desc:"消息内容不能为空"})),!1):!(e.atUserList&&!Rs(e.atUserList))||(console.warn(gh({api:"createTextAtMessage",desc:"payload.atUserList 类型必须为数组"})),!1):(console.warn(gh({api:"createTextAtMessage",param:"payload.text",desc:"类型必须为 String"})),!1):(console.warn(gh({api:"createTextAtMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createCustomMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){return Os(e)?e.data&&!ks(e.data)?(console.warn(gh({api:"createCustomMessage",param:"payload.data",desc:"类型必须为 String"})),!1):e.description&&!ks(e.description)?(console.warn(gh({api:"createCustomMessage",param:"payload.description",desc:"类型必须为 String"})),!1):!(e.extension&&!ks(e.extension))||(console.warn(gh({api:"createCustomMessage",param:"payload.extension",desc:"类型必须为 String"})),!1):(console.warn(gh({api:"createCustomMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createImageMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){if(!Os(e))return console.warn(gh({api:"createImageMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ns(e.file))return console.warn(gh({api:"createImageMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(Ha){if(!(e.file instanceof HTMLInputElement||Ts(e.file)))return console.warn(gh({api:"createImageMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1;if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(gh({api:"createImageMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return Ns(e)&&console.warn(gh({api:"createImageMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}})},createAudioMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){return!!Os(e)||(console.warn(gh({api:"createAudioMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ns(e)&&console.warn(gh({api:"createAudioMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createVideoMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){if(!Os(e))return console.warn(gh({api:"createVideoMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ns(e.file))return console.warn(gh({api:"createVideoMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(Ha){if(!(e.file instanceof HTMLInputElement||Ts(e.file)))return console.warn(gh({api:"createVideoMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1;if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(gh({api:"createVideoMessage",param:"payload.file",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ns(e)&&console.warn(gh({api:"createVideoMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},createFaceMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){return Os(e)?Ds(e.index)?!!ks(e.data)||(console.warn(gh({api:"createFaceMessage",param:"payload.data",desc:"类型必须为 String"})),!1):(console.warn(gh({api:"createFaceMessage",param:"payload.index",desc:"类型必须为 Number"})),!1):(console.warn(gh({api:"createFaceMessage",param:"payload",desc:"类型必须为 plain object"})),!1)}})},createFileMessage:{to:mh,conversationType:mh,payload:Un(Un({},yh),{},{validator:function(e){if(!Os(e))return console.warn(gh({api:"createFileMessage",param:"payload",desc:"类型必须为 plain object"})),!1;if(Ns(e.file))return console.warn(gh({api:"createFileMessage",param:"payload.file",desc:"不能为 undefined"})),!1;if(Ha){if(!(e.file instanceof HTMLInputElement||Ts(e.file)))return console.warn(gh({api:"createFileMessage",param:"payload.file",desc:"类型必须是 HTMLInputElement 或 File"})),!1;if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return console.warn(gh({api:"createFileMessage",desc:"您没有选择文件,无法发送"})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return Ns(e)&&console.warn(gh({api:"createFileMessage",desc:"没有 onProgress 回调,您将无法获取上传进度"})),!0}}},revokeMessage:[Un(Un({name:"message"},yh),{},{validator:function(e){return e instanceof fh?e.conversationType===Sn.CONV_SYSTEM?(console.warn("revokeMessage 不能撤回系统会话消息,只能撤回单聊消息或群消息"),!1):!0!==e.isRevoked||(console.warn("revokeMessage 消息已经被撤回,请勿重复操作"),!1):(console.warn("revokeMessage 参数 message 必须为 Message(".concat(dh,"Message.html) 实例。")),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return Rs(e)?(0===e.length&&console.warn(gh({api:"getUserProfile",param:"userIDList",desc:"不能为空数组"})),!0):(console.warn(gh({api:"getUserProfile",param:"userIDList",desc:"必须为数组"})),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!Ns(e)||(!!Rs(e)||(console.warn(gh({api:"updateMyProfile",param:"profileCustomField",desc:"必须为数组"})),!1))}}}},Ih={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",sendMessage:"sendMessage",resendMessage:"resendMessage",getMessageList:"getMessageList",setMessageRead:"setMessageRead",revokeMessage:"revokeMessage",getConversationList:"getConversationList",getConversationProfile:"getConversationProfile",deleteConversation:"deleteConversation",getGroupList:"getGroupList",getGroupProfile:"getGroupProfile",createGroup:"createGroup",joinGroup:"joinGroup",updateGroupProfile:"updateGroupProfile",quitGroup:"quitGroup",dismissGroup:"dismissGroup",changeGroupOwner:"changeGroupOwner",searchGroupByID:"searchGroupByID",setMessageRemindType:"setMessageRemindType",handleGroupApplication:"handleGroupApplication",getGroupMemberProfile:"getGroupMemberProfile",getGroupMemberList:"getGroupMemberList",addGroupMember:"addGroupMember",deleteGroupMember:"deleteGroupMember",setGroupMemberNameCard:"setGroupMemberNameCard",setGroupMemberMuteTime:"setGroupMemberMuteTime",setGroupMemberRole:"setGroupMemberRole",setGroupMemberCustomField:"setGroupMemberCustomField",getGroupOnlineMemberCount:"getGroupOnlineMemberCount",getMyProfile:"getMyProfile",getUserProfile:"getUserProfile",updateMyProfile:"updateMyProfile",getBlacklist:"getBlacklist",addToBlacklist:"addToBlacklist",removeFromBlacklist:"removeFromBlacklist",getFriendList:"getFriendList",callExperimentalAPI:"callExperimentalAPI"},Mh=!!To&&o((function(){To.prototype.finally.call({then:function(){}},(function(){}))}));Ne({target:"Promise",proto:!0,real:!0,forced:Mh},{finally:function(e){var t=Lo(this,oe("Promise")),n="function"==typeof e;return this.then(n?function(n){return mi(t,e()).then((function(){return n}))}:e,n?function(n){return mi(t,e()).then((function(){throw n}))}:e)}}),"function"!=typeof To||To.prototype.finally||te(To.prototype,"finally",oe("Promise").prototype.finally);var Ch="1.7.3",Sh="537048168",Eh="10",Th="protobuf",Dh="json",kh=1,Ah=2,Oh=3,Rh=4,Nh={HOST:{CURRENT:{COMMON:"https://webim.tim.qq.com",PIC:"https://pic.tim.qq.com",COS:"https://yun.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com",PIC:"https://pic.tim.qq.com",COS:"https://yun.tim.qq.com"},OVERSEA_PRODUCTION:{COMMON:"https://api.im.qcloud.com",PIC:"https://api.im.qcloud.com",COS:"https://api.im.qcloud.com"},SANDBOX:{COMMON:"https://events.tim.qq.com",PIC:"https://pic.tim.qq.com",COS:"https://yun.tim.qq.com"},TEST:{COMMON:"https://test.tim.qq.com",PIC:"https://pic.tim.qq.com",COS:"https://test.tim.qq.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;e===kh?this.CURRENT=this.SANDBOX:e===Ah?this.CURRENT=this.TEST:e===Oh?this.CURRENT=this.PRODUCTION:e===Rh&&(this.CURRENT=this.OVERSEA_PRODUCTION)}},NAME:{OPEN_IM:"openim",GROUP:"group_open_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",IM_COS_MESSAGE:"im_cos_msg"},CMD:{ACCESS_LAYER:"accesslayer",LOGIN:"login",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT_ALL:"logout",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",FRIEND_ADD:"friend_add",FRIEND_GET_ALL:"friend_get_all",FRIEND_DELETE:"friend_delete",RESPONSE_PENDENCY:"friend_response",GET_PENDENCY:"pendency_get",DELETE_PENDENCY:"pendency_delete",GET_GROUP_PENDENCY:"get_pendency",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",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",GET_GROUP_INFO:"get_group_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",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",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",GET_GROUP_ROAM_MESSAGES:"group_msg_get",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",TIM_WEB_REPORT:"tim_web_report",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num"},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"}};Nh.HOST.setCurrent(Oh);var Lh={request:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",avatar:"FaceUrl",groupAtUserID:"GroupAt_Account"},response:{GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",GroupWithdrawInfoArray:"revokedInfos",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",From_AccountNick:"nick",From_AccountHeadurl:"avatar",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",GroupName:"name",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID"},ignoreKeyWord:["C2C","ID","USP"]},wh="_contextWasUpdated",bh="_contextWasReset",Ph="_a2KeyAndTinyIDUpdated",Gh="_specifiedConfigUpdated",Uh="_noticeIsSynchronizing",xh="_noticeIsSynchronized",qh="_messageSent",Fh="_syncMessageProcessing",Vh="_syncMessageFinished",jh="_receiveInstantMessage",Bh="_receiveGroupInstantMessage",Kh="_receveGroupSystemNotice",Hh="_messageRevoked",$h="_longPollGetIDFailed",zh="_longPollRequestFailed",Wh="_longPollResponseOK",Yh="_longPollKickedOut",Jh="_longPollMitipuleDeviceKickedOut",Xh="_longPollGetNewC2CNotice",Qh="_longPollGetNewGroupMessages",Zh="_longPollGetNewGroupTips",ed="_longPollGetNewGroupAtTips",td="_longPollGetNewGroupNotice",nd="_longPollGetNewFriendMessages",rd="_longPollProfileModified",od=" _longpollGroupMessageRevoked",id="_longpollC2CMessageRevoked",ad="_longpollC2CMessageReadReceipt",sd="_avlongPollRequestFailed",ud="_avlongPollResponseOK",cd="_onGroupListUpdated",ld="_loginSuccess",pd="_signLogoutExcuting",fd="_logoutSuccess",hd="_a2keyExpired",dd="_errorHasBeenDetected",gd="_onConversationListUpdated",md="_onConversationListProfileUpdated",vd="_conversationDeleted",yd="onProfileUpdated",_d="joinAVChatRoomSuccess",Id="joinAVChatRoomSuccessNoAuth",Md="_sdkStateReady",Cd="_sdkReload",Sd=it.filter,Ed=Ye("filter"),Td=lt("filter");Ne({target:"Array",proto:!0,forced:!Ed||!Td},{filter:function(e){return Sd(this,e,arguments.length>1?arguments[1]:void 0)}});var Dd=Jr.trim;function kd(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=Ad(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)}Ne({target:"String",proto:!0,forced:function(e){return o((function(){return!!Hr[e]()||"
"!="
"[e]()||Hr[e].name!==e}))}("trim")},{trim:function(){return Dd(this)}});var Ad=function(e){for(var t=!1,n=!1,r=!1,o=0;o<e.length;o++){var i=e[o];t&&/[a-zA-Z]/.test(i)&&i.toUpperCase()===i?(e=e.slice(0,o)+"-"+e.slice(o),t=!1,r=n,n=!0,o++):n&&r&&/[a-zA-Z]/.test(i)&&i.toLowerCase()===i?(e=e.slice(0,o-1)+"-"+e.slice(o-1),r=n,n=!1,t=!0):(t=i.toLowerCase()===i&&i.toUpperCase()!==i,r=n,n=i.toUpperCase()===i&&i.toLowerCase()!==i)}return e};function Od(e,t,n){var r=[],o=0,i=function e(t,n){if(++o>10)return o--,t;if(Rs(t)){var i=t.map((function(t){return As(t)?e(t,n):t}));return o--,i}if(As(t)){var a=(s=t,u=function(e,t){if(!Gs(t))return!1;if((a=t)!==kd(a)){for(var o=!0,i=0;i<Lh.ignoreKeyWord.length;i++)if(t.includes(Lh.ignoreKeyWord[i])){o=!1;break}o&&r.push(t)}var a;return Ns(n[t])?function(e){return"OPPOChannelID"===e?e:e[0].toUpperCase()+kd(e).slice(1)}(t):n[t]},c=Object.create(null),Object.keys(s).forEach((function(e){var t=u(s[e],e);t&&(c[t]=s[e])})),c);return a=nu(a,(function(t,r){return Rs(t)||As(t)?e(t,n):t})),o--,a}var s,u,c}(e,t=Un(Un({},Lh.request),t));return r.length>0&&n.innerEmitter.emit(dd,{code:$p.CONVERTOR_IRREGULAR_PARAMS,message:Jf}),i}function Rd(e,t){if(t=Un(Un({},Lh.response),t),Rs(e))return e.map((function(e){return As(e)?Rd(e,t):e}));if(As(e)){var n=(r=e,o=function(e,n){return Ns(t[n])?kd(n):t[n]},i={},Object.keys(r).forEach((function(e){i[o(r[e],e)]=r[e]})),i);return n=nu(n,(function(e){return Rs(e)||As(e)?Rd(e,t):e}))}var r,o,i}var Nd=function(){function e(t){var n=this;Ln(this,e),this.url="",this.requestData=null,this.method=t.method||"POST",this.callback=function(e){return Rd(e=t.decode(e),n._getResponseMap(t))},this._initializeServerMap(),this._initializeURL(t),this._initializeRequestData(t)}return bn(e,[{key:"_initializeServerMap",value:function(){this._serverMap=Object.create(null);var e="";for(var t in Nh.NAME)if(Object.prototype.hasOwnProperty.call(Nh.NAME,t))switch(e=Nh.NAME[t]){case Nh.NAME.PIC:this._serverMap[e]=Nh.HOST.CURRENT.PIC;break;case Nh.NAME.IM_COS_SIGN:this._serverMap[e]=Nh.HOST.CURRENT.COS;break;default:this._serverMap[e]=Nh.HOST.CURRENT.COMMON}}},{key:"_getHost",value:function(e){if(void 0!==this._serverMap[e])return this._serverMap[e];throw new Hp({code:$p.NETWORK_UNDEFINED_SERVER_NAME,message:zf})}},{key:"_initializeURL",value:function(e){var t=e.serverName,n=e.cmd,r=this._getHost(t),o="".concat(r,"/").concat(Nh.NAME_VERSION[t],"/").concat(t,"/").concat(n);o+="?".concat(this._getQueryString(e.queryString)),this.url=o}},{key:"getUrl",value:function(){return this.url.replace(/&reqtime=(\d+)/,"&reqtime=".concat(Math.ceil(+new Date/1e3)))}},{key:"_initializeRequestData",value:function(e){var t,n=e.requestData;t=this._requestDataCleaner(n),this.requestData=e.encode(t)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&Gs(n)&&null!==e[n]&&("object"!==Nn(e[n])?t[n]=e[n]:t[n]=this._requestDataCleaner.bind(this)(e[n]));return t}},{key:"_getQueryString",value:function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&("function"!=typeof e[n]?t.push("".concat(n,"=").concat(e[n])):t.push("".concat(n,"=").concat(e[n]())));return t.join("&")}},{key:"_getResponseMap",value:function(e){if(e.keyMaps&&e.keyMaps.response&&Object.keys(e.keyMaps.response).length>0)return e.keyMaps.response}}]),e}(),Ld=[].slice,wd=/MSIE .\./.test(Be),bd=function(e){return function(t,n){var r=arguments.length>2,o=r?Ld.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,o)}:t,n)}};function Pd(e){this.mixin(e)}Ne({global:!0,bind:!0,forced:wd},{setTimeout:bd(r.setTimeout),setInterval:bd(r.setInterval)}),Pd.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 Gd=function(){function e(t){Ln(this,e),Pd.mixin(this),this.tim=t}return bn(e,[{key:"isLoggedIn",value:function(){return this.tim.context.login===tc.IS_LOGIN||!!this.tim.context.a2Key}},{key:"createTransportCapsule",value:function(e){var t=this.tim.packageConfig.get(e);return t?new Nd(t):null}},{key:"request",value:function(e){var t=this.createTransportCapsule(e);return t||Es.error("unknown transport capsule, please check!",e),this.tim.connectionController.request(t)}},{key:"emitInnerEvent",value:function(e,t){this.tim.innerEmitter.emit(e,t)}},{key:"emitOuterEvent",value:function(e,t){this.tim.outerEmitter.emit(e,t)}},{key:"reset",value:function(){Es.warn(["method: IMController.reset() method must be implemented"].join())}},{key:"probeNetwork",value:function(){return this.tim.netMonitor.probe()}},{key:"getNetworkType",value:function(){return this.tim.netMonitor.getNetworkType()}},{key:"getPlatform",value:function(){return za}}]),e}(),Ud=function(){function e(t,n){Ln(this,e),this.data=t,this._innerEmitter=n,this.defaultData={},Object.assign(this.defaultData,t),this.initGetterAndSetter()}return bn(e,[{key:"initGetterAndSetter",value:function(){var e=this,t=function(t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){return e.data[t]},set:function(n){e.data[t]!==n&&(e.data[t]=n,e.onChange.bind(e)(t,n))}})};for(var n in e.data)Object.prototype.hasOwnProperty.call(e.data,n)&&t(n)}},{key:"onChange",value:function(e,t){this._innerEmitter.emit(wh,{key:e,value:t})}},{key:"reset",value:function(){for(var e in Es.log("Context.reset"),this.data)Object.prototype.hasOwnProperty.call(this.data,e)&&(this.data[e]=this.defaultData.hasOwnProperty(e)?this.defaultData[e]:null)}}]),e}(),xd=function(e){xn(n,e);var t=zn(n);function n(e){var r;Ln(this,n);var o=(r=t.call(this,e)).tim.loginInfo;return r._context=new Ud({login:tc.IS_NOT_LOGIN,SDKAppID:o.SDKAppID,appIDAt3rd:null,accountType:o.accountType,identifier:o.identifier,tinyID:null,identifierNick:o.identifierNick,userSig:o.userSig,a2Key:null,contentType:"json",apn:1,unlimitedAVChatRoom:o.unlimitedAVChatRoom,scene:o.scene,oversea:o.oversea,instanceID:o.instanceID},r.tim.innerEmitter),r._initListener(),r}return bn(n,[{key:"reset",value:function(){this._context.reset(),this.emitInnerEvent(bh)}},{key:"_initListener",value:function(){this.tim.innerEmitter.on(wh,this._onContextMemberChange,this),this.tim.innerEmitter.on(ld,this._updateA2KeyAndTinyID,this)}},{key:"_updateA2KeyAndTinyID",value:function(e){var t=e.data,n=t.a2Key,r=t.tinyID;this._context.a2Key=n,this._context.tinyID=r,this.emitInnerEvent(Ph),this.triggerReady()}},{key:"getContext",value:function(){return this._context}},{key:"_onContextMemberChange",value:function(e){var t=e.data,n=t.key,r=t.value;("tinyID"===n||"a2Key"===n)&&(r.length<=0?this._context.login=tc.IS_NOT_LOGIN:this._context.login=null!==this._context.a2Key?tc.IS_LOGIN:tc.IS_NOT_LOGIN)}}]),n}(Gd),qd=function e(t){Ln(this,e),this.code=0,this.data=t||{}},Fd=null,Vd=function(e){Fd=e},jd=function(e){return e instanceof qd?(Es.warn("IMPromise.resolve 此函数会自动用options创建IMResponse实例,调用侧不需创建,建议修改!"),Promise.resolve(e)):Promise.resolve(new qd(e))},Bd=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof Hp)return t&&null!==Fd&&Fd.emit(Cn.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new Hp({code:$p.UNCAUGHT_ERROR,message:e.message});return t&&null!==Fd&&Fd.emit(Cn.ERROR,n),Promise.reject(n)}if(Ns(e)||Ns(e.code)||Ns(e.message))Es.error("IMPromise.reject 必须指定code(错误码)和message(错误信息)!!!");else{if(Ds(e.code)&&ks(e.message)){var r=new Hp(e);return t&&null!==Fd&&Fd.emit(Cn.ERROR,r),Promise.reject(r)}Es.error("IMPromise.reject code(错误码)必须为数字,message(错误信息)必须为字符串!!!")}},Kd="sdkReady",Hd="login",$d="longpolling",zd="longpollingAV",Wd="sendMessage",Yd="sendMessageC2C",Jd="sendMessageGroupWork",Xd="sendMessageGroupPublic",Qd="sendMessageGroupMeeting",Zd="sendMessageGroupAV",eg="messageReceived",tg="messageReceivedAV",ng="initConversationList",rg="initGroupList",og="upload",ig=function(){function e(t){Ln(this,e),this.SDKAppID="",this.version="",this.tinyID="",this.userID="",this.platform="",this.method=t,this.time="",this.startts=Date.now(),this.endts=0,this.timespan=0,this.codeint=0,this.message="",this.text="",this.msgType="",this.networkType="",this.platform="",this.scene="",this._sentFlag=!1,this.instanceID="",this.host=function(){var e="unknown";if(cs&&(e="mac"),us&&(e="windows"),Za&&(e="ios"),es&&(e="android"),Ka)try{var t=$a.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(C_){}return e}(),this.mpLibVersion=function(){if(Ka)try{var e;return void 0===(e=Ba?my.getSystemInfoSync().version:$a.getSystemInfoSync().SDKVersion)?"-":e}catch(C_){return"-"}return"-"}()}return bn(e,[{key:"setCommonInfo",value:function(e){var t=e.SDKAppID,n=e.version,r=e.tinyID,o=e.userID,i=e.platform,a=e.scene,s=e.instanceID;this.SDKAppID="".concat(t),this.version="".concat(n),this.tinyID=r,this.userID=o,this.platform=i,this.scene=a,this.time=Vs(),this.instanceID=s,this.startts&&this.endts&&!this.timespan&&(this.timespan=Math.abs(this.endts-this.startts))}},{key:"setEnd",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._sentFlag||(this.endts=Date.now(),t?(this._sentFlag=!0,this._eventStatController.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatController.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.setMessage(e.message)):(this.setCode($p.NO_NETWORK),this.setMessage(Yf))),this):(Es.warn("SSOLogData.setError value not instanceof Error, please check!"),this)}},{key:"setCode",value:function(e){return Ns(e)||this._sentFlag||("ECONNABORTED"===e&&(this.codeint=103),Ds(e)?this.codeint=e:Es.warn("SSOLogData.setCode value not a number, please check!",e,Nn(e))),this}},{key:"setMessage",value:function(e){return Ns(e)||this._sentFlag?this:ks(e)?(this.message=e,this):this}},{key:"setText",value:function(e){return Ds(e)?this.text=e.toString():ks(e)&&(this.text=e),this}},{key:"setMessageType",value:function(e){return this.msgType=e,this}},{key:"setNetworkType",value:function(e){return Ns(e)?Es.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networkType=e,this}}],[{key:"bindController",value:function(t){e.prototype._eventStatController=t}}]),e}(),ag="sdkConstruct",sg="sdkReady",ug="accessLayer",cg="login",lg="logout",pg="kickedOut",fg="registerPlugin",hg="getCosAuthKey",dg="getCosPreSigUrl",gg="upload",mg="sendMessage",vg="sendComboMessage",yg="getC2CRoamingMessages",_g="getGroupRoamingMessages",Ig="revokeMessage",Mg="setC2CMessageRead",Cg="setGroupMessageRead",Sg="emptyMessageBody",Eg="getPeerReadTime",Tg="getConversationList",Dg="getConversationProfile",kg="deleteConversation",Ag="getConversationListInStorage",Og="syncConversationList",Rg="createGroup",Ng="applyJoinGroup",Lg="joinAVChatRoomSilently",wg="quitGroup",bg="searchGroupByID",Pg="changeGroupOwner",Gg="handleGroupApplication",Ug="setMessageRemindType",xg="dismissGroup",qg="updateGroupProfile",Fg="getGroupList",Vg="getGroupProfile",jg="getGroupListInStorage",Bg="getGroupLastSequence",Kg="getGroupMemberList",Hg="getGroupMemberProfile",$g="addGroupMember",zg="deleteGroupMember",Wg="setGroupMemberMuteTime",Yg="setGroupMemberNameCard",Jg="setGroupMemberRole",Xg="setGroupMemberCustomField",Qg="getGroupOnlineMemberCount",Zg="getLongPollID",em="longPollingError",tm="networkJitter",nm="sdkReload",rm="messageLoss",om="messageStacked",im="getUserProfile",am="updateMyProfile",sm="getBlacklist",um="addToBlacklist",cm="removeFromBlacklist",lm="mpHideToShow",pm="callbackFunctionError",fm="exceptionError",hm=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),!0===(r=t.call(this,e)).tim.context.oversea&&Nh.HOST.setCurrent(Rh),r._initializeListener(),r}return bn(n,[{key:"login",value:function(e){if(this.isLoggedIn()){var t="您已经登录账号".concat(e.identifier,"!如需切换账号登录,请先调用 logout 接口登出,再调用 login 接口登录。");return Es.warn(t),jd({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}Es.log("SignController.login userID=".concat(e.identifier)),Es.time(Hd);var n=this._checkLoginInfo(e);return uu(n)?(this.tim.context.identifier=e.identifier,this.tim.context.userSig=e.userSig,this.tim.context.identifier&&this.tim.context.userSig?this._accessLayer():void 0):Bd(n)}},{key:"_isLoginCurrentUser",value:function(e){return this.tim.context.identifier===e}},{key:"_initializeListener",value:function(){var e=this.tim.innerEmitter;e.on(Yh,this._onMultipleAccountKickedOut,this),e.on(Jh,this._onMultipleDeviceKickedOut,this),e.on(hd,this._onUserSigExpired,this)}},{key:"_accessLayer",value:function(){var e=this,t=new ig(ug);return Es.log("SignController._accessLayer."),this.request({name:"accessLayer",action:"query"}).then((function(n){return t.setNetworkType(e.getNetworkType()).setText(n.data.webImAccessLayer).setEnd(),Es.log("SignController._accessLayer ok. webImAccessLayer=".concat(n.data.webImAccessLayer)),e.tim.context.oversea||n.data.webImAccessLayer!==kh||Nh.HOST.setCurrent(n.data.webImAccessLayer),e._login()})).catch((function(n){return e.probeNetwork().then((function(r){var o=Wn(r,2),i=o[0],a=o[1];t.setError(n,i,a).setEnd(!0),e.tim.eventStatController.reportAtOnce()})),Es.error("SignController._accessLayer failed. error:",n),Bd(n)}))}},{key:"_login",value:function(){var e=this,t=new ig(cg);return this.request({name:"login",action:"query"}).then((function(n){var r=null;if(!n.data.tinyID)throw r=new Hp({code:$p.NO_TINYID,message:Xp}),t.setError(r,!0,e.getNetworkType()).setEnd(),r;if(!n.data.a2Key)throw r=new Hp({code:$p.NO_A2KEY,message:Qp}),t.setError(r,!0,e.getNetworkType()).setEnd(),r;return t.setNetworkType(e.getNetworkType()).setText("".concat(e.tim.loginInfo.identifier)).setEnd(),Es.log("SignController.login ok. userID=".concat(e.tim.loginInfo.identifier," loginCost=").concat(Es.timeEnd(Hd),"ms")),e.emitInnerEvent(ld,{a2Key:n.data.a2Key,tinyID:n.data.tinyID}),jd(n.data)})).catch((function(n){return e.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];t.setError(n,o,i).setEnd(!0)})),Es.error("SignController.login failed. error:",n),Bd(n)}))}},{key:"logout",value:function(){return this.isLoggedIn()?(new ig(lg).setNetworkType(this.getNetworkType()).setText("userID=".concat(this.tim.loginInfo.identifier," type=").concat("longPollLogout")).setEnd(!0),Es.info("SignController.logout"),this.emitInnerEvent(pd),this._logout(Sp).then(this._emitLogoutSuccess.bind(this)).catch(this._emitLogoutSuccess.bind(this))):Bd({code:$p.USER_NOT_LOGGED_IN,message:Zp})}},{key:"_logout",value:function(e){var t=this.tim.notificationController,n=e===Cp?"logout":"longPollLogout",r=e===Cp?{name:n,action:"query"}:{name:n,action:"query",param:{longPollID:t.getLongPollID()}};return this.request(r).catch((function(e){return Es.error("SignController._logout error:",e),Bd(e)}))}},{key:"_checkLoginInfo",value:function(e){var t=0,n="";return null===e.SDKAppID?(t=$p.NO_SDKAPPID,n=zp):null===e.accountType?(t=$p.NO_ACCOUNT_TYPE,n=Wp):null===e.identifier?(t=$p.NO_IDENTIFIER,n=Yp):null===e.userSig&&(t=$p.NO_USERSIG,n=Jp),uu(t)||uu(n)?{}:{code:t,message:n}}},{key:"_emitLogoutSuccess",value:function(){return this.emitInnerEvent(fd),jd({})}},{key:"_onMultipleAccountKickedOut",value:function(){var e=this;new ig(pg).setNetworkType(this.getNetworkType()).setText(Sn.KICKED_OUT_MULT_ACCOUNT).setEnd(!0),Es.warn("SignController._onMultipleAccountKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)),this.tim.logout().then((function(){e.emitOuterEvent(Cn.KICKED_OUT,{type:Sn.KICKED_OUT_MULT_ACCOUNT})}))}},{key:"_onMultipleDeviceKickedOut",value:function(){var e=this;new ig(pg).setNetworkType(this.getNetworkType()).setText(Sn.KICKED_OUT_MULT_DEVICE).setEnd(!0),Es.warn("SignController._onMultipleDeviceKickedOut kicked out. userID=".concat(this.tim.loginInfo.identifier)),this.tim.logout().then((function(){e.emitOuterEvent(Cn.KICKED_OUT,{type:Sn.KICKED_OUT_MULT_DEVICE})}))}},{key:"_onUserSigExpired",value:function(){new ig(pg).setNetworkType(this.getNetworkType()).setText(Sn.KICKED_OUT_USERSIG_EXPIRED).setEnd(!0),Es.warn("SignController._onUserSigExpired: userSig 签名过期被踢下线"),this.emitOuterEvent(Cn.KICKED_OUT,{type:Sn.KICKED_OUT_USERSIG_EXPIRED}),this.tim.resetSDK()}},{key:"reset",value:function(){Es.info("SignController.reset")}}]),n}(Gd),dm=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},gm=Object.prototype.toString;function mm(e){return"[object Array]"===gm.call(e)}function vm(e){return void 0===e}function ym(e){return null!==e&&"object"==typeof e}function _m(e){return"[object Function]"===gm.call(e)}function Im(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),mm(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var Mm={isArray:mm,isArrayBuffer:function(e){return"[object ArrayBuffer]"===gm.call(e)},isBuffer:function(e){return null!==e&&!vm(e)&&null!==e.constructor&&!vm(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:ym,isUndefined:vm,isDate:function(e){return"[object Date]"===gm.call(e)},isFile:function(e){return"[object File]"===gm.call(e)},isBlob:function(e){return"[object Blob]"===gm.call(e)},isFunction:_m,isStream:function(e){return ym(e)&&_m(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Im,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,o=arguments.length;r<o;r++)Im(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,o=arguments.length;r<o;r++)Im(arguments[r],n);return t},extend:function(e,t,n){return Im(t,(function(t,r){e[r]=n&&"function"==typeof t?dm(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function Cm(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Sm=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(Mm.isURLSearchParams(t))r=t.toString();else{var o=[];Mm.forEach(t,(function(e,t){null!=e&&(Mm.isArray(e)?t+="[]":e=[e],Mm.forEach(e,(function(e){Mm.isDate(e)?e=e.toISOString():Mm.isObject(e)&&(e=JSON.stringify(e)),o.push(Cm(t)+"="+Cm(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function Em(){this.handlers=[]}Em.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},Em.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Em.prototype.forEach=function(e){Mm.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Tm=Em,Dm=function(e,t,n){return Mm.forEach(n,(function(n){e=n(e,t)})),e},km=function(e){return!(!e||!e.__CANCEL__)};function Am(){throw new Error("setTimeout has not been defined")}function Om(){throw new Error("clearTimeout has not been defined")}var Rm=Am,Nm=Om;function Lm(e){if(Rm===setTimeout)return setTimeout(e,0);if((Rm===Am||!Rm)&&setTimeout)return Rm=setTimeout,setTimeout(e,0);try{return Rm(e,0)}catch(t){try{return Rm.call(null,e,0)}catch(t){return Rm.call(this,e,0)}}}"function"==typeof ms.setTimeout&&(Rm=setTimeout),"function"==typeof ms.clearTimeout&&(Nm=clearTimeout);var wm,bm=[],Pm=!1,Gm=-1;function Um(){Pm&&wm&&(Pm=!1,wm.length?bm=wm.concat(bm):Gm=-1,bm.length&&xm())}function xm(){if(!Pm){var e=Lm(Um);Pm=!0;for(var t=bm.length;t;){for(wm=bm,bm=[];++Gm<t;)wm&&wm[Gm].run();Gm=-1,t=bm.length}wm=null,Pm=!1,function(e){if(Nm===clearTimeout)return clearTimeout(e);if((Nm===Om||!Nm)&&clearTimeout)return Nm=clearTimeout,clearTimeout(e);try{Nm(e)}catch(t){try{return Nm.call(null,e)}catch(t){return Nm.call(this,e)}}}(e)}}function qm(e,t){this.fun=e,this.array=t}qm.prototype.run=function(){this.fun.apply(null,this.array)};function Fm(){}var Vm=Fm,jm=Fm,Bm=Fm,Km=Fm,Hm=Fm,$m=Fm,zm=Fm;var Wm=ms.performance||{},Ym=Wm.now||Wm.mozNow||Wm.msNow||Wm.oNow||Wm.webkitNow||function(){return(new Date).getTime()};var Jm=new Date;var Xm={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];bm.push(new qm(e,t)),1!==bm.length||Pm||Lm(xm)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Vm,addListener:jm,once:Bm,off:Km,removeListener:Hm,removeAllListeners:$m,emit:zm,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Ym.call(Wm),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Jm)/1e3}},Qm=function(e,t){Mm.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},Zm=function(e,t,n,r,o){return function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,o)},ev=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],tv=Mm.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=Mm.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},nv=Mm.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),Mm.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),Mm.isString(r)&&a.push("path="+r),Mm.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},rv=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;Mm.isFormData(r)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password||"";o.Authorization="Basic "+btoa(a+":"+s)}var u,c,l=(u=e.baseURL,c=e.url,u&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(c)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(u,c):c);if(i.open(e.method.toUpperCase(),Sm(l,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in i?function(e){var t,n,r,o={};return e?(Mm.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=Mm.trim(e.substr(0,r)).toLowerCase(),n=Mm.trim(e.substr(r+1)),t){if(o[t]&&ev.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(i.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:r,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(Zm("Request failed with status code "+n.status,n.config,null,n.request,n))}(t,n,o),i=null}},i.onabort=function(){i&&(n(Zm("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(Zm("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Zm(t,e,"ECONNABORTED",i)),i=null},Mm.isStandardBrowserEnv()){var p=nv,f=(e.withCredentials||tv(l))&&e.xsrfCookieName?p.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}if("setRequestHeader"in i&&Mm.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),Mm.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(h){if("json"!==e.responseType)throw h}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),void 0===r&&(r=null),i.send(r)}))},ov={"Content-Type":"application/x-www-form-urlencoded"};function iv(e,t){!Mm.isUndefined(e)&&Mm.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var av,sv={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==Xm&&"[object process]"===Object.prototype.toString.call(Xm))&&(av=rv),av),transformRequest:[function(e,t){return Qm(t,"Accept"),Qm(t,"Content-Type"),Mm.isFormData(e)||Mm.isArrayBuffer(e)||Mm.isBuffer(e)||Mm.isStream(e)||Mm.isFile(e)||Mm.isBlob(e)?e:Mm.isArrayBufferView(e)?e.buffer:Mm.isURLSearchParams(e)?(iv(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Mm.isObject(e)?(iv(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};sv.headers={common:{Accept:"application/json, text/plain, */*"}},Mm.forEach(["delete","get","head"],(function(e){sv.headers[e]={}})),Mm.forEach(["post","put","patch"],(function(e){sv.headers[e]=Mm.merge(ov)}));var uv=sv;function cv(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var lv=function(e){return cv(e),e.headers=e.headers||{},e.data=Dm(e.data,e.headers,e.transformRequest),e.headers=Mm.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Mm.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||uv.adapter)(e).then((function(t){return cv(e),t.data=Dm(t.data,t.headers,e.transformResponse),t}),(function(t){return km(t)||(cv(e),t&&t.response&&(t.response.data=Dm(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},pv=function(e,t){t=t||{};var n={},r=["url","method","params","data"],o=["headers","auth","proxy"],i=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];Mm.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),Mm.forEach(o,(function(r){Mm.isObject(t[r])?n[r]=Mm.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:Mm.isObject(e[r])?n[r]=Mm.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),Mm.forEach(i,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var a=r.concat(o).concat(i),s=Object.keys(t).filter((function(e){return-1===a.indexOf(e)}));return Mm.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n};function fv(e){this.defaults=e,this.interceptors={request:new Tm,response:new Tm}}fv.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=pv(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[lv,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},fv.prototype.getUri=function(e){return e=pv(this.defaults,e),Sm(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Mm.forEach(["delete","get","head","options"],(function(e){fv.prototype[e]=function(t,n){return this.request(Mm.merge(n||{},{method:e,url:t}))}})),Mm.forEach(["post","put","patch"],(function(e){fv.prototype[e]=function(t,n,r){return this.request(Mm.merge(r||{},{method:e,url:t,data:n}))}}));var hv=fv;function dv(e){this.message=e}dv.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},dv.prototype.__CANCEL__=!0;var gv=dv;function mv(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new gv(e),t(n.reason))}))}mv.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},mv.source=function(){var e;return{token:new mv((function(t){e=t})),cancel:e}};var vv=mv;function yv(e){var t=new hv(e),n=dm(hv.prototype.request,t);return Mm.extend(n,hv.prototype,t),Mm.extend(n,t),n}var _v=yv(uv);_v.Axios=hv,_v.create=function(e){return yv(pv(_v.defaults,e))},_v.Cancel=gv,_v.CancelToken=vv,_v.isCancel=km,_v.all=function(e){return Promise.all(e)},_v.spread=function(e){return function(t){return e.apply(null,t)}};var Iv=_v,Mv=_v;Iv.default=Mv;var Cv=Iv,Sv=Cv.create({timeout:3e4,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});Sv.interceptors.response.use((function(e){var t=e.data,n=t.error_code,r=t.ErrorCode;return Ds(n)&&(r=n),r!==ec.SUCCESS&&(e.data.ErrorCode=Number(r)),e}),(function(e){return"Network Error"===e.message&&(!0===Sv.defaults.withCredentials&&Es.warn("Network Error, try to close `IMAxios.defaults.withCredentials` to false. (IMAxios.js)"),Sv.defaults.withCredentials=!1),Promise.reject(e)}));var Ev=function(){function e(){Ln(this,e)}return bn(e,[{key:"request",value:function(e){console.warn("请注意: ConnectionBase.request() 方法必须被派生类重写:")}},{key:"_checkOptions",value:function(e){if(!1==!!e.url)throw new Hp({code:$p.NETWORK_BASE_OPTIONS_NO_URL,message:$f})}},{key:"_initOptions",value:function(e){e.method=["POST","GET","PUT","DELETE","OPTION"].indexOf(e.method)>=0?e.method:"POST",e.dataType=e.dataType||"json",e.responseType=e.responseType||"json"}}]),e}(),Tv=function(e){xn(n,e);var t=zn(n);function n(){var e;return Ln(this,n),(e=t.call(this)).retry=2,e}return bn(n,[{key:"request",value:function(e){return this._checkOptions(e),this._initOptions(e),this._requestWithRetry({url:e.url,data:e.data,method:e.method})}},{key:"_requestWithRetry",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Sv(e).catch((function(r){return t.retry&&n<t.retry?t._requestWithRetry(e,++n):Bd(new Hp({code:r.code||"",message:r.message||""}))}))}}]),n}(Ev),Dv=function(e){xn(n,e);var t=zn(n);function n(){var e;return Ln(this,n),(e=t.call(this)).retry=2,e._request=e.promisify($a.request),e}return bn(n,[{key:"request",value:function(e){return this._checkOptions(e),this._initOptions(e),e=Un(Un({},e),{},{responseType:"text"}),this._requestWithRetry(e)}},{key:"_requestWithRetry",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._request(e).then(this._handleResolve).catch((function(r){if(ks(r.errMsg)){if(r.errMsg.includes("abort"))return jd({});if(r.errMsg.includes("timeout"))return t.retry>0&&n<t.retry?t._requestWithRetry(e,++n):Bd(new Hp({code:$p.NETWORK_TIMEOUT,message:r.errMsg}));if(r.errMsg.includes("fail"))return t.retry>0&&n<t.retry?t._requestWithRetry(e,++n):Bd(new Hp({code:$p.NETWORK_ERROR,message:r.errMsg}))}return Bd(new Hp(Un({code:$p.UNCAUGHT_ERROR,message:r.message},r)))}))}},{key:"_handleResolve",value:function(e){var t=e.data,n=t.error_code,r=t.ErrorCode;return Ds(n)&&(r=n),r!==ec.SUCCESS&&(e.data.ErrorCode=Number("".concat(r))),e}},{key:"promisify",value:function(e){return function(t){return new Promise((function(n,r){var o=e(Object.assign({},t,{success:n,fail:r}));t.updateAbort&&t.updateAbort((function(){o&&ws(o.abort)&&o.abort()}))}))}}}]),n}(Ev),kv=function(){function e(){Ln(this,e),this.request=0,this.success=0,this.fail=0,this.reportRate=10,this.requestTimeCost=[]}return bn(e,[{key:"report",value:function(){if(1!==this.request){if(this.request%this.reportRate!=0)return null;var e=this.avgRequestTime(),t="runLoop reports: success=".concat(this.success,",fail=").concat(this.fail,",total=").concat(this.request,",avg=").concat(e,",cur=").concat(this.requestTimeCost[this.requestTimeCost.length-1],",max=").concat(Math.max.apply(null,this.requestTimeCost),",min=").concat(Math.min.apply(null,this.requestTimeCost));Es.log(t)}}},{key:"setRequestTime",value:function(e,t){var n=Math.abs(t-e);100===this.requestTimeCost.length&&this.requestTimeCost.shift(),this.requestTimeCost.push(n)}},{key:"avgRequestTime",value:function(){for(var e,t=this.requestTimeCost.length,n=0,r=0;r<t;r++)n+=this.requestTimeCost[r];return e=n/t,Math.round(100*e)/100}}]),e}(),Av=Cv.create({timeout:6e3,headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}});Av.interceptors.response.use((function(e){var t=e.data,n=t.error_code,r=t.ErrorCode;return Ds(n)&&(r=n),r!==ec.SUCCESS&&(e.data.ErrorCode=Number(r)),e}),(function(e){return"Network Error"===e.message&&(!0===Av.defaults.withCredentials&&Es.warn("Network Error, try to close `IMAxiosAVChatroom.defaults.withCredentials` to false. (IMAxiosAVChatroom.js)"),Av.defaults.withCredentials=!1),Promise.reject(e)}));var Ov=Cv.CancelToken,Rv=function(){function e(t){Ln(this,e),this._initializeOptions(t),this._initializeMembers(),this.status=new kv}return bn(e,[{key:"destructor",value:function(){clearTimeout(this._seedID);var e=this._index();for(var t in this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=null);return e}},{key:"setIndex",value:function(e){this._index=e}},{key:"getIndex",value:function(){return this._index}},{key:"isRunning",value:function(){return!this._stoped}},{key:"_initializeOptions",value:function(e){this.options=e}},{key:"_initializeMembers",value:function(){this._index=-1,this._seedID=0,this._requestStatus=!1,this._stoped=!1,this._intervalTime=0,this._intervalIncreaseStep=1e3,this._intervalDecreaseStep=1e3,this._intervalTimeMax=5e3,this._protectTimeout=3e3,this._getNoticeSeq=this.options.getNoticeSeq,this._retryCount=0,this._responseTime=Date.now(),this._responseTimeThreshold=2e3,this.options.isAVChatRoomLoop?this.requestor=Av:this.requestor=Sv,Es.log("XHRRunLoop._initializeMembers isAVChatRoomLoop=".concat(!!this.options.isAVChatRoomLoop)),this.abort=null}},{key:"start",value:function(){0===this._seedID?(this._stoped=!1,this._send()):Es.log('XHRRunLoop.start(), XHRRunLoop is running now, if you want to restart runLoop , please run "stop()" first.')}},{key:"_reset",value:function(){Es.log("XHRRunLoop._reset(), reset long poll _intervalTime",this._intervalTime),this.stop(),this.start()}},{key:"_intervalTimeIncrease",value:function(){this._intervalTime!==this._responseTimeThreshold&&(this._intervalTime<this._responseTimeThreshold&&(this._intervalTime+=this._intervalIncreaseStep),this._intervalTime>this._responseTimeThreshold&&(this._intervalTime=this._responseTimeThreshold))}},{key:"_intervalTimeDecrease",value:function(){0!==this._intervalTime&&(this._intervalTime>0&&(this._intervalTime-=this._intervalDecreaseStep),this._intervalTime<0&&(this._intervalTime=0))}},{key:"_intervalTimeAdjustment",value:function(){var e=Date.now();100*Math.floor((e-this._responseTime)/100)<=this._responseTimeThreshold?this._intervalTimeIncrease():this._intervalTimeDecrease(),this._responseTime=e}},{key:"_intervalTimeAdjustmentBaseOnResponseData",value:function(e){e.ErrorCode===ec.SUCCESS?this._intervalTimeDecrease():this._intervalTimeIncrease()}},{key:"_send",value:function(){var e=this;if(!0!==this._requestStatus){this._requestStatus=!0,this.status.request++,"function"==typeof this.options.before&&this.options.before(this.options.pack.requestData);var t=Date.now(),n=0;this.requestor.request({url:this.options.pack.getUrl(),data:this.options.pack.requestData,method:this.options.pack.method,cancelToken:new Ov((function(t){e.abort=t}))}).then((function(r){if(e._intervalTimeAdjustmentBaseOnResponseData.bind(e)(r.data),e._retryCount>0&&(e._retryCount=0),e.status.success++,n=Date.now(),e.status.setRequestTime(t,n),r.data.timecost=n-t,"function"==typeof e.options.success)try{e.options.success({pack:e.options.pack,error:!1,data:e.options.pack.callback(r.data)})}catch(o){Es.warn("XHRRunLoop._send(), error:",o)}e._requestStatus=!1,!1===e._stoped&&(e._seedID=setTimeout(e._send.bind(e),e._intervalTime)),e.status.report()})).catch((function(r){if(e.status.fail++,e._retryCount++,e._intervalTimeAdjustment.bind(e)(),!1===e._stoped&&(e._seedID=setTimeout(e._send.bind(e),e._intervalTime)),e._requestStatus=!1,"function"==typeof e.options.fail&&void 0!==r.request)try{e.options.fail({pack:e.options.pack,error:r,data:!1})}catch(o){Es.warn("XHRRunLoop._send(), fail callback error:",o),Es.error(o)}n=Date.now(),e.status.setRequestTime(t,n),e.status.report()}))}}},{key:"stop",value:function(){this._clearAllTimeOut(),this._stoped=!0}},{key:"_clearAllTimeOut",value:function(){clearTimeout(this._seedID),this._seedID=0}}]),e}(),Nv=function(){function e(t){Ln(this,e),this._initializeOptions(t),this._initializeMembers(),this.status=new kv}return bn(e,[{key:"destructor",value:function(){clearTimeout(this._seedID);var e=this._index();for(var t in this)Object.prototype.hasOwnProperty.call(this,t)&&(this[t]=null);return e}},{key:"setIndex",value:function(e){this._index=e}},{key:"isRunning",value:function(){return!this._stoped}},{key:"getIndex",value:function(){return this._index}},{key:"_initializeOptions",value:function(e){this.options=e}},{key:"_initializeMembers",value:function(){this._index=-1,this._seedID=0,this._requestStatus=!1,this._stoped=!1,this._intervalTime=0,this._intervalIncreaseStep=1e3,this._intervalDecreaseStep=1e3,this._intervalTimeMax=5e3,this._protectTimeout=3e3,this._getNoticeSeq=this.options.getNoticeSeq,this._retryCount=0,this._responseTime=Date.now(),this._responseTimeThreshold=2e3,this.requestor=new Dv,this.abort=null}},{key:"start",value:function(){0===this._seedID?(this._stoped=!1,this._send()):Es.log('WXRunLoop.start(): WXRunLoop is running now, if you want to restart runLoop , please run "stop()" first.')}},{key:"_reset",value:function(){Es.log("WXRunLoop.reset(), long poll _intervalMaxRate",this._intervalMaxRate),this.stop(),this.start()}},{key:"_intervalTimeIncrease",value:function(){this._intervalTime!==this._responseTimeThreshold&&(this._intervalTime<this._responseTimeThreshold&&(this._intervalTime+=this._intervalIncreaseStep),this._intervalTime>this._responseTimeThreshold&&(this._intervalTime=this._responseTimeThreshold))}},{key:"_intervalTimeDecrease",value:function(){0!==this._intervalTime&&(this._intervalTime>0&&(this._intervalTime-=this._intervalDecreaseStep),this._intervalTime<0&&(this._intervalTime=0))}},{key:"_intervalTimeAdjustment",value:function(){var e=Date.now();100*Math.floor((e-this._responseTime)/100)<=this._responseTimeThreshold?this._intervalTimeIncrease():this._intervalTimeDecrease(),this._responseTime=e}},{key:"_intervalTimeAdjustmentBaseOnResponseData",value:function(e){e.ErrorCode===ec.SUCCESS?this._intervalTimeDecrease():this._intervalTimeIncrease()}},{key:"_send",value:function(){var e=this;if(!0!==this._requestStatus){var t=this;this._requestStatus=!0,this.status.request++,"function"==typeof this.options.before&&this.options.before(t.options.pack.requestData);var n=Date.now(),r=0;this.requestor.request({url:t.options.pack.getUrl(),data:t.options.pack.requestData,method:t.options.pack.method,updateAbort:function(t){e.abort=t}}).then((function(o){if(t._intervalTimeAdjustmentBaseOnResponseData.bind(e)(o.data),t._retryCount>0&&(t._retryCount=0),e.status.success++,r=Date.now(),e.status.setRequestTime(n,r),o.data.timecost=r-n,"function"==typeof t.options.success)try{e.options.success({pack:e.options.pack,error:!1,data:e.options.pack.callback(o.data)})}catch(i){Es.warn("WXRunLoop._send(), error:",i)}t._requestStatus=!1,!1===t._stoped&&(t._seedID=setTimeout(t._send.bind(t),t._intervalTime)),e.status.report()})).catch((function(o){if(e.status.fail++,t._retryCount++,t._intervalTimeAdjustment.bind(e)(),!1===t._stoped&&(t._seedID=setTimeout(t._send.bind(t),t._intervalTime)),t._requestStatus=!1,"function"==typeof t.options.fail)try{e.options.fail({pack:e.options.pack,error:o,data:!1})}catch(i){Es.warn("WXRunLoop._send(), fail callback error:",i),Es.error(i)}r=Date.now(),e.status.setRequestTime(n,r),e.status.report()}))}}},{key:"stop",value:function(){this._clearAllTimeOut(),this._stoped=!0}},{key:"_clearAllTimeOut",value:function(){clearTimeout(this._seedID),this._seedID=0}}]),e}(),Lv=function(){function e(t){Ln(this,e),this.tim=t,this.httpConnection=Ka?new Dv:new Tv,this.keepAliveConnections=[]}return bn(e,[{key:"initializeListener",value:function(){this.tim.innerEmitter.on(pd,this._stopAllRunLoop,this)}},{key:"request",value:function(e){var t={url:e.url,data:e.requestData,method:e.method,callback:e.callback};return this.httpConnection.request(t).then((function(t){return t.data=e.callback(t.data),t.data.errorCode!==ec.SUCCESS?Bd(new Hp({code:t.data.errorCode,message:t.data.errorInfo||t.data.errorMsg})):t}))}},{key:"createRunLoop",value:function(e){var t=this.createKeepAliveConnection(e);return t.setIndex(this.keepAliveConnections.push(t)-1),t}},{key:"stopRunLoop",value:function(e){e.stop()}},{key:"_stopAllRunLoop",value:function(){for(var e=this.keepAliveConnections.length,t=0;t<e;t++)this.keepAliveConnections[t].stop()}},{key:"destroyRunLoop",value:function(e){e.stop();var t=e.destructor();this.keepAliveConnections.slice(t,1)}},{key:"startRunLoopExclusive",value:function(e){for(var t=e.getIndex(),n=0;n<this.keepAliveConnections.length;n++)n!==t&&this.keepAliveConnections[n].stop();e.start()}},{key:"createKeepAliveConnection",value:function(e){return Ka?new Nv(e):(this.tim.options.runLoopNetType===Mp||this.tim.options.runLoopNetType,new Rv(e))}},{key:"clearAll",value:function(){this.conn.cancelAll()}},{key:"reset",value:function(){this.keepAliveConnections=[]}}]),e}(),wv=function(){function e(t){Ln(this,e),this.tim=t,this.tim.innerEmitter.on(dd,this._onErrorDetected,this)}return bn(e,[{key:"_onErrorDetected",value:function(e){var t=e.data;new ig(fm).setText("code=".concat(t.code," message=").concat(t.message)).setNetworkType(this.tim.netMonitor.getNetworkType()).setEnd(),t.code?Es.warn("Oops! code:".concat(t.code," message:").concat(t.message)):Es.warn("Oops! message:".concat(t.message," stack:").concat(t.stack)),this.tim.outerEmitter.emit(Cn.ERROR,t)}}]),e}(),bv=function(){function e(t){var n=this;Ln(this,e),uu(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||Sn.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||Sn.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],uu(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return bn(e,[{key:"validate",value:function(e){var t=!0,n="";if(uu(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var r=e.profileCustomField.length,o=null,i=0;i<r;i++){if(o=e.profileCustomField[i],!ks(o.key)||-1===o.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"自定义资料字段的前缀必须是 Tag_Profile_Custom"};if(!ks(o.value))return{valid:!1,tips:"自定义资料字段的 value 必须是字符串"}}for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if("profileCustomField"===a)continue;if(uu(e[a])&&!ks(e[a])&&!Ds(e[a])){n="key:"+a+", invalid value:"+e[a],t=!1;continue}switch(a){case"nick":ks(e[a])||(n="nick should be a string",t=!1),js(e[a])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(js(e[a])," bytes"),t=!1);break;case"gender":$s(Tp,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":Ds(e.birthday)||(n="birthday should be a number",t=!1);break;case"location":ks(e.location)||(n="location should be a string",t=!1);break;case"selfSignature":ks(e.selfSignature)||(n="selfSignature should be a string",t=!1);break;case"allowType":$s(kp,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":Ds(e.language)||(n="language should be a number",t=!1);break;case"avatar":ks(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":$s(Dp,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":Ds(e.level)||(n="level should be a number",t=!1);break;case"role":Ds(e.role)||(n="role should be a number",t=!1);break;default:n="unknown key:"+a+" "+e[a],t=!1}}return{valid:t,tips:n}}}]),e}(),Pv=function(){function e(t){Ln(this,e),this.userController=t,this.TAG="profile",this.Actions={Q:"query",U:"update"},this.accountProfileMap=new Map,this.expirationTime=864e5}return bn(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n=e.userIDList;e.fromAccount=this.userController.getMyAccount(),n.length>100&&(Es.warn("ProfileHandler.getUserProfile 获取用户资料人数不能超过100人"),n.length=100);for(var r,o=[],i=[],a=0,s=n.length;a<s;a++)r=n[a],this.userController.isMyFriend(r)&&this._containsAccount(r)?i.push(this._getProfileFromMap(r)):o.push(r);if(0===o.length)return jd(i);e.toAccount=o;var u=e.bFromGetMyProfile||!1,c=[];e.toAccount.forEach((function(e){c.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=c;var l=new ig(im);l.setText(n.length>5?"userIDList.length=".concat(n.length):"userIDList=".concat(n));var p=this.userController.generateConfig(this.TAG,this.Actions.Q,e);return this.userController.request(p).then((function(e){l.setNetworkType(t.userController.getNetworkType()).setEnd(),Es.info("ProfileHandler.getUserProfile ok");var n=t._handleResponse(e).concat(i);return u?(t.userController.onGotMyProfile(),new qd(n[0])):new qd(n)})).catch((function(e){return t.userController.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];l.setError(e,r,o).setEnd()})),Es.error("ProfileHandler.getUserProfile error:",e),Bd(e)}))}},{key:"getMyProfile",value:function(){var e=this.userController.getMyAccount();if(Es.log("ProfileHandler.getMyProfile myAccount="+e),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return Es.debug("ProfileHandler.getMyProfile from cache, myProfile:"+JSON.stringify(t)),this.userController.onGotMyProfile(),jd(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){for(var t,n,r=xs.now(),o=e.data.userProfileItem,i=[],a=0,s=o.length;a<s;a++)"@TLS#NOT_FOUND"!==o[a].to&&""!==o[a].to&&(t=o[a].to,n=this._updateMap(t,this._getLatestProfileFromResponse(t,o[a].profileItem)),i.push(n));return Es.log("ProfileHandler._handleResponse cost "+(xs.now()-r)+" ms"),i}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={};if(n.userID=e,n.profileCustomField=[],!uu(t))for(var r=0,o=t.length;r<o;r++)if(t[r].tag.indexOf("Tag_Profile_Custom")>-1)n.profileCustomField.push({key:t[r].tag,value:t[r].value});else switch(t[r].tag){case Ep.NICK:n.nick=t[r].value;break;case Ep.GENDER:n.gender=t[r].value;break;case Ep.BIRTHDAY:n.birthday=t[r].value;break;case Ep.LOCATION:n.location=t[r].value;break;case Ep.SELFSIGNATURE:n.selfSignature=t[r].value;break;case Ep.ALLOWTYPE:n.allowType=t[r].value;break;case Ep.LANGUAGE:n.language=t[r].value;break;case Ep.AVATAR:n.avatar=t[r].value;break;case Ep.MESSAGESETTINGS:n.messageSettings=t[r].value;break;case Ep.ADMINFORBIDTYPE:n.adminForbidType=t[r].value;break;case Ep.LEVEL:n.level=t[r].value;break;case Ep.ROLE:n.role=t[r].value;break;default:Es.warn("ProfileHandler._handleResponse unkown tag->",t[r].tag,t[r].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n=new ig(am);n.setText(JSON.stringify(e));var r=(new bv).validate(e);if(!r.valid)return n.setCode($p.UPDATE_PROFILE_INVALID_PARAM).setMessage("ProfileHandler.updateMyProfile info:".concat(r.tips)).setNetworkType(this.userController.getNetworkType()).setEnd(),Es.error("ProfileHandler.updateMyProfile info:".concat(r.tips,",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")),Bd({code:$p.UPDATE_PROFILE_INVALID_PARAM,message:Vf});var o=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&("profileCustomField"===i?e.profileCustomField.forEach((function(e){o.push({tag:e.key,value:e.value})})):o.push({tag:Ep[i.toUpperCase()],value:e[i]}));if(0===o.length)return n.setCode($p.UPDATE_PROFILE_NO_KEY).setMessage(jf).setNetworkType(this.userController.getNetworkType()).setEnd(),Es.error("ProfileHandler.updateMyProfile info:".concat(jf,",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#updateMyProfile")),Bd({code:$p.UPDATE_PROFILE_NO_KEY,message:jf});var a=this.userController.generateConfig(this.TAG,this.Actions.U,{fromAccount:this.userController.getMyAccount(),profileItem:o});return this.userController.request(a).then((function(r){n.setNetworkType(t.userController.getNetworkType()).setEnd(),Es.info("ProfileHandler.updateMyProfile ok");var o=t._updateMap(t.userController.getMyAccount(),e);return t.userController.emitOuterEvent(Cn.PROFILE_UPDATED,[o]),jd(o)})).catch((function(e){return t.userController.probeNetwork().then((function(t){var r=Wn(t,2),o=r[0],i=r[1];n.setError(e,o,i).setEnd()})),Es.error("ProfileHandler.updateMyProfile error:",e),Bd(e)}))}},{key:"onProfileModified",value:function(e){var t=e.data;if(!uu(t)){var n,r,o=t.length;Es.info("ProfileHandler.onProfileModified length="+o);for(var i=[],a=0;a<o;a++)n=t[a].userID,r=this._updateMap(n,this._getLatestProfileFromResponse(n,t[a].profileList)),i.push(r);this.userController.emitInnerEvent(yd,i),this.userController.emitOuterEvent(Cn.PROFILE_UPDATED,i)}}},{key:"_fillMap",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,r=e.length;n<r;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);Es.log("ProfileHandler._fillMap from cache, map.size="+this.accountProfileMap.size)}}},{key:"_updateMap",value:function(e,t){var n,r=Date.now();return this._containsAccount(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&Js(n.profileCustomField,t.profileCustomField),qs(n,t,["profileCustomField"]),n.lastUpdatedTime=r):(n=new bv(t),(this.userController.isMyFriend(e)||e===this.userController.getMyAccount())&&(n.lastUpdatedTime=r,this.accountProfileMap.set(e,n))),this._flushMap(e===this.userController.getMyAccount()),n}},{key:"_flushMap",value:function(e){var t=Yn(this.accountProfileMap.values()),n=this.userController.tim.storage;Es.debug("ProfileHandler._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.userController.tim.storage.getItem(this.TAG);return uu(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,r,o=[],i=0,a=e.length;i<a;i++)n=(t=e[i]).userID,this.userController.isMyFriend(n)&&(this._containsAccount(n)?(r=this._getProfileFromMap(n),qs(r,t)>0&&o.push(n)):o.push(t.userID));0!==o.length&&(Es.info("ProfileHandler.onConversationsProfileUpdated toAccount:",o),this.getUserProfile({userIDList:o}))}},{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}();Ne({target:"String",proto:!0},{repeat:Lr});var Gv=function(){function e(t){Ln(this,e),this.options=t?t.options:{enablePointer:!0},this.pointsList={},this.reportText={},this.maxNameLen=0,this.gapChar="-",this.log=console.log,this.currentTask=""}return bn(e,[{key:"newTask",value:function(e){!1!==this.options.enablePointer&&(e||(e=["task",this._timeFormat()].join("-")),this.pointsList[e]=[],this.currentTask=e,console.log("Pointer new Task : ".concat(this.currentTask)))}},{key:"deleteTask",value:function(e){!1!==this.options.enablePointer&&(e||(e=this.currentTask),this.pointsList[e].length=0,delete this.pointsList[e])}},{key:"dot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!1!==this.options.enablePointer){t=t||this.currentTask;var n=+new Date;this.maxNameLen=this.maxNameLen<e.length?e.length:this.maxNameLen,this.flen=this.maxNameLen+10,this.pointsList[t].push({pointerName:e,time:n})}}},{key:"_analisys",value:function(e){if(!1!==this.options.enablePointer){e=e||this.currentTask;for(var t=this.pointsList[e],n=t.length,r=[],o=[],i=0;i<n;i++)0!==i&&(o=this._analisysTowPoints(t[i-1],t[i]),r.push(o.join("")));return o=this._analisysTowPoints(t[0],t[n-1],!0),r.push(o.join("")),r.join("")}}},{key:"_analisysTowPoints",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!1!==this.options.enablePointer){var r=this.flen,o=t.time-e.time,i=o.toString(),a=e.pointerName+this.gapChar.repeat(r-e.pointerName.length),s=t.pointerName+this.gapChar.repeat(r-t.pointerName.length),u=this.gapChar.repeat(4-i.length)+i,c=n?["%c",a,s,u,"ms\n%c"]:[a,s,u,"ms\n"];return c}}},{key:"report",value:function(e){if(!1!==this.options.enablePointer){e=e||this.currentTask;var t=this._analisys(e);this.pointsList=[];var n=this._timeFormat(),r="Pointer[".concat(e,"(").concat(n,")]"),o=4*this.maxNameLen,i=(o-r.length)/2;console.log(["-".repeat(i),r,"-".repeat(i)].join("")),console.log("%c"+t,"color:#66a","color:red","color:#66a"),console.log("-".repeat(o))}}},{key:"_timeFormat",value:function(){var e=new Date,t=this.zeroFix(e.getMonth()+1,2),n=this.zeroFix(e.getDate(),2);return"".concat(t,"-").concat(n," ").concat(e.getHours(),":").concat(e.getSeconds(),":").concat(e.getMinutes(),"~").concat(e.getMilliseconds())}},{key:"zeroFix",value:function(e,t){return("000000000"+e).slice(-t)}},{key:"reportAll",value:function(){if(!1!==this.options.enablePointer)for(var e in this.pointsList)Object.prototype.hasOwnProperty.call(this.pointsList,e)&&this.eport(e)}}]),e}(),Uv=function e(t,n){Ln(this,e),this.userID=t;var r={};if(r.userID=t,!uu(n))for(var o=0,i=n.length;o<i;o++)switch(n[o].tag){case Ep.NICK:r.nick=n[o].value;break;case Ep.GENDER:r.gender=n[o].value;break;case Ep.BIRTHDAY:r.birthday=n[o].value;break;case Ep.LOCATION:r.location=n[o].value;break;case Ep.SELFSIGNATURE:r.selfSignature=n[o].value;break;case Ep.ALLOWTYPE:r.allowType=n[o].value;break;case Ep.LANGUAGE:r.language=n[o].value;break;case Ep.AVATAR:r.avatar=n[o].value;break;case Ep.MESSAGESETTINGS:r.messageSettings=n[o].value;break;case Ep.ADMINFORBIDTYPE:r.adminForbidType=n[o].value;break;case Ep.LEVEL:r.level=n[o].value;break;case Ep.ROLE:r.role=n[o].value;break;default:Es.debug("snsProfileItem unkown tag->",n[o].tag)}this.profile=new bv(r)},xv=function(){function e(t){Ln(this,e),this.userController=t,this.TAG="friend",this.Actions={G:"get",D:"delete"},this.friends=new Map,this.pointer=new Gv}return bn(e,[{key:"isMyFriend",value:function(e){var t=this.friends.has(e);return t||Es.debug("FriendHandler.isMyFriend "+e+" is not my friend"),t}},{key:"_transformFriendList",value:function(e){if(!uu(e)&&!uu(e.infoItem)){Es.info("FriendHandler._transformFriendList friendNum="+e.friendNum);for(var t,n,r=e.infoItem,o=0,i=r.length;o<i;o++)n=r[o].infoAccount,t=new Uv(n,r[o].snsProfileItem),this.friends.set(n,t)}}},{key:"_friends2map",value:function(e){var t=new Map;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.set(n,e[n]);return t}},{key:"getFriendList",value:function(){var e=this,t={};t.fromAccount=this.userController.getMyAccount(),Es.info("FriendHandler.getFriendList myAccount="+t.fromAccount);var n=this.userController.generateConfig(this.TAG,this.Actions.G,t);return this.userController.request(n).then((function(t){Es.info("FriendHandler.getFriendList ok"),e._transformFriendList(t.data);var n=Yn(e.friends.values());return jd(n)})).catch((function(e){return Es.error("FriendHandler.getFriendList error:",e),Bd(e)}))}},{key:"deleteFriend",value:function(e){if(!Array.isArray(e.toAccount))return Es.error("FriendHandler.deleteFriend options.toAccount 必需是数组"),Bd({code:$p.DEL_FRIEND_INVALID_PARAM,message:Ff});e.toAccount.length>1e3&&(Es.warn("FriendHandler.deleteFriend 删除好友人数不能超过1000人"),e.toAccount.length=1e3);var t=this.userController.generateConfig(this.TAG,this.Actions.D,e);return this.userController.request(t).then((function(e){return Es.info("FriendHandler.deleteFriend ok"),jd()})).catch((function(e){return Es.error("FriendHandler.deleteFriend error:",e),Bd(e)}))}}]),e}(),qv=function e(t){Ln(this,e),uu||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)},Fv=function(){function e(t){Ln(this,e),this.userController=t,this.TAG="blacklist",this.Actions={G:"get",C:"create",D:"delete"},this.blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.curruentSequence=0}return bn(e,[{key:"getBlacklist",value:function(){var e=this,t={};t.fromAccount=this.userController.getMyAccount(),t.maxLimited=this.maxLimited,t.startIndex=0,t.lastSequence=this.curruentSequence;var n=new ig(sm),r=this.userController.generateConfig(this.TAG,this.Actions.G,t);return this.userController.request(r).then((function(t){var r=uu(t.data.blackListItem)?0:t.data.blackListItem.length;return n.setNetworkType(e.userController.getNetworkType()).setText(r).setEnd(),Es.info("BlacklistHandler.getBlacklist ok"),e.curruentSequence=t.data.curruentSequence,e._handleResponse(t.data.blackListItem,!0),e._onBlacklistUpdated()})).catch((function(t){return e.userController.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];n.setError(t,o,i).setEnd()})),Es.error("BlacklistHandler.getBlacklist error:",t),Bd(t)}))}},{key:"addBlacklist",value:function(e){var t=this,n=new ig(um);if(!Rs(e.userIDList))return n.setCode($p.ADD_BLACKLIST_INVALID_PARAM).setMessage("BlacklistHandler.addBlacklist options.userIDList 必需是数组").setNetworkType(this.userController.getNetworkType()).setEnd(),Es.error("BlacklistHandler.addBlacklist options.userIDList 必需是数组"),Bd({code:$p.ADD_BLACKLIST_INVALID_PARAM,message:Bf});var r=this.userController.tim.loginInfo.identifier;if(1===e.userIDList.length&&e.userIDList[0]===r)return n.setCode($p.CANNOT_ADD_SELF_TO_BLACKLIST).setMessage(Hf).setNetworkType(this.userController.getNetworkType()).setEnd(),Es.error("BlacklistHandler.addBlacklist 不能把自己拉黑"),Bd({code:$p.CANNOT_ADD_SELF_TO_BLACKLIST,message:Hf});e.userIDList.includes(r)&&(e.userIDList=e.userIDList.filter((function(e){return e!==r})),Es.warn("BlacklistHandler.addBlacklist 不能把自己拉黑,已过滤")),e.fromAccount=this.userController.getMyAccount(),e.toAccount=e.userIDList;var o=this.userController.generateConfig(this.TAG,this.Actions.C,e);return this.userController.request(o).then((function(r){return n.setNetworkType(t.userController.getNetworkType()).setText(e.userIDList.length>5?"userIDList.length=".concat(e.userIDList.length):"userIDList=".concat(e.userIDList)).setEnd(),Es.info("BlacklistHandler.addBlacklist ok"),t._handleResponse(r.data.resultItem,!0),t._onBlacklistUpdated()})).catch((function(e){return t.userController.probeNetwork().then((function(t){var r=Wn(t,2),o=r[0],i=r[1];n.setError(e,o,i).setEnd()})),Es.error("BlacklistHandler.addBlacklist error:",e),Bd(e)}))}},{key:"_handleResponse",value:function(e,t){if(!uu(e))for(var n,r,o,i=0,a=e.length;i<a;i++)r=e[i].to,o=e[i].resultCode,(Ns(o)||0===o)&&(t?((n=this.blacklistMap.has(r)?this.blacklistMap.get(r):new qv).userID=r,!uu(e[i].addBlackTimeStamp)&&(n.timeStamp=e[i].addBlackTimeStamp),this.blacklistMap.set(r,n)):this.blacklistMap.has(r)&&(n=this.blacklistMap.get(r),this.blacklistMap.delete(r)));Es.log("BlacklistHandler._handleResponse total="+this.blacklistMap.size+" bAdd="+t)}},{key:"deleteBlacklist",value:function(e){var t=this,n=new ig(cm);if(!Rs(e.userIDList))return n.setCode($p.DEL_BLACKLIST_INVALID_PARAM).setMessage("BlacklistHandler.deleteBlacklist options.userIDList 必需是数组").setNetworkType(this.userController.getNetworkType()).setEnd(),Es.error("BlacklistHandler.deleteBlacklist options.userIDList 必需是数组"),Bd({code:$p.DEL_BLACKLIST_INVALID_PARAM,message:Kf});e.fromAccount=this.userController.getMyAccount(),e.toAccount=e.userIDList;var r=this.userController.generateConfig(this.TAG,this.Actions.D,e);return this.userController.request(r).then((function(r){return n.setNetworkType(t.userController.getNetworkType()).setText(e.userIDList.length>5?"userIDList.length=".concat(e.userIDList.length):"userIDList=".concat(e.userIDList)).setEnd(),Es.info("BlacklistHandler.deleteBlacklist ok"),t._handleResponse(r.data.resultItem,!1),t._onBlacklistUpdated()})).catch((function(e){return t.userController.probeNetwork().then((function(t){var r=Wn(t,2),o=r[0],i=r[1];n.setError(e,o,i).setEnd()})),Es.error("BlacklistHandler.deleteBlacklist error:",e),Bd(e)}))}},{key:"_onBlacklistUpdated",value:function(){var e=Yn(this.blacklistMap.keys());return this.userController.emitOuterEvent(Cn.BLACKLIST_UPDATED,e),jd(e)}},{key:"handleBlackListDelAccount",value:function(e){for(var t,n=[],r=0,o=e.length;r<o;r++)t=e[r],this.blacklistMap.has(t)&&(this.blacklistMap.delete(t),n.push(t));n.length>0&&(Es.log("BlacklistHandler.handleBlackListDelAccount delCount="+n.length+" : "+n.join(",")),this.userController.emitOuterEvent(Cn.BLACKLIST_UPDATED,Yn(this.blacklistMap.keys())))}},{key:"handleBlackListAddAccount",value:function(e){for(var t,n=[],r=0,o=e.length;r<o;r++)t=e[r],this.blacklistMap.has(t)||(this.blacklistMap.set(t,new qv({userID:t})),n.push(t));n.length>0&&(Es.log("BlacklistHandler.handleBlackListAddAccount addCount="+n.length+" : "+n.join(",")),this.userController.emitOuterEvent(Cn.BLACKLIST_UPDATED,Yn(this.blacklistMap.keys())))}},{key:"reset",value:function(){this.blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.curruentSequence=0}}]),e}(),Vv=function(){function e(t){Ln(this,e),this.userController=t,this.TAG="applyC2C",this.Actions={C:"create",G:"get",D:"delete",U:"update"}}return bn(e,[{key:"applyAddFriend",value:function(e){var t=this,n=this.userController.generateConfig(this.TAG,this.Actions.C,e),r=this.userController.request(n);return r.then((function(e){t.userController.isActionSuccessful("applyAddFriend",t.Actions.C,e)})).catch((function(e){})),r}},{key:"getPendency",value:function(e){var t=this,n=this.userController.generateConfig(this.TAG,this.Actions.G,e),r=this.userController.request(n);return r.then((function(e){t.userController.isActionSuccessful("getPendency",t.Actions.G,e)})).catch((function(e){})),r}},{key:"deletePendency",value:function(e){var t=this,n=this.userController.generateConfig(this.TAG,this.Actions.D,e),r=this.userController.request(n);return r.then((function(e){t.userController.isActionSuccessful("deletePendency",t.Actions.D,e)})).catch((function(e){})),r}},{key:"replyPendency",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.userController.generateConfig(this.TAG,this.Actions.U,t),r=this.userController.request(n);return r.then((function(t){e.userController.isActionSuccessful("replyPendency",e.Actions.U,t)})).catch((function(e){})),r}}]),e}(),jv=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).profileHandler=new Pv(Hn(r)),r.friendHandler=new xv(Hn(r)),r.blacklistHandler=new Fv(Hn(r)),r.applyC2CHandler=new Vv(Hn(r)),r._initializeListener(),r}return bn(n,[{key:"_initializeListener",value:function(e){var t=this.tim.innerEmitter;t.on(Ph,this.onContextUpdated,this),t.on(rd,this.onProfileModified,this),t.on(nd,this.onNewFriendMessages,this),t.on(md,this.onConversationsProfileUpdated,this)}},{key:"onContextUpdated",value:function(e){var t=this.tim.context;!1!=!!t.a2Key&&!1!=!!t.tinyID&&(this.profileHandler.getMyProfile(),this.friendHandler.getFriendList(),this.blacklistHandler.getBlacklist())}},{key:"onGotMyProfile",value:function(){this.triggerReady()}},{key:"onProfileModified",value:function(e){this.profileHandler.onProfileModified(e)}},{key:"onNewFriendMessages",value:function(e){Es.debug("onNewFriendMessages",JSON.stringify(e.data)),uu(e.data.blackListDelAccount)||this.blacklistHandler.handleBlackListDelAccount(e.data.blackListDelAccount),uu(e.data.blackListAddAccount)||this.blacklistHandler.handleBlackListAddAccount(e.data.blackListAddAccount)}},{key:"onConversationsProfileUpdated",value:function(e){this.profileHandler.onConversationsProfileUpdated(e.data)}},{key:"getMyAccount",value:function(){return this.tim.context.identifier}},{key:"isMyFriend",value:function(e){return this.friendHandler.isMyFriend(e)}},{key:"generateConfig",value:function(e,t,n){return{name:e,action:t,param:n}}},{key:"getMyProfile",value:function(){return this.profileHandler.getMyProfile()}},{key:"getUserProfile",value:function(e){return this.profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this.profileHandler.updateMyProfile(e)}},{key:"getFriendList",value:function(){return this.friendHandler.getFriendList()}},{key:"deleteFriend",value:function(e){return this.friendHandler.deleteFriend(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this.profileHandler.getNickAndAvatarByUserID(e)}},{key:"getBlacklist",value:function(){return this.blacklistHandler.getBlacklist()}},{key:"addBlacklist",value:function(e){return this.blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this.blacklistHandler.deleteBlacklist(e)}},{key:"applyAddFriend",value:function(e){return this.applyC2CHandler.applyAddFriend(e)}},{key:"getPendency",value:function(e){return this.applyC2CHandler.getPendency(e)}},{key:"deletePendency",value:function(e){return this.applyC2CHandler.deletePendency(e)}},{key:"replyPendency",value:function(e){return this.applyC2CHandler.replyPendency(e)}},{key:"reset",value:function(){Es.info("UserController.reset"),this.resetReady(),this.profileHandler.reset(),this.blacklistHandler.reset(),this.checkTimes=0}}]),n}(Gd),Bv=[],Kv=Bv.sort,Hv=o((function(){Bv.sort(void 0)})),$v=o((function(){Bv.sort(null)})),zv=at("sort");Ne({target:"Array",proto:!0,forced:Hv||!$v||!zv},{sort:function(e){return void 0===e?Kv.call(we(this)):Kv.call(we(this),et(e))}});var Wv=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers"],Yv=function(){function e(t){Ln(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:""},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.groupCustomField=[],this.muteAllMembers=void 0,this._initGroup(t)}return bn(e,[{key:"_initGroup",value:function(e){for(var t in e)Wv.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),this[t]=e[t]):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(e){var t=JSON.parse(JSON.stringify(e));t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),Ns(t.muteAllMembers)||("On"===t.muteAllMembers?t.muteAllMembers=!0:t.muteAllMembers=!1),t.groupCustomField&&Js(this.groupCustomField,t.groupCustomField),Ns(t.memberNum)||(this.memberCount=t.memberNum),Ns(t.maxMemberNum)||(this.maxMemberCount=t.maxMemberNum),qs(this,t,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum"])}},{key:"updateSelfInfo",value:function(e){var t=e.nameCard,n=e.joinTime,r=e.role,o=e.messageRemindType;qs(this.selfInfo,{nameCard:t,joinTime:n,role:r,messageRemindType:o},[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}},{key:"memberNum",set:function(e){},get:function(){return Es.warn("!!!v2.8.0起弃用memberNum,请使用 memberCount"),this.memberCount}},{key:"maxMemberNum",set:function(e){},get:function(){return Es.warn("!!!v2.8.0起弃用maxMemberNum,请使用 maxMemberCount"),this.maxMemberCount}}]),e}(),Jv=function(e,t){if(Ns(t))return"";switch(e){case Sn.MSG_TEXT:return t.text;case Sn.MSG_IMAGE:return"[图片]";case Sn.MSG_GEO:return"[位置]";case Sn.MSG_AUDIO:return"[语音]";case Sn.MSG_VIDEO:return"[视频]";case Sn.MSG_FILE:return"[文件]";case Sn.MSG_CUSTOM:return"[自定义消息]";case Sn.MSG_GRP_TIP:return"[群提示消息]";case Sn.MSG_GRP_SYS_NOTICE:return"[群系统通知]";case Sn.MSG_FACE:return"[动画表情]";default:return""}},Xv=function(e){return Ns(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1}:e instanceof fh?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Jv(e.type,e.payload),payload:e.payload||null,type:e.type||null,isRevoked:!1}:Un(Un({},e),{},{isRevoked:!1,messageForShow:Jv(e.type,e.payload)})},Qv=function(){function e(t){Ln(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Xv(t.lastMessage),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this._initProfile(t)}return bn(e,[{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}})),Ns(this.userProfile)&&this.type===Sn.CONV_C2C?this.userProfile=new bv({userID:e.conversationID.replace("C2C","")}):Ns(this.groupProfile)&&this.type===Sn.CONV_GROUP&&(this.groupProfile=new Yv({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e,t){Ns(e)||(Zs(this.subType)||eu(this.subType)?this.unreadCount=0:t&&this.type===Sn.CONV_GROUP?this.unreadCount=e:this.unreadCount=this.unreadCount+e)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Xv(e)}},{key:"updateGroupAtInfoList",value:function(e){var t,n=(Jn(t=e.groupAtType)||Xn(t)||Qn(t)||er()).slice(0);-1!==n.indexOf(Sn.CONV_AT_ME)&&-1!==n.indexOf(Sn.CONV_AT_ALL)&&(n=[Sn.CONV_AT_ALL_AT_ME]);var r={from:e.from,groupID:e.groupID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(r),Es.debug("Conversation.updateGroupAtInfoList conversationID=".concat(this.conversationID),this.groupAtInfoList)}},{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===Sn.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===Sn.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"toAccount",get:function(){return this.conversationID.replace("C2C","").replace("GROUP","")}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}}]),e}(),Zv=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).pagingStatus=rc.NOT_START,r.pagingTimeStamp=0,r.conversationMap=new Map,r.tempGroupList=[],r.tempGroupAtTipsList=[],r._initListeners(),r}return bn(n,[{key:"hasLocalConversationMap",value:function(){return this.conversationMap.size>0}},{key:"_createLocalConversation",value:function(e){return this.conversationMap.has(e)?this.conversationMap.get(e):(Es.log("ConversationController._createLocalConversation conversationID:".concat(e)),new Qv({conversationID:e,type:e.slice(0,3)===Sn.CONV_C2C?Sn.CONV_C2C:Sn.CONV_GROUP}))}},{key:"hasLocalConversation",value:function(e){return this.conversationMap.has(e)}},{key:"getConversationList",value:function(){var e=this;Es.log("ConversationController.getConversationList."),this.pagingStatus===rc.REJECTED&&(Es.log("ConversationController.getConversationList. continue to sync conversationList"),this._syncConversationList());var t=new ig(Tg);return this.request({name:"conversation",action:"query"}).then((function(n){var r=n.data.conversations,o=void 0===r?[]:r,i=e._getConversationOptions(o);return e._updateLocalConversationList(i,!0),e._setStorageConversationList(),e._handleC2CPeerReadTime(),t.setText(o.length).setNetworkType(e.getNetworkType()).setEnd(),Es.log("ConversationController.getConversationList ok."),jd({conversationList:e.getLocalConversationList()})})).catch((function(n){return e.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];t.setError(n,o,i).setEnd()})),Es.error("ConversationController.getConversationList error:",n),Bd(n)}))}},{key:"_syncConversationList",value:function(){var e=this,t=new ig(Og);return this.pagingStatus===rc.NOT_START&&this.conversationMap.clear(),this._autoPagingSyncConversationList().then((function(n){return e.pagingStatus=rc.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),t.setText("".concat(e.conversationMap.size)).setNetworkType(e.getNetworkType()).setEnd(),n})).catch((function(n){return e.pagingStatus=rc.REJECTED,t.setText(e.pagingTimeStamp),e.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];t.setError(n,o,i).setEnd()})),Bd(n)}))}},{key:"_autoPagingSyncConversationList",value:function(){var e=this;return this.pagingStatus=rc.PENDING,this.request({name:"conversation",action:"pagingQuery",param:{fromAccount:this.tim.context.identifier,timeStamp:this.pagingTimeStamp,orderType:1}}).then((function(t){var n=t.data,r=n.completeFlag,o=n.conversations,i=void 0===o?[]:o,a=n.timeStamp;if(Es.log("ConversationController._autoPagingSyncConversationList completeFlag=".concat(r," nums=").concat(i.length)),i.length>0){var s=e._getConversationOptions(i);e._updateLocalConversationList(s,!0)}if(e._isReady)e._emitConversationUpdate();else{if(!e.isLoggedIn())return jd();e.triggerReady()}return e.pagingTimeStamp=a,1!==r?e._autoPagingSyncConversationList():(e._handleGroupAtTipsList(),jd())})).catch((function(t){throw e.isLoggedIn()&&(e._isReady||(Es.warn("ConversationController._autoPagingSyncConversationList failed. error:".concat(Fs(t))),e.triggerReady())),t}))}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=this.tim.messageController,n=tr(this.conversationMap);try{for(n.s();!(e=n.n()).done;){var r=Wn(e.value,2),o=r[0],i=r[1];i.type===Sn.CONV_C2C&&(Es.debug("ConversationController._handleC2CPeerReadTime",o,i.peerReadTime),t.recordPeerReadTime(o,i.peerReadTime))}}catch(a){n.e(a)}finally{n.f()}}},{key:"getConversationProfile",value:function(e){var t=this,n=this.conversationMap.has(e)?this.conversationMap.get(e):this._createLocalConversation(e);if(n._isInfoCompleted||n.type===Sn.CONV_SYSTEM)return jd({conversation:n});var r=new ig(Dg);return Es.log("ConversationController.getConversationProfile. conversationID:".concat(e," lastMessage:"),n.lastMessage),this._updateUserOrGroupProfileCompletely(n).then((function(n){return r.setNetworkType(t.getNetworkType()).setText("conversationID=".concat(e," unreadCount=").concat(n.data.conversation.unreadCount)).setEnd(),Es.log("ConversationController.getConversationProfile ok. conversationID:",e),n})).catch((function(n){return t.probeNetwork().then((function(t){var o=Wn(t,2),i=o[0],a=o[1];r.setError(n,i,a).setText("conversationID=".concat(e)).setEnd()})),Es.error("ConversationController.getConversationProfile error:",n),Bd(n)}))}},{key:"deleteConversation",value:function(e){var t=this,n={};if(!this.conversationMap.has(e)){var r=new Hp({code:$p.CONVERSATION_NOT_FOUND,message:Cf});return Bd(r)}switch(this.conversationMap.get(e).type){case Sn.CONV_C2C:n.type=1,n.toAccount=e.replace(Sn.CONV_C2C,"");break;case Sn.CONV_GROUP:n.type=2,n.toGroupID=e.replace(Sn.CONV_GROUP,"");break;case Sn.CONV_SYSTEM:return this.tim.groupController.deleteGroupSystemNotice({messageList:this.tim.messageController.getLocalMessageList(e)}),this.deleteLocalConversation(e),jd({conversationID:e});default:var o=new Hp({code:$p.CONVERSATION_UN_RECORDED_TYPE,message:Ef});return Bd(o)}var i=new ig(kg);return i.setText("conversationID=".concat(e)),Es.log("ConversationController.deleteConversation. conversationID=".concat(e)),this.tim.setMessageRead({conversationID:e}).then((function(){return t.request({name:"conversation",action:"delete",param:n})})).then((function(){return i.setNetworkType(t.getNetworkType()).setEnd(),Es.log("ConversationController.deleteConversation ok."),t.deleteLocalConversation(e),jd({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];i.setError(e,r,o).setEnd()})),Es.error("ConversationController.deleteConversation error:",e),Bd(e)}))}},{key:"getLocalConversationList",value:function(){return Yn(this.conversationMap.values())}},{key:"getLocalConversation",value:function(e){return this.conversationMap.get(e)}},{key:"_initLocalConversationList",value:function(){var e=new ig(Ag);Es.time(ng),Es.log("ConversationController._initLocalConversationList.");var t=this._getStorageConversationList();if(t){for(var n=t.length,r=0;r<n;r++)this.conversationMap.set(t[r].conversationID,new Qv(t[r]));this._emitConversationUpdate(!0,!1),e.setNetworkType(this.getNetworkType()).setText(n).setEnd()}else e.setNetworkType(this.getNetworkType()).setText(0).setEnd();this._syncConversationList()}},{key:"_getStorageConversationList",value:function(){return this.tim.storage.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.tim.storage.setItem("conversationMap",e)}},{key:"_initListeners",value:function(){var e=this;this.tim.innerEmitter.once(Ph,this._initLocalConversationList,this),this.tim.innerEmitter.on(qh,this._onSendOrReceiveMessage,this),this.tim.innerEmitter.on(Fh,this._handleSyncMessages,this),this.tim.innerEmitter.on(Vh,this._handleSyncMessages,this),this.tim.innerEmitter.on(jh,this._onSendOrReceiveMessage,this),this.tim.innerEmitter.on(Bh,this._onSendOrReceiveMessage,this),this.tim.innerEmitter.on(Kh,this._onSendOrReceiveMessage,this),this.tim.innerEmitter.on(cd,this._onGroupListUpdated,this),this.tim.innerEmitter.on(yd,this._updateConversationUserProfile,this),this.tim.innerEmitter.on(Hh,this._onMessageRevoked,this),this.tim.innerEmitter.on(ed,this._onReceiveGroupAtTips,this),this.ready((function(){e.tempGroupList.length>0&&(e._updateConversationGroupProfile(e.tempGroupList),e.tempGroupList.length=0)}))}},{key:"_onGroupListUpdated",value:function(e){this._updateConversationGroupProfile(e.data)}},{key:"_updateConversationGroupProfile",value:function(e){var t=this;Rs(e)&&0===e.length||(this.hasLocalConversationMap()?(e.forEach((function(e){var n="GROUP".concat(e.groupID);if(t.conversationMap.has(n)){var r=t.conversationMap.get(n);r.groupProfile=e,r.lastMessage.lastSequence<e.nextMessageSeq&&(r.lastMessage.lastSequence=e.nextMessageSeq-1),r.subType||(r.subType=e.type)}})),this._emitConversationUpdate(!0,!1)):this.tempGroupList=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:"updateUserProfileSpecifiedKey",value:function(e){Es.log("ConversationController.updateUserProfileSpecifiedKey options:",e);var t=e.conversationID,n=e.nick,r=e.avatar;if(this.conversationMap.has(t)){var o=this.conversationMap.get(t).userProfile;ks(n)&&o.nick!==n&&(o.nick=n),ks(r)&&o.avatar!==r&&(o.avatar=r),this._emitConversationUpdate(!0,!1)}}},{key:"_onMessageRevoked",value:function(e){var t=this,n=e.data;if(0!==n.length){var r=null,o=!1;n.forEach((function(e){(r=t.conversationMap.get(e.conversationID))&&r.isLastMessageRevoked(e)&&(o=!0,r.setLastMessageRevoked(!0))})),o&&this._emitConversationUpdate(!0,!1)}}},{key:"_onReceiveGroupAtTips",value:function(e){var t=this,n=e.data,r=null;n.forEach((function(e){e.groupAtTips?r=e.groupAtTips:e.elements&&(r=e.elements),r.__random=e.random,r.__sequence=e.clientSequence,t.tempGroupAtTipsList.push(r)})),Es.debug("ConversationController._onReceiveGroupAtTips isReady=".concat(this._isReady),this.tempGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this.tempGroupAtTipsList.length){var t=!1;this.tempGroupAtTipsList.forEach((function(n){var r=n.groupID;if(n.from!==e.tim.context.identifier){var o=e.conversationMap.get("".concat(Sn.CONV_GROUP).concat(r));o&&(o.updateGroupAtInfoList(n),t=!0)}})),t&&this._emitConversationUpdate(!0,!1),this.tempGroupAtTipsList.length=0}}},{key:"deleteGroupAtTips",value:function(e){Es.log("ConversationController.deleteGroupAtTips");var t=this.conversationMap.get(e);if(!t)return Promise.resolve();var n=t.groupAtInfoList;if(0===n.length)return Promise.resolve();var r=this.tim.context.identifier;return this.request({name:"conversation",action:"deleteGroupAtTips",param:{messageListToDelete:n.map((function(e){return{from:e.from,to:r,messageSeq:e.__sequence,messageRandom:e.__random,groupID:e.groupID}}))}}).then((function(){return Es.log("ConversationController.deleteGroupAtTips ok. nums=".concat(n.length)),t.clearGroupAtInfoList(),Promise.resolve()})).catch((function(e){return Es.error("ConversationController.deleteGroupAtTips error:",e),Bd(e)}))}},{key:"_handleSyncMessages",value:function(e){this._onSendOrReceiveMessage(e,!0)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.data.eventDataList;this._isReady?0!==r.length&&(this._getPeerReadTime(r),this._updateLocalConversationList(r,!1,n),this._setStorageConversationList(),this._emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e,n)}))}},{key:"_getPeerReadTime",value:function(e){var t=this,n=[];e.forEach((function(e){t.conversationMap.has(e.conversationID)||e.type!==Sn.CONV_C2C||n.push(e.conversationID.replace(Sn.CONV_C2C,""))})),n.length>0&&(Es.debug("ConversationController._getPeerReadTime userIDList:".concat(n)),this.tim.messageController.getPeerReadTime(n))}},{key:"_updateLocalConversationList",value:function(e,t,n){var r;r=this._updateTempConversations(e,t,n),this.conversationMap=new Map(this._sortConversations([].concat(Yn(r.conversations),Yn(this.conversationMap)))),t||this._updateUserOrGroupProfile(r.newerConversations)}},{key:"_updateTempConversations",value:function(e,t,n){for(var r=[],o=[],i=0,a=e.length;i<a;i++){var s=new Qv(e[i]),u=this.conversationMap.get(s.conversationID);if(this.conversationMap.has(s.conversationID)){var c=["unreadCount","allowType","adminForbidType","payload"];n&&c.push("lastMessage"),qs(u,s,c,[null,void 0,"",0,NaN]),u.updateUnreadCount(s.unreadCount,t),n||(u.lastMessage.payload=e[i].lastMessage.payload),this.conversationMap.delete(u.conversationID),r.push([u.conversationID,u])}else{if(s.type===Sn.CONV_GROUP){var l=s.groupProfile.groupID,p=this.tim.groupController.getLocalGroupProfile(l);p&&(s.groupProfile=p,s.updateUnreadCount(0))}o.push(s),r.push([s.conversationID,s])}}return{conversations:r,newerConversations:o}}},{key:"_sortConversations",value:function(e){return e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime}))}},{key:"_updateUserOrGroupProfile",value:function(e){var t=this;if(0!==e.length){var n=[],r=[];e.forEach((function(e){if(e.type===Sn.CONV_C2C)n.push(e.toAccount);else if(e.type===Sn.CONV_GROUP){var o=e.toAccount;t.tim.groupController.hasLocalGroup(o)?e.groupProfile=t.tim.groupController.getLocalGroupProfile(o):r.push(o)}})),n.length>0&&this.tim.getUserProfile({userIDList:n}).then((function(e){var n=e.data;Rs(n)?n.forEach((function(e){t.conversationMap.get("C2C".concat(e.userID)).userProfile=e})):t.conversationMap.get("C2C".concat(n.userID)).userProfile=n})),r.length>0&&this.tim.groupController.getGroupProfileAdvance({groupIDList:r,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 r=t.conversationMap.get(n);qs(r.groupProfile,e,[],[null,void 0,"",0,NaN]),!r.subType&&e.type&&(r.subType=e.type)}}))}))}}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===Sn.CONV_C2C?this.tim.getUserProfile({userIDList:[e.toAccount]}).then((function(n){var r=n.data;return 0===r.length?Bd(new Hp({code:$p.USER_OR_GROUP_NOT_FOUND,message:Sf})):(e.userProfile=r[0],e._isInfoCompleted=!0,t._unshiftConversation(e),jd({conversation:e}))})):this.tim.getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),jd({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Qv&&!this.conversationMap.has(e.conversationID)&&(this.conversationMap=new Map([[e.conversationID,e]].concat(Yn(this.conversationMap))),this._setStorageConversationList(),this._emitConversationUpdate(!0,!1))}},{key:"deleteLocalConversation",value:function(e){this.conversationMap.delete(e),this._setStorageConversationList(),this.emitInnerEvent(vd,e),this._emitConversationUpdate(!0,!1)}},{key:"_getConversationOptions",value:function(e){var t=[],n=e.filter((function(e){var t=e.lastMsg;return Os(t)})).map((function(e){if(1===e.type){var n={userID:e.userID,nick:e.c2CNick,avatar:e.c2CImage};return t.push(n),{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},userProfile:new bv(n),peerReadTime:e.c2cPeerReadTime}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:{lastTime:e.time,lastSequence:e.messageReadSeq+e.unreadCount,fromAccount:e.msgGroupFromAccount,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},groupProfile:new Yv({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0}}));return t.length>0&&this.emitInnerEvent(md,t),n}},{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=Yn(this.conversationMap.values());t&&this.emitInnerEvent(gd,n),e&&this.emitOuterEvent(Cn.CONVERSATION_LIST_UPDATED,n)}},{key:"_conversationMapTreeShaking",value:function(e){var t=this,n=new Map(Yn(this.conversationMap));e.forEach((function(e){return n.delete(e.conversationID)})),n.has(Sn.CONV_SYSTEM)&&n.delete(Sn.CONV_SYSTEM);var r=this.tim.groupController.getJoinedAVChatRoom();r&&r.forEach((function(e){n.delete("".concat(Sn.CONV_GROUP).concat(e))})),Yn(n.keys()).forEach((function(e){return t.conversationMap.delete(e)}))}},{key:"reset",value:function(){this.pagingStatus=rc.NOT_START,this.pagingTimeStamp=0,this.conversationMap.clear(),this.tempGroupAtTipsList.length=0,this.resetReady(),this.tim.innerEmitter.once(Ph,this._initLocalConversationList,this)}}]),n}(Gd),ey=1..toFixed,ty=Math.floor,ny=function(e,t,n){return 0===t?n:t%2==1?ny(e,t-1,n*e):ny(e*e,t/2,n)},ry=ey&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!o((function(){ey.call({})}));Ne({target:"Number",proto:!0,forced:ry},{toFixed:function(e){var t,n,r,o,i=function(e){if("number"!=typeof e&&"Number"!=p(e))throw TypeError("Incorrect invocation");return+e}(this),a=se(e),s=[0,0,0,0,0,0],u="",c="0",l=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*s[n],s[n]=r%1e7,r=ty(r/1e7)},f=function(e){for(var t=6,n=0;--t>=0;)n+=s[t],s[t]=ty(n/e),n=n%e*1e7},h=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==s[e]){var n=String(s[e]);t=""===t?n:t+Lr.call("0",7-n.length)+n}return t};if(a<0||a>20)throw RangeError("Incorrect fraction digits");if(i!=i)return"NaN";if(i<=-1e21||i>=1e21)return String(i);if(i<0&&(u="-",i=-i),i>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(i*ny(2,69,1))-69)<0?i*ny(2,-t,1):i/ny(2,t,1),n*=4503599627370496,(t=52-t)>0){for(l(0,n),r=a;r>=7;)l(1e7,0),r-=7;for(l(ny(10,r,1),0),r=t-1;r>=23;)f(1<<23),r-=23;f(1<<r),l(1,1),f(2),c=h()}else l(0,n),l(1<<-t,0),c=h()+Lr.call("0",a);return c=a>0?u+((o=c.length)<=a?"0."+Lr.call("0",a-o)+c:c.slice(0,o-a)+"."+c.slice(o-a)):u+c}});var oy=[].push,iy=Math.min,ay=!o((function(){return!RegExp(4294967295,"y")}));va("split",2,(function(e,t,n){var r;return r="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 r=String(d(this)),o=void 0===n?4294967295:n>>>0;if(0===o)return[];if(void 0===e)return[r];if(!sa(e))return t.call(r,e,o);for(var i,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,p=new RegExp(e.source,c+"g");(i=ta.call(p,r))&&!((a=p.lastIndex)>l&&(u.push(r.slice(l,i.index)),i.length>1&&i.index<r.length&&oy.apply(u,i.slice(1)),s=i[0].length,l=a,u.length>=o));)p.lastIndex===i.index&&p.lastIndex++;return l===r.length?!s&&p.test("")||u.push(""):u.push(r.slice(l)),u.length>o?u.slice(0,o):u}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var o=d(this),i=null==t?void 0:t[e];return void 0!==i?i.call(t,o,n):r.call(String(o),t,n)},function(e,o){var i=n(r,e,this,o,r!==t);if(i.done)return i.value;var a=D(e),s=String(this),u=Lo(a,RegExp),c=a.unicode,l=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(ay?"y":"g"),p=new u(ay?a:"^(?:"+a.source+")",l),f=void 0===o?4294967295:o>>>0;if(0===f)return[];if(0===s.length)return null===Ia(p,s)?[s]:[];for(var h=0,d=0,g=[];d<s.length;){p.lastIndex=ay?d:0;var m,v=Ia(p,ay?s:s.slice(d));if(null===v||(m=iy(ce(p.lastIndex+(ay?0:d)),s.length))===h)d=_a(s,d,c);else{if(g.push(s.slice(h,d)),g.length===f)return g;for(var y=1;y<=v.length-1;y++)if(g.push(v[y]),g.length===f)return g;d=h=m}}return g.push(s.slice(h)),g}]}),!ay);var sy,uy=T.f,cy="".startsWith,ly=Math.min,py=la("startsWith"),fy=!(py||(sy=uy(String.prototype,"startsWith"),!sy||sy.writable));Ne({target:"String",proto:!0,forced:!fy&&!py},{startsWith:function(e){var t=String(d(this));ua(e);var n=ce(ly(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return cy?cy.call(t,r,n):t.slice(n,n+r.length)===r}});var hy=function(){function e(t){if(Ln(this,e),void 0===t)throw new Hp({code:$p.MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS,message:rf});if(void 0===t.tim)throw new Hp({code:$p.MESSAGE_LIST_CONSTRUCTOR_NEED_OPTIONS,message:"".concat(rf,".tim")});this.list=new Map,this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map,this.tim=t.tim,this._initializeOptions(t)}return bn(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:"_initializeOptions",value:function(e){this.options={};var t={memory:{maxDatasPerKey:100,maxBytesPerData:256,maxKeys:0},cache:{maxDatasPerKey:10,maxBytesPerData:256,maxKeys:0}};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(void 0===e[n]){this.options[n]=t[n];continue}var r=t[n];for(var o in r)if(Object.prototype.hasOwnProperty.call(r,o)){if(void 0===e[n][o]){this.options[n][o]=r[o];continue}this.options[n][o]=e[n][o]}}}},{key:"pushIn",value:function(e){var t=e.conversationID,n=e.ID,r=!0;return this.list.has(t)||this.list.set(t,new Map),this.list.has(t)&&this.list.get(t).has(n)?r=!1:(this.list.get(t).set(n,e),this._setLatestMessageSentByPeer(t,e),this._setLatestMessageSentByMe(t,e)),r}},{key:"unshift",value:function(e){var t;if(Rs(e)?e.length>0&&(t=e[0].conversationID,this._unshiftMultipleMessages(e)):(t=e.conversationID,this._unshiftSingleMessage(e)),t&&t.startsWith(Sn.CONV_C2C)){var n=Array.from(this.list.get(t).values()),r=n.length;if(0===r)return;for(var o=r-1;o>=0;o--)if("out"===n[o].flow){this._setLatestMessageSentByMe(t,n[o]);break}for(var i=r-1;i>=0;i--)if("in"===n[i].flow){this._setLatestMessageSentByPeer(t,n[i]);break}}}},{key:"_unshiftSingleMessage",value:function(e){var t=e.conversationID,n=e.ID;if(!this.list.has(t))return this.list.set(t,new Map),void this.list.get(t).set(n,e);var r=Array.from(this.list.get(t));r.unshift([n,e]),this.list.set(t,new Map(r))}},{key:"_unshiftMultipleMessages",value:function(e){for(var t=e.length,n=[],r=e[0].conversationID,o=this.list.has(r)?Array.from(this.list.get(r)):[],i=0;i<t;i++)n.push([e[i].ID,e[i]]);this.list.set(r,new Map(n.concat(o)))}},{key:"remove",value:function(e){var t=e.conversationID,n=e.ID;this.list.has(t)&&this.list.get(t).delete(n)}},{key:"revoke",value:function(e,t,n){if(Es.debug("revoke message",e,t,n),this.list.has(e)){var r,o=tr(this.list.get(e));try{for(o.s();!(r=o.n()).done;){var i=Wn(r.value,2)[1];if(i.sequence===t&&!i.isRevoked&&(Ns(n)||i.random===n))return i.isRevoked=!0,i}}catch(a){o.e(a)}finally{o.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:"updateMessageIsPeerReadProperty",value:function(e,t){var n=[];if(this.list.has(e)){var r,o=tr(this.list.get(e));try{for(o.s();!(r=o.n()).done;){var i=Wn(r.value,2)[1];i.time<=t&&!i.isPeerRead&&"out"===i.flow&&(i.isPeerRead=!0,n.push(i))}}catch(a){o.e(a)}finally{o.f()}Es.log("MessagesList.updateMessageIsPeerReadProperty conversationID=".concat(e," peerReadTime=").concat(t," count=").concat(n.length))}return n}},{key:"hasLocalMessageList",value:function(e){return this.list.has(e)}},{key:"getLocalMessageList",value:function(e){return this.hasLocalMessageList(e)?Yn(this.list.get(e).values()):[]}},{key:"hasLocalMessage",value:function(e,t){return!!this.hasLocalMessageList(e)&&this.list.get(e).has(t)}},{key:"getLocalMessage",value:function(e,t){return this.hasLocalMessage(e,t)?this.list.get(e).get(t):null}},{key:"_setLatestMessageSentByPeer",value:function(e,t){e.startsWith(Sn.CONV_C2C)&&"in"===t.flow&&this._latestMessageSentByPeerMap.set(e,t)}},{key:"_setLatestMessageSentByMe",value:function(e,t){e.startsWith(Sn.CONV_C2C)&&"out"===t.flow&&this._latestMessageSentByMeMap.set(e,t)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._latestMessageSentByPeerMap.get(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._latestMessageSentByMeMap.get(e)}},{key:"modifyMessageSentByPeer",value:function(e){var t=this.list.get(e);if(!uu(t)){var n=Array.from(t.values()),r=n.length;if(0!==r){for(var o=null,i=null,a=0,s=!1,u=r-1;u>=0;u--)"in"===n[u].flow&&(null===i?i=n[u]:((o=n[u]).nick!==i.nick&&(o.setNickAndAvatar({nick:i.nick}),s=!0),o.avatar!==i.avatar&&(o.setNickAndAvatar({avatar:i.avatar}),s=!0),s&&(a+=1)));Es.log("MessagesList.modifyMessageSentByPeer conversationID=".concat(e," count=").concat(a))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,r=e.latestAvatar,o=this.list.get(t);if(!uu(o)){var i=Array.from(o.values()),a=i.length;if(0!==a){for(var s=null,u=0,c=!1,l=a-1;l>=0;l--)"out"===i[l].flow&&((s=i[l]).nick!==n&&(s.setNickAndAvatar({nick:n}),c=!0),s.avatar!==r&&(s.setNickAndAvatar({avatar:r}),c=!0),c&&(u+=1));Es.log("MessagesList.modifyMessageSentByMe conversationID=".concat(t," count=").concat(u))}}}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear()}}]),e}(),dy=function(){function e(t){Ln(this,e),this.tim=t}return bn(e,[{key:"setMessageRead",value:function(e){var t=e.conversationID,n=e.messageID,r=this.tim.conversationController,o=r.getLocalConversation(t);if(Es.log("ReadReportHandler.setMessageRead conversationID=".concat(t," unreadCount=").concat(o?o.unreadCount:0)),!o)return jd();if(o.type!==Sn.CONV_GROUP||uu(o.groupAtInfoList)||r.deleteGroupAtTips(t),0===o.unreadCount)return jd();var i=n?this.tim.messageController.getLocalMessage(t,n):null;switch(o.type){case Sn.CONV_C2C:return this._setC2CMessageRead({conversationID:t,lastMessageTime:i?i.time:o.lastMessage.lastTime});case Sn.CONV_GROUP:return this._setGroupMessageRead({conversationID:t,lastMessageSeq:i?i.sequence:o.lastMessage.lastSequence});case Sn.CONV_SYSTEM:return o.unreadCount=0,jd();default:return jd()}}},{key:"_setC2CMessageRead",value:function(e){var t=this,n=e.conversationID,r=e.lastMessageTime;Es.log("ReadReportHandler._setC2CMessageRead conversationID=".concat(n," lastMessageTime=").concat(r)),Ds(r)||Es.warn("ReadReportHandler._setC2CMessageRead 请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确");var o=new ig(Mg);return o.setText("".concat(n,"-").concat(r)),this.tim.messageController.request({name:"conversation",action:"setC2CMessageRead",param:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:r,receipt:1}]}}}).then((function(){return o.setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(),Es.log("ReadReportHandler._setC2CMessageRead ok."),t._updateIsReadAfterReadReport({conversationID:n,lastMessageTime:r}),t._updateUnreadCount(n),new qd})).catch((function(e){return t.tim.netMonitor.probe().then((function(t){var n=Wn(t,2),r=n[0],i=n[1];o.setError(e,r,i).setEnd()})),Es.log("ReadReportHandler._setC2CMessageRead failed. ".concat(Fs(e))),Bd(e)}))}},{key:"_setGroupMessageRead",value:function(e){var t=this,n=e.conversationID,r=e.lastMessageSeq;Es.log("ReadReportHandler._setGroupMessageRead conversationID=".concat(n," lastMessageSeq=").concat(r)),Ds(r)||Es.warn("ReadReportHandler._setGroupMessageRead 请勿修改 Conversation.lastMessage.lastSequence,否则可能会导致已读上报结果不准确");var o=new ig(Cg);return o.setText("".concat(n,"-").concat(r)),this.tim.messageController.request({name:"conversation",action:"setGroupMessageRead",param:{groupID:n.replace("GROUP",""),messageReadSeq:r}}).then((function(){return o.setNetworkType(t.tim.netMonitor.getNetworkType()).setEnd(),Es.log("ReadReportHandler._setGroupMessageRead ok."),t._updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:r}),t._updateUnreadCount(n),new qd})).catch((function(e){return t.tim.netMonitor.probe().then((function(t){var n=Wn(t,2),r=n[0],i=n[1];o.setError(e,r,i).setEnd()})),Es.log("ReadReportHandler._setGroupMessageRead failed. ".concat(Fs(e))),Bd(e)}))}},{key:"_updateUnreadCount",value:function(e){var t=this.tim,n=t.conversationController,r=t.messageController,o=n.getLocalConversation(e),i=r.getLocalMessageList(e);o&&(o.unreadCount=i.filter((function(e){return!e.isRead&&!e.getOnlineOnlyFlag()})).length,Es.log("ReadReportHandler._updateUnreadCount conversationID=".concat(o.conversationID," unreadCount=").concat(o.unreadCount)))}},{key:"_updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,r=e.lastMessageTime,o=this.tim.messageController.getLocalMessageList(t);if(0!==o.length)for(var i,a=o.length-1;a>=0;a--)if(i=o[a],!(r&&i.time>r||n&&i.sequence>n)){if("in"===i.flow&&i.isRead)break;i.setIsRead(!0)}}},{key:"updateIsRead",value:function(e){var t=this.tim,n=t.conversationController,r=t.messageController,o=n.getLocalConversation(e),i=r.getLocalMessageList(e);if(o&&0!==i.length&&!tu(o.type)){for(var a=[],s=0;s<i.length;s++)"in"!==i[s].flow?"out"!==i[s].flow||i[s].isRead||i[s].setIsRead(!0):a.push(i[s]);var u=0;if(o.type===Sn.CONV_C2C){var c=a.slice(-o.unreadCount).filter((function(e){return e.isRevoked})).length;u=a.length-o.unreadCount-c}else u=a.length-o.unreadCount;for(var l=0;l<u&&!a[l].isRead;l++)a[l].setIsRead(!0)}}}]),e}(),gy=it.findIndex,vy=!0,yy=lt("findIndex");"findIndex"in[]&&Array(1).findIndex((function(){vy=!1})),Ne({target:"Array",proto:!0,forced:vy||!yy},{findIndex:function(e){return gy(this,e,arguments.length>1?arguments[1]:void 0)}}),lr("findIndex");var _y=function(){function e(t){var n=t.tim,r=t.messageController;Ln(this,e),this.tim=n,this.messageController=r,this.completedMap=new Map,this._initListener()}return bn(e,[{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,r=e.nextReqMessageID,o=e.count;if(this.tim.groupController.checkJoinedAVChatRoomByID(n.replace("GROUP","")))return Es.log("GetMessageHandler.getMessageList not available in avchatroom. conversationID=".concat(n)),jd({messageList:[],nextReqMessageID:"",isCompleted:!0});(Ns(o)||o>15)&&(o=15);var i=this._computeLeftCount({conversationID:n,nextReqMessageID:r});return Es.log("GetMessageHandler.getMessageList. conversationID=".concat(n," leftCount=").concat(i," count=").concat(o," nextReqMessageID=").concat(r)),this._needGetHistory({conversationID:n,leftCount:i,count:o})?this.messageController.getHistoryMessages({conversationID:n,count:20}).then((function(){return i=t._computeLeftCount({conversationID:n,nextReqMessageID:r}),new qd(t._computeResult({conversationID:n,nextReqMessageID:r,count:o,leftCount:i}))})):(Es.log("GetMessageHandler.getMessageList. get messagelist from memory"),this.messageController.modifyMessageList(n),jd(this._computeResult({conversationID:n,nextReqMessageID:r,count:o,leftCount:i})))}},{key:"setCompleted",value:function(e){Es.log("GetMessageHandler.setCompleted. conversationID=".concat(e)),this.completedMap.set(e,!0)}},{key:"deleteCompletedItem",value:function(e){Es.log("GetMessageHandler.deleteCompletedItem. conversationID=".concat(e)),this.completedMap.delete(e)}},{key:"_initListener",value:function(){var e=this;this.tim.innerEmitter.on(Md,(function(){e.setCompleted(Sn.CONV_SYSTEM)})),this.tim.innerEmitter.on(_d,(function(t){var n=t.data;e.setCompleted("".concat(Sn.CONV_GROUP).concat(n))}))}},{key:"_getMessageListSize",value:function(e){return this.messageController.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.leftCount,r=e.count,o=this.tim.conversationController.getLocalConversation(t),i=!!o&&o.type===Sn.CONV_SYSTEM,a=!!o&&o.subType===Sn.GRP_AVCHATROOM;return!i&&!a&&(n<r&&!this.completedMap.has(t))}},{key:"_computeResult",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,r=e.count,o=e.leftCount,i=this._computeMessageList({conversationID:t,nextReqMessageID:n,count:r}),a=this._computeIsCompleted({conversationID:t,leftCount:o,count:r}),s=this._computeNextReqMessageID({messageList:i,isCompleted:a,conversationID:t});return Es.log("GetMessageHandler._computeResult. conversationID=".concat(t," leftCount=").concat(o," count=").concat(r," nextReqMessageID=").concat(s," nums=").concat(i.length," isCompleted=").concat(a)),{messageList:i,nextReqMessageID:s,isCompleted:a}}},{key:"_computeNextReqMessageID",value:function(e){var t=e.messageList,n=e.isCompleted,r=e.conversationID;if(!n)return 0===t.length?"":t[0].ID;var o=this.messageController.getLocalMessageList(r);return 0===o.length?"":o[0].ID}},{key:"_computeMessageList",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,r=e.count,o=this.messageController.getLocalMessageList(t),i=this._computeIndexEnd({nextReqMessageID:n,messageList:o}),a=this._computeIndexStart({indexEnd:i,count:r});return o.slice(a,i)}},{key:"_computeIndexEnd",value:function(e){var t=e.messageList,n=void 0===t?[]:t,r=e.nextReqMessageID;return r?n.findIndex((function(e){return e.ID===r})):n.length}},{key:"_computeIndexStart",value:function(e){var t=e.indexEnd,n=e.count;return t>n?t-n:0}},{key:"_computeLeftCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID;return n?this.messageController.getLocalMessageList(t).findIndex((function(e){return e.ID===n})):this._getMessageListSize(t)}},{key:"_computeIsCompleted",value:function(e){var t=e.conversationID;return!!(e.leftCount<=e.count&&this.completedMap.has(t))}},{key:"reset",value:function(){Es.log("GetMessageHandler.reset"),this.completedMap.clear()}}]),e}(),Iy=function e(t){Ln(this,e),this.value=t,this.next=null},My=function(){function e(t){Ln(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,Es.log("SinglyLinkedList init MAX_LENGTH=".concat(this.MAX_LENGTH))}return bn(e,[{key:"pushIn",value:function(e){var t=new Iy(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:"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}(),Cy=function(){function e(t){Ln(this,e),this.tim=t}return bn(e,[{key:"upload",value:function(e){switch(e.type){case Sn.MSG_IMAGE:return this._uploadImage(e);case Sn.MSG_FILE:return this._uploadFile(e);case Sn.MSG_AUDIO:return this._uploadAudio(e);case Sn.MSG_VIDEO:return this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var t=this.tim,n=t.uploadController,r=t.messageController,o=e.getElements()[0],i=r.getMessageOptionByID(e.messageID);return n.uploadImage({file:i.payload.file,to:i.to,onProgress:function(e){if(o.updatePercent(e),ws(i.onProgress))try{i.onProgress(e)}catch(t){return Bd(new Hp({code:$p.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:"".concat(uf)}))}}}).then((function(t){var n=t.location,r=t.fileType,i=t.fileSize,a=t.width,s=t.height,u=Ys(n);o.updateImageFormat(r);var c=iu({originUrl:u,originWidth:a,originHeight:s,min:198}),l=iu({originUrl:u,originWidth:a,originHeight:s,min:720});return o.updateImageInfoArray([{size:i,url:u,width:a,height:s},Un({},l),Un({},c)]),e}))}},{key:"_uploadFile",value:function(e){var t=this.tim,n=t.uploadController,r=t.messageController,o=e.getElements()[0],i=r.getMessageOptionByID(e.messageID);return n.uploadFile({file:i.payload.file,to:i.to,onProgress:function(e){if(o.updatePercent(e),ws(i.onProgress))try{i.onProgress(e)}catch(t){return Bd(new Hp({code:$p.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:"".concat(uf)}))}}}).then((function(t){var n=t.location,r=Ys(n);return o.updateFileUrl(r),e}))}},{key:"_uploadAudio",value:function(e){var t=this.tim,n=t.uploadController,r=t.messageController,o=e.getElements()[0],i=r.getMessageOptionByID(e.messageID);return n.uploadAudio({file:i.payload.file,to:i.to,onProgress:function(e){if(o.updatePercent(e),ws(i.onProgress))try{i.onProgress(e)}catch(t){return Bd(new Hp({code:$p.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:"".concat(uf)}))}}}).then((function(t){var n=t.location,r=Ys(n);return o.updateAudioUrl(r),e}))}},{key:"_uploadVideo",value:function(e){var t=this.tim,n=t.uploadController,r=t.messageController,o=e.getElements()[0],i=r.getMessageOptionByID(e.messageID);return n.uploadVideo({file:i.payload.file,to:i.to,onProgress:function(e){if(o.updatePercent(e),ws(i.onProgress))try{i.onProgress(e)}catch(t){return Bd(new Hp({code:$p.MESSAGE_ONPROGRESS_FUNCTION_ERROR,message:"".concat(uf)}))}}}).then((function(t){var n=Ys(t.location);return o.updateVideoUrl(n),e}))}}]),e}(),Sy=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e))._initializeMembers(),r._initializeListener(),r._initializeHandlers(),r.messageOptionMap=new Map,r}return bn(n,[{key:"_initializeMembers",value:function(){this.messagesList=new hy({tim:this.tim}),this.currentMessageKey={},this.singlyLinkedList=new My(100),this._peerReadTimeMap=new Map}},{key:"_initializeHandlers",value:function(){this.readReportHandler=new dy(this.tim,this),this.getMessageHandler=new _y({messageController:this,tim:this.tim}),this.uploadFileHandler=new Cy(this.tim)}},{key:"reset",value:function(){this.messagesList.reset(),this.currentMessageKey={},this.getMessageHandler.reset(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this.messageOptionMap.clear()}},{key:"_initializeListener",value:function(){var e=this.tim.innerEmitter;e.on(Xh,this._onReceiveC2CMessage,this),e.on(Uh,this._onSyncMessagesProcessing,this),e.on(xh,this._onSyncMessagesFinished,this),e.on(Qh,this._onReceiveGroupMessage,this),e.on(Zh,this._onReceiveGroupTips,this),e.on(td,this._onReceiveSystemNotice,this),e.on(od,this._onReceiveGroupMessageRevokedNotice,this),e.on(id,this._onReceiveC2CMessageRevokedNotice,this),e.on(ad,this._onC2CMessageReadReceipt,this),e.on(vd,this._clearConversationMessages,this)}},{key:"_guardForAVChatRoom",value:function(e){if(e.conversationType===Sn.CONV_GROUP){var t=this.tim.groupController,n=e.to;return t.hasLocalGroup(n)?Promise.resolve():t.getGroupProfile({groupID:n}).then((function(t){var r=t.data.group.type;if(Es.log("MessageController._guardForAVChatRoom. groupID=".concat(n," type=").concat(r)),r===Sn.GRP_AVCHATROOM){var o="userId=".concat(e.from," 未加入群 groupID=").concat(n,"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#joinGroup");return Es.warn("MessageController._guardForAVChatRoom sendMessage not allowed. ".concat(o)),Bd(new Hp({code:$p.MESSAGE_SEND_FAIL,message:o,data:{message:e}}))}return Promise.resolve()}))}return Promise.resolve()}},{key:"sendMessageInstance",value:function(e,t){var n,r=this,o=null;switch(e.conversationType){case Sn.CONV_C2C:o=this._handleOnSendC2CMessageSuccess.bind(this);break;case Sn.CONV_GROUP:o=this._handleOnSendGroupMessageSuccess.bind(this);break;default:return Bd(new Hp({code:$p.MESSAGE_SEND_INVALID_CONVERSATION_TYPE,message:af}))}return this.singlyLinkedList.pushIn(e.random),this.uploadFileHandler.upload(e).then((function(){return r._guardForAVChatRoom(e).then((function(){var o=null;return e.isSendable()?(r._addSendMessageTotalCount(e),n=Date.now(),e.conversationType===Sn.CONV_C2C?o=r._createC2CMessagePack(e,t):e.conversationType===Sn.CONV_GROUP&&(o=r._createGroupMessagePack(e,t)),r.request(o)):Bd({code:$p.MESSAGE_FILE_URL_IS_EMPTY,message:Mf})})).then((function(i){r._addSendMessageSuccessCount(e,n);var a=!1;if(e.conversationType===Sn.CONV_GROUP)e.sequence=i.data.sequence,e.time=i.data.time,e.generateMessageID(r.tim.context.identifier);else if(e.conversationType===Sn.CONV_C2C){var s=r.messagesList.getLatestMessageSentByMe(e.conversationID);if(s){var u=s.nick,c=s.avatar;u===e.nick&&c===e.avatar||(a=!0)}}return r.messagesList.pushIn(e),o(e,i.data),a&&r.messagesList.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),r.messageOptionMap.delete(e.messageID),r._isOnlineMessage(e,t)?e.setOnlineOnlyFlag(!0):r.emitInnerEvent(qh,{eventDataList:[{conversationID:e.conversationID,unreadCount:0,type:e.conversationType,subType:e.conversationSubType,lastMessage:e}]}),"TIMImageElem"===e.type&&au(e.payload.imageInfoArray),new qd({message:e})})).catch((function(t){e.status=nc.FAIL;var n=new ig(mg);return n.setMessageType(e.type).setText("".concat(r._generateTjgID(e),"-").concat(e.type,"-").concat(e.from,"-").concat(e.to)),r.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];n.setError(t,o,i).setEnd()})),Es.error("MessageController.sendMessageInstance error:",t),Bd(new Hp({code:t&&t.code?t.code:$p.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:nf,data:{message:e}}))}))}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===Sn.CONV_C2C)return Yd;if(e.conversationType===Sn.CONV_GROUP){var t=this.tim.groupController.getLocalGroupProfile(e.to);if(!t)return;var n=t.type;if(Xs(n))return Jd;if(Qs(n))return Xd;if(Zs(n))return Qd;if(eu(n))return Zd}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this.tim.sumStatController;t.addTotalCount(Wd);var n=this._getSendMessageSpecifiedKey(e);n&&t.addTotalCount(n)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=this.tim.sumStatController,r=Math.abs(Date.now()-t);n.addSuccessCount(Wd),n.addCost(Wd,r);var o=this._getSendMessageSpecifiedKey(e);o&&(n.addSuccessCount(o),n.addCost(o,r))}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=nc.UNSEND,this.sendMessageInstance(e)}},{key:"_isFileLikeMessage",value:function(e){return[Sn.MSG_IMAGE,Sn.MSG_FILE,Sn.MSG_AUDIO,Sn.MSG_VIDEO].indexOf(e.type)>=0}},{key:"_resendBinaryTypeMessage",value:function(){}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.tim.groupController.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==Sn.CONV_GROUP}},{key:"_isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_createC2CMessagePack",value:function(e,t){var n=null;return t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0})),{name:"c2cMessage",action:"create",tjgID:this._generateTjgID(e),param:{toAccount:e.to,msgBody:e.getElements(),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}}}},{key:"_handleOnSendC2CMessageSuccess",value:function(e,t){e.status=nc.SUCCESS,e.time=t.time}},{key:"_createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var r=e.getGroupAtInfoList();return{name:"groupMessage",action:"create",tjgID:this._generateTjgID(e),param:{groupID:e.to,msgBody:e.getElements(),random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==Sn.MSG_TEXT||uu(r)?void 0:r,onlineOnlyFlag:this._isOnlineMessage(e,t)?1:0,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}}}},{key:"_handleOnSendGroupMessageSuccess",value:function(e,t){e.sequence=t.sequence,e.time=t.time,e.status=nc.SUCCESS}},{key:"_onReceiveC2CMessage",value:function(e){Es.debug("MessageController._onReceiveC2CMessage nums=".concat(e.data.length));var t=Date.now(),n=this._newC2CMessageStoredAndSummary({notifiesList:e.data,type:Sn.CONV_C2C,C2CRemainingUnreadList:e.C2CRemainingUnreadList}),r=n.eventDataList,o=n.result;if(r.length>0&&this.emitInnerEvent(jh,{eventDataList:r,result:o}),o.length>0){var i=this.tim.sumStatController;i.addTotalCount(eg),i.addSuccessCount(eg),i.addCost(eg,Date.now()-t),this.emitOuterEvent(Cn.MESSAGE_RECEIVED,o)}}},{key:"_onReceiveGroupMessage",value:function(e){Es.debug("MessageController._onReceiveGroupMessage nums=".concat(e.data.length));var t=Date.now(),n=this.newGroupMessageStoredAndSummary(e.data),r=n.eventDataList,o=n.result;if(r.length>0&&this.emitInnerEvent(Bh,{eventDataList:r,result:o,isGroupTip:!1}),o.length>0){var i=this.tim.sumStatController;i.addTotalCount(eg),i.addSuccessCount(eg),i.addCost(eg,Date.now()-t),this.emitOuterEvent(Cn.MESSAGE_RECEIVED,o)}}},{key:"_onReceiveGroupTips",value:function(e){var t=Date.now(),n=e.data;Es.debug("MessageController._onReceiveGroupTips nums=".concat(n.length));var r=this.newGroupTipsStoredAndSummary(n),o=r.eventDataList,i=r.result;if(o.length>0&&this.emitInnerEvent(Bh,{eventDataList:o,result:i,isGroupTip:!0}),i.length>0){var a=this.tim.sumStatController;a.addTotalCount(eg),a.addSuccessCount(eg),a.addCost(eg,Date.now()-t),this.emitOuterEvent(Cn.MESSAGE_RECEIVED,i)}}},{key:"_onReceiveSystemNotice",value:function(e){var t=Date.now(),n=e.data,r=n.groupSystemNotices,o=n.type;Es.debug("MessageController._onReceiveSystemNotice nums=".concat(r.length));var i=this.newSystemNoticeStoredAndSummary({notifiesList:r,type:o}),a=i.eventDataList,s=i.result;if(a.length>0&&this.emitInnerEvent(Kh,{eventDataList:a,result:s,type:o}),s.length>0&&"poll"===o){var u=this.tim.sumStatController;u.addTotalCount(eg),u.addSuccessCount(eg),u.addCost(eg,Date.now()-t),this.emitOuterEvent(Cn.MESSAGE_RECEIVED,s)}}},{key:"_onReceiveGroupMessageRevokedNotice",value:function(e){var t=this;Es.debug("MessageController._onReceiveGroupMessageRevokedNotice nums=".concat(e.data.length));var n=[],r=null;e.data.forEach((function(e){e.elements.revokedInfos.forEach((function(e){(r=t.messagesList.revoke("GROUP".concat(e.groupID),e.sequence))&&n.push(r)}))})),0!==n.length&&(this.emitInnerEvent(Hh,n),this.emitOuterEvent(Cn.MESSAGE_REVOKED,n))}},{key:"_onReceiveC2CMessageRevokedNotice",value:function(e){var t=this;Es.debug("MessageController._onReceiveC2CMessageRevokedNotice nums=".concat(e.data.length));var n=[],r=null;e.data.forEach((function(e){e.c2cMessageRevokedNotify.revokedInfos.forEach((function(e){var o=t.tim.context.identifier===e.from?"C2C".concat(e.to):"C2C".concat(e.from);(r=t.messagesList.revoke(o,e.sequence,e.random))&&n.push(r)}))})),0!==n.length&&(this.emitInnerEvent(Hh,n),this.emitOuterEvent(Cn.MESSAGE_REVOKED,n))}},{key:"_onC2CMessageReadReceipt",value:function(e){var t=this;e.data.forEach((function(e){if(!uu(e.c2cMessageReadReceipt)){var n=e.c2cMessageReadReceipt.to;e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){var r=e.peerReadTime;Es.debug("MessageController._onC2CMessageReadReceipt to=".concat(n," peerReadTime=").concat(r));var o="C2C".concat(n);t.recordPeerReadTime(o,r),t._updateMessageIsPeerReadProperty(o,r)}))}}))}},{key:"_updateMessageIsPeerReadProperty",value:function(e,t){if(e.startsWith(Sn.CONV_C2C)&&t>0){var n=this.messagesList.updateMessageIsPeerReadProperty(e,t);n.length>0&&this.emitOuterEvent(Cn.MESSAGE_READ_BY_PEER,n)}}},{key:"getPeerReadTime",value:function(e){var t=this;if(!uu(e)){var n=new ig(Eg);return Es.log("MessageController.getPeerReadTime userIDList:".concat(e)),this.request({name:"c2cPeerReadTime",action:"get",param:{userIDList:e}}).then((function(r){var o=r.data.peerReadTimeList;Es.log("MessageController.getPeerReadTime ok. peerReadTimeList:".concat(o));for(var i="",a=0;a<e.length;a++)i+="".concat(e[a],"-").concat(o[a]," "),o[a]>0&&t.recordPeerReadTime("C2C".concat(e[a]),o[a]);n.setNetworkType(t.getNetworkType()).setText(i).setEnd()})).catch((function(e){t.probeNetwork().then((function(t){var r=Wn(t,2),o=r[0],i=r[1];n.setError(e,o,i).setEnd()})),Es.warn("MessageController.getPeerReadTime failed. error:",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:"_clearConversationMessages",value:function(e){var t=e.data;this.messagesList.removeByConversationID(t),this.getMessageHandler.deleteCompletedItem(t)}},{key:"_pushIntoNoticeResult",value:function(e,t){return!(!this.messagesList.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.tim.userController.getNickAndAvatarByUserID(e)}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.notifiesList,n=e.type,r=e.C2CRemainingUnreadList,o=e.isFromSync,i=null,a=[],s=[],u={},c=this.tim.bigDataHallwayController,l=0,p=t.length;l<p;l++){var f=t[l];if(f.currentUser=this.tim.context.identifier,f.conversationType=n,f.isSystemMessage=!!f.isSystemMessage,i=new fh(f),f.elements=c.parseElements(f.elements,f.from),i.setElement(f.elements),i.setNickAndAvatar({nick:f.nick,avatar:f.avatar}),!o){var h=i.conversationID,d=this.messagesList.getLatestMessageSentByPeer(h),g=!1;if(d){var m=d.nick,v=d.avatar;m===i.nick&&v===i.avatar||(g=!0)}if(!this._pushIntoNoticeResult(s,i))continue;g&&(this.messagesList.modifyMessageSentByPeer(h),this.tim.conversationController.updateUserProfileSpecifiedKey({conversationID:h,nick:i.nick,avatar:i.avatar}))}0!==f.msgLifeTime?void 0===u[i.conversationID]?u[i.conversationID]=a.push({conversationID:i.conversationID,unreadCount:"out"===i.flow?0:1,type:i.conversationType,subType:i.conversationSubType,lastMessage:i})-1:(a[u[i.conversationID]].type=i.conversationType,a[u[i.conversationID]].subType=i.conversationSubType,a[u[i.conversationID]].lastMessage=i,"in"===i.flow&&a[u[i.conversationID]].unreadCount++):i.setOnlineOnlyFlag(!0)}if(Rs(r))for(var y=function(e,t){var n=a.find((function(t){return t.conversationID==="C2C".concat(r[e].from)}));n?n.unreadCount+=r[e].count:a.push({conversationID:"C2C".concat(r[e].from),unreadCount:r[e].count,type:Sn.CONV_C2C,lastMsgTime:r[e].lastMsgTime})},_=0,I=r.length;_<I;_++)y(_);return{eventDataList:a,result:s}}},{key:"newGroupMessageStoredAndSummary",value:function(e){var t=null,n=[],r={},o=[],i=Sn.CONV_GROUP,a=this.tim.bigDataHallwayController,s=e.length;s>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var u=0;u<s;u++){var c=e[u];if(c.currentUser=this.tim.context.identifier,c.conversationType=i,c.isSystemMessage=!!c.isSystemMessage,t=new fh(c),c.elements=a.parseElements(c.elements,c.from),t.setElement(c.elements),!this._isMessageFromAVChatroom(t))this._pushIntoNoticeResult(o,t)&&(1!==c.onlineOnlyFlag?void 0===r[t.conversationID]?r[t.conversationID]=n.push({conversationID:t.conversationID,unreadCount:"out"===t.flow?0:1,type:t.conversationType,subType:t.conversationSubType,lastMessage:t})-1:(n[r[t.conversationID]].type=t.conversationType,n[r[t.conversationID]].subType=t.conversationSubType,n[r[t.conversationID]].lastMessage=t,"in"===t.flow&&n[r[t.conversationID]].unreadCount++):t.setOnlineOnlyFlag(!0))}return{eventDataList:n,result:o}}},{key:"_isMessageFromAVChatroom",value:function(e){var t=e.conversationID.slice(5);return this.tim.groupController.checkJoinedAVChatRoomByID(t)}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var t=null,n=[],r=[],o={},i=0,a=e.length;i<a;i++){var s=e[i];if(s.currentUser=this.tim.context.identifier,s.conversationType=Sn.CONV_GROUP,(t=new fh(s)).setElement({type:Sn.MSG_GRP_TIP,content:Un(Un({},s.elements),{},{groupProfile:s.groupProfile})}),t.isSystemMessage=!1,!this._isMessageFromAVChatroom(t))this._pushIntoNoticeResult(r,t)&&(void 0===o[t.conversationID]?o[t.conversationID]=n.push({conversationID:t.conversationID,unreadCount:"out"===t.flow?0:1,type:t.conversationType,subType:t.conversationSubType,lastMessage:t})-1:(n[o[t.conversationID]].type=t.conversationType,n[o[t.conversationID]].subType=t.conversationSubType,n[o[t.conversationID]].lastMessage=t,"in"===t.flow&&n[o[t.conversationID]].unreadCount++))}return{eventDataList:n,result:r}}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var t=e.notifiesList,n=e.type,r=null,o=t.length,i=0,a=[],s={conversationID:Sn.CONV_SYSTEM,unreadCount:0,type:Sn.CONV_SYSTEM,subType:null,lastMessage:null};for(i=0;i<o;i++){var u=t[i];if(u.elements.operationType!==_p)u.currentUser=this.tim.context.identifier,u.conversationType=Sn.CONV_SYSTEM,u.conversationID=Sn.CONV_SYSTEM,(r=new fh(u)).setElement({type:Sn.MSG_GRP_SYS_NOTICE,content:Un(Un({},u.elements),{},{groupProfile:u.groupProfile})}),r.isSystemMessage=!0,(1===r.sequence&&1===r.random||2===r.sequence&&2===r.random)&&(r.sequence=Bs(),r.random=Bs(),r.generateMessageID(u.currentUser),Es.log("MessageController.newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID=".concat(r.ID))),this._pushIntoNoticeResult(a,r)&&("poll"===n?s.unreadCount++:"sync"===n&&r.setIsRead(!0),s.subType=r.conversationSubType)}return s.lastMessage=a[a.length-1],{eventDataList:a.length>0?[s]:[],result:a}}},{key:"_onSyncMessagesProcessing",value:function(e){var t=this._newC2CMessageStoredAndSummary({notifiesList:e.data,type:Sn.CONV_C2C,isFromSync:!0,C2CRemainingUnreadList:e.C2CRemainingUnreadList}),n=t.eventDataList,r=t.result;this.emitInnerEvent(Fh,{eventDataList:n,result:r})}},{key:"_onSyncMessagesFinished",value:function(e){this.triggerReady();var t=this._newC2CMessageStoredAndSummary({notifiesList:e.data.messageList,type:Sn.CONV_C2C,isFromSync:!0,C2CRemainingUnreadList:e.data.C2CRemainingUnreadList}),n=t.eventDataList,r=t.result;this.emitInnerEvent(Vh,{eventDataList:n,result:r})}},{key:"getHistoryMessages",value:function(e){if(e.conversationID===Sn.CONV_SYSTEM)return jd();!e.count&&(e.count=15),e.count>20&&(e.count=20);var t=this.messagesList.getLocalOldestMessageByConversationID(e.conversationID);t||((t={}).time=0,t.sequence=0,0===e.conversationID.indexOf(Sn.CONV_C2C)?(t.to=e.conversationID.replace(Sn.CONV_C2C,""),t.conversationType=Sn.CONV_C2C):0===e.conversationID.indexOf(Sn.CONV_GROUP)&&(t.to=e.conversationID.replace(Sn.CONV_GROUP,""),t.conversationType=Sn.CONV_GROUP));var n="";switch(t.conversationType){case Sn.CONV_C2C:return n=e.conversationID.replace(Sn.CONV_C2C,""),this.getC2CRoamMessages({conversationID:e.conversationID,peerAccount:n,count:e.count,lastMessageTime:void 0===this.currentMessageKey[e.conversationID]?0:t.time});case Sn.CONV_GROUP:return this.getGroupRoamMessages({conversationID:e.conversationID,groupID:t.to,count:e.count,sequence:t.sequence-1});default:return jd()}}},{key:"getC2CRoamMessages",value:function(e){var t=this,n=e.conversationID,r=void 0!==this.currentMessageKey[n]?this.currentMessageKey[n]:"";Es.log("MessageController.getC2CRoamMessages toAccount=".concat(e.peerAccount," count=").concat(e.count||15," lastMessageTime=").concat(e.lastMessageTime||0," messageKey=").concat(r));var o=new ig(yg);return this.request({name:"c2cMessage",action:"query",param:{peerAccount:e.peerAccount,count:e.count||15,lastMessageTime:e.lastMessageTime||0,messageKey:r}}).then((function(i){var a=i.data,s=a.complete,u=a.messageList;Ns(u)?Es.log("MessageController.getC2CRoamMessages ok. complete=".concat(s," but messageList is undefined!")):Es.log("MessageController.getC2CRoamMessages ok. complete=".concat(s," nums=").concat(u.length)),o.setNetworkType(t.getNetworkType()).setText("".concat(e.peerAccount,"-").concat(e.count||15,"-").concat(e.lastMessageTime||0,"-").concat(r,"-").concat(s,"-").concat(u?u.length:"undefined")).setEnd(),1===s&&t.getMessageHandler.setCompleted(n);var c=t._roamMessageStore(u,Sn.CONV_C2C,n);t.modifyMessageList(n),t.readReportHandler.updateIsRead(n),t.currentMessageKey[n]=i.data.messageKey;var l=t._peerReadTimeMap.get(n);if(Es.log("MessageController.getC2CRoamMessages update isPeerRead property. conversationID=".concat(n," peerReadTime=").concat(l)),l)t._updateMessageIsPeerReadProperty(n,l);else{var p=n.replace(Sn.CONV_C2C,"");t.getPeerReadTime([p]).then((function(){t._updateMessageIsPeerReadProperty(n,t._peerReadTimeMap.get(n))}))}return c})).catch((function(n){return t.probeNetwork().then((function(t){var i=Wn(t,2),a=i[0],s=i[1];o.setError(n,a,s).setText("".concat(e.peerAccount,"-").concat(e.count||15,"-").concat(e.lastMessageTime||0,"-").concat(r)).setEnd()})),Es.warn("MessageController.getC2CRoamMessages failed. ".concat(n)),Bd(n)}))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(Sn.CONV_C2C)){var t=Date.now();this.messagesList.modifyMessageSentByPeer(e);var n=this._getNickAndAvatarByUserID(this.tim.context.identifier);this.messagesList.modifyMessageSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),Es.log("MessageController.modifyMessageList conversationID=".concat(e," cost ").concat(Date.now()-t," ms"))}}},{key:"_computeLastSequence",value:function(e){return e.sequence>=0?Promise.resolve(e.sequence):this.tim.groupController.getGroupLastSequence(e.groupID)}},{key:"getGroupRoamMessages",value:function(e){var t=this,n=new ig(_g),r=0;return this._computeLastSequence(e).then((function(n){return r=n,Es.log("MessageController.getGroupRoamMessages groupID=".concat(e.groupID," lastSequence=").concat(r)),t.request({name:"groupMessage",action:"query",param:{groupID:e.groupID,count:21,sequence:r}})})).then((function(o){var i=o.data,a=i.messageList,s=i.complete;Ns(a)?Es.log("MessageController.getGroupRoamMessages ok. complete=".concat(s," but messageList is undefined!")):Es.log("MessageController.getGroupRoamMessages ok. complete=".concat(s," nums=").concat(a.length)),n.setNetworkType(t.getNetworkType()).setText("".concat(e.groupID,"-").concat(r,"-").concat(s,"-").concat(a?a.length:"undefined")).setEnd();var u="GROUP".concat(e.groupID);if(2===s||uu(a))return t.getMessageHandler.setCompleted(u),[];var c=t._roamMessageStore(a,Sn.CONV_GROUP,u);return t.readReportHandler.updateIsRead(u),t._patchConversationLastMessage(u),c})).catch((function(o){return t.probeNetwork().then((function(t){var i=Wn(t,2),a=i[0],s=i[1];n.setError(o,a,s).setText("".concat(e.groupID,"-").concat(r)).setEnd()})),Es.warn("MessageController.getGroupRoamMessages failed. ".concat(o)),Bd(o)}))}},{key:"_patchConversationLastMessage",value:function(e){var t=this.tim.conversationController.getLocalConversation(e);if(t){var n=t.lastMessage,r=n.messageForShow,o=n.payload;if(uu(r)||uu(o)){var i=this.messagesList.getLocalMessageList(e);if(0===i.length)return;var a=i[i.length-1];Es.log("MessageController._patchConversationLastMessage conversationID:".concat(e," payload:"),a.payload),t.updateLastMessage(a)}}}},{key:"_roamMessageStore",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=null,o=[],i=0,a=e.length,s=null,u=t===Sn.CONV_GROUP,c=this.tim.bigDataHallwayController,l=function(){i=u?e.length-1:0,a=u?0:e.length},p=function(){u?--i:++i},f=function(){return u?i>=a:i<a};for(l();f();p())if(u&&1===e[i].sequence&&this.getMessageHandler.setCompleted(n),1!==e[i].isPlaceMessage)if((r=new fh(e[i])).to=e[i].to,r.isSystemMessage=!!e[i].isSystemMessage,r.conversationType=t,e[i].event===cp.JSON.TYPE.GROUP.TIP?s={type:Sn.MSG_GRP_TIP,content:Un(Un({},e[i].elements),{},{groupProfile:e[i].groupProfile})}:(e[i].elements=c.parseElements(e[i].elements,e[i].from),s=e[i].elements),u||r.setNickAndAvatar({nick:e[i].nick,avatar:e[i].avatar}),uu(s)){var h=new ig(Sg);h.setText("from:".concat(r.from," to:").concat(r.to," sequence:").concat(r.sequence," event:").concat(e[i].event)),h.setNetworkType(this.getNetworkType()).setEnd()}else r.setElement(s),r.reInitialize(this.tim.context.identifier),o.push(r);return this.messagesList.unshift(o),l=p=f=null,o}},{key:"getLocalMessageList",value:function(e){return this.messagesList.getLocalMessageList(e)}},{key:"getLocalMessage",value:function(e,t){return this.messagesList.getLocalMessage(e,t)}},{key:"hasLocalMessage",value:function(e,t){return this.messagesList.hasLocalMessage(e,t)}},{key:"deleteLocalMessage",value:function(e){e instanceof fh&&this.messagesList.remove(e)}},{key:"revokeMessage",value:function(e){var t,n=this;e.conversationType===Sn.CONV_C2C?t={name:"c2cMessageWillBeRevoked",action:"create",param:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}}:e.conversationType===Sn.CONV_GROUP&&(t={name:"groupMessageWillBeRevoked",action:"create",param:{to:e.to,msgSeqList:[{msgSeq:e.sequence}]}});var r=new ig(Ig);return r.setMessageType(e.type).setText("".concat(this._generateTjgID(e),"-").concat(e.type,"-").concat(e.from,"-").concat(e.to)),this.request(t).then((function(t){var o=t.data.recallRetList;if(!uu(o)&&0!==o[0].retCode){var i=new Hp({code:o[0].retCode,message:Kp[o[0].retCode]||cf,data:{message:e}});return r.setCode(i.code).setMessage(i.message).setEnd(),Bd(i)}return Es.info("MessageController.revokeMessage ok. ID=".concat(e.ID)),e.isRevoked=!0,r.setEnd(),n.emitInnerEvent(Hh,[e]),new qd({message:e})})).catch((function(t){n.probeNetwork().then((function(e){var n=Wn(e,2),o=n[0],i=n[1];r.setError(t,o,i).setEnd()}));var o=new Hp({code:t&&t.code?t.code:$p.MESSAGE_REVOKE_FAIL,message:t&&t.message?t.message:cf,data:{message:e}});return Es.warn("MessageController.revokeMessage failed. ID=".concat(e.ID," code=").concat(o.code," message=").concat(o.message)),Bd(o)}))}},{key:"setMessageRead",value:function(e){var t=this;return new Promise((function(n,r){t.ready((function(){t.readReportHandler.setMessageRead(e).then(n).catch(r)}))}))}},{key:"getMessageList",value:function(e){return this.getMessageHandler.getMessageList(e)}},{key:"createTextMessage",value:function(e){var t=this.tim.context.identifier;e.currentUser=t;var n=new fh(e),r="string"==typeof e.payload?e.payload:e.payload.text,o=new oc({text:r}),i=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(i),n}},{key:"createCustomMessage",value:function(e){var t=this.tim.context.identifier;e.currentUser=t;var n=new fh(e),r=new uh({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),o=this._getNickAndAvatarByUserID(t);return n.setElement(r),n.setNickAndAvatar(o),n}},{key:"createImageMessage",value:function(e){var t=this.tim.context.identifier;e.currentUser=t;var n=new fh(e);if(Ka){var r=e.payload.file;if(Ts(r))return void Es.warn("小程序环境下调用 createImageMessage 接口时,payload.file 不支持传入 File 对象");var o=r.tempFilePaths[0],i={url:o,name:o.slice(o.lastIndexOf("/")+1),size:r.tempFiles&&r.tempFiles[0].size||1,type:o.slice(o.lastIndexOf(".")+1).toLowerCase()};e.payload.file=i}else if(Ha&&Ts(e.payload.file)){var a=e.payload.file;e.payload.file={files:[a]}}var s=new Ap({imageFormat:cp.IMAGE_FORMAT.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return n.setElement(s),n.setNickAndAvatar(u),this.messageOptionMap.set(n.messageID,e),n}},{key:"createFileMessage",value:function(e){if(!Ka){if(Ha&&Ts(e.payload.file)){var t=e.payload.file;e.payload.file={files:[t]}}var n=this.tim.context.identifier;e.currentUser=n;var r=new fh(e),o=new sh({uuid:this._generateUUID(),file:e.payload.file}),i=this._getNickAndAvatarByUserID(n);return r.setElement(o),r.setNickAndAvatar(i),this.messageOptionMap.set(r.messageID,e),r}Es.warn("小程序目前不支持选择文件, createFileMessage 接口不可用!")}},{key:"createAudioMessage",value:function(e){if(Ka){var t=e.payload.file;if(Ka){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 r=this.tim.context.identifier;e.currentUser=r;var o=new fh(e),i=new Rp({second:Math.floor(t.duration/1e3),size:t.fileSize,url:t.tempFilePath,uuid:this._generateUUID()}),a=this._getNickAndAvatarByUserID(r);return o.setElement(i),o.setNickAndAvatar(a),this.messageOptionMap.set(o.messageID,e),o}Es.warn("createAudioMessage 目前只支持小程序环境下发语音消息")}},{key:"createVideoMessage",value:function(e){var t=this.tim.context.identifier;e.currentUser=t,e.payload.file.thumbUrl="https://webim-1252463788.cos.ap-shanghai.myqcloud.com/assets/images/transparent.png",e.payload.file.thumbSize=1668;var n={};if(Ka){if(Ts(e.payload.file))return void Es.warn("小程序环境下调用 createVideoMessage 接口时,payload.file 不支持传入 File 对象");var r=e.payload.file;n.url=r.tempFilePath,n.name=r.tempFilePath.slice(r.tempFilePath.lastIndexOf("/")+1),n.size=r.size,n.second=r.duration,n.type=r.tempFilePath.slice(r.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(Ha){if(Ts(e.payload.file)){var o=e.payload.file;e.payload.file.files=[o]}var i=e.payload.file;n.url=window.URL.createObjectURL(i.files[0]),n.name=i.files[0].name,n.size=i.files[0].size,n.second=i.files[0].duration||0,n.type=i.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var a=new fh(e),s=new ch({videoFormat:n.type,videoSecond:Number(n.second.toFixed(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 a.setElement(s),a.setNickAndAvatar(u),this.messageOptionMap.set(a.messageID,e),a}},{key:"createFaceMessage",value:function(e){var t=this.tim.context.identifier;e.currentUser=t;var n=new fh(e),r=new Op(e.payload),o=this._getNickAndAvatarByUserID(t);return n.setElement(r),n.setNickAndAvatar(o),n}},{key:"_generateUUID",value:function(){var e=this.tim.context;return"".concat(e.SDKAppID,"-").concat(e.identifier,"-").concat(function(){for(var e="",t=32;t>0;--t)e+=Ks[Math.floor(Math.random()*Hs)];return e}())}},{key:"_generateTjgID",value:function(e){return this.tim.context.tinyID+"-"+e.random}},{key:"getMessageOptionByID",value:function(e){return this.messageOptionMap.get(e)}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this.messagesList.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"pushToMessageList",value:function(e){this.messagesList.pushIn(e)}}]),n}(Gd),Ey=function(){function e(t){Ln(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 bn(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&Js(this.memberCustomField,e.memberCustomField),qs(this,e,["memberCustomField"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){Ns(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){Ns(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&Js(this.memberCustomField,e)}}]),e}(),Ty=function(){function e(t){Ln(this,e),this.tim=t.tim,this.groupController=t.groupController,this._initListeners()}return bn(e,[{key:"_initListeners",value:function(){this.tim.innerEmitter.on(Bh,this._onReceivedGroupTips,this)}},{key:"_onReceivedGroupTips",value:function(e){var t=this,n=e.data,r=n.result;n.isGroupTip&&r.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;default:Es.warn("GroupTipsHandler._onReceivedGroupTips Unhandled groupTips. operationType=",e.payload.operationType)}}))}},{key:"_onNewMemberComeIn",value:function(e){var t=e.payload,n=t.memberNum,r=t.groupProfile.groupID,o=this.groupController.getLocalGroupProfile(r);o&&Ds(n)&&(o.memberNum=n)}},{key:"_onMemberQuit",value:function(e){var t=e.payload,n=t.memberNum,r=t.groupProfile.groupID,o=this.groupController.getLocalGroupProfile(r);o&&Ds(n)&&(o.memberNum=n),this.groupController.deleteLocalGroupMembers(r,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,n=t.memberNum,r=t.groupProfile.groupID,o=this.groupController.getLocalGroupProfile(r);o&&Ds(n)&&(o.memberNum=n),this.groupController.deleteLocalGroupMembers(r,e.payload.userIDList)}},{key:"_onMemberSetAdmin",value:function(e){var t=this,n=e.payload.groupProfile.groupID;e.payload.userIDList.forEach((function(e){var r=t.groupController.getLocalGroupMemberInfo(n,e);r&&r.updateRole(Sn.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=this,n=e.payload.groupProfile.groupID;e.payload.userIDList.forEach((function(e){var r=t.groupController.getLocalGroupMemberInfo(n,e);r&&r.updateRole(Sn.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,n=e.payload.newGroupProfile,r=e.payload.groupProfile.groupID,o=this.groupController.getLocalGroupProfile(r);Object.keys(n).forEach((function(e){switch(e){case"ownerID":t._ownerChaged(o,n);break;default:o[e]=n[e]}})),this.groupController.emitGroupListUpdate(!0,!0)}},{key:"_ownerChaged",value:function(e,t){var n=e.groupID,r=this.groupController.getLocalGroupProfile(n),o=this.tim.context.identifier;if(o===t.ownerID){r.updateGroup({selfInfo:{role:Sn.GRP_MBR_ROLE_OWNER}});var i=this.groupController.getLocalGroupMemberInfo(n,o),a=this.groupController.getLocalGroupProfile(n).ownerID,s=this.groupController.getLocalGroupMemberInfo(n,a);i&&i.updateRole(Sn.GRP_MBR_ROLE_OWNER),s&&s.updateRole(Sn.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(e){var t=this,n=e.payload.groupProfile.groupID;e.payload.memberList.forEach((function(e){var r=t.groupController.getLocalGroupMemberInfo(n,e.userID);r&&e.muteTime&&r.updateMuteUntil(e.muteTime)}))}}]),e}(),Dy=function(){function e(t){Ln(this,e),this.groupController=t.groupController,this.tim=t.tim,this.pendencyMap=new Map,this._initLiceners()}return bn(e,[{key:"_initLiceners",value:function(){this.tim.innerEmitter.on(Kh,this._onReceivedGroupSystemNotice,this),this.tim.innerEmitter.on(xh,this._clearGroupSystemNotice,this)}},{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.tim.messageController.getLocalMessageList(Sn.CONV_SYSTEM),r=[];n.forEach((function(t){var n=t.payload,o=n.operatorID,i=n.operationType,a=n.groupProfile;if(i===lp){var s="".concat(o,"_").concat(a.groupID,"_").concat(a.to),u=e.pendencyMap.get(s);u&&Ds(u.handled)&&0!==u.handled&&r.push(t)}})),e.groupController.deleteGroupSystemNotice({messageList:r})}))}},{key:"getPendencyList",value:function(e){var t=this;return this.groupController.request({name:"group",action:"getGroupPendency",param:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this.tim.context.identifier}}).then((function(e){var n=e.data,r=n.pendencyList;return 0!==n.nextStartTime?t.getPendencyList({startTime:n.nextStartTime}).then((function(e){return[].concat(Yn(r),Yn(e))})):r}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.data,r=n.result;"sync"!==n.type&&r.forEach((function(e){switch(e.payload.operationType){case 1:t._onApplyGroupRequest(e);break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:t._onApplyGroupRequestRefused(e);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 255:t.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:Ip})}}))}},{key:"_onApplyGroupRequest",value:function(e){this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:lp})}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this.groupController.hasLocalGroup(n)||this.groupController.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t.groupController.updateGroupMap([n]),t.groupController.emitGroupListUpdate())})),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:pp})}},{key:"_onApplyGroupRequestRefused",value:function(e){this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:fp})}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this.groupController.hasLocalGroup(t)&&this.groupController.deleteLocalGroupAndConversation(t),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:hp})}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID,n=this.groupController.hasLocalGroup(t),r=this.groupController.AVChatRoomHandler;n&&this.groupController.deleteLocalGroupAndConversation(t),r.checkJoinedAVChatRoomByID(t)&&r.reset(t),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:dp})}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this.groupController.hasLocalGroup(n)||this.groupController.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t.groupController.updateGroupMap([n]),t.groupController.emitGroupListUpdate())})),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:gp})}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this.groupController.hasLocalGroup(t)&&this.groupController.deleteLocalGroupAndConversation(t),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:mp})}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,r=t.groupID,o=this.groupController.getLocalGroupMemberInfo(r,n);o&&o.updateRole(Sn.GRP_MBR_ROLE_ADMIN),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:vp})}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,r=t.groupID,o=this.groupController.getLocalGroupMemberInfo(r,n);o&&o.updateRole(Sn.GRP_MBR_ROLE_MEMBER),this.groupController.emitOuterEvent(Cn.GROUP_SYSTEM_NOTICE_RECEIVED,{message:e,type:yp})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),ky=Ye("splice"),Ay=lt("splice",{ACCESSORS:!0,0:0,1:2}),Oy=Math.max,Ry=Math.min;Ne({target:"Array",proto:!0,forced:!ky||!Ay},{splice:function(e,t){var n,r,o,i,a,s,u=we(this),c=ce(u.length),l=fe(e,c),p=arguments.length;if(0===p?n=r=0:1===p?(n=0,r=c-l):(n=p-2,r=Ry(Oy(se(t),0),c-l)),c+n-r>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(o=je(u,r),i=0;i<r;i++)(a=l+i)in u&&be(o,i,u[a]);if(o.length=r,n<r){for(i=l;i<c-r;i++)s=i+n,(a=i+r)in u?u[s]=u[a]:delete u[s];for(i=c;i>c-r+n;i--)delete u[i-1]}else if(n>r)for(i=c-r;i>l;i--)s=i+n-1,(a=i+r-1)in u?u[s]=u[a]:delete u[s];for(i=0;i<n;i++)u[i+l]=arguments[i+2];return u.length=c-r+n,o}});var Ny={3:!0,4:!0,5:!0,6:!0},Ly=function(){function e(t){var n=t.tim,r=t.groupController;Ln(this,e),this.tim=n,this.groupController=r,this.sequencesLinkedList=new My(100),this.receivedMessageCount=0,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._joinedGroupMap=new Map,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60}return bn(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?Yn(this._joinedGroupMap.keys()):null}},{key:"start",value:function(e){var t=this._pollingRequestInfoMap.get(e),n={key:t.key,startSeq:t.startSeq};if(this._pollingInstanceMap.has(e)){var r=this._pollingInstanceMap.get(e);r.isRunning()||r.start()}else{var o=this.groupController.createTransportCapsule({name:"AVChatRoom",action:"startLongPoll",param:n}),i=this.tim.connectionController.createRunLoop({pack:o,before:this._updateRequestData.bind(this,e),success:this._handleSuccess.bind(this,e),fail:this._handleFailure.bind(this),isAVChatRoomLoop:!0});i.start(),this._pollingInstanceMap.set(e,i),Es.log("AVChatRoomHandler.start message channel started. groupID=".concat(e))}}},{key:"stop",value:function(e){var t=this._pollingInstanceMap.get(e);t&&t.isRunning()&&(t.abort(),t.stop(),Es.log("AVChatRoomHandler.stop message channel stopped. groupID=".concat(e)))}},{key:"startRunLoop",value:function(e){var t=this;return this._precheck().then((function(){var n=e.longPollingKey,r=e.group,o=r.groupID;return t._pollingRequestInfoMap.set(o,{key:n,startSeq:0}),t._joinedGroupMap.set(o,r),t._addAVChatRoomID(o),t.groupController.updateGroupMap([r]),t.groupController.emitGroupListUpdate(!0,!1),t.start(o),t.groupController.isLoggedIn()?jd({status:Zu.SUCCESS,group:r}):jd({status:Zu.SUCCESS})}))}},{key:"joinWithoutAuth",value:function(e){var t=this;return this.groupController.request({name:"group",action:"applyJoinAVChatRoom",param:e}).then((function(n){var r=n.data.longPollingKey;if(Ns(r))return Bd(new Hp({code:$p.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN,message:wf}));Es.log("AVChatRoomHandler.joinWithoutAuth ok. groupID:".concat(e.groupID)),t.groupController.emitInnerEvent(Id),t.groupController.emitInnerEvent(_d,e.groupID);var o=new Yv({groupID:e.groupID});return t.startRunLoop({group:o,longPollingKey:r}),new qd({status:Zu.SUCCESS})})).catch((function(t){return Es.error("AVChatRoomHandler.joinWithoutAuth error:".concat(Fs(t),". groupID:").concat(e.groupID)),Bd(t)}))}},{key:"_precheck",value:function(){if(this.tim.context.unlimitedAVChatRoom)return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=Wn(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this.groupController.isLoggedIn()){if(!(n.selfInfo.role===Sn.GRP_MBR_ROLE_OWNER||n.ownerID===this.tim.loginInfo.identifier))return this.groupController.quitGroup(t);this.groupController.deleteLocalGroupAndConversation(t)}else this.groupController.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"_updateRequestData",value:function(e,t){var n=this._pollingRequestInfoMap.get(e),r=n.key,o=n.startSeq;t.StartSeq=o,t.Key=r,this.tim.sumStatController.addTotalCount(zd)}},{key:"_handleSuccess",value:function(e,t){this.tim.sumStatController.addSuccessCount(zd),this.tim.sumStatController.addCost(zd,t.data.timecost);var n=t.data,r=n.errorCode,o=n.errorInfo,i=n.key,a=n.nextSeq,s=n.rspMsgList;if(r!==ec.SUCCESS){var u=this._pollingRequestInfoMap.get(e),c=new ig(em),l=u?"".concat(u.key,"-").concat(u.startSeq):"requestInfo is undefined";c.setMessage("".concat(e,"-").concat(l,"-").concat(o||JSON.stringify(t.data))).setCode(r).setNetworkType(this.groupController.getNetworkType()).setEnd(!0)}else ks(i)&&Ds(a)&&this._pollingRequestInfoMap.set(e,{key:i,startSeq:a}),Rs(s)&&s.length>0&&(s.forEach((function(e){e.to=e.groupID})),this._dispatchNotice(s));this.groupController.emitInnerEvent(ud)}},{key:"_handleFailure",value:function(e){if(e.error)if("ECONNABORTED"===e.error.code||e.error.code===$p.NETWORK_TIMEOUT)if(e.error.config){var t=e.error.config.url,n=e.error.config.data;Es.log("AVChatRoomHandler._handleFailure request timed out. url=".concat(t," data=").concat(n))}else Es.log("AVChatRoomHandler._handleFailure request timed out");else Es.log("AVChatRoomHandler._handleFailure request failed due to network error");this.groupController.emitInnerEvent(sd)}},{key:"_dispatchNotice",value:function(e){if(Rs(e)&&0!==e.length){var t=Date.now(),n=null,r=[],o=[],i=e.length;i>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var a=0;a<i;a++)if(Ny[e[a].event]){if(this.receivedMessageCount+=1,n=this.packMessage(e[a],e[a].event),this.tim.context.unlimitedAVChatRoom||!this.sequencesLinkedList.has(n.sequence)){var s=n.conversationID;if(this.receivedMessageCount%40==0&&this.tim.messageLossController.detectMessageLoss(s,this.sequencesLinkedList.data()),null!==this.sequencesLinkedList.tail()){var u=this.sequencesLinkedList.tail().value,c=n.sequence-u;c>1&&c<=20?this.tim.messageLossController.onMessageMaybeLost(s,u+1,c-1):c<-1&&c>=-20&&this.tim.messageLossController.onMessageMaybeLost(s,n.sequence+1,Math.abs(c)-1)}this.sequencesLinkedList.pushIn(n.sequence),this._isMessageSentByCurrentInstance(n)||(n.conversationType===Sn.CONV_SYSTEM&&o.push(n),r.push(n))}}else Es.warn("AVChatRoomHandler._dispatchMessage 未处理的 event 类型: ".concat(e[a].event));if(o.length>0&&this.groupController.emitInnerEvent(Kh,{result:o,eventDataList:[],type:"poll"}),0!==r.length){var l=this.packConversationOption(r);l.length>0&&this.groupController.emitInnerEvent(Bh,{eventDataList:l,type:"poll"}),Es.debug("AVChatRoomHandler._dispatchNotice nums=".concat(r.length));var p=this.tim.sumStatController;p.addTotalCount(tg),p.addSuccessCount(tg),p.addCost(tg,Date.now()-t),this._checkMessageStacked(r),this.groupController.emitOuterEvent(Cn.MESSAGE_RECEIVED,r)}}}},{key:"_checkMessageStacked",value:function(e){var t=e.length;t>=100&&(Es.warn("AVChatRoomHandler.checkMessageStacked 直播群消息堆积数:".concat(e.length,'!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误,建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new ig(om).setNetworkType(this.groupController.getNetworkType()).setText("nums=".concat(t," groupID=").concat(Yn(this._joinedGroupMap.keys()))).setEnd(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this.tim.messageController.isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this.tim.context.identifier,e.conversationType=5===t?Sn.CONV_SYSTEM:Sn.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new fh(e),r=this.packElements(e,t);return n.setElement(r),n}},{key:"packElements",value:function(e,t){return 4===t||6===t?(this._updateMemberCountByGroupTips(e),{type:Sn.MSG_GRP_TIP,content:Un(Un({},e.elements),{},{groupProfile:e.groupProfile})}):5===t?{type:Sn.MSG_GRP_SYS_NOTICE,content:Un(Un({},e.elements),{},{groupProfile:e.groupProfile})}:this.tim.bigDataHallwayController.parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var r=e[n],o=r.conversationID;if(t.has(o)){var i=t.get(o);i.lastMessage=r,"in"===r.flow&&i.unreadCount++}else t.set(o,{conversationID:r.conversationID,unreadCount:"out"===r.flow?0:1,type:r.conversationType,subType:r.conversationSubType,lastMessage:r})}return Yn(t.values())}},{key:"_addAVChatRoomID",value:function(e){var t=this.tim.loginInfo.avchatroomIDList||[];t.includes(e)||(this.tim.context.unlimitedAVChatRoom?t.push(e):t.splice(0,1,e),this.tim.loginInfo.avchatroomIDList=t)}},{key:"_deleteAVChatRoomID",value:function(e){var t=this.tim.loginInfo.avchatroomIDList||[],n=t.indexOf(e);-1!==n&&(t.splice(n,1),this.tim.loginInfo.avchatroomIDList=t)}},{key:"joinAVChatRoomSilently",value:function(){var e=this,t=this.tim.loginInfo.avchatroomIDList||[];if(0!==t.length){var n=new ig(Lg);t.forEach((function(t){e.groupController.joinGroup({groupID:t}).then((function(r){Es.warn("AVChatRoomHandler.joinAVChatRoomSilently silently join group ok:".concat(t)),n.setCode(r.code).setText("groupID=".concat(t)).setNetworkType(e.groupController.getNetworkType()).setEnd(!0)})).catch((function(r){Es.warn("AVChatRoomHandler.joinAVChatRoomSilently silently join group failed:".concat(Fs(r))),n.setMessage("".concat(t,"-").concat(JSON.stringify(r))).setCode(r.code).setNetworkType(e.groupController.getNetworkType()).setEnd(!0)}))}))}}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return uu(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 new qd({memberCount:e.memberCount})})).catch((function(e){return Bd(e)}))):jd({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this;return this.groupController.request({name:"group",action:"getOnlineMemberNum",param:{groupID:e}}).then((function(n){var r=t._onlineMemberCountMap.get(e)||{},o=n.data,i=o.onlineMemberNum,a=void 0===i?0:i,s=o.expireTime,u=void 0===s?t.DEFAULT_EXPIRE_TIME:s;Es.log("AVChatRoomHandler._getGroupOnlineMemberCount ok. groupID=".concat(e," memberCount=").concat(a," expireTime=").concat(u));var c=Date.now();return uu(r)&&(r.lastReqTime=c),t._onlineMemberCountMap.set(e,Object.assign(r,{lastSyncTime:c,latestUpdateTime:c,memberCount:a,expireTime:u})),{memberCount:a}})).catch((function(n){return Es.warn("AVChatRoomHandler._getGroupOnlineMemberCount failed. error:".concat(Fs(n))),new ig(Qg).setCode(n.code).setMessage("".concat(e,"-").concat(JSON.stringify(n))).setNetworkType(t.groupController.getNetworkType()).setEnd(),Promise.reject(n)}))}},{key:"_updateMemberCountByGroupTips",value:function(e){var t=e.groupProfile.groupID,n=e.elements.onlineMemberInfo,r=void 0===n?void 0:n;if(void 0!==r){var o=r.onlineMemberNum,i=void 0===o?0:o,a=r.expireTime,s=void 0===a?this.DEFAULT_EXPIRE_TIME:a,u=this._onlineMemberCountMap.get(t)||{},c=Date.now();uu(u)?Object.assign(u,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:c,memberCount:i,expireTime:s}):(u.latestUpdateTime=c,u.memberCount=i),Es.debug("AVChatRoomHandler._updateMemberCountByGroupTips info:",u),this._onlineMemberCountMap.set(t,u)}}},{key:"reset",value:function(e){if(0!==this._pollingInstanceMap.size){if(e)Es.log("AVChatRoomHandler.reset groupID=".concat(e)),this.stop(e),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e);else{Es.log("AVChatRoomHandler.reset all");var t,n=tr(this._pollingInstanceMap.keys());try{for(n.s();!(t=n.n()).done;){var r=t.value;this.stop(r)}}catch(o){n.e(o)}finally{n.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear()}this.sequencesLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._deleteAVChatRoomID(e)}}}]),e}(),wy="GroupController",by=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).groupMap=new Map,r.groupMemberListMap=new Map,r.groupNoticeHandler=new Dy({tim:e,groupController:Hn(r)}),r.groupTipsHandler=new Ty({tim:e,groupController:Hn(r)}),r.AVChatRoomHandler=new Ly({tim:e,groupController:Hn(r)}),r._initListeners(),r}return bn(n,[{key:"createGroup",value:function(e){var t=this,n="".concat(wy,".createGroup");if(!["Public","Private","ChatRoom","AVChatRoom"].includes(e.type)){var r=new Hp({code:$p.ILLEGAL_GROUP_TYPE,message:Tf});return Bd(r)}eu(e.type)&&!Ns(e.memberList)&&e.memberList.length>0&&(Es.warn("".concat(n,"创建AVChatRoom时不能添加群成员,自动忽略该字段")),e.memberList=void 0),Qs(e.type)||Ns(e.joinOption)||(Es.warn("".concat(n," 创建Work/Meeting/AVChatRoom群时不能设置字段:joinOption,自动忽略该字段")),e.joinOption=void 0);var o=new ig(Rg);return Es.log("".concat(n)),this.request({name:"group",action:"create",param:e}).then((function(r){if(o.setNetworkType(t.getNetworkType()).setText("groupType=".concat(e.type," groupID=").concat(r.data.groupID)).setEnd(),Es.log("".concat(n," ok. groupID:"),r.data.groupID),e.type===Sn.GRP_AVCHATROOM)return t.getGroupProfile({groupID:r.data.groupID});t.updateGroupMap([Un(Un({},e),{},{groupID:r.data.groupID})]);var i=t.tim.createCustomMessage({to:r.data.groupID,conversationType:Sn.CONV_GROUP,payload:{data:"group_create",extension:"".concat(t.tim.context.identifier,"创建群组")}});return t.tim.sendMessage(i),t.emitGroupListUpdate(),t.getGroupProfile({groupID:r.data.groupID})})).then((function(e){var t=e.data.group;return t.selfInfo.messageRemindType=Sn.MSG_REMIND_ACPT_AND_NOTE,t.selfInfo.role=Sn.GRP_MBR_ROLE_OWNER,e})).catch((function(r){return o.setText("groupType=".concat(e.type)),t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];o.setError(r,n,i).setEnd()})),Es.error("".concat(n," error:"),r),Bd(r)}))}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,r=e.type,o="".concat(wy,".joinGroup");if(r===Sn.GRP_WORK){var i=new Hp({code:$p.CANNOT_JOIN_WORK,message:Df});return Bd(i)}if(this.hasLocalGroup(n)){if(!this.isLoggedIn())return jd({status:Sn.JOIN_STATUS_ALREADY_IN_GROUP});var a=new ig(Ng);return this.getGroupProfile({groupID:n}).then((function(e){return a.setNetworkType(t.getNetworkType()).setText("groupID=".concat(n," joinedStatus=").concat(Sn.JOIN_STATUS_ALREADY_IN_GROUP)).setEnd(),jd({status:Sn.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(r){return a.setNetworkType(t.getNetworkType()).setText("groupID=".concat(n," unjoined")).setEnd(),Es.warn("".concat(o," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return Es.log("".concat(o," groupID:"),n),this.isLoggedIn()?this.applyJoinGroup(e):this.AVChatRoomHandler.joinWithoutAuth(e)}},{key:"quitGroup",value:function(e){var t=this,n="".concat(wy,".quitGroup");Es.log("".concat(n," groupID:"),e);var r=this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e);if(!r&&!this.hasLocalGroup(e)){var o=new Hp({code:$p.MEMBER_NOT_IN_GROUP,message:Rf});return Bd(o)}if(r&&!this.isLoggedIn())return Es.log("".concat(n," anonymously ok. groupID:"),e),this.deleteLocalGroupAndConversation(e),this.AVChatRoomHandler.reset(e),jd({groupID:e});var i=new ig(wg);return this.request({name:"group",action:"quitGroup",param:{groupID:e}}).then((function(){return i.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e)).setEnd(),Es.log("".concat(n," ok. groupID:"),e),r&&t.AVChatRoomHandler.reset(e),t.deleteLocalGroupAndConversation(e),new qd({groupID:e})})).catch((function(r){return i.setText("groupID=".concat(e)),t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],o=t[1];i.setError(r,n,o).setEnd()})),Es.error("".concat(n," error. error:").concat(Fs(r)," groupID:").concat(e)),Bd(r)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(wy,".changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===Sn.GRP_AVCHATROOM)return Bd(new Hp({code:$p.CANNOT_CHANGE_OWNER_IN_AVCHATROOM,message:kf}));if(e.newOwnerID===this.tim.loginInfo.identifier)return Bd(new Hp({code:$p.CANNOT_CHANGE_OWNER_TO_SELF,message:Af}));var r=new ig(Pg);return Es.log("".concat(n," groupID:"),e.groupID),this.request({name:"group",action:"changeGroupOwner",param:e}).then((function(){r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(),Es.log("".concat(n," ok. groupID:"),e.groupID);var o=e.groupID,i=e.newOwnerID;t.groupMap.get(o).ownerID=i;var a=t.groupMemberListMap.get(o);if(a instanceof Map){var s=a.get(t.tim.loginInfo.identifier);Ns(s)||(s.updateRole("Member"),t.groupMap.get(o).selfInfo.role="Member");var u=a.get(i);Ns(u)||u.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),new qd({group:t.groupMap.get(o)})})).catch((function(o){return r.setText("groupID=".concat(e.groupID)),t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];r.setError(o,n,i).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(wy,".dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===Sn.GRP_WORK)return Bd(new Hp({code:$p.CANNOT_DISMISS_WORK,message:Of}));var r=new ig(xg);return Es.log("".concat(n," groupID:").concat(e)),this.request({name:"group",action:"destroyGroup",param:{groupID:e}}).then((function(){return r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e)).setEnd(),Es.log("".concat(n," ok. groupID:").concat(e)),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t.AVChatRoomHandler.reset(e),new qd({groupID:e})})).catch((function(o){return r.setText("groupID=".concat(e)),t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];r.setError(o,n,i).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e)),Bd(o)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(wy,".updateGroupProfile");!this.hasLocalGroup(e.groupID)||Qs(this.getLocalGroupProfile(e.groupID).type)||Ns(e.joinOption)||(Es.warn("".concat(n," Work/Meeting/AVChatRoom群不能设置字段:joinOption,自动忽略该字段")),e.joinOption=void 0),Ns(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off");var r=new ig(qg);return r.setText(JSON.stringify(e)),Es.log("".concat(n," groupID:"),e.groupID),this.request({name:"group",action:"updateGroupProfile",param:e}).then((function(){(r.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:"),e.groupID),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return new qd({group:t.groupMap.get(e.groupID)})})).catch((function(o){return t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];r.setError(o,n,i).setEnd()})),Es.log("".concat(n," failed. error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(wy,".setGroupMemberRole"),r=e.groupID,o=e.userID,i=e.role,a=this.groupMap.get(r);if(a.selfInfo.role!==Sn.GRP_MBR_ROLE_OWNER)return Bd(new Hp({code:$p.NOT_OWNER,message:Pf}));if([Sn.GRP_WORK,Sn.GRP_AVCHATROOM].includes(a.type))return Bd(new Hp({code:$p.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM,message:Gf}));if([Sn.GRP_MBR_ROLE_ADMIN,Sn.GRP_MBR_ROLE_MEMBER].indexOf(i)<0)return Bd(new Hp({code:$p.INVALID_MEMBER_ROLE,message:Uf}));if(o===this.tim.loginInfo.identifier)return Bd(new Hp({code:$p.CANNOT_SET_SELF_MEMBER_ROLE,message:xf}));var s=new ig(Jg);return s.setText("groupID=".concat(r," userID=").concat(o," role=").concat(i)),Es.log("".concat(n," groupID:").concat(r,". userID: ").concat(o)),this._modifyGroupMemberInfo({groupID:r,userID:o,role:i}).then((function(e){return s.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:").concat(r,". userID: ").concat(o)),new qd({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];s.setError(e,r,o).setEnd()})),Es.error("".concat(n," error:").concat(Fs(e)," groupID:").concat(r," userID:").concat(o)),Bd(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,r=e.userID,o=e.muteTime,i="".concat(wy,".setGroupMemberMuteTime");if(r===this.tim.loginInfo.identifier)return Bd(new Hp({code:$p.CANNOT_MUTE_SELF,message:qf}));Es.log("".concat(i," groupID:").concat(n,". userID: ").concat(r));var a=new ig(Wg);return a.setText("groupID=".concat(n," userID=").concat(r," muteTime=").concat(o)),this._modifyGroupMemberInfo({groupID:n,userID:r,muteTime:o}).then((function(e){return a.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(i," ok. groupID:").concat(n,". userID: ").concat(r)),new qd({group:t.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];a.setError(e,r,o).setEnd()})),Es.error("".concat(i," error:").concat(Fs(e)," groupID:").concat(n," userID:").concat(r)),Bd(e)}))}},{key:"setMessageRemindType",value:function(e){var t=this,n="".concat(wy,".setMessageRemindType"),r=new ig(Ug);r.setText("groupID=".concat(e.groupID," userID=").concat(e.userID||this.tim.loginInfo.identifier)),Es.log("".concat(n," groupID:").concat(e.groupID,". userID: ").concat(e.userID||this.tim.loginInfo.identifier));var o=e.groupID,i=e.messageRemindType;return this._modifyGroupMemberInfo({groupID:o,messageRemindType:i,userID:this.tim.loginInfo.identifier}).then((function(){r.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:").concat(e.groupID," userID:").concat(e.userID||t.tim.loginInfo.identifier));var o=t.getLocalGroupProfile(e.groupID);return o&&(o.selfInfo.messageRemindType=i),new qd({group:o})})).catch((function(o){return t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];r.setError(o,n,i).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID," userID:").concat(e.userID||t.tim.loginInfo.identifier)),Bd(o)}))}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(wy,".setGroupMemberNameCard"),r=e.groupID,o=e.userID,i=void 0===o?this.tim.loginInfo.identifier:o,a=e.nameCard;Es.log("".concat(n," groupID:").concat(r,". userID: ").concat(i));var s=new ig(Yg);return s.setText("groupID=".concat(r," userID=").concat(i," nameCard=").concat(a)),this._modifyGroupMemberInfo({groupID:r,userID:i,nameCard:a}).then((function(e){Es.log("".concat(n," ok. groupID:").concat(r,". userID: ").concat(i)),s.setNetworkType(t.getNetworkType()).setEnd();var o=t.getLocalGroupProfile(r);return i===t.tim.loginInfo.identifier&&o&&o.setSelfNameCard(a),new qd({group:o,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];s.setError(e,r,o).setEnd()})),Es.error("".concat(n," error:").concat(Fs(e)," groupID:").concat(r," userID:").concat(i)),Bd(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(wy,".setGroupMemberCustomField"),r=e.groupID,o=e.userID,i=void 0===o?this.tim.loginInfo.identifier:o,a=e.memberCustomField;Es.log("".concat(n," groupID:").concat(r,". userID: ").concat(i));var s=new ig(Xg);return s.setText("groupID=".concat(r," userID=").concat(i," memberCustomField=").concat(JSON.stringify(a))),this._modifyGroupMemberInfo({groupID:r,userID:i,memberCustomField:a}).then((function(e){return s.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:").concat(r,". userID: ").concat(i)),new qd({group:t.groupMap.get(r),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];s.setError(e,r,o).setEnd()})),Es.error("".concat(n," error:").concat(Fs(e)," groupID:").concat(r," userID:").concat(i)),Bd(e)}))}},{key:"getGroupList",value:function(e){var t=this,n="".concat(wy,".getGroupList"),r=new ig(Fg);Es.log("".concat(n));var o={introduction:"Introduction",notification:"Notification",createTime:"CreateTime",ownerID:"Owner_Account",lastInfoTime:"LastInfoTime",memberNum:"MemberNum",maxMemberNum:"MaxMemberNum",joinOption:"ApplyJoinOption",muteAllMembers:"ShutUpAllMember"},i=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime"];return e&&e.groupProfileFilter&&e.groupProfileFilter.forEach((function(e){o[e]&&i.push(o[e])})),this.request({name:"group",action:"list",param:{responseFilter:{groupBaseInfoFilter:i,selfInfoFilter:["Role","JoinTime","MsgFlag"]}}}).then((function(e){var o=e.data.groups;return Es.log("".concat(n," ok. nums=").concat(o.length)),t._groupListTreeShaking(o),t.updateGroupMap(o),r.setNetworkType(t.getNetworkType()).setText("".concat(o.length,"-afterTreeshaking-").concat(t.groupMap.size)).setEnd(),t.tempConversationList&&(Es.log("".concat(n," update last message with tempConversationList, nums=").concat(t.tempConversationList.length)),t._handleUpdateGroupLastMessage({data:t.tempConversationList}),t.tempConversationList=null),t.emitGroupListUpdate(),new qd({groupList:t.getLocalGroups()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),o=n[0],i=n[1];r.setError(e,o,i).setEnd()})),Es.error("".concat(n," error:"),e),Bd(e)}))}},{key:"getGroupMemberList",value:function(e){var t=this,n=e.groupID,r=e.offset,o=void 0===r?0:r,i=e.count,a=void 0===i?15:i,s="".concat(wy,".getGroupMemberList"),u=new ig(Kg);Es.log("".concat(s," groupID: ").concat(n," offset: ").concat(o," count: ").concat(a));var c=[];return this.request({name:"group",action:"getGroupMemberList",param:{groupID:n,offset:o,limit:a>100?100:a,memberInfoFilter:["Role","NameCard","ShutUpUntil"]}}).then((function(e){var r=e.data,o=r.members,i=r.memberNum;return Rs(o)&&0!==o.length?(t.hasLocalGroup(n)&&(t.getLocalGroupProfile(n).memberNum=i),c=t._updateLocalGroupMemberMap(n,o),t.tim.getUserProfile({userIDList:o.map((function(e){return e.userID})),tagList:[Ep.NICK,Ep.AVATAR]})):Promise.resolve([])})).then((function(e){var r=e.data;if(!Rs(r)||0===r.length)return jd({memberList:[]});var i=r.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,i),u.setNetworkType(t.getNetworkType()).setText("groupID=".concat(n," offset=").concat(o," count=").concat(a)).setEnd(),Es.log("".concat(s," ok.")),new qd({memberList:c})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];u.setError(e,r,o).setEnd()})),Es.error("".concat(s," error:"),e),Bd(e)}))}},{key:"getLocalGroups",value:function(){return Yn(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(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:"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:"getGroupProfile",value:function(e){var t=this,n="".concat(wy,".getGroupProfile"),r=new ig(Vg);Es.log("".concat(n," groupID:"),e.groupID);var o=e.groupID,i=e.groupCustomFieldFilter,a={groupIDList:[o],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:i}};return this.getGroupProfileAdvance(a).then((function(i){var a,s=i.data,u=s.successGroupList,c=s.failureGroupList;return Es.log("".concat(n," ok. groupID:").concat(e.groupID)),c.length>0?Bd(c[0]):(eu(u[0].type)&&!t.hasLocalGroup(o)?a=new Yv(u[0]):(t.updateGroupMap(u),a=t.getLocalGroupProfile(o)),r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(a.groupID," type=").concat(a.type," muteAllMembers=").concat(a.muteAllMembers," ownerID=").concat(a.ownerID)).setEnd(),a&&a.selfInfo&&!a.selfInfo.nameCard?t.updateSelfInfo(a).then((function(e){return new qd({group:e})})):new qd({group:a}))})).catch((function(o){return t.probeNetwork().then((function(t){var n=Wn(t,2),i=n[0],a=n[1];r.setError(o,i,a).setText("groupID=".concat(e.groupID)).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"getGroupMemberProfile",value:function(e){var t=this,n="".concat(wy,".getGroupMemberProfile"),r=new ig(Hg);r.setText(e.userIDList.length>5?"userIDList.length=".concat(e.userIDList.length):"userIDList=".concat(e.userIDList)),Es.log("".concat(n," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var o=e.groupID,i=e.userIDList;return this._getGroupMemberProfileAdvance(Un(Un({},e),{},{userIDList:i})).then((function(e){var n=e.data.members;return Rs(n)&&0!==n.length?(t._updateLocalGroupMemberMap(o,n),t.tim.getUserProfile({userIDList:n.map((function(e){return e.userID})),tagList:[Ep.NICK,Ep.AVATAR]})):jd([])})).then((function(e){var n=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));t._updateLocalGroupMemberMap(o,n);var a=i.filter((function(e){return t.hasLocalGroupMember(o,e)})).map((function(e){return t.getLocalGroupMemberInfo(o,e)}));return r.setNetworkType(t.getNetworkType()).setEnd(),new qd({memberList:a})}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({name:"group",action:"getGroupMemberProfile",param:Un(Un({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"updateSelfInfo",value:function(e){var t="".concat(wy,".updateSelfInfo"),n=e.groupID;Es.log("".concat(t," groupID:"),n);var r={groupID:n,userIDList:[this.tim.loginInfo.identifier]};return this.getGroupMemberProfile(r).then((function(r){var o=r.data.memberList;return Es.log("".concat(t," ok. groupID:"),n),e&&0!==o.length&&e.updateSelfInfo(o[0]),e}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(wy,".addGroupMember"),r=new ig($g);r.setText("groupID=".concat(e.groupID));var o=this.getLocalGroupProfile(e.groupID);if(eu(o.type)){var i=new Hp({code:$p.CANNOT_ADD_MEMBER_IN_AVCHATROOM,message:Lf});return r.setCode($p.CANNOT_ADD_MEMBER_IN_AVCHATROOM).setMessage(Lf).setNetworkType(this.getNetworkType()).setText("groupID=".concat(e.groupID," groupType=").concat(o.type)).setEnd(),Bd(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Es.log("".concat(n," groupID:"),e.groupID),this.request({name:"group",action:"addGroupMember",param:e}).then((function(i){var a=i.data.members;r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID)).setEnd(),Es.log("".concat(n," ok. groupID:"),e.groupID);var s=a.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),u=a.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=a.filter((function(e){return 2===e.result})).map((function(e){return e.userID}));return 0===s.length?new qd({successUserIDList:s,failureUserIDList:u,existedUserIDList:c}):(o.memberNum+=s.length,new qd({successUserIDList:s,failureUserIDList:u,existedUserIDList:c,group:o}))})).catch((function(o){return t.probeNetwork().then((function(t){var n=Wn(t,2),i=n[0],a=n[1];r.setError(o,i,a).setText("groupID=".concat(e.groupID)).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(wy,".deleteGroupMember"),r=new ig(zg);r.setText(e.userIDList.length>5?"userIDList.length=".concat(e.userIDList.length):"userIDList=".concat(e.userIDList)),Es.log("".concat(n," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList));var o=this.getLocalGroupProfile(e.groupID);return o.type===Sn.GRP_AVCHATROOM?Bd(new Hp({code:$p.CANNOT_KICK_MEMBER_IN_AVCHATROOM,message:bf})):this.request({name:"group",action:"deleteGroupMember",param:e}).then((function(){return r.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok")),o.memberNum--,t.deleteLocalGroupMembers(e.groupID,e.userIDList),new qd({group:o,userIDList:e.userIDList})})).catch((function(o){return t.probeNetwork().then((function(t){var n=Wn(t,2),i=n[0],a=n[1];r.setError(o,i,a).setText("groupID=".concat(e.groupID)).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(wy,".searchGroupByID"),r={groupIDList:[e]},o=new ig(bg);return o.setText("groupID=".concat(e)),Es.log("".concat(n," groupID:").concat(e)),this.request({name:"group",action:"searchGroupByID",param:r}).then((function(r){var i=r.data.groupProfile;if(i[0].errorCode!==ec.SUCCESS)throw new Hp({code:i[0].errorCode,message:i[0].errorInfo});return o.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:").concat(e)),new qd({group:new Yv(i[0])})})).catch((function(r){return t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];o.setError(r,n,i).setEnd()})),Es.warn("".concat(n," error:").concat(Fs(r)," groupID:").concat(e)),Bd(r)}))}},{key:"applyJoinGroup",value:function(e){var t=this,n="".concat(wy,".applyJoinGroup"),r=new ig(Ng);return this.request({name:"group",action:"applyJoinGroup",param:e}).then((function(o){var i=o.data,a=i.joinedStatus,s=i.longPollingKey;switch(r.setNetworkType(t.getNetworkType()).setText("groupID=".concat(e.groupID," joinedStatus=").concat(a)).setEnd(),Es.log("".concat(n," ok. groupID:").concat(e.groupID," joinedStatus:").concat(a," longPollingKey:").concat(s)),a){case Zu.WAIT_APPROVAL:return new qd({status:Zu.WAIT_APPROVAL});case Zu.SUCCESS:return t.getGroupProfile({groupID:e.groupID}).then((function(n){var r=n.data.group,o={status:Zu.SUCCESS,group:r};return Ns(s)?(t.emitGroupListUpdate(!0,!1),new qd(o)):(t.emitInnerEvent(_d,e.groupID),t.AVChatRoomHandler.startRunLoop({longPollingKey:s,group:r}))}));default:var u=new Hp({code:$p.JOIN_GROUP_FAIL,message:Nf});return Es.error("".concat(n," error:").concat(Fs(u)," groupID:").concat(e.groupID)),Bd(u)}})).catch((function(o){return r.setText("groupID=".concat(e.groupID)),t.probeNetwork().then((function(e){var t=Wn(e,2),n=t[0],i=t[1];r.setError(o,n,i).setEnd()})),Es.error("".concat(n," error:").concat(Fs(o)," groupID:").concat(e.groupID)),Bd(o)}))}},{key:"applyJoinAVChatRoom",value:function(e){return this.AVChatRoomHandler.applyJoinAVChatRoom(e)}},{key:"handleGroupApplication",value:function(e){var t=this,n="".concat(wy,".handleGroupApplication"),r=e.message.payload,o=r.groupProfile.groupID,i=r.authentication,a=r.messageKey,s=r.operatorID,u=new ig(Gg);return u.setText("groupID=".concat(o)),Es.log("".concat(n," groupID:"),o),this.request({name:"group",action:"handleApplyJoinGroup",param:Un(Un({},e),{},{applicant:s,groupID:o,authentication:i,messageKey:a})}).then((function(){return u.setNetworkType(t.getNetworkType()).setEnd(),Es.log("".concat(n," ok. groupID:"),o),t.deleteGroupSystemNotice({messageList:[e.message]}),new qd({group:t.getLocalGroupProfile(o)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];u.setError(e,r,o).setEnd()})),Es.error("".concat(n," error. error:").concat(Fs(e)," groupID:").concat(o)),Bd(e)}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(wy,".deleteGroupSystemNotice");return Rs(e.messageList)&&0!==e.messageList.length?(Es.log("".concat(n)+e.messageList.map((function(e){return e.ID}))),this.request({name:"group",action:"deleteGroupSystemNotice",param:{messageListToDelete:e.messageList.map((function(e){return{from:Sn.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){return Es.log("".concat(n," ok")),e.messageList.forEach((function(e){t.tim.messageController.deleteLocalMessage(e)})),new qd})).catch((function(e){return Es.error("".concat(n," error:"),e),Bd(e)}))):jd()}},{key:"getGroupProfileAdvance",value:function(e){var t="".concat(wy,".getGroupProfileAdvance");return Rs(e.groupIDList)&&e.groupIDList.length>50&&(Es.warn("".concat(t," 获取群资料的数量不能超过50个")),e.groupIDList.length=50),Es.log("".concat(t," groupIDList:"),e.groupIDList),this.request({name:"group",action:"query",param:e}).then((function(e){Es.log("".concat(t," ok."));var n=e.data.groups,r=n.filter((function(e){return Ns(e.errorCode)||e.errorCode===ec.SUCCESS})),o=n.filter((function(e){return e.errorCode&&e.errorCode!==ec.SUCCESS})).map((function(e){return new Hp({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}));return new qd({successGroupList:r,failureGroupList:o})})).catch((function(n){return Es.error("".concat(t," error:").concat(Fs(n)," groupIDList:").concat(e.groupIDList)),Bd(n)}))}},{key:"_deleteLocalGroup",value:function(e){return this.groupMap.delete(e),this.groupMemberListMap.delete(e),this._setStorageGroupList(),this.groupMap.has(e)&&this.groupMemberListMap.has(e)}},{key:"_initGroupList",value:function(){var e=this,t="".concat(wy,"._initGroupList"),n=new ig(jg);Es.time(rg),Es.log("".concat(t));var r=this._getStorageGroupList();Rs(r)&&r.length>0?(r.forEach((function(t){e.groupMap.set(t.groupID,new Yv(t))})),this.emitGroupListUpdate(!0,!1),n.setNetworkType(this.getNetworkType()).setText(this.groupMap.size).setEnd()):n.setNetworkType(this.getNetworkType()).setText(0).setEnd(),this.triggerReady(),Es.log("".concat(t," ok. initCost=").concat(Es.timeEnd(rg),"ms")),this.getGroupList()}},{key:"_initListeners",value:function(){var e=this.tim.innerEmitter;e.once(Ph,this._initGroupList,this),e.on(gd,this._handleUpdateGroupLastMessage,this),e.on(Bh,this._handleReceivedGroupMessage,this),e.on(yd,this._handleProfileUpdated,this)}},{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.getLocalGroups(),r=JSON.parse(JSON.stringify(n));t&&this.emitInnerEvent(cd,r),e&&this.emitOuterEvent(Cn.GROUP_LIST_UPDATED,n)}},{key:"_handleReceivedGroupMessage",value:function(e){var t=this,n=e.data.eventDataList;Array.isArray(n)&&n.forEach((function(e){var n=e.conversationID.replace(Sn.CONV_GROUP,"");t.groupMap.has(n)&&(t.groupMap.get(n).nextMessageSeq=e.lastMessage.sequence+1)}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=e.data;this.groupNoticeHandler._onReceivedGroupNotice(t)}},{key:"_handleUpdateGroupLastMessage",value:function(e){var t="".concat(wy,"._handleUpdateGroupLastMessage"),n=e.data;if(Es.log("".concat(t," convNums=").concat(n.length," groupNums=").concat(this.groupMap.size)),0!==this.groupMap.size){for(var r,o,i,a=!1,s=0,u=n.length;s<u;s++)(r=n[s]).conversationID&&r.type!==Sn.CONV_GROUP&&(o=r.conversationID.split(/^GROUP/)[1],(i=this.getLocalGroupProfile(o))&&(i.lastMessage=r.lastMessage,a=!0));a&&(this.groupMap=this._sortLocalGroupList(this.groupMap),this.emitGroupListUpdate(!0,!1))}else this.tempConversationList=n}},{key:"_sortLocalGroupList",value:function(e){var t=Yn(e).filter((function(e){var t=Wn(e,2);t[0];return!uu(t[1].lastMessage)}));return t.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),new Map([].concat(Yn(t),Yn(e)))}},{key:"_getStorageGroupList",value:function(){return this.tim.storage.getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroups().filter((function(e){var t=e.type;return!eu(t)})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.tim.storage.setItem("groupMap",e)}},{key:"updateGroupMap",value:function(e){var t=this;e.forEach((function(e){t.groupMap.has(e.groupID)?t.groupMap.get(e.groupID).updateGroup(e):t.groupMap.set(e.groupID,new Yv(e))})),this._setStorageGroupList()}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return Rs(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 Ey(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:"_modifyGroupMemberInfo",value:function(e){var t=this,n=e.groupID,r=e.userID;return this.request({name:"group",action:"modifyGroupMemberInfo",param:e}).then((function(){if(t.hasLocalGroupMember(n,r)){var o=t.getLocalGroupMemberInfo(n,r);return Ns(e.muteTime)||o.updateMuteUntil(e.muteTime),Ns(e.role)||o.updateRole(e.role),Ns(e.nameCard)||o.updateNameCard(e.nameCard),Ns(e.memberCustomField)||o.updateMemberCustomField(e.memberCustomField),o}return t.getGroupMemberProfile({groupID:n,userIDList:[r]}).then((function(e){return Wn(e.data.memberList,1)[0]}))}))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(Yn(this.groupMap)),n=0,r=e.length;n<r;n++)t.delete(e[n].groupID);this.AVChatRoomHandler.hasJoinedAVChatRoom()&&this.AVChatRoomHandler.getJoinedAVChatRoom().forEach((function(e){t.delete(e)}));for(var o=Yn(t.keys()),i=0,a=o.length;i<a;i++)this.groupMap.delete(o[i])}},{key:"_handleProfileUpdated",value:function(e){for(var t=this,n=e.data,r=function(e){var r=n[e];t.groupMemberListMap.forEach((function(e){e.has(r.userID)&&e.get(r.userID).updateMember({nick:r.nick,avatar:r.avatar})}))},o=0;o<n.length;o++)r(o)}},{key:"getJoinedAVChatRoom",value:function(){return this.AVChatRoomHandler.getJoinedAVChatRoom()}},{key:"deleteLocalGroupAndConversation",value:function(e){this._deleteLocalGroup(e),this.tim.conversationController.deleteLocalConversation("GROUP".concat(e)),this.emitGroupListUpdate(!0,!1)}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(wy,".getGroupLastSequence"),r=new ig(Bg),o=0;if(this.hasLocalGroup(e)){var i=this.getLocalGroupProfile(e);if(i.lastMessage.lastSequence>0)return o=i.lastMessage.lastSequence,Es.log("".concat(n," got lastSequence=").concat(o," from local group profile[lastMessage.lastSequence]. groupID=").concat(e)),r.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(o," from local group profile[lastMessage.lastSequence]. groupID=").concat(e)).setEnd(),Promise.resolve(o);if(i.nextMessageSeq>1)return o=i.nextMessageSeq-1,Es.log("".concat(n," got lastSequence=").concat(o," from local group profile[nextMessageSeq]. groupID=").concat(e)),r.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(o," from local group profile[nextMessageSeq]. groupID=").concat(e)).setEnd(),Promise.resolve(o)}var a="GROUP".concat(e),s=this.tim.conversationController.getLocalConversation(a);if(s&&s.lastMessage.lastSequence)return o=s.lastMessage.lastSequence,Es.log("".concat(n," got lastSequence=").concat(o," from local conversation profile[lastMessage.lastSequence]. groupID=").concat(e)),r.setNetworkType(this.getNetworkType()).setText("got lastSequence=".concat(o," from local conversation profile[lastMessage.lastSequence]. groupID=").concat(e)).setEnd(),Promise.resolve(o);var u={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(u).then((function(i){var a=i.data.successGroupList;return uu(a)?Es.log("".concat(n," successGroupList is empty. groupID=").concat(e)):(o=a[0].nextMessageSeq-1,Es.log("".concat(n," got lastSequence=").concat(o," from getGroupProfileAdvance. groupID=").concat(e))),r.setNetworkType(t.getNetworkType()).setText("got lastSequence=".concat(o," from getGroupProfileAdvance. groupID=").concat(e)).setEnd(),o})).catch((function(o){return t.probeNetwork().then((function(t){var n=Wn(t,2),i=n[0],a=n[1];r.setError(o,i,a).setText("get lastSequence failed from getGroupProfileAdvance. groupID=".concat(e)).setEnd()})),Es.warn("".concat(n," failed. ").concat(o)),Bd(o)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this.AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this.AVChatRoomHandler.getGroupOnlineMemberCount(e):jd({memberCount:0})}},{key:"reset",value:function(){this.groupMap.clear(),this.groupMemberListMap.clear(),this.resetReady(),this.groupNoticeHandler.reset(),this.AVChatRoomHandler.reset(),this.tim.innerEmitter.once(Ph,this._initGroupList,this)}}]),n}(Gd),Py=function(e){xn(n,e);var t=zn(n);function n(e){var r;Ln(this,n),(r=t.call(this,e)).REALTIME_MESSAGE_TIMEOUT=3e5,r.LONGPOLLING_ID_TIMEOUT=3e5,r._currentState=Sn.NET_STATE_CONNECTED,r._status={OPENIM:{lastResponseReceivedTime:0,jitterCount:0,failedCount:0},AVCHATROOM:{lastResponseReceivedTime:0,jitterCount:0,failedCount:0}};var o=r.tim.innerEmitter;return o.on($h,r._onGetLongPollIDFailed,Hn(r)),o.on(Wh,r._onOpenIMResponseOK,Hn(r)),o.on(zh,r._onOpenIMRequestFailed,Hn(r)),o.on(ud,r._onAVChatroomResponseOK,Hn(r)),o.on(sd,r._onAVChatroomRequestFailed,Hn(r)),r}return bn(n,[{key:"_onGetLongPollIDFailed",value:function(){this._currentState!==Sn.NET_STATE_DISCONNECTED&&this._emitNetStateChangeEvent(Sn.NET_STATE_DISCONNECTED)}},{key:"_onOpenIMResponseOK",value:function(){this._onResponseOK("OPENIM")}},{key:"_onOpenIMRequestFailed",value:function(){this._onRequestFailed("OPENIM")}},{key:"_onAVChatroomResponseOK",value:function(){this.isLoggedIn()||this._onResponseOK("AVCHATROOM")}},{key:"_onAVChatroomRequestFailed",value:function(){this.isLoggedIn()||this._onRequestFailed("AVCHATROOM")}},{key:"_onResponseOK",value:function(e){var t=this._status[e],n=Date.now();if(0!==t.lastResponseReceivedTime){var r=n-t.lastResponseReceivedTime;Es.debug("StatusController._onResponseOK key=".concat(e," currentState=").concat(this._currentState," interval=").concat(r," failedCount=").concat(t.failedCount," jitterCount=").concat(t.jitterCount)),t.failedCount>0&&(t.failedCount=0,t.jitterCount+=1,this._currentState!==Sn.NET_STATE_CONNECTED&&this._emitNetStateChangeEvent(Sn.NET_STATE_CONNECTED));r<=this.LONGPOLLING_ID_TIMEOUT?t.jitterCount>=3&&(new ig(tm).setText("".concat(e,"-").concat(r,"-").concat(t.jitterCount)).setNetworkType(this.getNetworkType()).setEnd(),t.jitterCount=0):(new ig(nm).setText("".concat(e,"-").concat(r)).setNetworkType(this.getNetworkType()).setEnd(),Es.warn("StatusController._onResponseOK, sdk reload. key=".concat(e," interval=").concat(r,"ms. https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/module-EVENT.html#.SDK_RELOAD")),this.emitInnerEvent(Cd)),t.lastResponseReceivedTime=n}else t.lastResponseReceivedTime=n}},{key:"_onRequestFailed",value:function(e){var t=this,n=this._status[e];Date.now()-n.lastResponseReceivedTime>=this.LONGPOLLING_ID_TIMEOUT?this._currentState!==Sn.NET_STATE_DISCONNECTED&&(Es.warn("StatusController._onRequestFailed, disconnected, longpolling unavailable more than 5min. key=".concat(e," networkType=").concat(this.getNetworkType())),this._emitNetStateChangeEvent(Sn.NET_STATE_DISCONNECTED)):(n.failedCount+=1,n.failedCount>5?this.probeNetwork().then((function(r){var o=Wn(r,2),i=o[0],a=o[1];i?(t._currentState!==Sn.NET_STATE_CONNECTING&&t._emitNetStateChangeEvent(Sn.NET_STATE_CONNECTING),Es.warn("StatusController._onRequestFailed, connecting, network jitter. key=".concat(e," networkType=").concat(a))):(t._currentState!==Sn.NET_STATE_DISCONNECTED&&t._emitNetStateChangeEvent(Sn.NET_STATE_DISCONNECTED),Es.warn("StatusController._onRequestFailed, disconnected, longpolling unavailable. key=".concat(e," networkType=").concat(a))),n.failedCount=0,n.jitterCount=0})):this._currentState===Sn.NET_STATE_CONNECTED&&this._emitNetStateChangeEvent(Sn.NET_STATE_CONNECTING))}},{key:"_emitNetStateChangeEvent",value:function(e){Es.log("StatusController._emitNetStateChangeEvent net state changed from ".concat(this._currentState," to ").concat(e)),this._currentState=e,this.emitOuterEvent(Cn.NET_STATE_CHANGE,{state:e})}},{key:"reset",value:function(){Es.log("StatusController.reset"),this._currentState=Sn.NET_STATE_CONNECTED,this._status={OPENIM:{lastResponseReceivedTime:0,jitterCount:0,failedCount:0},AVCHATROOM:{lastResponseReceivedTime:0,jitterCount:0,failedCount:0}}}}]),n}(Gd);function Gy(){return null}var Uy=function(){function e(t){Ln(this,e),this.tim=t,this.storageQueue=new Map,this.checkTimes=0,this.checkTimer=setInterval(this._onCheckTimer.bind(this),1e3),this._errorTolerantHandle()}return bn(e,[{key:"_errorTolerantHandle",value:function(){!Ka&&Ns(window.localStorage)&&(this.getItem=Gy,this.setItem=Gy,this.removeItem=Gy,this.clear=Gy)}},{key:"_onCheckTimer",value:function(){if(this.checkTimes++,this.checkTimes%20==0){if(0===this.storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=tr(this.storageQueue);try{for(t.s();!(e=t.n()).done;){var n=Wn(e.value,2),r=n[0],o=n[1];this._setStorageSync(this._getKey(r),o)}}catch(i){t.e(i)}finally{t.f()}this.storageQueue.clear()}catch(C_){Es.warn("Storage._doFlush error",C_)}}},{key:"_getPrefix",value:function(){var e=this.tim.loginInfo,t=e.SDKAppID,n=e.identifier;return"TIM_".concat(t,"_").concat(n,"_")}},{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(C_){return Es.warn("Storage.getItem error:",C_),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var o=r?this._getKey(e):e;this._setStorageSync(o,t)}else this.storageQueue.set(e,t)}},{key:"clear",value:function(){try{Ka?$a.clearStorageSync():localStorage.clear()}catch(C_){Es.warn("Storage.clear error:",C_)}}},{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(C_){Es.warn("Storage.removeItem error:",C_)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var r={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(r,"leftSize",{enumerable:!0,get:function(){return r.limitSize-r.size}}),Ka&&(r.limitSize=1024*$a.getStorageInfoSync().limitSize),e)r.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(Ka){var o=$a.getStorageInfoSync(),i=o.keys;i.forEach((function(e){r.size+=JSON.stringify(t._getStorageSync(e)).length+t._getKey(e).length}))}else for(var a in localStorage)localStorage.hasOwnProperty(a)&&(r.size+=localStorage.getItem(a).length+a.length);return this._convertUnit(r)}catch(C_){Es.warn("Storage.getSize error:",C_)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var r in t.unit=n,e)"number"==typeof e[r]&&("kb"===n.toLowerCase()?t[r]=Math.round(e[r]/1024):"mb"===n.toLowerCase()?t[r]=Math.round(e[r]/1024/1024):t[r]=e[r]);return t}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"_setStorageSync",value:function(e,t){Ka?Ba?my.setStorageSync({key:e,data:t}):$a.setStorageSync(e,t):localStorage.setItem(e,JSON.stringify(t))}},{key:"_getStorageSync",value:function(e){return Ka?Ba?my.getStorageSync({key:e}).data:$a.getStorageSync(e):JSON.parse(localStorage.getItem(e))}},{key:"_removeStorageSync",value:function(e){Ka?Ba?my.removeStorageSync({key:e}):$a.removeStorageSync(e):localStorage.removeItem(e)}},{key:"reset",value:function(){this._doFlush(),this.checkTimes=0}}]),e}(),xy=t((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new o(r,i||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,o,i,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],p=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),p){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,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,i),!0;case 6:return l.fn.call(l.context,t,r,o,i,a),!0}for(c=1,u=new Array(p-1);c<p;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var f,h=l.length;for(c=0;c<h;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),p){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,o);break;default:if(!u)for(f=1,u=new Array(p-1);f<p;f++)u[f-1]=arguments[f];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var s=this._events[i];if(s.fn)s.fn!==t||o&&!s.once||r&&s.context!==r||a(this,i);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||o&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}));function qy(e){var t=e.context||null;return{platform:Eh,websdkappid:Sh,v:Ch,a2:t&&t.a2Key||void 0,tinyid:t&&t.tinyID||void 0,sdkappid:t&&t.SDKAppID||0,contentType:t&&t.contentType||0,apn:t&&t.apn||1,accounttype:t&&t.accountType||0}}var Fy=function(){function e(t){Ln(this,e),this.tim=t,this.tim.innerEmitter.on(wh,this._update,this),this.tim.innerEmitter.on(bh,this._update,this),this.tim.innerEmitter.on(Gh,this._updateSpecifiedConfig,this),this._initConfig()}return bn(e,[{key:"_update",value:function(e){this._initConfig()}},{key:"_updateSpecifiedConfig",value:function(e){var t=this;e.data.forEach((function(e){t._set(e)}))}},{key:"get",value:function(e){var t=e.name,n=e.action,r=e.param,o=e.tjgID;if(Ns(this.config[t])||Ns(this.config[t][n]))throw new Hp({code:$p.NETWORK_PACKAGE_UNDEFINED,message:"".concat(Wf,": PackageConfig.").concat(t)});var i=function e(t){if(0===Object.getOwnPropertyNames(t).length)return Object.create(null);var n=Array.isArray(t)?[]:Object.create(null),r="";for(var o in t)null!==t[o]?void 0!==t[o]?(r=Nn(t[o]),["string","number","function","boolean"].indexOf(r)>=0?n[o]=t[o]:n[o]=e(t[o])):n[o]=void 0:n[o]=null;return n}(this.config[t][n]);return i.requestData=this._initRequestData(r,i),i.encode=this._initEncoder(i),i.decode=this._initDecoder(i),o&&(i.queryString.tjg_id=o),i}},{key:"_set",value:function(e){var t=e.key,n=e.value;if(!1!=!!t){var r=t.split(".");if(!(r.length<=0)){!function e(t,n,r,o){var i=n[r];"object"===Nn(t[i])?e(t[i],n,r+1,o):t[i]=o}(this.config,r,0,n)}}}},{key:"_initConfig",value:function(){var e;this.config={},this.config.accessLayer=(e=this.tim,{create:null,query:{serverName:Nh.NAME.WEB_IM,cmd:Nh.CMD.ACCESS_LAYER,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:Un(Un({},qy(e)),{},{identifier:e.context.identifier,usersig:e.context.userSig}),requestData:{}},update:null,delete:null}),this.config.login=function(e){return{create:null,query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.LOGIN,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:Un(Un({},qy(e)),{},{identifier:e.loginInfo.identifier,usersig:e.loginInfo.userSig,sdkappid:e.loginInfo.SDKAppID,accounttype:e.loginInfo.accountType,reqtime:+new Date/1e3}),requestData:{state:"Online"},keyMaps:{request:{tinyID:"tinyId"},response:{TinyId:"tinyID"}}},update:null,delete:null}}(this.tim),this.config.logout=function(e){return{create:null,query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.LOGOUT_ALL,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:Un(Un({},qy(e)),{},{reqtime:+new Date/1e3}),requestData:{}},update:null,delete:null}}(this.tim),this.config.longPollLogout=function(e){return{create:null,query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.LOGOUT_LONG_POLL,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:Un(Un({},qy(e)),{},{reqtime:+new Date}),requestData:{longPollID:""},keyMaps:{request:{longPollID:"LongPollingId"}}},update:null,delete:null}}(this.tim),this.config.profile=function(e){var t=qy(e),n={serverName:Nh.NAME.PROFILE,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{query:Un(Un({},n),{},{cmd:Nh.CMD.PORTRAIT_GET,requestData:{fromAccount:"",userItem:[]},keyMaps:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),update:Un(Un({},n),{},{cmd:Nh.CMD.PORTRAIT_SET,requestData:{fromAccount:"",profileItem:[{tag:Ep.NICK,value:""},{tag:Ep.GENDER,value:""},{tag:Ep.ALLOWTYPE,value:""},{tag:Ep.AVATAR,value:""}]}})}}(this.tim),this.config.group=function(e){var t=Nh.NAME.GROUP,n=qy(e);if(e.context.login!==tc.IS_LOGIN||!e.context.a2Key){t=Nh.NAME.BIG_GROUP_NO_AUTH;var r=qy(e);r.a2,r.tinyid;n=Kn(r,["a2","tinyid"])}var o={request:{ownerID:"Owner_Account",userID:"Member_Account",newOwnerID:"NewOwner_Account",maxMemberNum:"MaxMemberCount",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember",messageRemindType:"MsgFlag",userIDList:"MemberList",groupIDList:"GroupIdList",applyMessage:"ApplyMsg",muteTime:"ShutUpTime",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption"},response:{GroupIdList:"groups",MsgFlag:"messageRemindType",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers",ApplyJoinOption:"joinOption"}},i={serverName:Nh.NAME.GROUP,channel:Nh.CHANNEL.XHR,protocol:Dh,queryString:n};return{create:Un(Un({},i),{},{cmd:Nh.CMD.CREATE_GROUP,requestData:{type:Sn.GRP_WORK,name:void 0,groupID:void 0,ownerID:e.loginInfo.identifier,introduction:void 0,notification:void 0,avatar:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0},keyMaps:o}),list:Un(Un({},i),{},{cmd:Nh.CMD.GET_JOINED_GROUPS,requestData:{userID:e.loginInfo.identifier,limit:void 0,offset:void 0,groupType:void 0,responseFilter:void 0},keyMaps:o}),query:Un(Un({},i),{},{cmd:Nh.CMD.GET_GROUP_INFO,requestData:{groupIDList:void 0,responseFilter:void 0},keyMaps:o}),getGroupMemberProfile:Un(Un({},i),{},{cmd:Nh.CMD.GET_GROUP_MEMBER_INFO,requestData:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMaps:{request:Un(Un({},o.request),{},{userIDList:"Member_List_Account"}),response:o.response}}),getGroupMemberList:Un(Un({},i),{},{cmd:Nh.CMD.GET_GROUP_MEMBER_LIST,requestData:{groupID:void 0,limit:0,offset:0,memberRoleFilter:void 0,memberInfoFilter:void 0},keyMaps:o}),quitGroup:Un(Un({},i),{},{cmd:Nh.CMD.QUIT_GROUP,requestData:{groupID:void 0}}),changeGroupOwner:Un(Un({},i),{},{cmd:Nh.CMD.CHANGE_GROUP_OWNER,queryString:n,requestData:{groupID:void 0,newOwnerID:void 0},keyMaps:o}),destroyGroup:Un(Un({},i),{},{cmd:Nh.CMD.DESTROY_GROUP,requestData:{groupID:void 0}}),updateGroupProfile:Un(Un({},i),{},{cmd:Nh.CMD.MODIFY_GROUP_INFO,requestData:{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},keyMaps:{request:Un(Un({},o.request),{},{groupCustomField:"AppDefinedData"}),response:o.response}}),modifyGroupMemberInfo:Un(Un({},i),{},{cmd:Nh.CMD.MODIFY_GROUP_MEMBER_INFO,requestData:{groupID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMaps:o}),addGroupMember:Un(Un({},i),{},{cmd:Nh.CMD.ADD_GROUP_MEMBER,requestData:{groupID:void 0,silence:void 0,userIDList:void 0},keyMaps:o}),deleteGroupMember:Un(Un({},i),{},{cmd:Nh.CMD.DELETE_GROUP_MEMBER,requestData:{groupID:void 0,userIDList:void 0,reason:void 0},keyMaps:{request:{userIDList:"MemberToDel_Account"}}}),searchGroupByID:Un(Un({},i),{},{cmd:Nh.CMD.SEARCH_GROUP_BY_ID,requestData:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption"]}},keyMaps:{request:{groupIDList:"GroupIdList"}}}),applyJoinGroup:Un(Un({},i),{},{cmd:Nh.CMD.APPLY_JOIN_GROUP,requestData:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0},keyMaps:o}),applyJoinAVChatRoom:Un(Un({},i),{},{serverName:Nh.NAME.BIG_GROUP_NO_AUTH,cmd:Nh.CMD.APPLY_JOIN_GROUP,requestData:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0},keyMaps:o}),handleApplyJoinGroup:Un(Un({},i),{},{cmd:Nh.CMD.HANDLE_APPLY_JOIN_GROUP,requestData:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMaps:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"},response:{MsgKey:"messageKey"}}}),deleteGroupSystemNotice:Un(Un({},i),{},{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.DELETE_GROUP_SYSTEM_MESSAGE,requestData:{messageListToDelete:void 0},keyMaps:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),getGroupPendency:Un(Un({},i),{},{cmd:Nh.CMD.GET_GROUP_PENDENCY,requestData:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMaps:{request:{handleAccount:"Handle_Account"}}}),getOnlineMemberNum:{serverName:t,cmd:Nh.CMD.GET_ONLINE_MEMBER_NUM,channel:Nh.CHANNEL.XHR,protocol:Dh,queryString:n,requestData:{groupID:void 0}}}}(this.tim),this.config.longPollID=function(e){return{create:{},query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.GET_LONG_POLL_ID,channel:Nh.CHANNEL.XHR,protocol:Dh,queryString:Un(Un({},qy(e)),{},{instanceid:e.context.instanceID,reqtime:+new Date/1e3}),requestData:{},keyMaps:{response:{LongPollingId:"longPollingID"}}},update:{},delete:{}}}(this.tim),this.config.longPoll=function(e){var t=Un(Un({},qy(e)),{},{instanceid:e.context.instanceID,reqtime:Math.ceil(+new Date/1e3)});return{create:{},query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.LONG_POLL,channel:Nh.CHANNEL.AUTO,protocol:Dh,queryString:t,requestData:{timeout:null,cookie:{notifySeq:0,noticeSeq:0,longPollingID:0}},keyMaps:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension"}}},update:{},delete:{}}}(this.tim),this.config.applyC2C=function(e){var t=qy(e),n={serverName:Nh.NAME.FRIEND,channel:Nh.CHANNEL.XHR,protocol:Dh,queryString:t};return{create:Un(Un({},n),{},{cmd:Nh.CMD.FRIEND_ADD,requestData:{fromAccount:"",addFriendItem:[]}}),get:Un(Un({},n),{},{cmd:Nh.CMD.GET_PENDENCY,requestData:{fromAccount:"",pendencyType:"Pendency_Type_ComeIn"}}),update:Un(Un({},n),{},{cmd:Nh.CMD.RESPONSE_PENDENCY,requestData:{fromAccount:"",responseFriendItem:[]}}),delete:Un(Un({},n),{},{cmd:Nh.CMD.DELETE_PENDENCY,requestData:{fromAccount:"",toAccount:[],pendencyType:"Pendency_Type_ComeIn"}})}}(this.tim),this.config.friend=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}}),n={serverName:Nh.NAME.FRIEND,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{get:Un(Un({},n),{},{cmd:Nh.CMD.FRIEND_GET_ALL,requestData:{fromAccount:"",timeStamp:0,tagList:[Ep.NICK,"Tag_SNS_IM_Remark",Ep.AVATAR]},keyMaps:{request:{},response:{}}}),delete:Un(Un({},n),{},{cmd:Nh.CMD.FRIEND_DELETE,requestData:{fromAccount:"",toAccount:[],deleteType:"Delete_Type_Single"}})}}(this.tim),this.config.blacklist=function(e){var t=qy(e),n={serverName:Nh.NAME.FRIEND,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{create:Un(Un({},n),{},{cmd:Nh.CMD.ADD_BLACKLIST,requestData:{fromAccount:"",toAccount:[]}}),get:Un(Un({},n),{},{cmd:Nh.CMD.GET_BLACKLIST,requestData:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0}}),delete:Un(Un({},n),{},{cmd:Nh.CMD.DELETE_BLACKLIST,requestData:{fromAccount:"",toAccount:[]}}),update:{}}}(this.tim),this.config.c2cMessage=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}}),n={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",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl"},response:{MsgContent:"content",MsgTime:"time",Data:"data",Desc:"description",Ext:"extension",MsgKey:"messageKey",MsgType:"type",MsgBody:"elements",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}},r={serverName:Nh.NAME.OPEN_IM,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{create:Un(Un({},r),{},{cmd:Nh.CMD.SEND_MESSAGE,requestData:{fromAccount:e.loginInfo.identifier,toAccount:"",msgTimeStamp:Math.ceil(+new Date/1e3),msgSeq:0,msgRandom:0,msgBody:[],nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}}},keyMaps:n}),query:Un(Un({},r),{},{cmd:Nh.CMD.GET_C2C_ROAM_MESSAGES,requestData:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMsg:1},keyMaps:n})}}(this.tim),this.config.c2cMessageWillBeRevoked=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}});return{create:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.REVOKE_C2C_MESSAGE,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:Math.ceil(+new Date/1e3),msgSeq:0,msgRandom:0}},keyMaps:{request:{msgInfo:"MsgInfo",fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody"}}}}}(this.tim),this.config.c2cPeerReadTime=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}});return{get:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.GET_PEER_READ_TIME,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{userIDList:void 0},keyMaps:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}}(this.tim),this.config.groupMessage=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}}),n={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",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq"},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"}},r={serverName:Nh.NAME.GROUP,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{create:Un(Un({},r),{},{cmd:Nh.CMD.SEND_GROUP_MESSAGE,requestData:{groupID:"",fromAccount:e.loginInfo.identifier,random:0,clientSequence:0,priority:"",msgBody:[],onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[]},keyMaps:n}),query:Un(Un({},r),{},{cmd:Nh.CMD.GET_GROUP_ROAM_MESSAGES,requestData:{withRecalledMsg:1,groupID:"",count:15,sequence:""},keyMaps:n}),update:null,delete:null}}(this.tim),this.config.groupMessageWillBeRevoked=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}});return{create:{serverName:Nh.NAME.GROUP,cmd:Nh.CMD.REVOKE_GROUP_MESSAGE,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{to:"",msgSeqList:[]},keyMaps:{request:{to:"GroupId",msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}}(this.tim),this.config.conversation=function(e){var t=qy(e),n={serverName:Nh.NAME.RECENT_CONTACT,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t};return{query:Un(Un({},n),{},{cmd:Nh.CMD.GET_CONVERSATION_LIST,requestData:{fromAccount:e.loginInfo.identifier,count:0},keyMaps:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq"}}}),pagingQuery:Un(Un({},n),{},{cmd:Nh.CMD.PAGING_GET_CONVERSATION_LIST,requestData:{fromAccount:void 0,timeStamp:void 0,orderType:void 0},keyMaps:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}),delete:Un(Un({},n),{},{cmd:Nh.CMD.DELETE_CONVERSATION,requestData:{fromAccount:e.loginInfo.identifier,toAccount:void 0,type:1,toGroupID:void 0},keyMaps:{request:{toGroupID:"ToGroupid"}}}),setC2CMessageRead:Un(Un({},n),{},{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.SET_C2C_MESSAGE_READ,requestData:{C2CMsgReaded:void 0},keyMaps:{request:{lastMessageTime:"LastedMsgTime"}}}),setGroupMessageRead:Un(Un({},n),{},{serverName:Nh.NAME.GROUP,cmd:Nh.CMD.SET_GROUP_MESSAGE_READ,requestData:{groupID:void 0,messageReadSeq:void 0},keyMaps:{request:{messageReadSeq:"MsgReadedSeq"}}}),deleteGroupAtTips:Un(Un({},n),{},{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.DELETE_GROUP_AT_TIPS,requestData:{messageListToDelete:void 0},keyMaps:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}})}}(this.tim),this.config.syncMessage=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return[Math.ceil(+new Date),Math.random()].join("")}});return{create:null,query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.GET_MESSAGES,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{cookie:"",syncFlag:0,needAbstract:1},keyMaps:{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"}}},update:null,delete:null}}(this.tim),this.config.AVChatRoom=function(e){var t=Nh.NAME.BIG_GROUP_LONG_POLLING,n=Un(Un({},qy(e)),{},{accounttype:"792",reqtime:function(){return+new Date}});if(e.context.login!==tc.IS_LOGIN||!e.context.a2Key){t=Nh.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH;var r=n;r.a2,r.tinyid;n=Kn(r,["a2","tinyid"])}return{startLongPoll:{serverName:t,cmd:Nh.CMD.AVCHATROOM_LONG_POLL,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:n,requestData:{USP:1,startSeq:1,holdTime:90,key:void 0},keyMaps:{request:{USP:"USP"},response:{ToGroupId:"groupID",MsgPriority:"priority"}}}}}(this.tim),this.config.cosUpload=function(e){var t=Un(Un({},qy(e)),{},{reqtime:function(){return+new Date}});return{create:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.FILE_UPLOAD,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{appVersion:"2.1",fromAccount:"",toAccount:"",sequence:0,time:function(){return Math.ceil(Date.now()/1e3)},random:function(){return Bs()},fileStrMd5:"",fileSize:"",serverVer:1,authKey:"",busiId:1,pkgFlag:1,sliceOffset:0,sliceSize:0,sliceData:"",contentType:"application/x-www-form-urlencoded"},keyMaps:{request:{},response:{}}},update:null,delete:null}}(this.tim),this.config.cosSig=function(e){var t={sdkappid:e.loginInfo.SDKAppID,identifier:e.loginInfo.identifier,userSig:e.context.userSig};return{create:null,query:{serverName:Nh.NAME.IM_COS_SIGN,cmd:Nh.CMD.COS_SIGN,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMaps:{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"}}},update:null,delete:null}}(this.tim),this.config.cosPreSig=function(e){var t={sdkappid:e.loginInfo.SDKAppID,identifier:e.loginInfo.identifier,userSig:e.context.userSig,platform:Ka?8:7,version:Ch};return{query:{serverName:Nh.NAME.IM_COS_MESSAGE,cmd:Nh.CMD.COS_PRE_SIG,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:t,requestData:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMaps:{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"}}}}}(this.tim),this.config.bigDataHallwayAuthKey=function(e){return{create:null,query:{serverName:Nh.NAME.OPEN_IM,cmd:Nh.CMD.BIG_DATA_HALLWAY_AUTH_KEY,channel:Nh.CHANNEL.XHR,protocol:Dh,method:"POST",queryString:Un(Un({},qy(e)),{},{accounttype:"792",reqtime:function(){return+new Date}}),requestData:{}}}}(this.tim),this.config.ssoEventStat=function(e){var t={sdkappid:e.loginInfo.SDKAppID,reqtime:Math.ceil(+new Date/1e3)};return{create:{serverName:Nh.NAME.IM_OPEN_STAT,cmd:Nh.CMD.TIM_WEB_REPORT,channel:Nh.CHANNEL.AUTO,protocol:Dh,queryString:t,requestData:{table:"",report:[]},keyMaps:{request:{table:"table",report:"report",SDKAppID:"sdkappid",version:"version",tinyID:"tinyid",userID:"userid",platform:"platform",method:"method",time:"time",start:"start",end:"end",cost:"cost",status:"status",codeint:"codeint",message:"message",pointer:"pointer",text:"text",msgType:"msgtype",networkType:"networktype",startts:"startts",endts:"endts",timespan:"timespan"}}},query:{},update:{},delete:{}}}(this.tim),this.config.ssoSumStat=function(e){var t=null;null!==e.context&&(t={sdkappid:e.context.SDKAppID,reqtime:Math.ceil(+new Date/1e3)});return{create:{serverName:Nh.NAME.IM_OPEN_STAT,cmd:Nh.CMD.TIM_WEB_REPORT,channel:Nh.CHANNEL.AUTO,protocol:Dh,queryString:t,requestData:{table:"",report:[]},keyMaps:{request:{table:"table",report:"report",SDKAppID:"sdkappid",version:"version",tinyID:"tinyid",userID:"userid",item:"item",lpID:"lpid",platform:"platform",scene:"scene",networkType:"networktype",total:"total",successRate:"successrate",avg:"avg",timespan:"timespan",time:"time"}}},query:{},update:{},delete:{}}}(this.tim)}},{key:"_initRequestData",value:function(e,t){if(void 0===e)return Od(t.requestData,this._getRequestMap(t),this.tim);var n=t.requestData,r=Object.create(null);for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)){if(r[o]="function"==typeof n[o]?n[o]():n[o],void 0===e[o])continue;r[o]=e[o]}return r=Od(r,this._getRequestMap(t),this.tim)}},{key:"_getRequestMap",value:function(e){if(e.keyMaps&&e.keyMaps.request&&Object.keys(e.keyMaps.request).length>0)return e.keyMaps.request}},{key:"_initEncoder",value:function(e){switch(e.protocol){case Dh:return function(e){if("string"===Nn(e))try{return JSON.parse(e)}catch(C_){return e}return e};case Th:return function(e){return e};default:return function(e){return Es.warn("PackageConfig._initEncoder(), unknow response type, data: ",JSON.stringify(e)),e}}}},{key:"_initDecoder",value:function(e){switch(e.protocol){case Dh:return function(e){if("string"===Nn(e))try{return JSON.parse(e)}catch(C_){return e}return e};case Th:return function(e){return e};default:return function(e){return Es.warn("PackageConfig._initDecoder(), unknow response type, data: ",e),e}}}}]),e}(),Vy=Math.floor;Ne({target:"Number",stat:!0},{isInteger:function(e){return!m(e)&&isFinite(e)&&Vy(e)===e}});var jy=function(){for(var e=[],t=By(arguments),n=0;n<arguments.length;n++)Number.isInteger(arguments[n])?e.push(arguments[n]):e.push(!0==!!arguments[n]?"1":"0");return e.join(t)},By=function(e){var t=e.length,n=e[t-1];if("string"!=typeof n)return"";if(n.length>1)return"";var r=e[t-1];return delete e[t-1],e.length-=t===e.length?1:0,r},Ky={C2CMessageArray:1,groupMessageArray:1,groupTips:1,C2CNotifyMessageArray:1,profileModify:1,friendListMod:1},Hy=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e))._initialization(),r}return bn(n,[{key:"_initialization",value:function(){this._syncOffset="",this._syncNoticeList=[],this._syncEventArray=[],this._syncMessagesIsRunning=!1,this._syncMessagesFinished=!1,this._isLongPoll=!1,this._longPollID="0",this._noticeSequence=0,this._initializeListener(),this._runLoop=null,this._initShuntChannels()}},{key:"_initShuntChannels",value:function(){this._shuntChannels=Object.create(null),this._shuntChannels.C2CMessageArray=this._C2CMessageArrayChannel.bind(this),this._shuntChannels.groupMessageArray=this._groupMessageArrayChannel.bind(this),this._shuntChannels.groupTips=this._groupTipsChannel.bind(this),this._shuntChannels.C2CNotifyMessageArray=this._C2CNotifyMessageArrayChannel.bind(this),this._shuntChannels.profileModify=this._profileModifyChannel.bind(this),this._shuntChannels.friendListMod=this._friendListModChannel.bind(this)}},{key:"_C2CMessageArrayChannel",value:function(e,t,n){this.emitInnerEvent(Xh,t)}},{key:"_groupMessageArrayChannel",value:function(e,t,n){this.emitInnerEvent(Qh,t)}},{key:"_groupTipsChannel",value:function(e,t,n){var r=this;switch(e){case 4:case 6:this.emitInnerEvent(Zh,t);break;case 5:t.forEach((function(e){Rs(e.elements.revokedInfos)?r.emitInnerEvent(od,t):r.emitInnerEvent(td,{groupSystemNotices:t,type:n})}));break;case 12:this.emitInnerEvent(ed,t);break;default:Es.log("NotificationController._groupTipsChannel unknown event=".concat(e," type=").concat(n),t)}}},{key:"_C2CNotifyMessageArrayChannel",value:function(e,t,n){if(t[0]){var r=t[0];r.hasOwnProperty("kickoutMsgNotify")?this.emitInnerEvent(Jh):r.hasOwnProperty("c2cMessageRevokedNotify")?this.emitInnerEvent(id,t):r.hasOwnProperty("c2cMessageReadReceipt")&&this.emitInnerEvent(ad,t)}}},{key:"_profileModifyChannel",value:function(e,t,n){this.emitInnerEvent(rd,t)}},{key:"_friendListModChannel",value:function(e,t,n){this.emitInnerEvent(nd,t)}},{key:"_dispatchNotice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"poll";if(Rs(e))for(var n=null,r=null,o="",i=0,a=0,s=e.length;a<s;a++)i=(n=e[a]).event,o=Object.keys(n).find((function(e){return void 0!==Ky[e]})),ws(this._shuntChannels[o])?(r=n[o],"poll"===t&&this._updatenoticeSequence(r),this._shuntChannels[o](i,r,t)):("poll"===t&&this._updatenoticeSequence(),Es.log("NotificationController._dispatchNotice unknown eventItem=",n))}},{key:"getLongPollID",value:function(){return this._longPollID}},{key:"_IAmReady",value:function(){this.triggerReady()}},{key:"reset",value:function(){this._noticeSequence=0,this._resetSync(),this.closeNoticeChannel()}},{key:"_resetSync",value:function(){this._syncOffset="",this._syncNoticeList=[],this._syncEventArray=[],this._syncMessagesIsRunning=!1,this._syncMessagesFinished=!1}},{key:"_setNoticeSeqInRequestData",value:function(e){e.Cookie.NoticeSeq=this._noticeSequence,this.tim.sumStatController.addTotalCount($d)}},{key:"_updatenoticeSequence",value:function(e){if(e){var t=e[e.length-1].noticeSequence;t&&"number"==typeof t?t<=this._noticeSequence||(this._noticeSequence=t):this._noticeSequence++}else this._noticeSequence++}},{key:"_initializeListener",value:function(){var e=this.tim.innerEmitter;e.on(Ph,this._startSyncMessages,this),e.on(fd,this.closeNoticeChannel,this)}},{key:"openNoticeChannel",value:function(){Es.log("NotificationController.openNoticeChannel"),this._getLongPollID()}},{key:"closeNoticeChannel",value:function(){Es.log("NotificationController.closeNoticeChannel"),(this._runLoop instanceof Rv||this._runLoop instanceof Nv)&&(this._runLoop.abort(),this._runLoop.stop()),this._longPollID="0",this._isLongPoll=!1}},{key:"_getLongPollID",value:function(){var e=this;if("0"===this._longPollID){var t=new ig(Zg);this.request({name:"longPollID",action:"query"}).then((function(n){var r=n.data.longPollingID;e._onGetLongPollIDSuccess(r),t.setText("longPollingID=".concat(r)).setNetworkType(e.getNetworkType()).setEnd()})).catch((function(n){var r=new Hp({code:n.code||$p.GET_LONGPOLL_ID_FAILED,message:n.message||Qf});e.emitInnerEvent($h),e.emitInnerEvent(dd,r),e.probeNetwork().then((function(e){var n=Wn(e,2),o=n[0],i=n[1];t.setError(r,o,i).setEnd()}))}))}else this._onGetLongPollIDSuccess(this._longPollID)}},{key:"_onGetLongPollIDSuccess",value:function(e){this.emitInnerEvent(Gh,[{key:"long_poll_logout.query.requestData.longPollingID",value:e},{key:"longPoll.query.requestData.cookie.longPollingID",value:e}]),this._longPollID=e,this._startLongPoll(),this._IAmReady(),this.tim.sumStatController.recordLongPollingID(this._longPollID)}},{key:"_startLongPoll",value:function(){if(!0!==this._isLongPoll){Es.log("NotificationController._startLongPoll...");var e=this.tim.connectionController,t=this.createTransportCapsule({name:"longPoll",action:"query"});this._isLongPoll=!0,this._runLoop=e.createRunLoop({pack:t,before:this._setNoticeSeqInRequestData.bind(this),success:this._onNoticeReceived.bind(this),fail:this._onNoticeFail.bind(this)}),this._runLoop.start()}else Es.log("NotificationController._startLongPoll is running...")}},{key:"_onNoticeReceived",value:function(e){var t=e.data;t.errorCode!==ec.SUCCESS?(new ig(em).setMessage(t.errorInfo||JSON.stringify(t)).setCode(t.errorCode).setNetworkType(this.getNetworkType()).setEnd(!0),this._onResponseError(t)):this.emitInnerEvent(Wh);this.tim.sumStatController.addSuccessCount($d),this.tim.sumStatController.addCost($d,t.timecost),e.data.eventArray&&this._dispatchNotice(e.data.eventArray)}},{key:"_onResponseError",value:function(e){switch(e.errorCode){case $p.LONG_POLL_KICK_OUT:Es.warn("NotificationController._onResponseError, longPollingID=".concat(this._longPollID," was kicked out")),this.emitInnerEvent(Yh),this.closeNoticeChannel();break;case $p.MESSAGE_A2KEY_EXPIRED:case $p.ACCOUNT_A2KEY_EXPIRED:this.emitInnerEvent(hd);break;default:Ns(e.errorCode)||Ns(e.errorInfo)?Es.log("NotificationController._onResponseError, errorCode or errorInfo undefined!",e):this.emitInnerEvent(dd,new Hp({code:e.errorCode,message:e.errorInfo}))}}},{key:"_onNoticeFail",value:function(e){if(e.error)if("ECONNABORTED"===e.error.code||e.error.code===$p.NETWORK_TIMEOUT)if(e.error.config){var t=e.error.config.url,n=e.error.config.data;Es.log("NotificationController._onNoticeFail request timed out. url=".concat(t," data=").concat(n))}else Es.log("NotificationController._onNoticeFail request timed out.");else Es.log("NotificationController._onNoticeFail request failed due to network error");this.emitInnerEvent(zh)}},{key:"_startSyncMessages",value:function(e){!0!==this._syncMessagesFinished&&this.syncMessage()}},{key:"syncMessage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._syncMessagesIsRunning=!0,this.request({name:"syncMessage",action:"query",param:{cookie:t,syncFlag:n}}).then((function(t){var n=t.data;switch(jy(n.cookie,n.syncFlag)){case"00":case"01":e.emitInnerEvent(dd,{code:$p.NOTICE_RUNLOOP_OFFSET_LOST,message:Xf});break;case"10":case"11":n.eventArray&&e._dispatchNotice(n.eventArray,"sync"),e._syncNoticeList=e._syncNoticeList.concat(n.messageList),e.emitInnerEvent(Uh,{data:n.messageList,C2CRemainingUnreadList:n.C2CRemainingUnreadList}),e._syncOffset=n.cookie,e.syncMessage(n.cookie,n.syncFlag);break;case"12":n.eventArray&&e._dispatchNotice(n.eventArray,"sync"),e.openNoticeChannel(),e._syncNoticeList=e._syncNoticeList.concat(n.messageList),e.emitInnerEvent(xh,{messageList:n.messageList,C2CRemainingUnreadList:n.C2CRemainingUnreadList}),e._syncOffset=n.cookie,e._syncNoticeList=[],e._syncMessagesIsRunning=!1,e._syncMessagesFinished=!0}})).catch((function(t){e._syncMessagesIsRunning=!1,Es.error("NotificationController.syncMessage failed. error:",t)}))}}]),n}(Gd),$y=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).TIMUploadPlugin=null,r.timUploadPlugin=null,r.COSSDK=null,r._cosUploadMethod=null,r.expiredTimeLimit=600,r.appid=0,r.bucketName="",r.ciUrl="",r.directory="",r.downloadUrl="",r.uploadUrl="",r.expiredTimeOut=r.expiredTimeLimit,r.region="ap-shanghai",r.cos=null,r.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},r._timer=0,r.uploadFileType="",r.duration=900,r.tryCount=0,r.tim.innerEmitter.on(Ph,r._init,Hn(r)),r.triggerReady(),r}return bn(n,[{key:"_expiredTimer",value:function(){var e=this;this._timer=setInterval((function(){Math.ceil(Date.now()/1e3)>=e.cosOptions.expiredTime-120&&(e._getAuthorizationKey(),clearInterval(e._timer))}),6e4)}},{key:"_init",value:function(){if(this.TIMUploadPlugin=this.tim.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var e=Ka?"cos-wx-sdk":"cos-js-sdk";this.COSSDK=this.tim.getPlugin(e),this.COSSDK?(this._getAuthorizationKey(),Es.warn("UploadController._init v2.9.2起推荐使用 tim-upload-plugin 代替 ".concat(e,",上传更快更安全。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin"))):Es.warn("UploadController._init 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin")}}},{key:"_getAuthorizationKey",value:function(){var e=this,t=Math.ceil(Date.now()/1e3),n=new ig(hg);this.request({name:"cosSig",action:"query",param:{duration:this.expiredTimeLimit}}).then((function(r){Es.log("UploadController._getAuthorizationKey ok. data:",r.data);var o=r.data,i=o.expiredTime-t;n.setText("requestId=".concat(o.requestId," requestTime=").concat(t," expiredTime=").concat(o.expiredTime," timeout=").concat(i,"s")).setNetworkType(e.getNetworkType()).setEnd(),!Ka&&o.region&&(e.region=o.region),e.appid=o.appid,e.bucketName=o.bucketName,e.ciUrl=o.ciUrl,e.directory=o.directory,e.downloadUrl=o.downloadUrl,e.uploadUrl=o.uploadUrl,e.expiredTimeOut=i,e.cosOptions={secretId:o.secretId,secretKey:o.secretKey,sessionToken:o.sessionToken,expiredTime:o.expiredTime},Es.log("UploadController._getAuthorizationKey cos.config:","region=".concat(e.region,",bucketName=").concat(e.bucketName)),e._initUploaderMethod(),e._expiredTimer()})).catch((function(t){e.probeNetwork().then((function(e){var r=Wn(e,2),o=r[0],i=r[1];n.setError(t,o,i).setEnd()})),Es.warn("UploadController._getAuthorizationKey failed. error:",t)}))}},{key:"_getCosPreSigUrl",value:function(e){var t=this,n=Math.ceil(Date.now()/1e3),r=new ig(dg);return this.request({name:"cosPreSig",action:"query",param:{fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration}}).then((function(e){t.tryCount=0;var o=e.data||{},i=o.expiredTime-n;return Es.log("UploadController._getCosPreSigUrl ok. data:",o),r.setText("requestId=".concat(o.requestId," expiredTime=").concat(o.expiredTime," timeout=").concat(i,"s")).setNetworkType(t.getNetworkType()).setEnd(),o})).catch((function(n){return-1===n.code&&(n.code=$p.COS_GET_SIG_FAIL),t.probeNetwork().then((function(e){var t=Wn(e,2),o=t[0],i=t[1];r.setError(n,o,i).setEnd()})),Es.warn("UploadController._getCosPreSigUrl failed. error:",n),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,Bd(new Hp({code:$p.COS_GET_SIG_FAIL,message:tf})))}))}},{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=Ka?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=Ka?function(t,n){e.cos.postObject(t,n)}:function(t,n){e.cos.uploadFiles(t,n)})}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"uploadImage",value:function(e){if(!e.file)return Bd(new Hp({code:$p.MESSAGE_IMAGE_SELECT_FILE_FIRST,message:lf}));var t=this._checkImageType(e.file);if(!0!==t)return t;var n=this._checkImageMime(e.file);if(!0!==n)return n;var r=this._checkImageSize(e.file);if(!0!==r)return r;var o=null;return this._setUploadFileType(rh),this.upload(e).then((function(e){return o=e,t="https://".concat(e.location),Ka?new Promise((function(e,n){$a.getImageInfo({src:t,success:function(t){e({width:t.width,height:t.height})},fail:function(){e({width:0,height:0})}})})):os&&9===is?Promise.resolve({width:0,height:0}):new Promise((function(e,n){var r=new Image;r.onload=function(){e({width:this.width,height:this.height}),r=null},r.onerror=function(){e({width:0,height:0}),r=null},r.src=t}));var t})).then((function(e){return o.width=e.width,o.height=e.height,Promise.resolve(o)}))}},{key:"_checkImageType",value:function(e){var t="";return t=Ka?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),th.indexOf(t.toLowerCase())>=0||Bd(new Hp({code:$p.MESSAGE_IMAGE_TYPES_LIMIT,message:pf}))}},{key:"_checkImageMime",value:function(e){return!0}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=Ka?e.size:e.files[0].size)?Bd(new Hp({code:$p.MESSAGE_FILE_IS_EMPTY,message:"".concat(sf)})):t<20971520||Bd(new Hp({code:$p.MESSAGE_IMAGE_SIZE_LIMIT,message:"".concat(ff)}))}},{key:"uploadFile",value:function(e){var t=null;return e.file?e.file.files[0].size>104857600?(t=new Hp({code:$p.MESSAGE_FILE_SIZE_LIMIT,message:If}),Bd(t)):0===e.file.files[0].size?(t=new Hp({code:$p.MESSAGE_FILE_IS_EMPTY,message:"".concat(sf)}),Bd(t)):(this._setUploadFileType(ah),this.upload(e)):(t=new Hp({code:$p.MESSAGE_FILE_SELECT_FILE_FIRST,message:_f}),Bd(t))}},{key:"uploadVideo",value:function(e){return e.file.videoFile.size>104857600?Bd(new Hp({code:$p.MESSAGE_VIDEO_SIZE_LIMIT,message:"".concat(mf)})):0===e.file.videoFile.size?Bd(new Hp({code:$p.MESSAGE_FILE_IS_EMPTY,message:"".concat(sf)})):-1===nh.indexOf(e.file.videoFile.type)?Bd(new Hp({code:$p.MESSAGE_VIDEO_TYPES_LIMIT,message:"".concat(vf)})):(this._setUploadFileType(oh),Ka?this.handleVideoUpload({file:e.file.videoFile}):Ha?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,r){t.upload(e).then((function(e){n(e)})).catch((function(){t.upload(e).then((function(e){n(e)})).catch((function(){r(new Hp({code:$p.MESSAGE_VIDEO_UPLOAD_FAIL,message:gf}))}))}))}))}},{key:"uploadAudio",value:function(e){return e.file?e.file.size>20971520?Bd(new Hp({code:$p.MESSAGE_AUDIO_SIZE_LIMIT,message:"".concat(df)})):0===e.file.size?Bd(new Hp({code:$p.MESSAGE_FILE_IS_EMPTY,message:"".concat(sf)})):(this._setUploadFileType(ih),this.upload(e)):Bd(new Hp({code:$p.MESSAGE_AUDIO_UPLOAD_FAIL,message:hf}))}},{key:"upload",value:function(e){var t=this;if(!ws(this._cosUploadMethod))return Es.warn("UploadController.upload 没有检测到上传插件,将无法发送图片、音频、视频、文件等类型的消息。详细请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html#registerPlugin"),Bd(new Hp({code:$p.COS_UNDETECTED,message:ef}));if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new ig(gg);Es.time(og);var r=Ka?e.file:e.file.files[0];return new Promise((function(o,i){var a=Ka?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),s=t;t._cosUploadMethod(a,(function(e,a){var u=Object.create(null);if(a){if(e||Rs(a.files)&&a.files[0].error){var c=new Hp({code:$p.MESSAGE_FILE_UPLOAD_FAIL,message:yf});return n.setError(c,!0,t.getNetworkType()).setEnd(),Es.log("UploadController.upload failed, error:",a.files[0].error),403===a.files[0].error.statusCode&&(Es.warn("UploadController.upload failed. cos AccessKeyId was invalid, regain auth key!"),t._getAuthorizationKey()),void i(c)}u.fileName=r.name,u.fileSize=r.size,u.fileType=r.type.slice(r.type.indexOf("/")+1).toLowerCase(),u.location=Ka?a.Location:a.files[0].data.Location;var l=Es.timeEnd(og),p=s._formatFileSize(r.size),f=s._formatSpeed(1e3*r.size/l),h="size=".concat(p,",time=").concat(l,"ms,speed=").concat(f);return Es.log("UploadController.upload success name=".concat(r.name,",").concat(h)),o(u),void n.setNetworkType(t.getNetworkType()).setText(h).setEnd()}var d=new Hp({code:$p.MESSAGE_FILE_UPLOAD_FAIL,message:yf});n.setError(d,!0,s.getNetworkType()).setEnd(),Es.warn("UploadController.upload failed, error:",e),403===e.statusCode&&(Es.warn("UploadController.upload failed. cos AccessKeyId was invalid, regain auth key!"),t._getAuthorizationKey()),i(d)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n=Ka?e.file:e.file.files[0];return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(r,o){var i=new ig(gg);Es.time(og),t._cosUploadMethod(e,(function(e,a){var s=Object.create(null);if(e||403===a.statusCode){var u=new Hp({code:$p.MESSAGE_FILE_UPLOAD_FAIL,message:yf});return i.setError(u,!0,t.getNetworkType()).setEnd(),Es.log("UploadController._uploadWithPreSigUrl failed, error:",e),void o(u)}var c=a.data.location||"";0!==c.indexOf("https://")&&0!==c.indexOf("http://")||(c=c.split("//")[1]),s.fileName=n.name,s.fileSize=n.size,s.fileType=n.type.slice(n.type.indexOf("/")+1).toLowerCase(),s.location=c;var l=Es.timeEnd(og),p=t._formatFileSize(n.size),f=t._formatSpeed(1e3*n.size/l),h="size=".concat(p,",time=").concat(l,"ms,speed=").concat(f);Es.log("UploadController._uploadWithPreSigUrl success name=".concat(n.name,",").concat(h)),i.setNetworkType(t.getNetworkType()).setText(h).setEnd(),r(s)}))}))}))}},{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?(e/1024).toFixed(1)+"KB/s":(e/1048576).toFixed(1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._genFileName(e.file.files[0].name);return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(t),Body:e.file.files[0]}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Es.warn("onProgress callback error:",n),Es.error(n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._genFileName(e.file.name),n=e.file.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(t),FilePath:n,onProgress:function(t){if(Es.log(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Es.warn("onProgress callback error:",n),Es.error(n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",r="",o=0;return Ka?(n=this._genFileName(e.file.name),r=e.file.url,o=1):(n=this._genFileName("".concat(Bs(999999))),r=e.file.files[0],o=0),this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:o,duration:this.duration}).then((function(o){var i=o.uploadUrl,a=o.downloadUrl;return{url:i,fileType:t.uploadFileType,fileName:n,resources:r,downloadUrl:a,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Es.warn("onProgress callback error:",n),Es.error(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(ou(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"reset",value:function(){this._timer&&(clearInterval(this._timer),this._timer=0)}}]),n}(Gd),zy=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).FILETYPE={SOUND:2106,FILE:2107,VIDEO:2113},r._bdh_download_server="grouptalk.c2c.qq.com",r._BDHBizID=10001,r._authKey="",r._expireTime=0,r.tim.innerEmitter.on(Ph,r._getAuthKey,Hn(r)),r}return bn(n,[{key:"_getAuthKey",value:function(){var e=this;this.request({name:"bigDataHallwayAuthKey",action:"query"}).then((function(t){t.data.authKey&&(e._authKey=t.data.authKey,e._expireTime=parseInt(t.data.expireTime))}))}},{key:"_isFromOlderVersion",value:function(e){return 2!==e.content.downloadFlag}},{key:"parseElements",value:function(e,t){if(!Rs(e)||!t)return[];for(var n=[],r=null,o=0;o<e.length;o++)r=e[o],this._needParse(r)?n.push(this._parseElement(r,t)):n.push(e[o]);return n}},{key:"_needParse",value:function(e){return!(!this._isFromOlderVersion(e)||e.type!==Sn.MSG_AUDIO&&e.type!==Sn.MSG_FILE&&e.type!==Sn.MSG_VIDEO)}},{key:"_parseElement",value:function(e,t){switch(e.type){case Sn.MSG_AUDIO:return this._parseAudioElement(e,t);case Sn.MSG_FILE:return this._parseFileElement(e,t);case Sn.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){return""===this._authKey?(Es.warn("BigDataHallwayController._genAudioUrl no authKey!"),""):"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(this.tim.context.SDKAppID,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.SOUND,"&openid=").concat(t,"&ver=0")}},{key:"_genFileUrl",value:function(e,t,n){return""===this._authKey?(Es.warn("BigDataHallwayController._genFileUrl no authKey!"),""):(n||(n="".concat(Math.floor(1e5*Math.random()),"-").concat(Date.now())),"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(this.tim.context.SDKAppID,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.FILE,"&openid=").concat(t,"&ver=0&filename=").concat(encodeURIComponent(n)))}},{key:"_genVideoUrl",value:function(e,t){return""===this._authKey?(Es.warn("BigDataHallwayController._genVideoUrl no authKey!"),""):"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(this.tim.context.SDKAppID,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.VIDEO,"&openid=").concat(t,"&ver=0")}},{key:"reset",value:function(){this._authKey="",this.expireTime=0}}]),n}(Gd);function Wy(e){return e=window.localStorage?localStorage.getItem(e)||sessionStorage.getItem(e):(e=document.cookie.match(new RegExp("(?:^|;\\s)"+e+"=(.*?)(?:;\\s|$)")))?e[1]:""}function Yy(e,t,n){if(window.localStorage)try{n?localStorage.setItem(e,t):sessionStorage.setItem(e,t)}catch(r){}else document.cookie=e+"="+t+";path=/;domain="+function(){var e=window.location.host,t=e.split(".");return 2<t.length&&(e=({"com.cn":1,"js.cn":1,"net.cn":1,"gov.cn":1,"com.hk":1,"co.nz":1}[t.slice(-2).join(".")]?t.slice(-3):t.slice(-2)).join(".")),e}()+(n?";expires="+n:"")}function Jy(e,t){var n,r={};if(void 0===t)var o=window.location,i=o.host,a=o.pathname,s=o.search.substr(1),u=o.hash;else i=(o=t.match(/\w+:\/\/((?:[\w-]+\.)+\w+)(?::\d+)?(\/[^\?\\"'\|:<>]*)?(?:\?([^'"\\<>#]*))?(?:#(\w+))?/i)||[])[1],a=o[2],s=o[3],u=o[4];return void 0!==u&&(u=u.replace(/"|'|<|>/gi,"M")),s&&function(){for(var e=s.split("&"),t=0,n=e.length;t<n;t++)if(-1!=e[t].indexOf("=")){var o=e[t].indexOf("="),i=e[t].slice(0,o);o=e[t].slice(o+1),r[i]=o}}(),s=function(){if(void 0===s)return s;for(var t=s.split("&"),n=[],r=0,o=t.length;r<o;r++)if(-1!=t[r].indexOf("=")){var i=t[r].indexOf("="),a=t[r].slice(0,i);i=t[r].slice(i+1),e.ignoreParams&&-1!=e.ignoreParams.indexOf(a)||n.push(a+"="+i)}return n.join("&")}(),u&&function(){for(var e=0==u.indexOf("#")?u.substr(1).split("&"):u.split("&"),t=0,r=e.length;t<r;t++)if(-1!=e[t].indexOf("=")){var o=e[t].indexOf("="),i=e[t].slice(0,o);if(o=e[t].slice(o+1),"adtag"===i.toLowerCase()){n=o;break}}}(),{host:i,path:a,search:s,hash:u,param:r,adtag:n}}function Xy(e){var t,n=Jy(e),r={dm:n.host,pvi:"",si:"",url:n.path,arg:encodeURIComponent(n.search||"").substr(0,512),ty:0};return r.pvi=function(){var t=new Date((new Date).getTime()+63072e6).toGMTString();if(e.userReport){var n=Wy("pgv_uid");n&&n==e.user.user_id||(r.ty=1,Yy("pgv_uid",e.user.user_id,t)),n=e.user.user_id}else(n=Wy("pgv_pvi"))||(r.ty=1,Yy("pgv_pvi",n=Qy(),t));return n}(),r.si=((t=Wy("pgv_si"))||Yy("pgv_si",t=Qy("s")),t),r.url=function(){var t=n.path;return e.senseQuery&&(t+=n.search?"?"+encodeURIComponent(n.search||"").substr(0,512):""),e.senseHash&&(t+=n.hash?encodeURIComponent(n.hash):""),t}(),r}function Qy(e){for(var t=[0,1,2,3,4,5,6,7,8,9],n=10;1<n;n--){var r=Math.floor(10*Math.random()),o=t[r];t[r]=t[n-1],t[n-1]=o}for(n=r=0;5>n;n++)r=10*r+t[n];return(e||"")+(r+"")+ +new Date}function Zy(e){return{r2:e.sid}}function e_(e){var t={};if(e){var n,r=[];for(n in e)e.hasOwnProperty(n)&&r.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));e=r.join(";"),t.ext=e}return t}function t_(e){var t=Jy(e,document.referrer);return e=Jy(e),{rdm:t.host,rurl:t.path,rarg:encodeURIComponent(t.search||"").substr(0,512),adt:e.param.ADTAG||e.param.adtag||e.param.CKTAG||e.param.cktag||e.param.PTAG||e.param.ptag||e.adtag}}function n_(){try{var e=navigator,t=screen||{width:"",height:"",colorDepth:""},n={scr:t.width+"x"+t.height,scl:t.colorDepth+"-bit",lg:(e.language||e.userLanguage).toLowerCase(),tz:(new Date).getTimezoneOffset()/60}}catch(r){return{}}return n}var r_={conf:{},version:"2.0.19",init:function(e){var t={sid:0,cid:0,autoReport:0,senseHash:0,senseQuery:0,userReport:0,performanceMonitor:0,ignoreParams:[]};if(e)for(var n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(t[n]=e[n]);this.conf=t,this.conf.autoReport&&this.pgv()},pgv:function(){var e=this.conf,t=[],n=this.version;if(e.sid)if(!e.userReport||e.user&&e.user.user_id&&!parseInt(e.user.user_id,10)!==conf.user.user_id){for(var r=0,o=[Xy(e),t_(e),Zy(e),n_(),e_({version:n}),{random:+new Date}],i=o.length;r<i;r++)for(var a in o[r])o[r].hasOwnProperty(a)&&t.push(a+"="+(void 0===o[r][a]?"":o[r][a]));var s=function(e){e="https://pingtas.qq.com/webview/pingd?"+e.join("&").toLowerCase();var t=new Image;t.onload=t.onerror=t.onabort=function(){t=t.onload=t.onerror=t.onabort=null},t.src=e};s(t),e.performanceMonitor&&(t=function(){for(var t=function(){if(window.performance){var e=window.performance.timing,t={value:e.domainLookupEnd-e.domainLookupStart},n={value:e.connectEnd-e.connectStart},r={value:e.responseStart-(e.requestStart||e.responseStart+1)},o=e.responseEnd-e.responseStart;e.domContentLoadedEventStart?0>o&&(o=0):o=-1,e={domainLookupTime:t,connectTime:n,requestTime:r,resourcesLoadedTime:{value:o},domParsingTime:{value:e.domContentLoadedEventStart?e.domInteractive-e.domLoading:-1},domContentLoadedTime:{value:e.domContentLoadedEventStart?e.domContentLoadedEventStart-e.fetchStart:-1}}}else e="";return e}(),r=[],o=[],i=0,a=[Xy(e),{r2:e.cid},n_(),{random:+new Date}],u=a.length;i<u;i++)for(var c in a[i])a[i].hasOwnProperty(c)&&o.push(c+"="+(void 0===a[i][c]?"":a[i][c]));for(c in t)t.hasOwnProperty(c)&&("domContentLoadedTime"==c?o.push("r3="+t[c].value):r.push(t[c].value));t=e_({pfm:r.join("_"),version:n}),o.push("ext="+t.ext),s(o)},void 0!==window.performance&&void 0!==window.performance.timing&&0!=window.performance.timing.loadEventEnd?t():window.attachEvent?window.attachEvent("onload",t):window.addEventListener&&window.addEventListener("load",t,!1))}else console.log("MTA H5分析错误提示:您选择了用户统计uv,请设置业务的user_id,需为int类型");else console.log("MTA H5分析错误提示:您没有设置sid")},clickStat:function(e,t){var n=this.conf,r=[],o=Xy(n),i=Zy(n);if(n.cid){o.dm="taclick",o.url=e,i.r2=n.cid,i.r5=function(e){e=void 0===e?{}:e;var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t+"="+encodeURIComponent(e[t]));return n.join(";")}(t);var a=0;for(o=(n=[o,t_(n),i,n_(),e_({version:this.version}),{random:+new Date}]).length;a<o;a++)for(var s in n[a])n[a].hasOwnProperty(s)&&r.push(s+"="+(void 0===n[a][s]?"":n[a][s]));r="https://pingtas.qq.com/webview/pingd?"+r.join("&");var u=new Image;u.onload=u.onerror=u.onabort=function(){u=u.onload=u.onerror=u.onabort=null},u.src=r}else console.log("MTA H5分析错误提示:您没有设置cid,请到管理台开通自定义事件并更新统计代码")},clickShare:function(e){var t,n,r=this.conf,o=Jy(r),i=void 0===(o=o.param.CKTAG||o.param.ckatg)?[]:o.split(".");if(r.cid){o=[];var a=Xy(r),s=Zy(r);for(a.dm="taclick_share",a.url="mtah5-share-"+e,s.r2=r.cid,s.r5=(n=[],2===(t=i).length&&"mtah5_share"==t[0]&&n.push(t[0]+"="+t[1]),n.join(";")),e=0,a=(r=[a,t_(r),s,n_(),e_({version:this.version}),{random:+new Date}]).length;e<a;e++)for(var u in r[e])r[e].hasOwnProperty(u)&&o.push(u+"="+(void 0===r[e][u]?"":r[e][u]));u="https://pingtas.qq.com/webview/pingd?"+o.join("&");var c=new Image;c.onload=c.onerror=c.onabort=function(){c=c.onload=c.onerror=c.onabort=null},c.src=u}else console.log("MTA H5分析错误提示:您没有设置cid,请到管理台开通自定义事件并更新统计代码")}};var o_=function(){function e(){Ln(this,e);try{r_.init({sid:"500690998",cid:"500691017",autoReport:0,senseHash:0,senseQuery:0,performanceMonitor:0,ignoreParams:[]})}catch(C_){}}return bn(e,[{key:"report",value:function(e,t){try{r_.clickStat(e,t)}catch(C_){}}},{key:"stat",value:function(){try{r_.pgv()}catch(C_){}}}]),e}(),i_=function(e){xn(n,e);var t=zn(n);function n(e){var r;Ln(this,n),(r=t.call(this,e)).MTA=new o_;var o=r.tim.innerEmitter;return o.on(Md,r._stat,Hn(r)),o.on(Id,r._stat,Hn(r)),r}return bn(n,[{key:"_stat",value:function(){this.MTA.report("sdkappid",{value:this.tim.context.SDKAppID}),this.MTA.report("version",{value:"2.9.3"}),this.MTA.stat()}}]),n}(Gd),a_=function(){function e(t){Ln(this,e),this._table="timwebii",this._report=[]}return bn(e,[{key:"pushIn",value:function(e){Es.debug("SSOLogBody.pushIn",this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;Rs(e)&&0!==e.length&&(Es.debug("SSOLogBody.backfill",this._report.length,e.length),(t=this._report).unshift.apply(t,Yn(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:"getTable",value:function(){return this._table}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),s_=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).TAG="im-ssolog-event",r._reportBody=new a_,r._version="2.9.3",r.MIN_THRESHOLD=20,r.MAX_THRESHOLD=100,r.WAITING_TIME=6e4,r.INTERVAL=2e4,r._timerID=0,r._resetLastReportTime(),r._startReportTimer(),r._retryCount=0,r.MAX_RETRY_COUNT=3,r.tim.innerEmitter.on(ld,r._onLoginSuccess,Hn(r)),r}return bn(n,[{key:"reportAtOnce",value:function(){Es.debug("EventStatController.reportAtOnce"),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.tim.storage,n=t.getItem(this.TAG,!1);!uu(n)&&ws(n.forEach)&&(Es.log("EventStatController._onLoginSuccess get ssolog in storage, nums="+n.length),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"pushIn",value:function(e){e instanceof ig&&(e.setCommonInfo({SDKAppID:this.tim.context.SDKAppID,version:this._version,tinyID:this.tim.context.tinyID,userID:this.tim.loginInfo.identifier,platform:this.getPlatform(),scene:this.tim.context.scene,instanceID:this.tim.context.instanceID}),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"_resetLastReportTime",value:function(){this._lastReportTime=Date.now()}},{key:"_startReportTimer",value:function(){var e=this;this._timerID=setInterval((function(){Date.now()<e._lastReportTime+e.WAITING_TIME||e._reportBody.isEmpty()||e._report()}),this.INTERVAL)}},{key:"_stopReportTimer",value:function(){this._timerID>0&&(clearInterval(this._timerID),this._timerID=0)}},{key:"_report",value:function(){var e=this;if(!this._reportBody.isEmpty()){var t=this._reportBody.getLogsInMemory();this.request({name:"ssoEventStat",action:"create",param:{table:this._reportBody.getTable(),report:t}}).then((function(){e._resetLastReportTime(),e._retryCount>0&&(Es.debug("EventStatController.report retry success"),e._retryCount=0)})).catch((function(n){if(Es.warn("EventStatController.report, networkType:".concat(e.getNetworkType()," error:").concat(Fs(n))),e._reportBody.backfill(t),e._reportBody.getLogsNumInMemory()>e.MAX_THRESHOLD||e._retryCount===e.MAX_RETRY_COUNT||0===e._timerID)return e._retryCount=0,void e._flushAtOnce();e._retryCount+=1}))}}},{key:"_flushAtOnce",value:function(){var e=this.tim.storage,t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory();if(uu(t))Es.log("EventStatController._flushAtOnce nums="+n.length),e.setItem(this.TAG,n,!0,!1);else{var r=n.concat(t);r.length>this.MAX_THRESHOLD&&(r=r.slice(0,this.MAX_THRESHOLD)),Es.log("EventStatController._flushAtOnce nums="+r.length),e.setItem(this.TAG,r,!0,!1)}}},{key:"reset",value:function(){Es.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}]),n}(Gd),u_="none",c_="online",l_=function(){function e(){Ln(this,e),this._networkType="",this.maxWaitTime=3e3}return bn(e,[{key:"start",value:function(){var e=this;Ka?($a.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===u_?Es.warn("NetMonitor no network, please check!"):Es.info("NetMonitor networkType:".concat(t.networkType))}}),$a.onNetworkStatusChange(this._onNetworkStatusChange.bind(this))):this._networkType=c_}},{key:"_onNetworkStatusChange",value:function(e){this._networkType=e.networkType,e.isConnected?Es.info("NetMonitor networkType:".concat(e.networkType)):Es.warn("NetMonitor no network, please check!")}},{key:"probe",value:function(){var e=this;return new Promise((function(t,n){if(Ka)$a.getNetworkType({success:function(n){e._networkType=n.networkType,n.networkType===u_?(Es.warn("NetMonitor no network, please check!"),t([!1,n.networkType])):(Es.info("NetMonitor networkType:".concat(n.networkType)),t([!0,n.networkType]))}});else if(window&&window.fetch)fetch("".concat(Ws(),"//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())).then((function(e){e.ok?t([!0,c_]):t([!1,u_])})).catch((function(e){t([!1,u_])}));else{var r=new XMLHttpRequest,o=setTimeout((function(){Es.warn("NetMonitor fetch timeout. Probably no network, please check!"),r.abort(),e._networkType=u_,t([!1,u_])}),e.maxWaitTime);r.onreadystatechange=function(){4===r.readyState&&(clearTimeout(o),200===r.status||304===r.status?(this._networkType=c_,t([!0,c_])):(Es.warn("NetMonitor fetch status:".concat(r.status,". Probably no network, please check!")),this._networkType=u_,t([!1,u_])))},r.open("GET","".concat(Ws(),"//webim-1252463788.file.myqcloud.com/assets/test/speed.xml?random=").concat(Math.random())),r.send()}}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){this._networkType=""}}]),e}(),p_=function(){function e(t){var n=this;Ln(this,e),Rs(t)?(this._map=new Map,t.forEach((function(e){n._map.set(e,[])}))):Es.warn("AverageCalculator.constructor need keys")}return bn(e,[{key:"push",value:function(e,t){return!(Ns(e)||!this._map.has(e)||!Ds(t))&&(this._map.get(e).push(t),!0)}},{key:"getSize",value:function(e){return Ns(e)||!this._map.has(e)?-1:this._map.get(e).length}},{key:"getAvg",value:function(e){if(Ns(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=t.length;if(0===n)return 0;var r=0;return t.forEach((function(e){r+=e})),t.length=0,this._map.set(e,[]),parseInt(r/n)}},{key:"getMax",value:function(e){return Ns(e)||!this._map.has(e)?-1:Math.max.apply(null,this._map.get(e))}},{key:"getMin",value:function(e){return Ns(e)||!this._map.has(e)?-1:Math.min.apply(null,this._map.get(e))}},{key:"reset",value:function(){this._map.forEach((function(e){e.length=0}))}}]),e}(),f_=function(){function e(t){var n=this;Ln(this,e),Rs(t)?(this._map=new Map,t.forEach((function(e){n._map.set(e,{totalCount:0,successCount:0})}))):Es.warn("SuccessRateCalculator.constructor need keys")}return bn(e,[{key:"addTotalCount",value:function(e){return!(Ns(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(Ns(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"getSuccessRate",value:function(e){if(Ns(e)||!this._map.has(e))return-1;var t=this._map.get(e);if(0===t.totalCount)return 1;var n=parseFloat((t.successCount/t.totalCount).toFixed(2));return n>1&&(n=1),t.totalCount=t.successCount=0,n}},{key:"getTotalCount",value:function(e){return Ns(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"reset",value:function(){this._map.forEach((function(e){e.totalCount=0,e.successCount=0}))}}]),e}(),h_=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e)).TABLE="timwebsum",r.TAG="im-ssolog-sumstat",r._items=[$d,zd,Wd,Yd,Jd,Xd,Qd,Zd,eg,tg],r._thresholdMap=new Map,r._thresholdMap.set($d,100),r._thresholdMap.set(zd,150),r._thresholdMap.set(Wd,15),r._thresholdMap.set(Yd,6),r._thresholdMap.set(Jd,6),r._thresholdMap.set(Xd,6),r._thresholdMap.set(Qd,6),r._thresholdMap.set(Zd,6),r._thresholdMap.set(eg,50),r._thresholdMap.set(tg,50),r._lpID="",r._platform=r.getPlatform(),r._lastReportTime=0,r._statInfoArr=[],r._retryCount=0,r._avgCalc=new p_(r._items),r._successRateCalc=new f_(r._items),r.tim.innerEmitter.on(ld,r._onLoginSuccess,Hn(r)),r}return bn(n,[{key:"_onLoginSuccess",value:function(){var e=this,t=this.tim.storage,n=t.getItem(this.TAG,!1);!uu(n)&&ws(n.forEach)&&(Es.log("SumStatController._onLoginSuccess get sumstatlog in storage, nums="+n.length),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"recordLongPollingID",value:function(e){this._lpID=e}},{key:"addTotalCount",value:function(e){this._successRateCalc.addTotalCount(e)?1===this._successRateCalc.getTotalCount(e)&&(this._lastReportTime=Date.now()):Es.warn("SumStatController.addTotalCount invalid key:",e)}},{key:"addSuccessCount",value:function(e){this._successRateCalc.addSuccessCount(e)||Es.warn("SumStatController.addSuccessCount invalid key:",e)}},{key:"addCost",value:function(e,t){this._avgCalc.push(e,t)?(Es.debug("SumStatController.addCost",e,t,this._avgCalc.getSize(e)),this._avgCalc.getSize(e)>=this._thresholdMap.get(e)&&this._report(e)):Es.warn("SumStatController.addCost invalid key or cost:",e,t)}},{key:"_getItemNum",value:function(e){switch(e){case $d:return 1;case zd:return 2;case Wd:return 3;case eg:return 4;case tg:return 5;case Yd:return 6;case Jd:return 7;case Xd:return 8;case Qd:return 9;case Zd:return 10;default:return 100}}},{key:"_getStatInfo",value:function(e){var t=null;return this._avgCalc.getSize(e)>0&&(t={SDKAppID:"".concat(this.tim.context.SDKAppID),version:"".concat("2.9.3"),tinyID:this.tim.context.tinyID,userID:this.tim.loginInfo.identifier,item:this._getItemNum(e),lpID:e===$d?this._lpID:"",platform:this._platform,scene:this.tim.context.scene,networkType:this.getNetworkType(),total:this._successRateCalc.getTotalCount(e),successRate:this._successRateCalc.getSuccessRate(e),avg:this._avgCalc.getAvg(e),timespan:Date.now()-this._lastReportTime,time:Vs()}),t}},{key:"_report",value:function(e){var t=this,n=[],r=null;Ns(e)?this._items.forEach((function(e){null!==(r=t._getStatInfo(e))&&n.push(r)})):null!==(r=this._getStatInfo(e))&&n.push(r),Es.debug("SumStatController._report",n),this._statInfoArr.length>0&&(n=n.concat(this.statInfoArr),this._statInfoArr=[]),this._doReport(n)}},{key:"_doReport",value:function(e){var t=this;uu(e)?Es.warn("SumStatController._doReport statInfoArr is empty, do nothing"):this.request({name:"ssoSumStat",action:"create",param:{table:this.TABLE,report:e}}).then((function(){t._lastReportTime=Date.now(),t._retryCount>0&&(Es.debug("SumStatController._doReport retry success"),t._retryCount=0)})).catch((function(n){Es.warn("SumStatController._doReport, online:".concat(t.getNetworkType()," error:").concat(Fs(n)),e),t._retryCount<=1?setTimeout((function(){Es.info("SumStatController._doReport retry",e),t._retryCount+=1,t._doReport(e)}),5e3):(t._retryCount=0,t._statInfoArr=t._statInfoArr.concat(e),t._flushAtOnce())}))}},{key:"_flushAtOnce",value:function(){var e=this.tim.storage,t=e.getItem(this.TAG,!1),n=this._statInfoArr;if(uu(t))Es.log("SumStatController._flushAtOnce nums="+n.length),e.setItem(this.TAG,n,!0,!1);else{var r=n.concat(t);r.length>10&&(r=r.slice(0,10)),Es.log("SumStatController._flushAtOnce nums="+r.length),e.setItem(this.TAG,r,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Es.info("SumStatController.reset"),this._report(),this._avgCalc.reset(),this._successRateCalc.reset()}}]),n}(Gd),d_=function(){function e(){Ln(this,e),this._funcMap=new Map}return bn(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 r=null;return this._funcMap.get(e).has(t)?r=this._funcMap.get(e).get(t):(r=this._pack(e,t,n),this._funcMap.get(e).set(t,r)),r}},{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):(Es.log("SafetyCallback.find: 找不到 func —— ".concat(e,"/").concat(""!==t.name?t.name:"[anonymous]")),null):(Es.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(a){var r=Object.values(Cn).indexOf(e);if(-1!==r){var o=Object.keys(Cn)[r];Es.warn("接入侧事件 TIM.EVENT.".concat(o," 对应的回调函数逻辑存在问题,请检查!"),a)}var i=new ig(pm);i.setText("eventName=".concat(e)).setMessage(a.message).setEnd()}}}}]),e}(),g_=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e))._maybeLostSequencesMap=new Map,r}return bn(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var r=this._maybeLostSequencesMap.get(e),o=0;o<n;o++)r.push(t+o);Es.debug("MessageLossController.onMessageMaybeLost. maybeLostSequences:".concat(r))}},{key:"detectMessageLoss",value:function(e,t){var n=this._maybeLostSequencesMap.get(e);if(!uu(n)&&!uu(t)){var r=t.filter((function(e){return-1!==n.indexOf(e)}));if(Es.debug("MessageLossController.detectMessageLoss. matchedSequences:".concat(r)),n.length===r.length)Es.info("MessageLossController.detectMessageLoss no message loss. conversationID=".concat(e));else{var o,i=n.filter((function(e){return-1===r.indexOf(e)})),a=i.length;a<=5?o=e+"-"+i.join("-"):(i.sort((function(e,t){return e-t})),o=e+" start:"+i[0]+" end:"+i[a-1]+" count:"+a),new ig(rm).setText(o).setNetworkType(this.getNetworkType()).setEnd(),Es.warn("MessageLossController.detectMessageLoss message loss detected. conversationID:".concat(e," lostSequences:").concat(i))}n.length=0}}},{key:"reset",value:function(){Es.log("MessageLossController.reset"),this._maybeLostSequencesMap.clear()}}]),n}(Gd),m_=function(e){xn(n,e);var t=zn(n);function n(e){var r;return Ln(this,n),(r=t.call(this,e))._request=Ka?new Dv:new Tv,r}return bn(n,[{key:"sendMessage",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return Bd({code:$p.MESSAGE_SEND_FAIL,message:nf});var r=Date.now(),o=uu(e.GroupId)?"openim/sendmsg":"group_open_http_svc/send_group_msg",i=this.tim.context,a=i.a2Key,s=i.tinyID,u=i.SDKAppID,c=i.identifier,l={url:"https://"+(!0===this.tim.context.oversea?"api.im.qcloud.com":"webim.tim.qq.com")+"/v4/"+o+"?platform=10&websdkappid=537048168&v=1.7.3&a2="+a+"&tinyid="+s+"&sdkappid="+u+"&contentType=json&apn=1&reqtime="+Date.now()+"tjg_id="+this._generateTjgID(n),data:e,method:"POST"};this._addSendMessageTotalCount(n);var p=new ig(vg);return p.setText("".concat(this._generateTjgID(n),"-").concat(n.from,"-").concat(n.to,"-").concat(n.getElements().length)),this._request.request(l).then((function(e){var o=e.data,i=o.ErrorCode,a=o.ErrorInfo;if(0!==i)return p.setCode(i).setMessage(a).setNetworkType(t.getNetworkType()).setEnd(),n.status=nc.FAIL,Bd(new Hp({code:i,message:a||nf,data:{message:n}}));t._addSendMessageSuccessCount(n,r),n.status=nc.SUCCESS;var s=e.data,u=s.MsgTime,l=s.MsgSeq;return n.time=u,l&&(n.sequence=l),n.generateMessageID(c),t.tim.messageController.pushToMessageList(n),t.emitInnerEvent(qh,{eventDataList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:n}]}),jd(n)})).catch((function(e){return t.probeNetwork().then((function(t){var n=Wn(t,2),r=n[0],o=n[1];p.setError(e,r,o).setEnd()})),Es.warn("ComboMessageController.sendMessage failed. error:",e),n.status=nc.FAIL,Bd(new Hp({code:$p.MESSAGE_SEND_FAIL,message:nf,data:{message:n}}))}))}},{key:"_constructMessageInstance",value:function(e){var t=null;try{var n=this.tim.context.identifier,r={};r.currentUser=n,r.from=e.From_Account||n,e.GroupId?(r.conversationID="".concat(Sn.CONV_GROUP).concat(e.GroupId),r.conversationType=Sn.CONV_GROUP,r.to=e.GroupId):e.To_Account&&(r.conversationID="".concat(Sn.CONV_C2C).concat(e.To_Account),r.conversationType=Sn.CONV_C2C,r.to=e.To_Account),r.time=e.MsgTimeStamp||0,r.random=e.Random||e.MsgRandom||0,r.priority=e.MsgPriority,(t=new fh(r)).status=nc.UNSEND;for(var o,i=e.MsgBody.length,a=0;a<i;a++)"TIMTextElem"===(o=e.MsgBody[a]).MsgType?t.setTextElement(o.MsgContent.Text):"TIMCustomElem"===o.MsgType?t.setCustomElement({data:o.MsgContent.Data||"",description:o.MsgContent.Desc||"",extension:o.MsgContent.Ext||""}):"TIMFaceElem"===o.MsgType&&t.setFaceElement({index:o.MsgContent.Index,data:o.MsgContent.Data});var s=t.getElements();t.payload=s[0].content,t.type=s[0].type}catch(C_){t=null,Es.error("ComboMessageController._constructMessageInstance failed. error:",C_)}return t}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=this.tim.sumStatController,r=Math.abs(Date.now()-t);n.addSuccessCount(Wd),n.addCost(Wd,r);var o=this._getSendMessageSpecifiedKey(e);o&&(n.addSuccessCount(o),n.addCost(o,r))}},{key:"_addSendMessageTotalCount",value:function(e){var t=this.tim.sumStatController;t.addTotalCount(Wd);var n=this._getSendMessageSpecifiedKey(e);n&&t.addTotalCount(n)}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===Sn.CONV_C2C)return Yd;if(e.conversationType===Sn.CONV_GROUP){var t=this.tim.groupController.getLocalGroupProfile(e.to);if(!t)return;var n=t.type;if(Xs(n))return Jd;if(Qs(n))return Xd;if(Zs(n))return Qd;if(eu(n))return Zd}}},{key:"_generateTjgID",value:function(e){return this.tim.context.tinyID+"-"+e.random}},{key:"reset",value:function(){Es.info("ComboMessageController.reset")}}]),n}(Gd),v_=function(){function e(t){Ln(this,e);var n=new ig(ag);Pd.mixin(this),this._initOptions(t),this._initMemberVariables(),this._initControllers(),this._initListener(),ig.bindController(this.eventStatController),n.setText("instanceID=".concat(this.loginInfo.instanceID,"-oversea=").concat(this.loginInfo.oversea,"-mp=").concat(Ka,"-ua=").concat(Wa)).setEnd(),Es.info("SDK instanceID:".concat(this.loginInfo.instanceID," oversea:").concat(this.loginInfo.oversea," inMiniApp:").concat(Ka,", SDKAppID:").concat(t.SDKAppID,", UserAgent:").concat(Wa)),this._safetyCallbackFactory=new d_}return bn(e,[{key:"login",value:function(e){return Es.time(Kd),this._ssoLog=new ig(sg),this.netMonitor.start(),this.loginInfo.identifier=e.identifier||e.userID,this.loginInfo.userSig=e.userSig,this.signController.login(this.loginInfo)}},{key:"logout",value:function(){var e=this.signController.logout();return this.resetSDK(),e}},{key:"on",value:function(e,t,n){e===Cn.GROUP_SYSTEM_NOTICE_RECEIVED&&Es.warn("!!!TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知,详细请参考:https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/Message.html#.GroupSystemNoticePayload"),Es.debug("on","eventName:".concat(e)),this.outerEmitter.on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){Es.debug("once","eventName:".concat(e)),this.outerEmitter.once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,r){Es.debug("off","eventName:".concat(e));var o=this._safetyCallbackFactory.find(e,t);null!==o&&(this.outerEmitter.off(e,o,n,r),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){var t=this;this.plugins||(this.plugins={}),Object.keys(e).forEach((function(n){t.plugins[n]=e[n]})),new ig(fg).setText("key=".concat(Object.keys(e))).setEnd()}},{key:"getPlugin",value:function(e){return this.plugins[e]||void 0}},{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:#ff0000");console.log(["","参考以下文档,会更快解决问题哦!(#^.^#)\n","SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n","SDK 接口文档: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/SDK.html\n","常见问题: https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/tutorial-01-faq.html\n","反馈问题?戳我提 issue: https://github.com/tencentyun/TIMSDK/issues\n","如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\n"].join("\n"))}Es.setLevel(e)}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e.outerEmitter.emit(Cn.SDK_DESTROY,{SDKAppID:e.loginInfo.SDKAppID})}))}},{key:"createTextMessage",value:function(e){return this.messageController.createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this.messageController.createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this.messageController.createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this.messageController.createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this.messageController.createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this.messageController.createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this.messageController.createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this.messageController.createFileMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof fh?this.messageController.sendMessageInstance(e,t):Bd(new Hp({code:$p.MESSAGE_SEND_NEED_MESSAGE_INSTANCE,message:of}))}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this.comboMessageController.sendMessage(t):Bd(new Hp({code:$p.INVALID_OPERATION,message:Zf}))}},{key:"revokeMessage",value:function(e){return this.messageController.revokeMessage(e)}},{key:"resendMessage",value:function(e){return this.messageController.resendMessage(e)}},{key:"getMessageList",value:function(e){return this.messageController.getMessageList(e)}},{key:"setMessageRead",value:function(e){return this.messageController.setMessageRead(e)}},{key:"getConversationList",value:function(){return this.conversationController.getConversationList()}},{key:"getConversationProfile",value:function(e){return this.conversationController.getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this.conversationController.deleteConversation(e)}},{key:"getMyProfile",value:function(){return this.userController.getMyProfile()}},{key:"getUserProfile",value:function(e){return this.userController.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this.userController.updateMyProfile(e)}},{key:"getFriendList",value:function(){return this.userController.getFriendList()}},{key:"deleteFriend",value:function(e){return this.userController.deleteFriend(e)}},{key:"getBlacklist",value:function(){return this.userController.getBlacklist()}},{key:"addToBlacklist",value:function(e){return this.userController.addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this.userController.deleteBlacklist(e)}},{key:"getGroupList",value:function(e){return this.groupController.getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this.groupController.getGroupProfile(e)}},{key:"createGroup",value:function(e){return this.groupController.createGroup(e)}},{key:"dismissGroup",value:function(e){return this.groupController.dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this.groupController.updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this.groupController.joinGroup(e)}},{key:"quitGroup",value:function(e){return this.groupController.quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this.groupController.searchGroupByID(e)}},{key:"changeGroupOwner",value:function(e){return this.groupController.changeGroupOwner(e)}},{key:"handleGroupApplication",value:function(e){return this.groupController.handleGroupApplication(e)}},{key:"setMessageRemindType",value:function(e){return this.groupController.setMessageRemindType(e)}},{key:"getGroupMemberList",value:function(e){return this.groupController.getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this.groupController.getGroupMemberProfile(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this.groupController.getGroupOnlineMemberCount(e)}},{key:"addGroupMember",value:function(e){return this.groupController.addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this.groupController.deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this.groupController.setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this.groupController.setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this.groupController.setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this.groupController.setGroupMemberCustomField(e)}},{key:"_initOptions",value:function(e){this.plugins={},this._sdkReloadFlag=!1;var t=e.SDKAppID||0,n=Bs();this.context={SDKAppID:t,accountType:n},this.loginInfo={SDKAppID:t,accountType:n,identifier:null,userSig:null,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,avchatroomIDList:[],instanceID:ou()},this.options={runLoopNetType:e.runLoopNetType||Mp,enablePointer:e.enablePointer||!1}}},{key:"_initMemberVariables",value:function(){this.innerEmitter=new xy,this.outerEmitter=new xy,Vd(this.outerEmitter),this.packageConfig=new Fy(this),this.storage=new Uy(this),this.netMonitor=new l_,this.outerEmitter._emit=this.outerEmitter.emit,this.outerEmitter.emit=function(e,t){var n=arguments[0],r=[n,{name:arguments[0],data:arguments[1]}];this.outerEmitter._emit.apply(this.outerEmitter,r)}.bind(this),this.innerEmitter._emit=this.innerEmitter.emit,this.innerEmitter.emit=function(e,t){var n;Os(arguments[1])&&arguments[1].data?(Es.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)}},{key:"_initControllers",value:function(){this.exceptionController=new wv(this),this.connectionController=new Lv(this),this.contextController=new xd(this),this.context=this.contextController.getContext(),this.signController=new hm(this),this.messageController=new Sy(this),this.comboMessageController=new m_(this),this.conversationController=new Zv(this),this.userController=new jv(this),this.groupController=new by(this),this.notificationController=new Hy(this),this.bigDataHallwayController=new zy(this),this.statusController=new Py(this),this.uploadController=new $y(this),this.messageLossController=new g_(this),this.eventStatController=new s_(this),this.sumStatController=new h_(this),this.mtaReportController=new i_(this),this._initReadyListener()}},{key:"_initListener",value:function(){var e=this;if(this.innerEmitter.on(Cd,this._onSDKReload,this),Ka&&"function"==typeof $a.onAppShow&&"function"==typeof $a.onAppHide){var t=null;$a.onAppHide((function(){t=new ig(lm)})),$a.onAppShow((function(){null!==t&&t.setNetworkType(e.netMonitor.getNetworkType()).setEnd()}))}}},{key:"_initReadyListener",value:function(){for(var e=this,t=this.readyList,n=0,r=t.length;n<r;n++)this[t[n]].ready((function(){return e._readyHandle()}))}},{key:"_onSDKReload",value:function(){var e=this;Es.log("sdk reloading..."),this.resetSDK(),this.login(this.loginInfo).then((function(t){e._sdkReloadFlag=!0}))}},{key:"resetSDK",value:function(){var e=this;this.initList.forEach((function(t){e[t].reset&&e[t].reset()})),this.netMonitor.reset(),this.storage.reset(),this.resetReady(),this._initReadyListener(),this.outerEmitter.emit(Cn.SDK_NOT_READY)}},{key:"_readyHandle",value:function(){for(var e=this.readyList,t=!0,n=0,r=e.length;n<r;n++)if(!this[e[n]].isReady()){t=!1;break}if(t){var o=Es.timeEnd(Kd);Es.warn("SDK is ready. cost=".concat(o,"ms")),this.triggerReady(),this.innerEmitter.emit(Md),this.outerEmitter.emit(Cn.SDK_READY),this._sdkReloadFlag&&(this.outerEmitter.emit(Cn.SDK_RELOAD),this.groupController.AVChatRoomHandler.joinAVChatRoomSilently(),this._sdkReloadFlag=!1),this._ssoLog.setNetworkType(this.netMonitor.getNetworkType()).setText(o).setEnd()}}}]),e}();v_.prototype.readyList=["conversationController"],v_.prototype.initList=["exceptionController","connectionController","signController","contextController","messageController","comboMessageController","conversationController","userController","groupController","notificationController","eventStatController","sumStatController","messageLossController","statusController"];var y_={login:"login",logout:"logout",destroy:"destroy",on:"on",off:"off",ready:"ready",setLogLevel:"setLogLevel",joinGroup:"joinGroup",quitGroup:"quitGroup",registerPlugin:"registerPlugin",getGroupOnlineMemberCount:"getGroupOnlineMemberCount"};function __(e,t){return!(!e.isReady()&&void 0===y_[t])||(e.innerEmitter.emit(dd,new Hp({code:$p.SDK_IS_NOT_READY,message:"".concat(t," ").concat(eh,",请参考 https://imsdk-1252463788.file.myqcloud.com/IM_DOC/Web/module-EVENT.html#.SDK_READY")})),!1)}var I_={},M_={};return M_.create=function(e){if(e.SDKAppID&&I_[e.SDKAppID])return I_[e.SDKAppID];Es.log("TIM.create");var t=new v_(e);t.on(Cn.SDK_DESTROY,(function(e){I_[e.data.SDKAppID]=null,delete I_[e.data.SDKAppID]}));var n=function(e){var t=Object.create(null);return Object.keys(Ih).forEach((function(n){if(e[n]){var r=Ih[n],o=new nr;t[r]=function(){var t=Array.from(arguments);return o.use((function(t,r){return __(e,n)?r():Bd(new Hp({code:$p.SDK_IS_NOT_READY,message:"".concat(n," ").concat(eh,"。")}))})).use((function(e,t){if(!0===cu(e,_h[n],r))return t()})).use((function(t,r){return e[n].apply(e,t)})),o.run(t)}}})),t}(t);return I_[e.SDKAppID]=n,Es.log("TIM.create ok"),n},M_.TYPES=Sn,M_.EVENT=Cn,M_.VERSION="2.9.3",Es.log("TIM.VERSION: ".concat(M_.VERSION)),M_}));