webim.min.js
81 KB
var Version="1.7.3";!function(e,t){e.Long=function(){"use strict";function e(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function t(e){return!0===(e&&e.__isLong__)}function n(e,t){var n,o,r;return t?(e>>>=0,(r=0<=e&&e<256)&&(o=a[e])?o:(n=i(e,(0|e)<0?-1:0,!0),r&&(a[e]=n),n)):(e|=0,(r=-128<=e&&e<128)&&(o=u[e])?o:(n=i(e,e<0?-1:0,!1),r&&(u[e]=n),n))}function o(e,t){if(isNaN(e)||!isFinite(e))return t?m:d;if(t){if(e<0)return m;if(e>=p)return _}else{if(e<=-f)return y;if(e+1>=f)return M}return e<0?o(-e,t).neg():i(e%l|0,e/l|0,t)}function i(t,n,o){return new e(t,n,o)}function r(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return d;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return r(e.substring(1),t,n).neg();for(var s=o(c(n,8)),u=d,a=0;a<e.length;a+=8){var l=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+l),n);if(l<8){var f=o(c(n,l));u=u.mul(f).add(o(p))}else u=u.mul(s),u=u.add(o(p))}return u.unsigned=t,u}function s(t){return t instanceof e?t:"number"==typeof t?o(t):"string"==typeof t?r(t):i(t.low,t.high,t.unsigned)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var u={},a={};e.fromInt=n,e.fromNumber=o,e.fromBits=i;var c=Math.pow;e.fromString=r,e.fromValue=s;var l=4294967296,p=l*l,f=p/2,g=n(1<<24),d=n(0);e.ZERO=d;var m=n(0,!0);e.UZERO=m;var h=n(1);e.ONE=h;var I=n(1,!0);e.UONE=I;var E=n(-1);e.NEG_ONE=E;var M=i(-1,2147483647,!1);e.MAX_VALUE=M;var _=i(-1,-1,!0);e.MAX_UNSIGNED_VALUE=_;var y=i(0,-2147483648,!1);e.MIN_VALUE=y;var T=e.prototype;return T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(y)){var t=o(e),n=this.div(t),i=n.mul(t).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var r=o(c(e,6),this.unsigned),s=this,u="";;){var a=s.div(r),l=s.sub(a.mul(r)).toInt()>>>0,p=l.toString(e);if(s=a,s.isZero())return p+u;for(;p.length<6;)p="0"+p;u=""+p+u}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(y)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return t(e)||(e=s(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.compare=function(e){if(t(e)||(e=s(e)),this.eq(e))return 0;var n=this.isNegative(),o=e.isNegative();return n&&!o?-1:!n&&o?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(y)?y:this.not().add(h)},T.neg=T.negate,T.add=function(e){t(e)||(e=s(e));var n=this.high>>>16,o=65535&this.high,r=this.low>>>16,u=65535&this.low,a=e.high>>>16,c=65535&e.high,l=e.low>>>16,p=65535&e.low,f=0,g=0,d=0,m=0;return m+=u+p,d+=m>>>16,m&=65535,d+=r+l,g+=d>>>16,d&=65535,g+=o+c,f+=g>>>16,g&=65535,f+=n+a,f&=65535,i(d<<16|m,f<<16|g,this.unsigned)},T.subtract=function(e){return t(e)||(e=s(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return d;if(t(e)||(e=s(e)),e.isZero())return d;if(this.eq(y))return e.isOdd()?y:d;if(e.eq(y))return this.isOdd()?y:d;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return o(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,r=65535&this.high,u=this.low>>>16,a=65535&this.low,c=e.high>>>16,l=65535&e.high,p=e.low>>>16,f=65535&e.low,m=0,h=0,I=0,E=0;return E+=a*f,I+=E>>>16,E&=65535,I+=u*f,h+=I>>>16,I&=65535,I+=a*p,h+=I>>>16,I&=65535,h+=r*f,m+=h>>>16,h&=65535,h+=u*p,m+=h>>>16,h&=65535,h+=a*l,m+=h>>>16,h&=65535,m+=n*f+r*p+u*l+a*c,m&=65535,i(I<<16|E,m<<16|h,this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(t(e)||(e=s(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?m:d;var n,i,r;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return I;r=m}else{if(this.eq(y)){if(e.eq(h)||e.eq(E))return y;if(e.eq(y))return h;return n=this.shr(1).div(e).shl(1),n.eq(d)?e.isNegative()?h:E:(i=this.sub(e.mul(n)),r=n.add(i.div(e)))}if(e.eq(y))return this.unsigned?m:d;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=d}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var u=Math.ceil(Math.log(n)/Math.LN2),a=u<=48?1:c(2,u-48),l=o(n),p=l.mul(e);p.isNegative()||p.gt(i);)n-=a,l=o(n,this.unsigned),p=l.mul(e);l.isZero()&&(l=h),r=r.add(l),i=i.sub(p)}return r},T.div=T.divide,T.modulo=function(e){return t(e)||(e=s(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return i(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=s(e)),i(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=s(e)),i(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=s(e)),i(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):i(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?i(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):i(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0===(e&=63))return this;var n=this.high;if(e<32){return i(this.low>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?i(n,0,this.unsigned):i(n>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?i(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:i(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e}()}(window),"function"!=typeof Array.prototype.forEach&&(Array.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e.apply(this,[this[t],t,this])});var msgCache={},webim={login:function(e,t,n){},syncMsgs:function(e,t){},getC2CHistoryMsgs:function(e,t,n){},syncGroupMsgs:function(e,t,n){},sendMsg:function(e,t,n){},logout:function(e,t){},setAutoRead:function(e,t,n){},getProfilePortrait:function(e,t,n){},setProfilePortrait:function(e,t,n){},applyAddFriend:function(e,t,n){},getPendency:function(e,t,n){},deletePendency:function(e,t,n){},responseFriend:function(e,t,n){},getAllFriend:function(e,t,n){},deleteFriend:function(e,t,n){},addBlackList:function(e,t,n){},getBlackList:function(e,t,n){},deleteBlackList:function(e,t,n){},uploadPic:function(e,t,n){},createGroup:function(e,t,n){},applyJoinGroup:function(e,t,n){},handleApplyJoinGroup:function(e,t,n){},deleteApplyJoinGroupPendency:function(e,t,n){},quitGroup:function(e,t,n){},getGroupPublicInfo:function(e,t,n){},getGroupInfo:function(e,t,n){},modifyGroupBaseInfo:function(e,t,n){},destroyGroup:function(e,t,n){},getJoinedGroupListHigh:function(e,t,n){},getGroupMemberInfo:function(e,t,n){},addGroupMember:function(e,t,n){},modifyGroupMember:function(e,t,n){},forbidSendMsg:function(e,t,n){},deleteGroupMember:function(e,t,n){},getPendencyGroup:function(e,t,n){},getPendencyReport:function(e,t,n){},getPendencyGroupRead:function(e,t,n){},sendCustomGroupNotify:function(e,t,n){},Msg:function(e,t,n,o,i,r,s,u,a){},MsgStore:{sessMap:function(){return{}},sessCount:function(){return 0},sessByTypeId:function(e,t){return{}},delSessByTypeId:function(e,t){return!0},resetCookieAndSyncFlag:function(){},downloadMap:{}}};window.webim=webim,function(e){var t={VERSION:Version,APPID:"537048168",PLAATFORM:"10"},n=!0,o=!0,i={FORMAL:{COMMON:"https://webim.tim.qq.com",PIC:"https://pic.tim.qq.com"},TEST:{COMMON:"https://test.tim.qq.com",PIC:"https://pic.tim.qq.com"}},r={},s=!1,u={OPEN_IM:"openim",GROUP:"group_open_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",DEL_CHAT:"recentcontact",WEB_IM:"webim"},a={openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v1",group_open_long_polling_http_noauth_svc:"v1",imopenstat:"v4",webim:"v3"},c={login:1,pic_up:3,apply_join_group:9,create_group:10,longpolling:18,send_group_msg:19,sendmsg:20},l={C2C:"C2C",GROUP:"GROUP"},p={C2C:1,GROUP:2},f={C2C:9e3,GROUP:9e3},g={OK:"OK",FAIL:"FAIL"},d={TEXT:"TIMTextElem",FACE:"TIMFaceElem",IMAGE:"TIMImageElem",CUSTOM:"TIMCustomElem",SOUND:"TIMSoundElem",FILE:"TIMFileElem",LOCATION:"TIMLocationElem",GROUP_TIP:"TIMGroupTipElem"},m={ORIGIN:1,LARGE:2,SMALL:3},h={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},I={RAW_DATA:0,BASE64_DATA:1},E={BUSSINESS_ID:"10001",AUTH_KEY:"617574686b6579",SERVER_IP:"182.140.186.147",SOUND_SERVER_DOMAIN:"grouptalk.c2c.qq.com"},M={SOUND:2106,FILE:2107},_={IMAGE:1,FILE:2,SHORT_VIDEO:3,SOUND:4},y={APP_VERSION:"2.1",SERVER_VERSION:1},T={C2C:1,GROUP_COMMON:3,GROUP_TIP:4,GROUP_SYSTEM:5,GROUP_TIP2:6,FRIEND_NOTICE:7,PROFILE_NOTICE:8,C2C_COMMON:9,C2C_EVENT:10},C={COMMON:0},A={READED:92,KICKEDOUT:96},S={COMMON:0,LOVEMSG:1,TIP:2,REDPACKET:3},v={REDPACKET:1,COMMON:2,LOVEMSG:3},O={JOIN:1,QUIT:2,KICK:3,SET_ADMIN:4,CANCEL_ADMIN:5,MODIFY_GROUP_INFO:6,MODIFY_MEMBER_INFO:7},G={FACE_URL:1,NAME:2,OWNER:3,NOTIFICATION:4,INTRODUCTION:5},F={JOIN_GROUP_REQUEST:1,JOIN_GROUP_ACCEPT:2,JOIN_GROUP_REFUSE:3,KICK:4,DESTORY:5,CREATE:6,INVITED_JOIN_GROUP_REQUEST:7,QUIT:8,SET_ADMIN:9,CANCEL_ADMIN:10,REVOKE:11,READED:15,CUSTOM:255,INVITED_JOIN_GROUP_REQUEST_AGREE:12},N={FRIEND_ADD:1,FRIEND_DELETE:2,PENDENCY_ADD:3,PENDENCY_DELETE:4,BLACK_LIST_ADD:5,BLACK_LIST_DELETE:6,PENDENCY_REPORT:7,FRIEND_UPDATE:8},R={PROFILE_MODIFY:1},P={OK:0,SIGNATURE_EXPIRATION:11},b={INIT:-1,ON:0,RECONNECT:1,OFF:9999},U={GROUP_MSG:1,C2C_MSG:2,USER_HEAD:3,GROUP_HEAD:4},L={ING:14,STOP:15},w=b.INIT,D=!1,k=0,q=6e4,B=null,x=0,K=0,H=0,V=null,J=null,z=0,Y=[],X=null,j=null,W={sdkAppID:null,appIDAt3rd:null,accountType:null,identifier:null,tinyid:null,identifierNick:null,userSig:null,a2:null,contentType:"json",apn:1},Q={},Z=0,$={},ee=0,te=[],ne=[],oe=[],ie=null,re={downloadMap:{}},se={"[惊讶]":0,"[撇嘴]":1,"[色]":2,"[发呆]":3,"[得意]":4,"[流泪]":5,"[害羞]":6,"[闭嘴]":7,"[睡]":8,"[大哭]":9,"[尴尬]":10,"[发怒]":11,"[调皮]":12,"[龇牙]":13,"[微笑]":14,"[难过]":15,"[酷]":16,"[冷汗]":17,"[抓狂]":18,"[吐]":19,"[偷笑]":20,"[可爱]":21,"[白眼]":22,"[傲慢]":23,"[饿]":24,"[困]":25,"[惊恐]":26,"[流汗]":27,"[憨笑]":28,"[大兵]":29,"[奋斗]":30,"[咒骂]":31,"[疑问]":32,"[嘘]":33,"[晕]":34},ue={},ae=new function(){this.formatTimeStamp=function(e,t){if(!e)return 0;var n;t=t||"yyyy-MM-dd hh:mm:ss";var o=new Date(1e3*e),i={"M+":o.getMonth()+1,"d+":o.getDate(),"h+":o.getHours(),"m+":o.getMinutes(),"s+":o.getSeconds()};n=/(y+)/.test(t)?t.replace(RegExp.$1,(o.getFullYear()+"").substr(4-RegExp.$1.length)):t;for(var r in i)new RegExp("("+r+")").test(n)&&(n=n.replace(RegExp.$1,1==RegExp.$1.length?i[r]:("00"+i[r]).substr((""+i[r]).length)));return n},this.groupTypeEn2Ch=function(e){var t=null;switch(e){case"Public":t="公开群";break;case"ChatRoom":t="聊天室";break;case"Private":t="私有群";break;case"AVChatRoom":t="直播聊天室";break;default:t=e}return t},this.groupTypeCh2En=function(e){var t=null;switch(e){case"公开群":t="Public";break;case"聊天室":t="ChatRoom";break;case"私有群":t="Private";break;case"直播聊天室":t="AVChatRoom";break;default:t=e}return t},this.groupRoleEn2Ch=function(e){var t=null;switch(e){case"Member":t="成员";break;case"Admin":t="管理员";break;case"Owner":t="群主";break;default:t=e}return t},this.groupRoleCh2En=function(e){var t=null;switch(e){case"成员":t="Member";break;case"管理员":t="Admin";break;case"群主":t="Owner";break;default:t=e}return t},this.groupMsgFlagEn2Ch=function(e){var t=null;switch(e){case"AcceptAndNotify":t="接收并提示";break;case"AcceptNotNotify":t="接收不提示";break;case"Discard":t="屏蔽";break;default:t=e}return t},this.groupMsgFlagCh2En=function(e){var t=null;switch(e){case"接收并提示":t="AcceptAndNotify";break;case"接收不提示":t="AcceptNotNotify";break;case"屏蔽":t="Discard";break;default:t=e}return t},this.formatText2Html=function(e){var t=e;return t&&(t=this.xssFilter(t),t=t.replace(/ /g," "),t=t.replace(/\n/g,"<br/>")),t},this.formatHtml2Text=function(e){var t=e;return t&&(t=t.replace(/ /g," "),t=t.replace(/<br\/>/g,"\n")),t},this.getStrBytes=function(e){if(null==e||void 0===e)return 0;if("string"!=typeof e)return 0;var t,n,o,i=0;for(n=0,o=e.length;n<o;n++)t=e.charCodeAt(n),i+=t<=127?1:t<=2047?2:t<=65535?3:4;return i},this.xssFilter=function(e){return o&&(e=e.toString(),e=e.replace(/[<]/g,"<"),e=e.replace(/[>]/g,">"),e=e.replace(/"/g,""")),e},this.trimStr=function(e){return e?(e=e.toString(),e.replace(/(^\s*)|(\s*$)/g,"")):""},this.validNumber=function(e){return e=e.toString(),e.match(/(^\d{1,8}$)/g)},this.getReturnError=function(e,t){return t||(t=-100),{ActionStatus:g.FAIL,ErrorCode:t,ErrorInfo:e+"["+t+"]"}},this.setCookie=function(e,t,n,o,i){var r=new Date;r.setTime(r.getTime()+1e3*n),document.cookie=e+"="+escape(t)+";expires="+r.toGMTString()},this.getCookie=function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]*)(;|$)"));return null!=t?unescape(t[2]):null},this.delCookie=function(e){var t=new Date;t.setTime(t.getTime()-1);var n=this.getCookie(e);null!=n&&(document.cookie=e+"="+escape(n)+";expires="+t.toGMTString())},this.getQueryString=function(e){var t=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),n=window.location.search.substr(1).match(t);return null!=n?unescape(n[2]):null},this.isIE=function(e){var t=document.createElement("b");return t.innerHTML="\x3c!--[if IE "+e+"]><i></i><![endif]--\x3e",1===t.getElementsByTagName("i").length},this.getBrowserInfo=function(){var e={},t=navigator.userAgent.toLowerCase();ce.info("navigator.userAgent="+t);var n;return(n=t.match(/msie ([\d.]+)/))?e.ie=n[1]:(n=t.match(/firefox\/([\d.]+)/))?e.firefox=n[1]:(n=t.match(/chrome\/([\d.]+)/))?e.chrome=n[1]:(n=t.match(/opera.([\d.]+)/))?e.opera=n[1]:(n=t.match(/version\/([\d.]+).*safari/))&&(e.safari=n[1]),e.ie?(t.match(/trident\/(\d)\./)&&6==t.match(/trident\/(\d)\./)[1]&&(e.ie=10),{type:"ie",ver:e.ie}):e.firefox?{type:"firefox",ver:e.firefox}:e.chrome?{type:"chrome",ver:e.chrome}:e.opera?{type:"opera",ver:e.opera}:e.safari?{type:"safari",ver:e.safari}:{type:"unknow",ver:-1}},this.replaceObject=function(e,t){for(var n in t)if(e[n])if(t[e[n]]=t[n],delete t[n],t[e[n]]instanceof Array)for(var o=t[e[n]].length,i=0;i<o;i++)t[e[n]][i]=this.replaceObject(e,t[e[n]][i]);else"object"==typeof t[e[n]]&&(t[e[n]]=this.replaceObject(e,t[e[n]]));return t}},ce=new function(){var e=!0;this.setOn=function(t){e=t},this.getOn=function(){return e},this.error=function(t){try{e&&console.error(t)}catch(e){}},this.warn=function(t){try{e&&console.warn(t)}catch(e){}},this.info=function(t){try{e&&console.info(t)}catch(e){}},this.debug=function(t){try{e&&console.debug(t)}catch(e){}}},le=function(e){return e||(e=new Date),Math.round(e.getTime()/1e3)},pe=function(){return ee?ee+=1:ee=Math.round(1e7*Math.random()),ee},fe=function(){return Math.round(4294967296*Math.random())},ge=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}return e},de=function(e,t,n,o,i,r,s,u){var a,c,l=ge();if(!l){c="创建请求失败";var a=ae.getReturnError(c,-1);return ce.error(c),void(u&&u(a))}Z++,$[Z]=l,l.open(e,t,!0),l.onreadystatechange=function(){4==l.readyState&&($[Z]=null,200==l.status?(s&&s(l.responseText),l=null,k=x=0):(l=null,setTimeout(function(){var e=ae.getReturnError("请求服务器失败,请检查你的网络是否正常",-2);r&&ie&&ie(e),u&&u(e)},16)))},l.setRequestHeader("Content-Type",i),o||(o=15e3),o&&(l.timeout=o,l.ontimeout=function(e){l=null}),l.overrideMimeType,l.send(n)},me=function(e,t,n,o,i,r,s,u){de(e,t,JSON.stringify(n),o,i,r,function(e){var t=null;e&&(t=JSON.parse(e)),r&&ie&&ie(t),s&&s(t)},u)},he=function(){return W.sdkAppID&&W.identifier},Ie=function(e,t){if(!he()){if(t){var n=ae.getReturnError("请登录",-4);e&&e(n)}return!1}return!0},Ee=function(){return n},Me=function(e,n,o,r){var s=i;s=Ee()?i.FORMAL.COMMON:i.TEST.COMMON,e==u.PIC&&(s=Ee()?i.FORMAL.PIC:i.TEST.PIC);var c=s+"/"+a[e]+"/"+e+"/"+n+"?websdkappid="+t.APPID+"&v="+t.VERSION+"&platform="+t.PLAATFORM;if(he()){if("login"==n||"accesslayer"==n)c+="&identifier="+encodeURIComponent(W.identifier)+"&usersig="+W.userSig;else if(W.tinyid&&W.a2)c+="&tinyid="+W.tinyid+"&a2="+W.a2;else if(r)return ce.error("tinyid或a2为空["+e+"]["+n+"]"),r(ae.getReturnError("tinyid或a2为空["+e+"]["+n+"]",-5)),!1;c+="&contenttype="+W.contentType}return c+="&sdkappid="+W.sdkAppID+"&accounttype="+W.accountType+"&apn="+W.apn+"&reqtime="+le()},_e=function(e,t){var n=null;return X&&Y[0]?n="https://"+E.SOUND_SERVER_DOMAIN+"/asn.com/stddownload_common_file?authkey="+X+"&bid="+E.BUSSINESS_ID+"&subbid="+W.sdkAppID+"&fileid="+e+"&filetype="+M.SOUND+"&openid="+t+"&ver=0":ce.error("拼接语音下载url不报错:ip或者authkey为空"),n},ye=function(e,t,n){var o=null;return X&&Y[0]?o="http://"+Y[0]+"/asn.com/stddownload_common_file?authkey="+X+"&bid="+E.BUSSINESS_ID+"&subbid="+W.sdkAppID+"&fileid="+e+"&filetype="+M.FILE+"&openid="+t+"&ver=0&filename="+encodeURIComponent(n):ce.error("拼接文件下载url不报错:ip或者authkey为空"),re.downloadMap["uuid_"+e]=o,o},Te=function(e,t,n,o,i,r,s){var u={From_Account:t,To_Account:i,os_platform:10,Timestamp:le().toString(),Random:fe().toString(),request_info:[{busi_id:r,download_flag:o,type:s,uuid:e,version:y.SERVER_VERSION,auth_key:X,ip:Y[0]}]};Gt(u,function(e){0==e.error_code&&e.response_info&&(re.downloadMap["uuid_"+u.uuid]=e.response_info.url),onAppliedDownloadUrl&&onAppliedDownloadUrl({uuid:u.uuid,url:e.response_info.url,maps:re.downloadMap})},function(e){ce.error("获取下载地址失败",u.uuid)})},Ce=function(){for(var e in $){var t=$[e];t&&(t.abort(),$[Z]=null)}Z=0,$={}},Ae=function(){Ce(),W={sdkAppID:null,appIDAt3rd:null,accountType:null,identifier:null,identifierNick:null,userSig:null,contentType:"json",apn:1},Q={},ee=0,H=0,V=null,oe=[],Lt.clear(),Ut.clear(),B=null},Se=function(e,t,i,r,s){return Ae(),i&&(Q=i),0==Q.isAccessFormalEnv&&(ce.error("请切换为正式环境!!!!"),n=Q.isAccessFormalEnv),0==Q.isLogOn&&ce.setOn(Q.isLogOn),void 0!==Q.xssFilterEnable&&(o=Q.xssFilterEnable),!e&&s?void s(ae.getReturnError("loginInfo is empty",-6)):!e.sdkAppID&&s?void s(ae.getReturnError("loginInfo.sdkAppID is empty",-7)):(e.identifier&&(W.identifier=e.identifier.toString()),e.identifier&&!e.userSig&&s?void s(ae.getReturnError("loginInfo.userSig is empty",-9)):(e.userSig&&(W.userSig=e.userSig.toString()),W.sdkAppID=e.sdkAppID,W.accountType=Math.ceil(1e4*Math.random()),void(W.identifier&&W.userSig?Oe(function(){Ge(function(e,n){Lt.init(t,function(t){r&&(t.identifierNick=e,t.headurl=n,r(t))},s)},s)}):Lt.init(t,r,s))))},ve=function(e,n,o){if("longpolling"!=e||60008!=n&&91101!=n){var i=c[e];if(i){var r=le(),s=null,u={Code:n,ErrMsg:o};if(W.a2?s=W.a2.substring(0,10)+"_"+r+"_"+fe():W.userSig&&(s=W.userSig.substring(0,10)+"_"+r+"_"+fe()),s){var a={UniqKey:s,EventId:i,ReportTime:r,MsgCmdErrorCode:u};if("login"==e){var l=[];l.push(a);vt({EvtItems:l,MainVersion:t.VERSION,Version:"0"},function(e){l=null},function(e){l=null})}else if(oe.push(a),oe.length>=20){var p={EvtItems:oe,MainVersion:t.VERSION,Version:"0"};vt(p,function(e){oe=[]},function(e){oe=[]})}}}}},Oe=function(e){Ft.apiCall(u.WEB_IM,"accesslayer",{},function(t){0===t.ErrorCode&&1===t.WebImAccessLayer&&(i.FORMAL.COMMON="https://events.tim.qq.com"),e()},function(){e()})},Ge=function(e,t){Ft.apiCall(u.OPEN_IM,"login",{State:"Online"},function(n){if(n.TinyId)W.tinyid=n.TinyId;else if(t)return void t(ae.getReturnError("TinyId is empty",-10));if(n.A2Key)W.a2=n.A2Key;else if(t)return void t(ae.getReturnError("A2Key is empty",-11));var o=["Tag_Profile_IM_Nick","Tag_Profile_IM_Image"],i={From_Account:W.identifier,To_Account:[W.identifier],LastStandardSequence:0,TagList:o};Et(i,function(t){var n,o;if(t.UserProfileItem&&t.UserProfileItem.length>0)for(var i in t.UserProfileItem)for(var r in t.UserProfileItem[i].ProfileItem)switch(t.UserProfileItem[i].ProfileItem[r].Tag){case"Tag_Profile_IM_Nick":n=t.UserProfileItem[i].ProfileItem[r].Value,n&&(W.identifierNick=n);break;case"Tag_Profile_IM_Image":o=t.UserProfileItem[i].ProfileItem[r].Value,o&&(W.headurl=o)}e&&e(W.identifierNick,W.headurl)},t)},t)},Fe=function(e,t,n){if(!Ie(n,!1))return Ae(),void(t&&t({ActionStatus:g.OK,ErrorCode:0,ErrorInfo:"logout success"}));"all"==e?Ft.apiCall(u.OPEN_IM,"logout",{},function(e){Ae(),t&&t(e)},n):Ft.apiCall(u.OPEN_IM,"longpollinglogout",{LongPollingId:B},function(e){Ae(),t&&t(e)},n)},Ne=function(e,t,n){if(Ie(n,!0)){var o=null;switch(e.sess.type()){case l.C2C:o={From_Account:W.identifier,To_Account:e.sess.id().toString(),MsgTimeStamp:e.time,MsgSeq:e.seq,MsgRandom:e.random,MsgBody:[],OfflinePushInfo:e.offlinePushInfo};break;case l.GROUP:var i=e.getSubType();switch(o={GroupId:e.sess.id().toString(),From_Account:W.identifier,Random:e.random,MsgBody:[]},i){case S.COMMON:o.MsgPriority="COMMON";break;case S.REDPACKET:o.MsgPriority="REDPACKET";break;case S.LOVEMSG:o.MsgPriority="LOVEMSG";break;case S.TIP:ce.error("不能主动发送群提示消息,subType="+i);break;default:return void ce.error("发送群消息时,出现未知子消息类型:subType="+i)}}for(var r in e.elems){var s=e.elems[r],a=null,c=s.type;switch(c){case d.TEXT:a={Text:s.content.text};break;case d.FACE:a={Index:s.content.index,Data:s.content.data};break;case d.IMAGE:var p=[];for(var f in s.content.ImageInfoArray)p.push({Type:s.content.ImageInfoArray[f].type,Size:s.content.ImageInfoArray[f].size,Width:s.content.ImageInfoArray[f].width,Height:s.content.ImageInfoArray[f].height,URL:s.content.ImageInfoArray[f].url});a={ImageFormat:s.content.ImageFormat,UUID:s.content.UUID,ImageInfoArray:p};break;case d.SOUND:ce.warn("web端暂不支持发送语音消息");continue;case d.LOCATION:ce.warn("web端暂不支持发送地理位置消息");continue;case d.FILE:a={UUID:s.content.uuid,FileName:s.content.name,FileSize:s.content.size,DownloadFlag:s.content.downFlag};break;case d.CUSTOM:a={Data:s.content.data,Desc:s.content.desc,Ext:s.content.ext},c=d.CUSTOM;break;default:ce.warn("web端暂不支持发送"+s.type+"消息");continue}e.PushInfoBoolean&&(o.OfflinePushInfo=e.PushInfo),o.MsgBody.push({MsgType:c,MsgContent:a})}e.sess.type()==l.C2C?Ft.apiCall(u.OPEN_IM,"sendmsg",o,t,n):e.sess.type()==l.GROUP&&Ft.apiCall(u.GROUP,"send_group_msg",o,t,n)}},Re=function(e,t,o){(n||"undefined"==typeof stopPolling||1!=stopPolling)&&Ie(o,!0)&&Ft.apiCall(u.OPEN_IM,"longpolling",e,t,o,q,!0)},Pe=function(e,t,n,o){Ft.apiCall(u.BIG_GROUP_LONG_POLLING,"get_msg",e,t,n,o)},be=function(e,t,n,o){Ie(o,!0)&&Ft.apiCall(u.OPEN_IM,"getmsg",{Cookie:e,SyncFlag:t},function(e){if(e.MsgList&&e.MsgList.length)for(var t in e.MsgList)te.push(e.MsgList[t]);1==e.SyncFlag?be(e.Cookie,e.SyncFlag,n,o):(e.MsgList=te,te=[],n&&n(e))},o)},Ue=function(e,t,n,o){if(Ie(o,!0)){var i=[];for(var r in t){var s={To_Account:t[r].toAccount,LastedMsgTime:t[r].lastedMsgTime};i.push(s)}Ft.apiCall(u.OPEN_IM,"msgreaded",{C2CMsgReaded:{Cookie:e,C2CMsgReadedItem:i}},n,o)}},Le=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.OPEN_IM,"deletemsg",e,t,n)},we=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.OPEN_IM,"getroammsg",e,function(o){var i=e.MaxCnt,r=o.Complete,s=o.MaxCnt,u=o.MsgKey,a=o.LastMsgTime;o.MsgList&&o.MsgList.length&&(ne=o.MsgList.concat(ne));var c=null;0==r&&s<i&&(c={Peer_Account:e.Peer_Account,MaxCnt:i-s,LastMsgTime:a,MsgKey:u}),c?we(c,t,n):(o.MsgList=ne,ne=[],t&&t(o))},n)},De=function(e,t,n){if(Ie(n,!0)){for(var o={Type:e.Type,Name:e.Name},i=[],r=0;r<e.MemberList.length;r++)i.push({Member_Account:e.MemberList[r]});o.MemberList=i,e.GroupId&&(o.GroupId=e.GroupId),e.Owner_Account&&(o.Owner_Account=e.Owner_Account),e.Introduction&&(o.Introduction=e.Introduction),e.Notification&&(o.Notification=e.Notification),e.MaxMemberCount&&(o.MaxMemberCount=e.MaxMemberCount),e.ApplyJoinOption&&(o.ApplyJoinOption=e.ApplyJoinOption),e.AppDefinedData&&(o.AppDefinedData=e.AppDefinedData),e.FaceUrl&&(o.FaceUrl=e.FaceUrl),Ft.apiCall(u.GROUP,"create_group",o,t,n)}},ke=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"create_group",e,t,n)},qe=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"modify_group_base_info",e,t,n)},Be=function(e,t,n){Ie(n,!0)&&(e.GroupId=String(e.GroupId),Ft.apiCall(u.GROUP,"apply_join_group",{GroupId:e.GroupId,ApplyMsg:e.ApplyMsg,UserDefinedField:e.UserDefinedField},t,n))},xe=function(e,t,n){e.GroupId=String(e.GroupId);var o;if(o=Ie(n,!1)?u.GROUP:u.BIG_GROUP,Lt.checkBigGroupLongPollingOn(e.GroupId))return void(n&&n(ae.getReturnError("Join Group failed; You have already been in this group, you have to quit group before you rejoin",10013)));Ft.apiCall(o,"apply_join_group",{GroupId:e.GroupId,ApplyMsg:e.ApplyMsg,UserDefinedField:e.UserDefinedField},function(o){if(o.JoinedStatus&&"JoinedSuccess"==o.JoinedStatus){if(!o.LongPollingKey)return void(n&&n(ae.getReturnError("Join Group succeed; But the type of group is not AVChatRoom: groupid="+e.GroupId,-12)));Lt.setBigGroupLongPollingOn(!0),Lt.setBigGroupLongPollingKey(e.GroupId,o.LongPollingKey),Lt.setBigGroupLongPollingMsgMap(e.GroupId,0),Lt.bigGroupLongPolling(e.GroupId)}t&&t(o)},function(e){n&&n(e)})},Ke=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"handle_apply_join_group",{GroupId:e.GroupId,Applicant_Account:e.Applicant_Account,HandleMsg:e.HandleMsg,Authentication:e.Authentication,MsgKey:e.MsgKey,ApprovalMsg:e.ApprovalMsg,UserDefinedField:e.UserDefinedField},t,function(e){if(10024==e.ErrorCode){if(t){var o={ActionStatus:g.OK,ErrorCode:0,ErrorInfo:"该申请已经被处理过"};t(o)}}else n&&n(e)})},He=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"get_pendency",{StartTime:e.StartTime,Limit:e.Limit,Handle_Account:W.identifier},t,function(e){})},Ve=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"report_pendency",{ReportTime:e.ReportTime,From_Account:W.identifier},t,function(e){})},Je=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"handle_invite_join_group",{GroupId:e.GroupId,Inviter_Account:e.Inviter_Account,HandleMsg:e.HandleMsg,Authentication:e.Authentication,MsgKey:e.MsgKey,ApprovalMsg:e.ApprovalMsg,UserDefinedField:e.UserDefinedField},t,function(e){})},ze=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"quit_group",{GroupId:e.GroupId},t,n)},Ye=function(e,t,n){var o;o=Ie(n,!1)?u.GROUP:u.BIG_GROUP,Lt.resetBigGroupLongPollingInfo(e.GroupId),Ft.apiCall(o,"quit_group",{GroupId:e.GroupId},function(n){Ut.delSessByTypeId(l.GROUP,e.GroupId),t&&t(n)},n)},Xe=function(e,t,n){Ft.apiCall(u.GROUP,"search_group",e,t,n)},je=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"get_group_public_info",{GroupIdList:e.GroupIdList,ResponseFilter:{GroupBasePublicInfoFilter:e.GroupBasePublicInfoFilter}},function(e){if(e.ErrorInfo="",e.GroupInfo)for(var o in e.GroupInfo){var i=e.GroupInfo[o].ErrorCode;i>0&&(e.ActionStatus=g.FAIL,e.GroupInfo[o].ErrorInfo="["+i+"]"+e.GroupInfo[o].ErrorInfo,e.ErrorInfo+=e.GroupInfo[o].ErrorInfo+"\n")}e.ActionStatus==g.FAIL?n&&n(e):t&&t(e)},n)},We=function(e,t,n){if(Ie(n,!0)){var o={GroupIdList:e.GroupIdList,ResponseFilter:{GroupBaseInfoFilter:e.GroupBaseInfoFilter,MemberInfoFilter:e.MemberInfoFilter}};e.AppDefinedDataFilter_Group&&(o.ResponseFilter.AppDefinedDataFilter_Group=e.AppDefinedDataFilter_Group),e.AppDefinedDataFilter_GroupMember&&(o.ResponseFilter.AppDefinedDataFilter_GroupMember=e.AppDefinedDataFilter_GroupMember),Ft.apiCall(u.GROUP,"get_group_info",o,t,n)}},Qe=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"get_group_member_info",{GroupId:e.GroupId,Offset:e.Offset,Limit:e.Limit,MemberInfoFilter:e.MemberInfoFilter,MemberRoleFilter:e.MemberRoleFilter,AppDefinedDataFilter_GroupMember:e.AppDefinedDataFilter_GroupMember},t,n)},Ze=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"add_group_member",{GroupId:e.GroupId,Silence:e.Silence,MemberList:e.MemberList},t,n)},$e=function(e,t,n){if(Ie(n,!0)){var o={};e.GroupId&&(o.GroupId=e.GroupId),e.Member_Account&&(o.Member_Account=e.Member_Account),e.Role&&(o.Role=e.Role),e.MsgFlag&&(o.MsgFlag=e.MsgFlag),e.ShutUpTime&&(o.ShutUpTime=e.ShutUpTime),e.NameCard&&(o.NameCard=e.NameCard),e.AppMemberDefinedData&&(o.AppMemberDefinedData=e.AppMemberDefinedData),Ft.apiCall(u.GROUP,"modify_group_member_info",o,t,n)}},et=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"delete_group_member",{GroupId:e.GroupId,Silence:e.Silence,MemberToDel_Account:e.MemberToDel_Account,Reason:e.Reason},t,n)},tt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"destroy_group",{GroupId:e.GroupId},t,n)},nt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"change_group_owner",e,t,n)},ot=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"get_joined_group_list",{Member_Account:e.Member_Account,Limit:e.Limit,Offset:e.Offset,GroupType:e.GroupType,ResponseFilter:{GroupBaseInfoFilter:e.GroupBaseInfoFilter,SelfInfoFilter:e.SelfInfoFilter}},t,n)},it=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"get_role_in_group",{GroupId:e.GroupId,User_Account:e.User_Account},t,n)},rt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"forbid_send_msg",{GroupId:e.GroupId,Members_Account:e.Members_Account,ShutUpTime:e.ShutUpTime},t,n)},st=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"send_group_system_notification",e,t,n)},ut=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"group_msg_get",{GroupId:e.GroupId,ReqMsgSeq:e.ReqMsgSeq,ReqMsgNumber:e.ReqMsgNumber},t,n)},at=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.GROUP,"msg_read_report",{GroupId:e.GroupId,MsgReadedSeq:e.MsgReadedSeq},t,n)},ct=function(e){var t=[];if(e.Fail_Account&&e.Fail_Account.length&&(t=e.Fail_Account),e.Invalid_Account&&e.Invalid_Account.length)for(var n in e.Invalid_Account)t.push(e.Invalid_Account[n]);if(t.length){e.ActionStatus=g.FAIL,e.ErrorCode=99999,e.ErrorInfo="";for(var o in t){var i=t[o];for(var r in e.ResultItem)if(e.ResultItem[r].To_Account==i){var s=e.ResultItem[r].ResultCode;e.ResultItem[r].ResultInfo="["+s+"]"+e.ResultItem[r].ResultInfo,e.ErrorInfo+=e.ResultItem[r].ResultInfo+"\n";break}}}return e},lt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"friend_add",{From_Account:W.identifier,AddFriendItem:e.AddFriendItem},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},pt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"friend_delete",{From_Account:W.identifier,To_Account:e.To_Account,DeleteType:e.DeleteType},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},ft=function(e,t,n){Ie(n,!0)&&(1==e.chatType?Ft.apiCall(u.DEL_CHAT,"delete",{From_Account:W.identifier,Type:e.chatType,To_Account:e.To_Account},t,n):Ft.apiCall(u.DEL_CHAT,"delete",{From_Account:W.identifier,Type:e.chatType,ToGroupid:e.To_Account},t,n))},gt=function(e,t,n){
Ie(n,!0)&&Ft.apiCall(u.FRIEND,"pendency_get",{From_Account:W.identifier,PendencyType:e.PendencyType,StartTime:e.StartTime,MaxLimited:e.MaxLimited,LastSequence:e.LastSequence},t,n)},dt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"PendencyReport",{From_Account:W.identifier,LatestPendencyTimeStamp:e.LatestPendencyTimeStamp},t,n)},mt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"pendency_delete",{From_Account:W.identifier,PendencyType:e.PendencyType,To_Account:e.To_Account},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},ht=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"friend_response",{From_Account:W.identifier,ResponseFriendItem:e.ResponseFriendItem},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},It=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"friend_get_all",{From_Account:W.identifier,TimeStamp:e.TimeStamp,StartIndex:e.StartIndex,GetCount:e.GetCount,LastStandardSequence:e.LastStandardSequence,TagList:e.TagList},t,n)},Et=function(e,t,n){e.To_Account.length>100&&(e.To_Account.length=100,ce.error("获取用户资料人数不能超过100人")),Ie(n,!0)&&Ft.apiCall(u.PROFILE,"portrait_get",{From_Account:W.identifier,To_Account:e.To_Account,TagList:e.TagList},function(e){var o=[];if(e.Fail_Account&&e.Fail_Account.length&&(o=e.Fail_Account),e.Invalid_Account&&e.Invalid_Account.length)for(var i in e.Invalid_Account)o.push(e.Invalid_Account[i]);if(o.length){e.ActionStatus=g.FAIL,e.ErrorCode=99999,e.ErrorInfo="";for(var r in o){var s=o[r];for(var u in e.UserProfileItem)if(e.UserProfileItem[u].To_Account==s){var a=e.UserProfileItem[u].ResultCode;e.UserProfileItem[u].ResultInfo="["+a+"]"+e.UserProfileItem[u].ResultInfo,e.ErrorInfo+="账号:"+s+","+e.UserProfileItem[u].ResultInfo+"\n";break}}}e.ActionStatus==g.FAIL?n&&n(e):t&&t(e)},n)},Mt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.PROFILE,"portrait_set",{From_Account:W.identifier,ProfileItem:e.ProfileItem},function(n){for(var o in e.ProfileItem){var i=e.ProfileItem[o];if("Tag_Profile_IM_Nick"==i.Tag){W.identifierNick=i.Value;break}}t&&t(n)},n)},_t=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"black_list_add",{From_Account:W.identifier,To_Account:e.To_Account},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},yt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"black_list_delete",{From_Account:W.identifier,To_Account:e.To_Account},function(e){var o=ct(e);o.ActionStatus==g.FAIL?n&&n(o):t&&t(o)},n)},Tt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.FRIEND,"black_list_get",{From_Account:W.identifier,StartIndex:e.StartIndex,MaxLimited:e.MaxLimited,LastSequence:e.LastSequence},t,n)},Ct=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.RECENT_CONTACT,"get",{From_Account:W.identifier,Count:e.Count},t,n)},At=function(e,t,n){if(Ie(n,!0)){var o;o=Ee()?"pic_up":"pic_up_test",Ft.apiCall(u.PIC,o,{App_Version:y.APP_VERSION,From_Account:W.identifier,To_Account:e.To_Account,Seq:e.Seq,Timestamp:e.Timestamp,Random:e.Random,File_Str_Md5:e.File_Str_Md5,File_Size:e.File_Size,File_Type:e.File_Type,Server_Ver:y.SERVER_VERSION,Auth_Key:X,Busi_Id:e.Busi_Id,PkgFlag:e.PkgFlag,Slice_Offset:e.Slice_Offset,Slice_Size:e.Slice_Size,Slice_Data:e.Slice_Data,content_type:"application/x-www-form-urlencoded"},t,n)}},St=function(e,t){Ie(t,!0)&&Ft.apiCall(u.OPEN_IM,"authkey",{},e,t)},vt=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.IM_OPEN_STAT,"web_report",e,t,n)},Ot=function(e,t,n){Ie(n,!0)&&Ft.apiCall(u.OPEN_IM,"getlongpollingid",{},function(e){t&&t(e)},n)},Gt=function(e,t,n){Ft.apiCall(u.PIC,"apply_download",e,t,n)};!function(){r=ae.getBrowserInfo(),ce.info("BROWSER_INFO: type="+r.type+", ver="+r.ver),"ie"==r.type&&parseInt(r.ver)<10&&(s=!0)}();var Ft=0==s?new function(){var e=null;this.init=function(t,n,o){t&&(e=t)},this.callBack=function(t){e&&e(t)},this.clear=function(){e=null},this.apiCall=function(e,t,n,o,i,r,s){var u=Me(e,t,0,i);if(0!=u){var a=n.content_type?n.content_type:"application/x-www-form-urlencoded";me("POST",u,n,r,a,s,function(r){var s=null,a="";"pic_up"==t&&(n.Slice_Data="");var c="\n request url: \n"+u+"\n request body: \n"+JSON.stringify(n)+"\n response: \n"+JSON.stringify(r);r.ActionStatus==g.OK?(ce.info("["+e+"]["+t+"]success: "+c),o&&o(r),s=0,a=""):(s=r.ErrorCode,a=r.ErrorInfo,i&&(r.SrcErrorInfo=r.ErrorInfo,r.ErrorInfo="["+e+"]["+t+"]failed: "+c,"longpolling"==t&&60008==r.ErrorCode||ce.error(r.ErrorInfo),i(r))),ve(t,s,a)},function(e){i&&i(e),ve(t,e.ErrorCode,e.ErrorInfo)})}}}:new function(){var e=null;this.init=function(t,n,o){t&&(e=t)},this.callBack=function(t){e&&e(t)},this.clear=function(){e=null},this.apiCall=function(e,t,n,o,i,r,s){var u=Me(e,t,0,i);if(0!=u){var a=H++,c="jsonpRequest"+a,l=document.createElement("script"),p=0;window[c]=J,l.type="text/javascript",u=u+"&jsonpcallback="+c+"&jsonpbody="+encodeURIComponent(JSON.stringify(n)),l.src=u,l.async=!0,void 0!==l.onreadystatechange&&(l.event="onclick",l.htmlFor=l.id="_jsonpRequest_"+a),l.onload=l.onreadystatechange=function(){if(this.readyState&&"complete"!==this.readyState&&"loaded"!==this.readyState||p)return!1;l.onload=l.onreadystatechange=null,l.onclick&&l.onclick();var r=V,s="\n request url: \n"+u+"\n request body: \n"+JSON.stringify(n)+"\n response: \n"+JSON.stringify(r);r.ActionStatus==g.OK?(ce.info("["+e+"]["+t+"]success: "+s),o&&o(r)):(r.ErrorInfo="["+e+"]["+t+"]failed "+s,"longpolling"!=t||60008!=r.ErrorCode?ce.error(r.ErrorInfo):ce.warn("["+e+"]["+t+"]success: "+s),i&&i(r)),V=void 0,document.body.removeChild(l),p=1},document.body.appendChild(l)}}},Nt=function(e,t,n,o,i,r){this._impl={skey:Nt.skey(e,t),type:e,id:t,name:n,icon:o,unread:0,isAutoRead:!1,time:i>=0?i:0,curMaxMsgSeq:r>=0?r:0,msgs:[],isFinished:1}};Nt.skey=function(e,t){return e+t},Nt.prototype.type=function(){return this._impl.type},Nt.prototype.id=function(){return this._impl.id},Nt.prototype.name=function(){return this._impl.name},Nt.prototype.icon=function(){return this._impl.icon},Nt.prototype.unread=function(e){if(void 0===e)return this._impl.unread;this._impl.unread=e},Nt.prototype.isFinished=function(e){if(void 0===e)return this._impl.isFinished;this._impl.isFinished=e},Nt.prototype.time=function(){return this._impl.time},Nt.prototype.curMaxMsgSeq=function(e){if(void 0===e)return this._impl.curMaxMsgSeq;this._impl.curMaxMsgSeq=e},Nt.prototype.msgCount=function(){return this._impl.msgs.length},Nt.prototype.msg=function(e){return this._impl.msgs[e]},Nt.prototype.msgs=function(){return this._impl.msgs},Nt.prototype._impl_addMsg=function(e,t){this._impl.msgs.push(e),e.time>this._impl.time&&(this._impl.time=e.time),e.seq>this._impl.curMaxMsgSeq&&(this._impl.curMaxMsgSeq=e.seq),e.isSend||this._impl.isAutoRead||!t||this._impl.unread++};var Rt=function(e,t){this.toAccount=e,this.lastedMsgTime=t},Pt=function(e,t){for(var n=parseInt(e).toString(2)+"00000000000000000000000000000000",o=parseInt(t).toString(2),i=n.split("").reverse(),r=o.split("").reverse(),s=null,u=[],a=i.length>r.length?i.length:r.length,c=0;c<a;c++)s=Number(i[c]||0)||Number(r[c]||0),u.push(s);var l=u.reverse().join(""),p={high:"0x"+parseInt(l.substr(0,l.length-32),2).toString(16),low:"0x"+parseInt(l.substr(l.length-32-1),2).toString(16)};return new Long(p.low,p.high,!0).toString()},bt=function(e,t,n,o,i,r,s,u,a){switch(this.sess=e,this.subType=s>=0?s:0,this.fromAccount=r,this.fromAccountNick=u||r,this.fromAccountHeadurl=a||null,this.isSend=Boolean(t),this.seq=n>=0?n:pe(),this.random=o>=0?o:fe(),this.time=i>=0?i:le(),this.elems=[],e.type()){case l.GROUP:this.uniqueId=Pt(this.seq,this.random);break;case l.C2C:default:this.uniqueId=Pt(this.time,this.random)}};bt.prototype.getSession=function(){return this.sess},bt.prototype.getType=function(){return this.subType},bt.prototype.getSubType=function(){return this.subType},bt.prototype.getFromAccount=function(){return this.fromAccount},bt.prototype.getFromAccountNick=function(){return this.fromAccountNick},bt.prototype.getIsSend=function(){return this.isSend},bt.prototype.getSeq=function(){return this.seq},bt.prototype.getTime=function(){return this.time},bt.prototype.getRandom=function(){return this.random},bt.prototype.getElems=function(){return this.elems},bt.prototype.getMsgUniqueId=function(){return this.uniqueId},bt.prototype.addText=function(t){this.addElem(new e.Msg.Elem(d.TEXT,t))},bt.prototype.addFace=function(t){this.addElem(new e.Msg.Elem(d.FACE,t))},bt.prototype.addImage=function(t){this.addElem(new e.Msg.Elem(d.IMAGE,t))},bt.prototype.addLocation=function(t){this.addElem(new e.Msg.Elem(d.LOCATION,t))},bt.prototype.addFile=function(t){this.addElem(new e.Msg.Elem(d.FILE,t))},bt.prototype.addCustom=function(t){this.addElem(new e.Msg.Elem(d.CUSTOM,t))},bt.prototype.addElem=function(e){this.elems.push(e)},bt.prototype.toHtml=function(){var e="";for(var t in this.elems){e+=this.elems[t].toHtml()}return e},bt.prototype.setOfflinePushInfo=function(e){this.offlinePushInfo=e},bt.Elem=function(e,t){this.type=e,this.content=t},bt.Elem.prototype.getType=function(){return this.type},bt.Elem.prototype.getContent=function(){return this.content},bt.Elem.prototype.toHtml=function(){return this.content.toHtml()},bt.Elem.Text=function(e){this.text=ae.xssFilter(e)},bt.Elem.Text.prototype.getText=function(){return this.text},bt.Elem.Text.prototype.toHtml=function(){return this.text},bt.Elem.Face=function(e,t){this.index=e,this.data=t},bt.Elem.Face.prototype.getIndex=function(){return this.index},bt.Elem.Face.prototype.getData=function(){return this.data},bt.Elem.Face.prototype.toHtml=function(){var e=null,t=se[this.data],n=ue[t];return n&&n[1]&&(e=n[1]),e?"<img src='"+e+"'/>":this.data},bt.Elem.Location=function(e,t,n){this.latitude=t,this.longitude=e,this.desc=n},bt.Elem.Location.prototype.getLatitude=function(){return this.latitude},bt.Elem.Location.prototype.getLongitude=function(){return this.longitude},bt.Elem.Location.prototype.getDesc=function(){return this.desc},bt.Elem.Location.prototype.toHtml=function(){return"经度="+this.longitude+",纬度="+this.latitude+",描述="+this.desc},bt.Elem.Images=function(e,t){this.UUID=e,"number"!=typeof t&&(t=parseInt(h[t]||h.UNKNOWN,10)),this.ImageFormat=t,this.ImageInfoArray=[]},bt.Elem.Images.prototype.addImage=function(e){this.ImageInfoArray.push(e)},bt.Elem.Images.prototype.toHtml=function(){var e=this.getImage(m.SMALL),t=this.getImage(m.LARGE),n=this.getImage(m.ORIGIN);return t||(t=e),n||(n=e),"<img src='"+e.getUrl()+"#"+t.getUrl()+"#"+n.getUrl()+"' style='CURSOR: hand' id='"+this.getImageId()+"' bigImgUrl='"+t.getUrl()+"' onclick='imageClick(this)' />"},bt.Elem.Images.prototype.getImageId=function(){return this.UUID},bt.Elem.Images.prototype.getImageFormat=function(){return this.ImageFormat},bt.Elem.Images.prototype.getImage=function(e){for(var t in this.ImageInfoArray)if(this.ImageInfoArray[t].getType()==e)return this.ImageInfoArray[t];var n=null;return this.ImageInfoArray.forEach(function(t){t.getType()==e&&(n=t)}),n},bt.Elem.Images.Image=function(e,t,n,o,i){this.type=e,this.size=t,this.width=n,this.height=o,this.url=i},bt.Elem.Images.Image.prototype.getType=function(){return this.type},bt.Elem.Images.Image.prototype.getSize=function(){return this.size},bt.Elem.Images.Image.prototype.getWidth=function(){return this.width},bt.Elem.Images.Image.prototype.getHeight=function(){return this.height},bt.Elem.Images.Image.prototype.getUrl=function(){return this.url},bt.Elem.Sound=function(e,t,n,o,i,r,s,u){this.uuid=e,this.second=t,this.size=n,this.senderId=o,this.receiverId=i,this.downFlag=r,this.busiId=s==l.C2C?2:1,2==r&&null!=u?this.downUrl=u:void 0!==this.downFlag&&void 0!==this.busiId?Te(e,o,0,r,i,this.busiId,_.SOUND):this.downUrl=_e(e,o)},bt.Elem.Sound.prototype.getUUID=function(){return this.uuid},bt.Elem.Sound.prototype.getSecond=function(){return this.second},bt.Elem.Sound.prototype.getSize=function(){return this.size},bt.Elem.Sound.prototype.getSenderId=function(){return this.senderId},bt.Elem.Sound.prototype.getDownUrl=function(){return this.downUrl},bt.Elem.Sound.prototype.toHtml=function(){return"ie"==r.type&&parseInt(r.ver)<=8?"[这是一条语音消息]demo暂不支持ie8(含)以下浏览器播放语音,语音URL:"+this.downUrl:'<audio id="uuid_'+this.uuid+'" src="'+this.downUrl+'" controls="controls" onplay="onChangePlayAudio(this)" preload="none"></audio>'},bt.Elem.File=function(e,t,n,o,i,r,s,u){this.uuid=e,this.name=t,this.size=n,this.senderId=o,this.receiverId=i,this.downFlag=r,this.busiId=s==l.C2C?2:1,2==r&&null!=u?this.downUrl=u:void 0!==r&&void 0!==this.busiId?Te(e,o,0,r,i,this.busiId,_.FILE):this.downUrl=ye(e,o,t)},bt.Elem.File.prototype.getUUID=function(){return this.uuid},bt.Elem.File.prototype.getName=function(){return this.name},bt.Elem.File.prototype.getSize=function(){return this.size},bt.Elem.File.prototype.getSenderId=function(){return this.senderId},bt.Elem.File.prototype.getDownUrl=function(){return this.downUrl},bt.Elem.File.prototype.getDownFlag=function(){return this.downFlag},bt.Elem.File.prototype.toHtml=function(){var e,t;return e=this.size,t="Byte",this.size>=1024&&(e=Math.round(this.size/1024),t="KB"),'<a href="javascript" onclick="webim.onDownFile("'+this.uuid+'")" title="点击下载文件" ><i class="glyphicon glyphicon-file"> '+this.name+"("+e+t+")</i></a>"},bt.Elem.GroupTip=function(e,t,n,o,i,r){this.opType=e,this.opUserId=t,this.groupId=n,this.groupName=o,this.userIdList=i||[],this.groupInfoList=[],this.memberInfoList=[],this.groupMemberNum=null,this.userinfo=r||[]},bt.Elem.GroupTip.prototype.addGroupInfo=function(e){this.groupInfoList.push(e)},bt.Elem.GroupTip.prototype.addMemberInfo=function(e){this.memberInfoList.push(e)},bt.Elem.GroupTip.prototype.getOpType=function(){return this.opType},bt.Elem.GroupTip.prototype.getOpUserId=function(){return this.opUserId},bt.Elem.GroupTip.prototype.getGroupId=function(){return this.groupId},bt.Elem.GroupTip.prototype.getGroupName=function(){return this.groupName},bt.Elem.GroupTip.prototype.getUserIdList=function(){return this.userIdList},bt.Elem.GroupTip.prototype.getUserInfo=function(){return this.userinfo},bt.Elem.GroupTip.prototype.getGroupInfoList=function(){return this.groupInfoList},bt.Elem.GroupTip.prototype.getMemberInfoList=function(){return this.memberInfoList},bt.Elem.GroupTip.prototype.getGroupMemberNum=function(){return this.groupMemberNum},bt.Elem.GroupTip.prototype.setGroupMemberNum=function(e){return this.groupMemberNum=e},bt.Elem.GroupTip.prototype.toHtml=function(){var e="[群提示消息]";switch(this.opType){case O.JOIN:e+=this.opUserId+"邀请了";for(var t in this.userIdList)if(e+=this.userIdList[t]+",",this.userIdList.length>10&&9==t){e+="等"+this.userIdList.length+"人";break}e+="加入该群";break;case O.QUIT:e+=this.opUserId+"主动退出该群";break;case O.KICK:e+=this.opUserId+"将";for(var t in this.userIdList)if(e+=this.userIdList[t]+",",this.userIdList.length>10&&9==t){e+="等"+this.userIdList.length+"人";break}e+="踢出该群";break;case O.SET_ADMIN:e+=this.opUserId+"将";for(var t in this.userIdList)if(e+=this.userIdList[t]+",",this.userIdList.length>10&&9==t){e+="等"+this.userIdList.length+"人";break}e+="设为管理员";break;case O.CANCEL_ADMIN:e+=this.opUserId+"取消";for(var t in this.userIdList)if(e+=this.userIdList[t]+",",this.userIdList.length>10&&9==t){e+="等"+this.userIdList.length+"人";break}e+="的管理员资格";break;case O.MODIFY_GROUP_INFO:e+=this.opUserId+"修改了群资料:";for(var t in this.groupInfoList){var n=this.groupInfoList[t].getType(),o=this.groupInfoList[t].getValue();switch(n){case G.FACE_URL:e+="群头像为"+o+"; ";break;case G.NAME:e+="群名称为"+o+"; ";break;case G.OWNER:e+="群主为"+o+"; ";break;case G.NOTIFICATION:e+="群公告为"+o+"; ";break;case G.INTRODUCTION:e+="群简介为"+o+"; ";break;default:e+="未知信息为:type="+n+",value="+o+"; "}}break;case O.MODIFY_MEMBER_INFO:e+=this.opUserId+"修改了群成员资料:";for(var t in this.memberInfoList){var i=this.memberInfoList[t].getUserId(),r=this.memberInfoList[t].getShutupTime();if(e+=i+": ",e+=null!=r&&void 0!==r?0==r?"取消禁言; ":"禁言"+r+"秒; ":" shutupTime为空",this.memberInfoList.length>10&&9==t){e+="等"+this.memberInfoList.length+"人";break}}break;case O.READED:Log.info("消息已读同步");break;default:e+="未知群提示消息类型:type="+this.opType}return e},bt.Elem.GroupTip.GroupInfo=function(e,t){this.type=e,this.value=t},bt.Elem.GroupTip.GroupInfo.prototype.getType=function(){return this.type},bt.Elem.GroupTip.GroupInfo.prototype.getValue=function(){return this.value},bt.Elem.GroupTip.MemberInfo=function(e,t){this.userId=e,this.shutupTime=t},bt.Elem.GroupTip.MemberInfo.prototype.getUserId=function(){return this.userId},bt.Elem.GroupTip.MemberInfo.prototype.getShutupTime=function(){return this.shutupTime},bt.Elem.Custom=function(e,t,n){this.data=e,this.desc=t,this.ext=n},bt.Elem.Custom.prototype.getData=function(){return this.data},bt.Elem.Custom.prototype.getDesc=function(){return this.desc},bt.Elem.Custom.prototype.getExt=function(){return this.ext},bt.Elem.Custom.prototype.toHtml=function(){return this.data};var Ut=new function(){var e={},t=[];msgCache={},this.cookie="",this.syncFlag=0;var n=function(t){for(var n in e)t(e[n])},o=function(e){var t=!1,n=e.sess._impl.skey,o=[e.isSend?"1":"0",e.seq,e.random].join("");return msgCache[n]&&msgCache[n][o]&&(t=!0),msgCache[n]?msgCache[n][o]={time:e.time}:(msgCache[n]={},msgCache[n][o]={time:e.time}),t};this.sessMap=function(){return e},this.sessCount=function(){return t.length},this.sessByTypeId=function(t,n){var o=Nt.skey(t,n);return void 0===o||null==o?null:e[o]},this.delSessByTypeId=function(t,n){var o=Nt.skey(t,n);return void 0!==o&&null!=o&&(e[o]&&(delete e[o],delete msgCache[o]),!0)},this.resetCookieAndSyncFlag=function(){this.cookie="",this.syncFlag=0},this.setAutoRead=function(e,t,o){if(o&&n(function(e){e._impl.isAutoRead=!1}),e&&(e._impl.isAutoRead=t,t))if(e._impl.unread=0,e._impl.type==l.C2C){var i=[];i.push(new Rt(e._impl.id,e._impl.time)),Ue(Ut.cookie,i,function(e){ce.info("[setAutoRead]: c2CMsgReaded success")},function(e){ce.error("[setAutoRead}: c2CMsgReaded failed:"+e.ErrorInfo)})}else if(e._impl.type==l.GROUP){var r={GroupId:e._impl.id,MsgReadedSeq:e._impl.curMaxMsgSeq};at(r,function(e){ce.info("groupMsgReaded success")},function(e){ce.error("groupMsgReaded failed:"+e.ErrorInfo)})}},this.c2CMsgReaded=function(e,t,n){var o=[];o.push(new Rt(e.To_Account,e.LastedMsgTime)),Ue(Ut.cookie,o,function(e){t&&(ce.info("c2CMsgReaded success"),t(e))},function(e){n&&(ce.error("c2CMsgReaded failed:"+e.ErrorInfo),n(e))})},this.addSession=function(t){e[t._impl.skey]=t},this.delSession=function(t){delete e[t._impl.skey]},this.clear=function(){e={},t=[],msgCache={},this.cookie="",this.syncFlag=0},this.addMsg=function(t,n){if(o(t))return!1;var i=t.sess;return e[i._impl.skey]||this.addSession(i),i._impl_addMsg(t,n),!0},this.updateTimeline=function(){var e=new Array;n(function(t){e.push(t)}),e.sort(function(e,t){return t.time-e.time}),t=e}},Lt=new function(){var e=null,t=null,n={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null,9:null,10:null,11:null,15:null,255:null,12:null},o={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null},i={1:null},r=null,s=!1,u=0,a=0,c=null,p=!1,f={},m=90,h=null,I={},E={92:null,96:null},M=null,_={},y={};this.setLongPollingOn=function(e){s=e},this.getLongPollingOn=function(){return s},this.resetLongPollingInfo=function(){s=!1,u=0,a=0},this.setBigGroupLongPollingOn=function(e){p=e},this.checkBigGroupLongPollingOn=function(e){return!!h[e]},this.setBigGroupLongPollingKey=function(e,t){h[e]=t},this.resetBigGroupLongPollingInfo=function(e){p=!1,f[e]=0,h[e]=null,I[e]={},delete f[e],delete h[e],delete I[e]},this.setBigGroupLongPollingMsgMap=function(e,t){var n=I[e];n?(n=parseInt(n)+t,I[e]=n):I[e]=t},this.clear=function(){t=null,n={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null,9:null,10:null,11:null,15:null,255:null,12:null},o={1:null,2:null,3:null,4:null,5:null,6:null,7:null,8:null},i={1:null},e=null,s=!1,u=0,a=0,c=null,p=!1,f={},h={},I={},y={},Y=[],X=null,j=null};var P=function(e,t){St(function(t){Y=t.IpList,X=t.AuthKey,j=t.ExpireTime,e&&e(t)},function(e){ce.error("initIpAndAuthkey failed:"+e.ErrorInfo),t&&t(e)})},U=function(e,t){var n={Member_Account:W.identifier,Limit:1e3,Offset:0,GroupBaseInfoFilter:["NextMsgSeq"]};ot(n,function(t){if(!t.GroupIdList||0==t.GroupIdList.length)return ce.info("initMyGroupMaxSeqs: 目前还没有加入任何群组"),void(e&&e(t));for(var n=0;n<t.GroupIdList.length;n++){var o=t.GroupIdList[n].GroupId,i=t.GroupIdList[n].NextMsgSeq-1;_[o]=i}e&&e(t)},function(e){ce.error("initMyGroupMaxSeqs failed:"+e.ErrorInfo),t&&t(e)})},K=function(e,t){var n=_[e];n?t>n&&(_[e]=t):_[e]=t},H=function(e,t){for(var n in e){var o=e[n];if(o.From_Account){var i=se(o,!1,!0);i&&t.push(i),K(o.ToGroupId,o.MsgSeq)}}return t},V=function(t,n){var o={},i=[];for(var r in n){var s=o[n[r].ToGroupId];s||(s=o[n[r].ToGroupId]={min:99999999,max:-1,msgs:[]}),n[r].NoticeSeq>a&&(ce.warn("noticeSeq="+a+",msgNoticeSeq="+n[r].NoticeSeq),a=n[r].NoticeSeq),n[r].Event=t,o[n[r].ToGroupId].msgs.push(n[r]),n[r].MsgSeq<s.min&&(o[n[r].ToGroupId].min=n[r].MsgSeq),n[r].MsgSeq>s.max&&(o[n[r].ToGroupId].max=n[r].MsgSeq)}for(var u in o)i=H(o[u].msgs,i);i.length&&Ut.updateTimeline(),e&&i.length&&e(i)},J=function(t,n){var o={},i=[];for(var r in n){var s=o[n[r].ToGroupId];s||(s=o[n[r].ToGroupId]={min:99999999,max:-1,msgs:[]}),n[r].NoticeSeq>a&&(ce.warn("noticeSeq="+a+",msgNoticeSeq="+n[r].NoticeSeq),a=n[r].NoticeSeq),n[r].Event=t,o[n[r].ToGroupId].msgs.push(n[r]),n[r].MsgSeq<s.min&&(o[n[r].ToGroupId].min=n[r].MsgSeq),n[r].MsgSeq>s.max&&(o[n[r].ToGroupId].max=n[r].MsgSeq)}for(var u in o)i=H(o[u].msgs,i);i.length&&Ut.updateTimeline(),e&&i.length&&e(i)},z=function(e,t){for(var o in e){var i=e[o],r=i.MsgBody,s=r.ReportType;0==t&&i.NoticeSeq&&i.NoticeSeq>a&&(a=i.NoticeSeq);i.GroupInfo.To_Account;if(t){var u=i.ToGroupId+"_"+s+"_"+r.Operator_Account+"_"+i.ClientSeq;if(y[u]){ce.warn("收到重复的群系统消息:key="+u);continue}y[u]=!0}var c={SrcFlag:0,ReportType:s,GroupId:i.ToGroupId,GroupName:i.GroupInfo.GroupName,Operator_Account:r.Operator_Account,MsgTime:i.MsgTimeStamp,groupReportTypeMsg:r,MsgSeq:i.ClientSeq,MsgRandom:i.MsgRandom,sourceGroupTip:i};switch(s){case F.JOIN_GROUP_REQUEST:c.RemarkInfo=r.RemarkInfo,c.MsgKey=r.MsgKey,c.Authentication=r.Authentication,c.UserDefinedField=i.UserDefinedField,c.From_Account=i.From_Account;break;case F.JOIN_GROUP_ACCEPT:case F.JOIN_GROUP_REFUSE:c.RemarkInfo=r.RemarkInfo;break;case F.KICK:case F.DESTORY:case F.CREATE:case F.INVITED_JOIN_GROUP_REQUEST:case F.INVITED_JOIN_GROUP_REQUEST_AGREE:case F.QUIT:case F.SET_ADMIN:case F.CANCEL_ADMIN:case F.REVOKE:case F.READED:break;case F.CUSTOM:c.UserDefinedField=r.UserDefinedField;break;default:ce.error("未知群系统消息类型:reportType="+s)}if(t)n[s]?n[s](c):ce.error("未知群系统消息类型:reportType="+s);else if(n[s])if(s==F.READED)for(var l=c.groupReportTypeMsg.GroupReadInfoArray,p=0,f=l.length;p<f;p++){var g=l[p];n[s](g)}else n[s](c)}},Q=function(e,t){var n,i,r;for(var s in e){switch(n=e[s],i=n.PushType,0==t&&n.NoticeSeq&&n.NoticeSeq>a&&(a=n.NoticeSeq),r={Type:i},i){case N.FRIEND_ADD:r.Accounts=n.FriendAdd_Account;break;case N.FRIEND_DELETE:r.Accounts=n.FriendDel_Account;break;case N.PENDENCY_ADD:r.PendencyList=n.PendencyAdd;break;case N.PENDENCY_DELETE:r.Accounts=n.FrienPencydDel_Account;break;case N.BLACK_LIST_ADD:r.Accounts=n.BlackListAdd_Account;break;case N.BLACK_LIST_DELETE:r.Accounts=n.BlackListDel_Account;break;default:ce.error("未知好友系统通知类型:friendNotice="+JSON.stringify(n))}t?i==N.PENDENCY_ADD&&o[i]&&o[i](r):o[i]&&o[i](r)}},Z=function(e,t){var n,o,r;for(var s in e){switch(n=e[s],o=n.PushType,0==t&&n.NoticeSeq&&n.NoticeSeq>a&&(a=n.NoticeSeq),r={Type:o},o){case R.PROFILE_MODIFY:r.Profile_Account=n.Profile_Account,r.ProfileList=n.ProfileList;break;default:ce.error("未知资料系统通知类型:profileNotice="+JSON.stringify(n))}t?o==R.PROFILE_MODIFY&&i[o]&&i[o](r):i[o]&&i[o](r)}},$=function(e){var t=e.MsgBody,o=t.ReportType,i=(e.GroupInfo.To_Account,{SrcFlag:1,ReportType:o,GroupId:e.ToGroupId,GroupName:e.GroupInfo.GroupName,Operator_Account:t.Operator_Account,MsgTime:e.MsgTimeStamp});switch(o){case F.JOIN_GROUP_REQUEST:i.RemarkInfo=t.RemarkInfo,i.MsgKey=t.MsgKey,i.Authentication=t.Authentication,i.UserDefinedField=e.UserDefinedField,i.From_Account=e.From_Account,i.MsgSeq=e.ClientSeq,i.MsgRandom=e.MsgRandom;break;case F.JOIN_GROUP_ACCEPT:case F.JOIN_GROUP_REFUSE:i.RemarkInfo=t.RemarkInfo;break;case F.KICK:case F.DESTORY:case F.CREATE:case F.INVITED_JOIN_GROUP_REQUEST:case F.INVITED_JOIN_GROUP_REQUEST_AGREE:case F.QUIT:case F.SET_ADMIN:case F.CANCEL_ADMIN:case F.REVOKE:break;case F.CUSTOM:i.MsgSeq=e.MsgSeq,i.UserDefinedField=t.UserDefinedField;break;default:ce.error("未知群系统消息类型:reportType="+o)}n[o]&&n[o](i)},ee=function(e){for(var t=0,n=e.length;t<n;t++)te(e[t])},te=function(e){var t=e.SubMsgType;switch(t){case A.READED:if(ce.warn("C2C已读消息通知"),e.ReadC2cMsgNotify&&e.ReadC2cMsgNotify.UinPairReadArray&&E[t])for(var n=0,o=e.ReadC2cMsgNotify.UinPairReadArray.length;n<o;n++){var i=e.ReadC2cMsgNotify.UinPairReadArray[n];E[t](i)}break;case A.KICKEDOUT:ce.warn("多终端互踢通知"),Fe("instance"),E[t]&&E[t]();break;default:ce.error("未知C2c系统消息:subType="+t)}};this.longPolling=function(e,t){function n(){Re(o,function(e){for(var t in e.EventArray){var n=e.EventArray[t];switch(n.Event){case T.C2C:u=n.NotifySeq,ce.warn("longpolling: received new c2c msg"),Lt.syncMsgs();break;case T.GROUP_COMMON:ce.warn("longpolling: received new group msgs"),J(n.Event,n.GroupMsgArray);break;case T.GROUP_TIP:case T.GROUP_TIP2:ce.warn("longpolling: received new group tips"),J(n.Event,n.GroupTips);break;case T.GROUP_SYSTEM:ce.warn("longpolling: received new group system msgs"),z(n.GroupTips,!1);break;case T.FRIEND_NOTICE:ce.warn("longpolling: received new friend system notice"),Q(n.FriendListMod,!1);break;case T.PROFILE_NOTICE:ce.warn("longpolling: received new profile system notice"),Z(n.ProfileDataMod,!1);break;case T.C2C_COMMON:a=n.C2cMsgArray[0].NoticeSeq,ce.warn("longpolling: received new c2c_common msg",a),V(n.Event,n.C2cMsgArray);break;case T.C2C_EVENT:a=n.C2cNotifyMsgArray[0].NoticeSeq,ce.warn("longpolling: received new c2c_event msg"),ee(n.C2cNotifyMsgArray);break;default:ce.error("longpolling收到未知新消息类型: Event="+n.Event)}}var o={ActionStatus:g.OK,ErrorCode:0};ne(o)},function(e){ne(e),t&&t(e)})}var o={Timeout:q/1e3,Cookie:{NotifySeq:u,NoticeSeq:a}};B?(o.Cookie.LongPollingId=B,n()):Ot(0,function(e){B=o.Cookie.LongPollingId=e.LongPollingId,q=e.Timeout>60?q:1e3*e.Timeout,n()})},this.bigGroupLongPolling=function(e,t,n){var o={USP:1,StartSeq:f[e],HoldTime:m,Key:h[e]};Pe(o,function(n){var o=[];if(f[e]=n.NextSeq,m=n.HoldTime,h[e]=n.Key,n.RspMsgList&&n.RspMsgList.length>0){for(var i,r,s,u=0,a=n.RspMsgList.length-1;a>=0;a--){i=n.RspMsgList[a];var l={F_Account:"From_Account",T_Account:"To_Account",FAType:"EnumFrom_AccountType",TAType:"EnumTo_AccountType",GCode:"GroupCode",GName:"GroupName",GId:"GroupId",MFlg:"MsgFlag",FAEInfo:"MsgFrom_AccountExtraInfo",Evt:"Event",GInfo:"GroupInfo",BPlc:"IsPlaceMsg",MBody:"MsgBody",Pri:"MsgPriority",Rdm:"MsgRandom",MSeq:"MsgSeq",TStp:"MsgTimeStamp",TGId:"ToGroupId",UEInfo:"UinExtInfo",UId:"UserId",BSys:"IsSystemMsg",FAHUrl:"From_AccountHeadurl",FANick:"From_AccountNick"};if(i=ae.replaceObject(l,i),!i.IsPlaceMsg&&i.From_Account&&i.MsgBody&&0!=i.MsgBody.length)switch(r=i.Event){case T.GROUP_COMMON:ce.info("bigGroupLongPolling: return new group msg"),s=se(i,!1,!1),s&&o.push(s),u+=1;break;case T.GROUP_TIP:case T.GROUP_TIP2:ce.info("bigGroupLongPolling: return new group tip"),s=se(i,!1,!1),s&&o.push(s);break;case T.GROUP_SYSTEM:ce.info("bigGroupLongPolling: new group system msg"),$(i);break;default:ce.error("bigGroupLongPolling收到未知新消息类型: Event="+r)}}u>0&&(Lt.setBigGroupLongPollingMsgMap(i.ToGroupId,u),ce.warn("current bigGroupLongPollingMsgMap: "+JSON.stringify(I)))}x=0;var d={ActionStatus:g.OK,ErrorCode:b.ON,ErrorInfo:"connection is ok..."};Ft.callBack(d),t?t(o):c&&c(o),p&&Lt.bigGroupLongPolling(e)},function(t){10018==t.ErrorCode?f[e]=0:60008!=t.ErrorCode&&(ce.error(t.ErrorInfo),x++),91101==t.ErrorCode&&(ce.error("多实例登录,被kick"),r&&r()),p&&Lt.bigGroupLongPolling(e),n&&n(t)},1e3*m)};var ne=function(e){if(0==e.ErrorCode||60008==e.ErrorCode){k=0,D=!1;var t,n=!1;switch(w){case b.INIT:n=!0,w=b.ON,t="create connection successfully(INIT->ON)";break;case b.ON:t="connection is on...(ON->ON)";break;case b.RECONNECT:w=b.ON,t="connection is on...(RECONNECT->ON)";break;case b.OFF:n=!0,w=b.RECONNECT,t="reconnect successfully(OFF->RECONNECT)"}var o={ActionStatus:g.OK,ErrorCode:w,ErrorInfo:t};n&&Ft.callBack(o),s&&Lt.longPolling()}else if(91101==e.ErrorCode)ce.error("多实例登录,被kick"),r&&r();else if(k++,ce.warn("longPolling接口第"+k+"次报错: "+e.ErrorInfo),k<=10)setTimeout(oe,100);else{w=b.OFF;var i={ActionStatus:g.FAIL,ErrorCode:b.OFF,ErrorInfo:"connection is off"};0==D&&Ft.callBack(i),D=!0,ce.warn("5000毫秒之后,SDK会发起新的longPolling请求..."),setTimeout(oe,5e3)}},V=function(t,n){var o=[],i=[];i=n;for(var r in i){var s,u,a=i[r],c=a.From_AccountHeadurl||"";a.From_Account==W.identifier?(s=!0,u=a.To_Account):(s=!1,u=a.From_Account);var p=Ut.sessByTypeId(l.C2C,u);p||(p=new Nt(l.C2C,u,u,c,0,0));var f=new bt(p,s,a.MsgSeq,a.MsgRandom,a.MsgTimeStamp,a.From_Account,C.COMMON,a.From_AccountNick,c),g=null,m=null,h=null;for(var I in a.MsgBody){switch(g=a.MsgBody[I],h=g.MsgType){case d.TEXT:m=new bt.Elem.Text(g.MsgContent.Text);break;case d.FACE:m=new bt.Elem.Face(g.MsgContent.Index,g.MsgContent.Data);break;case d.IMAGE:m=new bt.Elem.Images(g.MsgContent.UUID,g.MsgContent.ImageFormat||"");for(var E in g.MsgContent.ImageInfoArray){var M=g.MsgContent.ImageInfoArray[E];m.addImage(new bt.Elem.Images.Image(M.Type,M.Size,M.Width,M.Height,M.URL))}break;case d.SOUND:g.MsgContent?m=new bt.Elem.Sound(g.MsgContent.UUID,g.MsgContent.Second,g.MsgContent.Size,a.From_Account,a.To_Account,g.MsgContent.Download_Flag,l.C2C,g.MsgContent.Url||null):(h=d.TEXT,m=new bt.Elem.Text("[语音消息]下载地址解析出错"));break;case d.LOCATION:m=new bt.Elem.Location(g.MsgContent.Longitude,g.MsgContent.Latitude,g.MsgContent.Desc);break;case d.FILE:case d.FILE+" ":h=d.FILE,g.MsgContent?m=new bt.Elem.File(g.MsgContent.UUID,g.MsgContent.FileName,g.MsgContent.FileSize,a.From_Account,a.To_Account,g.MsgContent.Download_Flag,l.C2C,g.MsgContent.Url||null):(h=d.TEXT,m=new bt.Elem.Text("[文件消息下载地址解析出错]"));break;case d.CUSTOM:try{var _=JSON.parse(g.MsgContent.Data);if(_&&_.userAction&&_.userAction==L.ING)continue}catch(e){}h=d.CUSTOM,m=new bt.Elem.Custom(g.MsgContent.Data,g.MsgContent.Desc,g.MsgContent.Ext);break;default:h=d.TEXT,m=new bt.Elem.Text("web端暂不支持"+g.MsgType+"消息")}f.elems.push(new bt.Elem(h,m))}f.elems.length>0&&Ut.addMsg(f,!0)&&o.push(f)}o.length>0&&Ut.updateTimeline(),o.length>0&&e&&e(o)},oe=function(){s&&Lt.longPolling()},re=function(e){for(var t in e){var n=e[t];switch(z(n.GroupTips,!0),n.Event){case T.GROUP_SYSTEM:ce.warn("handlerApplyJoinGroupSystemMsgs: handler new group system msg"),z(n.GroupTips,!0);break;default:ce.error("syncMsgs收到未知的群系统消息类型: Event="+n.Event)}}};this.syncMsgs=function(t,n){var o=[],i=[];be(Ut.cookie,Ut.syncFlag,function(n){2==n.SyncFlag&&(Ut.syncFlag=0),i=n.MsgList,Ut.cookie=n.Cookie;for(var r in i){var s,u,a,c=i[r];c.From_Account==W.identifier?(s=!0,u=c.To_Account,a=""):(s=!1,u=c.From_Account,a="");var p=Ut.sessByTypeId(l.C2C,u);p||(p=new Nt(l.C2C,u,u,a,0,0));var f=new bt(p,s,c.MsgSeq,c.MsgRandom,c.MsgTimeStamp,c.From_Account,C.COMMON,c.From_AccountNick,c.From_AccountHeadurl),g=null,m=null,h=null;for(var I in c.MsgBody){switch(g=c.MsgBody[I],h=g.MsgType){case d.TEXT:m=new bt.Elem.Text(g.MsgContent.Text);break;case d.FACE:m=new bt.Elem.Face(g.MsgContent.Index,g.MsgContent.Data);break;case d.IMAGE:m=new bt.Elem.Images(g.MsgContent.UUID,g.MsgContent.ImageFormat);for(var E in g.MsgContent.ImageInfoArray){var M=g.MsgContent.ImageInfoArray[E];m.addImage(new bt.Elem.Images.Image(M.Type,M.Size,M.Width,M.Height,M.URL))}break;case d.SOUND:g.MsgContent?m=new bt.Elem.Sound(g.MsgContent.UUID,g.MsgContent.Second,g.MsgContent.Size,c.From_Account,c.To_Account,g.MsgContent.Download_Flag,l.C2C,g.MsgContent.Url||null):(h=d.TEXT,m=new bt.Elem.Text("[语音消息]下载地址解析出错"));break;case d.LOCATION:m=new bt.Elem.Location(g.MsgContent.Longitude,g.MsgContent.Latitude,g.MsgContent.Desc);break;case d.FILE:case d.FILE+" ":h=d.FILE,
g.MsgContent?m=new bt.Elem.File(g.MsgContent.UUID,g.MsgContent.FileName,g.MsgContent.FileSize,c.From_Account,c.To_Account,g.MsgContent.Download_Flag,l.C2C,g.MsgContent.Url?g.MsgContent.Url:null):(h=d.TEXT,m=new bt.Elem.Text("[文件消息下载地址解析出错]"));break;case d.CUSTOM:try{var _=JSON.parse(g.MsgContent.Data);if(_&&_.userAction&&_.userAction==L.ING)continue}catch(e){}h=d.CUSTOM,m=new bt.Elem.Custom(g.MsgContent.Data,g.MsgContent.Desc,g.MsgContent.Ext);break;default:h=d.TEXT,m=new bt.Elem.Text("web端暂不支持"+g.MsgType+"消息")}f.elems.push(new bt.Elem(h,m))}f.elems.length>0&&Ut.addMsg(f,!0)&&o.push(f)}re(n.EventArray),o.length>0&&Ut.updateTimeline(),t?t(o):o.length>0&&e&&e(o)},function(e){ce.error("getMsgs failed:"+e.ErrorInfo),n&&n(e)})},this.getC2CHistoryMsgs=function(e,t,n){if(!e.Peer_Account&&n)return void n(ae.getReturnError("Peer_Account is empty",-13));if(e.MaxCnt||(e.MaxCnt=15),e.MaxCnt<=0&&n)return void n(ae.getReturnError("MaxCnt should be greater than 0",-14));if(e.MaxCnt>15){if(n)return void n(ae.getReturnError("MaxCnt can not be greater than 15",-15))}else{null!=e.MsgKey&&void 0!==e.MsgKey||(e.MsgKey="");var o={Peer_Account:e.Peer_Account,MaxCnt:e.MaxCnt,LastMsgTime:e.LastMsgTime,MsgKey:e.MsgKey};we(o,function(n){var o=[],i=[];i=n.MsgList;var r=Ut.sessByTypeId(l.C2C,e.Peer_Account);r||(r=new Nt(l.C2C,e.Peer_Account,e.Peer_Account,"",0,0));for(var s in i){var u,a=i[s],c=a.From_AccountHeadurl||"";a.From_Account==W.identifier?(u=!0,a.To_Account):(u=!1,a.From_Account);var p=new bt(r,u,a.MsgSeq,a.MsgRandom,a.MsgTimeStamp,a.From_Account,C.COMMON,a.From_AccountNick,c),f=null,g=null,m=null;for(var h in a.MsgBody){switch(f=a.MsgBody[h],m=f.MsgType){case d.TEXT:g=new bt.Elem.Text(f.MsgContent.Text);break;case d.FACE:g=new bt.Elem.Face(f.MsgContent.Index,f.MsgContent.Data);break;case d.IMAGE:g=new bt.Elem.Images(f.MsgContent.UUID,f.MsgContent.ImageFormat);for(var I in f.MsgContent.ImageInfoArray){var E=f.MsgContent.ImageInfoArray[I];g.addImage(new bt.Elem.Images.Image(E.Type,E.Size,E.Width,E.Height,E.URL))}break;case d.SOUND:f.MsgContent?g=new bt.Elem.Sound(f.MsgContent.UUID,f.MsgContent.Second,f.MsgContent.Size,a.From_Account,a.To_Account,f.MsgContent.Download_Flag,l.C2C,f.MsgContent.Url||null):(m=d.TEXT,g=new bt.Elem.Text("[语音消息]下载地址解析出错"));break;case d.LOCATION:g=new bt.Elem.Location(f.MsgContent.Longitude,f.MsgContent.Latitude,f.MsgContent.Desc);break;case d.FILE:case d.FILE+" ":m=d.FILE,f.MsgContent?g=new bt.Elem.File(f.MsgContent.UUID,f.MsgContent.FileName,f.MsgContent.FileSize,a.From_Account,a.To_Account,f.MsgContent.Download_Flag,l.C2C,f.MsgContent.Url||null):(m=d.TEXT,g=new bt.Elem.Text("[文件消息下载地址解析出错]"));break;case d.CUSTOM:m=d.CUSTOM,g=new bt.Elem.Custom(f.MsgContent.Data,f.MsgContent.Desc,f.MsgContent.Ext);break;default:m=d.TEXT,g=new bt.Elem.Text("web端暂不支持"+f.MsgType+"消息")}p.elems.push(new bt.Elem(m,g))}Ut.addMsg(p),o.push(p)}if(Ut.updateTimeline(),t){var M={Complete:n.Complete,MsgCount:o.length,LastMsgTime:n.LastMsgTime,MsgKey:n.MsgKey,MsgList:o};r.isFinished(n.Complete),t(M)}},function(e){ce.error("getC2CHistoryMsgs failed:"+e.ErrorInfo),n&&n(e)})}},this.syncGroupMsgs=function(t,n,o){if(t.ReqMsgSeq<=0){if(o){var i=ae.getReturnError("ReqMsgSeq must be greater than 0",-16);o(i)}}else{var r={GroupId:t.GroupId,ReqMsgSeq:t.ReqMsgSeq,ReqMsgNumber:t.ReqMsgNumber};ut(r,function(t){var o=[],i=(t.GroupId,t.RspMsgList),r=t.IsFinished;if(null==i||void 0===i)return void(n&&n([]));for(var s=i.length-1;s>=0;s--){var u=i[s];if(!u.IsPlaceMsg&&u.From_Account&&u.MsgBody&&0!=u.MsgBody.length){var a=se(u,!0,!0,r);a&&o.push(a)}}o.length>0&&Ut.updateTimeline(),n?n(o):o.length>0&&e&&e(o)},function(e){ce.error("getGroupMsgs failed:"+e.ErrorInfo),o&&o(e)})}};var se=function(e,n,o,i){if(e.IsPlaceMsg||!e.From_Account||!e.MsgBody||0==e.MsgBody.length)return null;var r,s,u,a,c=e.ToGroupId,p=c;e.GroupInfo&&e.GroupInfo.GroupName&&(p=e.GroupInfo.GroupName),u=e.From_Account,e.GroupInfo&&(e.GroupInfo.From_AccountNick&&(u=e.GroupInfo.From_AccountNick),a=e.GroupInfo.From_AccountHeadurl?e.GroupInfo.From_AccountHeadurl:null),e.From_Account==W.identifier?(r=!0,e.From_Account,s=""):(r=!1,e.From_Account,s="");var f=Ut.sessByTypeId(l.GROUP,c);f||(f=new Nt(l.GROUP,c,p,s,0,0)),void 0!==i&&f.isFinished(i||0);var g=S.COMMON;if(T.GROUP_TIP==e.Event||T.GROUP_TIP2==e.Event){g=S.TIP;var m=e.MsgBody;e.MsgBody=[],e.MsgBody.push({MsgType:d.GROUP_TIP,MsgContent:m})}else e.MsgPriority&&(e.MsgPriority==v.REDPACKET?g=S.REDPACKET:e.MsgPriority==v.LOVEMSG&&(g=S.LOVEMSG));var h=new bt(f,r,e.MsgSeq,e.MsgRandom,e.MsgTimeStamp,e.From_Account,g,u,a),I=null,E=null,M=null;for(var _ in e.MsgBody){switch(I=e.MsgBody[_],M=I.MsgType){case d.TEXT:E=new bt.Elem.Text(I.MsgContent.Text);break;case d.FACE:E=new bt.Elem.Face(I.MsgContent.Index,I.MsgContent.Data);break;case d.IMAGE:E=new bt.Elem.Images(I.MsgContent.UUID,I.MsgContent.ImageFormat||"");for(var y in I.MsgContent.ImageInfoArray)E.addImage(new bt.Elem.Images.Image(I.MsgContent.ImageInfoArray[y].Type,I.MsgContent.ImageInfoArray[y].Size,I.MsgContent.ImageInfoArray[y].Width,I.MsgContent.ImageInfoArray[y].Height,I.MsgContent.ImageInfoArray[y].URL));break;case d.SOUND:I.MsgContent?E=new bt.Elem.Sound(I.MsgContent.UUID,I.MsgContent.Second,I.MsgContent.Size,e.From_Account,e.To_Account,I.MsgContent.Download_Flag,l.GROUP,I.MsgContent.Url||null):(M=d.TEXT,E=new bt.Elem.Text("[语音消息]下载地址解析出错"));break;case d.LOCATION:E=new bt.Elem.Location(I.MsgContent.Longitude,I.MsgContent.Latitude,I.MsgContent.Desc);break;case d.FILE:case d.FILE+" ":M=d.FILE;ye(I.MsgContent.UUID,e.From_Account,I.MsgContent.FileName);I.MsgContent?E=new bt.Elem.File(I.MsgContent.UUID,I.MsgContent.FileName,I.MsgContent.FileSize,e.From_Account,e.To_Account,I.MsgContent.Download_Flag,l.GROUP,I.MsgContent.Url||null):(M=d.TEXT,E=new bt.Elem.Text("[文件消息]地址解析出错"));break;case d.GROUP_TIP:var C=I.MsgContent.OpType;if(E=new bt.Elem.GroupTip(C,I.MsgContent.Operator_Account,c,e.GroupInfo.GroupName,I.MsgContent.List_Account,I.MsgContent.MsgMemberExtraInfo),O.JOIN==C||O.QUIT==C)E.setGroupMemberNum(I.MsgContent.MemberNum);else if(O.MODIFY_GROUP_INFO==C){var A=!1,F={GroupId:c,GroupFaceUrl:null,GroupName:null,OwnerAccount:null,GroupNotification:null,GroupIntroduction:null},N=I.MsgContent.MsgGroupNewInfo;if(N.GroupFaceUrl){var R=new bt.Elem.GroupTip.GroupInfo(G.FACE_URL,N.GroupFaceUrl);E.addGroupInfo(R),A=!0,F.GroupFaceUrl=N.GroupFaceUrl}if(N.GroupName){var P=new bt.Elem.GroupTip.GroupInfo(G.NAME,N.GroupName);E.addGroupInfo(P),A=!0,F.GroupName=N.GroupName}if(N.Owner_Account){var b=new bt.Elem.GroupTip.GroupInfo(G.OWNER,N.Owner_Account);E.addGroupInfo(b),A=!0,F.OwnerAccount=N.Owner_Account}if(N.GroupNotification){var U=new bt.Elem.GroupTip.GroupInfo(G.NOTIFICATION,N.GroupNotification);E.addGroupInfo(U),A=!0,F.GroupNotification=N.GroupNotification}if(N.GroupIntroduction){var L=new bt.Elem.GroupTip.GroupInfo(G.INTRODUCTION,N.GroupIntroduction);E.addGroupInfo(L),A=!0,F.GroupIntroduction=N.GroupIntroduction}0==n&&A&&t&&t(F)}else if(O.MODIFY_MEMBER_INFO==C){var w=I.MsgContent.MsgMemberInfo;for(var D in w){var k=w[D];E.addMemberInfo(new bt.Elem.GroupTip.MemberInfo(k.User_Account,k.ShutupTime))}}break;case d.CUSTOM:M=d.CUSTOM,E=new bt.Elem.Custom(I.MsgContent.Data,I.MsgContent.Desc,I.MsgContent.Ext);break;default:M=d.TEXT,E=new bt.Elem.Text("web端暂不支持"+I.MsgType+"消息")}h.elems.push(new bt.Elem(M,E))}return 0==o?h:Ut.addMsg(h,!0)?(h.extraInfo=e.GroupInfo.MsgFrom_AccountExtraInfo,h):null};this.init=function(u,a,l){if(u.onMsgNotify||ce.warn("listeners.onMsgNotify is empty"),e=u.onMsgNotify,u.onBigGroupMsgNotify?c=u.onBigGroupMsgNotify:ce.warn("listeners.onBigGroupMsgNotify is empty"),u.onC2cEventNotifys?E=u.onC2cEventNotifys:ce.warn("listeners.onC2cEventNotifys is empty"),u.onGroupSystemNotifys?n=u.onGroupSystemNotifys:ce.warn("listeners.onGroupSystemNotifys is empty"),u.onGroupInfoChangeNotify?t=u.onGroupInfoChangeNotify:ce.warn("listeners.onGroupInfoChangeNotify is empty"),u.onFriendSystemNotifys?o=u.onFriendSystemNotifys:ce.warn("listeners.onFriendSystemNotifys is empty"),u.onProfileSystemNotifys?i=u.onProfileSystemNotifys:ce.warn("listeners.onProfileSystemNotifys is empty"),u.onKickedEventCall?r=u.onKickedEventCall:ce.warn("listeners.onKickedEventCall is empty"),u.onLongPullingNotify?ie=u.onLongPullingNotify:ce.warn("listeners.onKickedEventCall is empty"),u.onAppliedDownloadUrl?M=u.onAppliedDownloadUrl:ce.warn("listeners.onAppliedDownloadUrl is empty"),W.identifier&&W.userSig)U(function(e){ce.info("initMyGroupMaxSeqs success"),P(function(e){if(ce.info("initIpAndAuthkey success"),a){ce.info("login success(have login state))");var t={ActionStatus:g.OK,ErrorCode:0,ErrorInfo:"login success"};a(t)}Lt.setLongPollingOn(!0),s&&Lt.longPolling(a)},l)},l);else if(a){var p={ActionStatus:g.OK,ErrorCode:0,ErrorInfo:"login success(no login state)"};a(p)}},this.sendMsg=function(e,t,n){Ne(e,function(n){e.sess.type()==l.C2C&&(Ut.addMsg(e),Ut.updateTimeline()),t&&t(n)},function(e){n&&n(e)})}},wt=new function(){this.fileMd5=null;var e=function(e,t,n){function o(){var t=a*s,n=t+s>=e.size?e.size:t+s,o=r.call(e,t,n);i.readAsArrayBuffer(o)}var i=null;try{i=new FileReader}catch(e){if(n)return void n(ae.getReturnError("当前浏览器不支持FileReader",-18))}var r=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice;if(!r&&n)return void n(ae.getReturnError("当前浏览器不支持FileAPI",-19));var s=2097152,u=Math.ceil(e.size/s),a=0,c=new SparkMD5;i.onload=function(e){for(var n="",i=new Uint8Array(e.target.result),r=i.byteLength,s=0;s<r;s++)n+=String.fromCharCode(i[s]);c.appendBinary(n),a++,a<u?o():(this.fileMd5=c.end(),t&&t(this.fileMd5))},o()};this.submitUploadFileForm=function(e,t,n){function o(e,t){var n=document.createElement("input");n.type="hidden",n.name=e,n.value=t,d.appendChild(n)}function i(){var e;try{e=JSON.parse(h.contentWindow.name)||{}}catch(t){e={}}e.ActionStatus?(h.src="about:blank",h.parentNode.removeChild(h),h=null,e.ActionStatus==g.OK?t&&t(e):n&&n(e)):setTimeout(i,100)}var r,s,u=e.formId,a=e.fileId,c=z++,l="uploadResultIframe_"+c,p=e.To_Account,f=e.businessType,d=document.getElementById(u);if(!d)return r="获取表单对象为空: formId="+u+"(formId非法)",s=ae.getReturnError(r,-20),void(n&&n(s));var m=document.getElementById(a);if(!m)return r="获取文件对象为空: fileId="+a+"(没有选择文件或者fileId非法)",s=ae.getReturnError(r,-21),void(n&&n(s));m.name="file";var h=document.createElement("iframe");h.name=l,h.id=l,h.style.display="none",document.body.appendChild(h);var E;E=Ee()?"pic_up":"pic_up_test";var M="https://pic.tim.qq.com/v4/openpic/"+E+"?tinyid="+W.tinyid+"&a2="+W.a2+"&sdkappid="+W.sdkAppID+"&accounttype="+W.accountType+"&contenttype=http";d.action=M,d.method="post",d.target=l,o("App_Version",y.APP_VERSION),o("From_Account",W.identifier),o("To_Account",p),o("Seq",pe().toString()),o("Timestamp",le().toString()),o("Random",fe().toString()),o("Busi_Id",f),o("PkgFlag",I.RAW_DATA.toString()),o("Auth_Key",X),o("Server_Ver",y.SERVER_VERSION.toString()),o("File_Type",e.fileType),setTimeout(i,500),d.submit()},this.uploadFile=function(t,n,o){var i={init:function(e,t,n){var o=this;o.file=e.file,o.onProgressCallBack=e.onProgressCallBack,e.abortButton&&(e.abortButton.onclick=o.abortHandler),o.total=o.file.size,o.loaded=0,o.step=1105920,o.sliceSize=0,o.sliceOffset=0,o.timestamp=le(),o.seq=pe(),o.random=fe(),o.fromAccount=W.identifier,o.toAccount=e.To_Account,o.fileMd5=e.fileMd5,o.businessType=e.businessType,o.fileType=e.fileType,o.cbOk=t,o.cbErr=n,o.reader=new FileReader,o.blobSlice=File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice,o.reader.onloadstart=o.onLoadStart,o.reader.onprogress=o.onProgress,o.reader.onabort=o.onAbort,o.reader.onerror=o.onerror,o.reader.onload=o.onLoad,o.reader.onloadend=o.onLoadEnd},upload:function(){i.readBlob(0)},onLoadStart:function(){},onProgress:function(e){var t=i;t.loaded+=e.loaded,t.onProgressCallBack&&t.onProgressCallBack(t.loaded,t.total)},onAbort:function(){},onError:function(){},onLoad:function(e){var t=i;if(e.target.readyState==FileReader.DONE){var n=e.target.result,o=n.indexOf(",");-1!=o&&(n=n.substr(o+1));var r={From_Account:t.fromAccount,To_Account:t.toAccount,Busi_Id:t.businessType,File_Type:t.fileType,File_Str_Md5:t.fileMd5,PkgFlag:I.BASE64_DATA,File_Size:t.total,Slice_Offset:t.sliceOffset,Slice_Size:t.sliceSize,Slice_Data:n,Seq:t.seq,Timestamp:t.timestamp,Random:t.random},s=function(e){if(0==e.IsFinish)t.loaded=e.Next_Offset,t.loaded<t.total?t.readBlob(t.loaded):t.loaded=t.total;else if(t.cbOk){var n={ActionStatus:e.ActionStatus,ErrorCode:e.ErrorCode,ErrorInfo:e.ErrorInfo,File_UUID:e.File_UUID,File_Size:e.Next_Offset,URL_INFO:e.URL_INFO,Download_Flag:e.Download_Flag};t.fileType==_.FILE&&(n.URL_INFO=ye(e.File_UUID,W.identifier,t.file.name)),t.cbOk(n)}K=0},u=function(e){K<20?(K++,setTimeout(function(){At(r,s,u)},1e3)):t.cbErr(e)};At(r,s,u)}},onLoadEnd:function(){},readBlob:function(e){var t,n=i,o=n.file,r=e+n.step;r>n.total?(r=n.total,n.sliceSize=r-e):n.sliceSize=n.step,n.sliceOffset=e,t=n.blobSlice.call(o,e,r),n.reader.readAsDataURL(t)},abortHandler:function(){var e=i;e.reader&&e.reader.abort()}};e(t.file,function(e){ce.info("fileMd5: "+e),t.fileMd5=e,i.init(t,n,o),i.upload()},o)}};e.SESSION_TYPE=l,e.MSG_MAX_LENGTH=f,e.C2C_MSG_SUB_TYPE=C,e.GROUP_MSG_SUB_TYPE=S,e.MSG_ELEMENT_TYPE=d,e.GROUP_TIP_TYPE=O,e.IMAGE_TYPE=m,e.GROUP_SYSTEM_TYPE=F,e.FRIEND_NOTICE_TYPE=N,e.GROUP_TIP_MODIFY_GROUP_INFO_TYPE=G,e.BROWSER_INFO=r,e.Emotions=e.EmotionPicData=ue,e.EmotionDataIndexs=e.EmotionPicDataIndex=se,e.TLS_ERROR_CODE=P,e.CONNECTION_STATUS=b,e.UPLOAD_PIC_BUSSINESS_TYPE=U,e.RECENT_CONTACT_TYPE=p,e.UPLOAD_RES_TYPE=_,e.Tool=ae,e.Log=ce,e.Msg=bt,e.Session=Nt,e.MsgStore={sessMap:function(){return Ut.sessMap()},sessCount:function(){return Ut.sessCount()},sessByTypeId:function(e,t){return Ut.sessByTypeId(e,t)},delSessByTypeId:function(e,t){return Ut.delSessByTypeId(e,t)},resetCookieAndSyncFlag:function(){return Ut.resetCookieAndSyncFlag()}},e.Resources=re,e.login=e.init=function(e,t,n,o,i){Ft.init(t.onConnNotify,o,i),t.jsonpCallback&&(J=t.jsonpCallback),Se(e,t,n,o,i)},e.logout=e.offline=function(e,t){return Fe("instance",e,t)},e.logoutAll=function(e,t){return Fe("all",e,t)},e.sendMsg=function(e,t,n){return Lt.sendMsg(e,t,n)},e.syncMsgs=function(e,t){return Lt.syncMsgs(e,t)},e.getC2CHistoryMsgs=function(e,t,n){return Lt.getC2CHistoryMsgs(e,t,n)},e.syncGroupMsgs=function(e,t,n){return Lt.syncGroupMsgs(e,t,n)},e.c2CMsgReaded=function(e,t,n){return Ut.c2CMsgReaded(e,t,n)},e.groupMsgReaded=function(e,t,n){return at(e,t,n)},e.setAutoRead=function(e,t,n){return Ut.setAutoRead(e,t,n)},e.createGroup=function(e,t,n){return De(e,t,n)},e.createGroupHigh=function(e,t,n){return ke(e,t,n)},e.applyJoinGroup=function(e,t,n){return Be(e,t,n)},e.handleApplyJoinGroupPendency=function(e,t,n){return Ke(e,t,n)},e.getPendencyGroup=function(e,t,n){return He(e,t,n)},e.getPendencyGroupRead=function(e,t,n){return Ve(e,t,n)},e.handleInviteJoinGroupRequest=function(e,t,n){return Je(e,t,n)},e.deleteApplyJoinGroupPendency=function(e,t,n){return Le(e,t,n)},e.deleteGroupSystemMsgs=function(e,t,n){return e.DelMsgList.forEach(function(e){e.From_Account="@TIM#SYSTEM"}),Le(e,t,n)},e.quitGroup=function(e,t,n){return ze(e,t,n)},e.searchGroupByName=function(e,t,n){return Xe(e,t,n)},e.getGroupPublicInfo=function(e,t,n){return je(e,t,n)},e.getGroupInfo=function(e,t,n){return We(e,t,n)},e.modifyGroupBaseInfo=function(e,t,n){return qe(e,t,n)},e.getGroupMemberInfo=function(e,t,n){return Qe(e,t,n)},e.addGroupMember=function(e,t,n){return Ze(e,t,n)},e.modifyGroupMember=function(e,t,n){return $e(e,t,n)},e.deleteGroupMember=function(e,t,n){return et(e,t,n)},e.destroyGroup=function(e,t,n){return tt(e,t,n)},e.changeGroupOwner=function(e,t,n){return nt(e,t,n)},e.getJoinedGroupListHigh=function(e,t,n){return ot(e,t,n)},e.getRoleInGroup=function(e,t,n){return it(e,t,n)},e.forbidSendMsg=function(e,t,n){return rt(e,t,n)},e.sendCustomGroupNotify=function(e,t,n){return st(e,t,n)},e.applyJoinBigGroup=function(e,t,n){return xe(e,t,n)},e.quitBigGroup=function(e,t,n){return Ye(e,t,n)},e.getProfilePortrait=function(e,t,n){return Et(e,t,n)},e.setProfilePortrait=function(e,t,n){return Mt(e,t,n)},e.applyAddFriend=function(e,t,n){return lt(e,t,n)},e.getPendency=function(e,t,n){return gt(e,t,n)},e.getPendencyReport=function(e,t,n){return dt(e,t,n)},e.deletePendency=function(e,t,n){return mt(e,t,n)},e.responseFriend=function(e,t,n){return ht(e,t,n)},e.getAllFriend=function(e,t,n){return It(e,t,n)},e.deleteChat=function(e,t,n){return ft(e,t,n)},e.deleteFriend=function(e,t,n){return pt(e,t,n)},e.addBlackList=function(e,t,n){return _t(e,t,n)},e.deleteBlackList=function(e,t,n){return yt(e,t,n)},e.getBlackList=function(e,t,n){return Tt(e,t,n)},e.getRecentContactList=function(e,t,n){return Ct(e,t,n)},e.uploadFile=e.uploadPic=function(e,t,n){return wt.uploadFile(e,t,n)},e.submitUploadFileForm=function(e,t,n){return wt.submitUploadFileForm(e,t,n)},e.uploadFileByBase64=e.uploadPicByBase64=function(e,t,n){var o={To_Account:e.toAccount,Busi_Id:e.businessType,File_Type:e.File_Type,File_Str_Md5:e.fileMd5,PkgFlag:I.BASE64_DATA,File_Size:e.totalSize,Slice_Offset:0,Slice_Size:e.totalSize,Slice_Data:e.base64Str,Seq:pe(),Timestamp:le(),Random:fe()};return At(o,t,n)},e.setJsonpLastRspData=function(e){V="string"==typeof e?JSON.parse(e):e},e.getLongPollingId=function(e,t,n){return Ot(0,t,n)},e.applyDownload=function(e,t,n){return Gt(e,t,n)},e.onDownFile=function(e){window.open(re.downloadMap["uuid_"+e])},e.checkLogin=function(e,t){return Ie(e,t)}}(webim);