text: function adjustScrollbars(){var a=document.getElementById("Messages");a&&(a.style.height=document.documentElement.clientHeight-parseFloat(getComputedStyle(document.querySelector(".inputBox")).height)-parseFloat(getComputedStyle(document.querySelector(".box_hd")).height)+"px",a.scrollTop=a.scrollHeight)}function cancelScollStyle(){var a=["body","#functionBox","#chatArea","#Messages",".main",".chatArea",".communicateList",".arobase"];a.length}var account=angular.module("webim.account",["webim.main.server"]);account.controller("signinController",["$scope","$state","mainServer","mainDataServer","conversationServer","RongIMSDKServer",function(a,b,c,d,e,f){if(a.user={accountNumber:"",passWord:""},a.userorpwdIsError=!1,a.$watch("user.passWord",function(b,c){b!=c&&(a.userorpwdIsError=!1)}),e.historyMessagesCache={},d.conversation.conversations=[],RongIMLib.RongIMClient&&RongIMLib.RongIMClient.getInstance)try{f.logout()}catch(g){}a.signin=function(){a.formSignin.submitted=!0,webimutil.CookieHelper.removeCookie("loginuserid"),d.loginUser=new webimmodel.UserInfo;var c=localStorage.getItem("rc_id"),e=localStorage.getItem("rc_token");console.log("11",c),console.log("22",e),d.loginUser.id=c,d.loginUser.token=e;var f=new Date;f.setDate(f.getDate()+30),webimutil.CookieHelper.setCookie("loginuserid",c,f.toGMTString()),webimutil.CookieHelper.setCookie("loginusertoken",e,f.toGMTString()),b.go("main")}}]),account.controller("signupController",["$scope","$interval","$state","mainServer",function(a,b,c,d){a.user={nickname:"",phone:"",code:"",passWord:""},a.$watch("user.code",function(){a.codeIsError=!1}),a.signup=function(){a.formSignup.submitted=!0,a.formSignup.$valid&&d.user.verifyCode(a.user.phone,"86",a.user.code).success(function(b){200==b.code&&b.result.verification_token?d.user.signup(a.user.nickname,a.user.passWord,b.result.verification_token).success(function(a){webimutil.Helper.alertMessage.success("注册成功",2),c.go("account.signin")}).error(function(a){webimutil.Helper.alertMessage.error("注册失败",2)}):a.codeIsError=!0}).error(function(b,c){403==c?webimutil.Helper.alertMessage.error("手机号已被注册过",2):a.codeIsError=!0})}}]),account.controller("forgotpasswordController",["$scope","$state","mainServer",function(a,b,c){a.user={phone:"",code:""},a.codeIsError=!1,a.$watch("user.code",function(){a.codeIsError=!1}),a.nextfun=function(){a.formFogot.submitted=!0,a.formFogot.$valid&&c.user.verifyCode(a.user.phone,"86",a.user.code).success(function(c){200==c.code&&c.result.verification_token?b.go("account.resetpassword",{token:c.result.verification_token}):a.codeIsError=!0}).error(function(a){})}}]),account.controller("resetpasswordController",["$scope","$state","$stateParams","mainServer",function(a,b,c,d){var e=c.token;a.user={newpassword:"",repassword:""},a.submit=function(){a.formResetPwd.submitted=!0,a.formResetPwd.$valid&&d.user.resetPassword(a.user.newpassword,e).success(function(a){200==a.code?(b.go("account.signin"),webimutil.Helper.alertMessage.success("重置成功",2)):webimutil.Helper.alertMessage.error("重置失败",2)}).error(function(a,b){400==b?webimutil.Helper.alertMessage.error("重置失败",2):404==b&&webimutil.Helper.alertMessage.error("重置失败",2)})}}]),account.directive("usernameAvailable",["$http","$q","mainServer",function(a,b,c){return{require:"ngModel",link:function(a,d,e,f){if(f)var g=/^[a-z0-9A-Z_]{4,64}$/;var h=function(a){var b=f.$isEmpty(a)||g.test(a);return f.$setValidity("userformat",b),b?a:void 0};f.$formatters.push(h),f.$parsers.push(h),f.$asyncValidators.uniqueUsername=function(a,d){var e=a||d;return c.user.checkUsernameAvailable(e).then(function(a){return!(!a.data||!a.data.result)||b.reject(a.data)},function(){})}}}}]),account.directive("phoneAvailable",["$http","$q","mainServer",function(a,b,c){return{require:"ngModel",link:function(a,d,e,f){if(f)var g=/^1[3-9][0-9]{9,9}$/;var h=function(a){var b=f.$isEmpty(a)||g.test(a);return f.$setValidity("phoneformat",b),b?a:void 0};f.$formatters.push(h),f.$parsers.push(h),f.$asyncValidators.uniquephone=function(a,d){var e=a||d;return c.user.checkPhoneAvailable(e,"86").then(function(a){return!(!a.data||!a.data.result)||b.reject(a.data)},function(){})}}}}]),account.directive("phoneRegistered",["$http","$q","mainServer",function(a,b,c){return{require:"ngModel",link:function(a,d,e,f){if(f)var g=/^1[3-9][0-9]{9,9}$/;var h=function(a){var b=f.$isEmpty(a)||g.test(a);return f.$setValidity("phoneformat",b),b?a:void 0};f.$formatters.push(h),f.$parsers.push(h),f.$asyncValidators.uniquephone=function(a,d){var e=a||d;return c.user.checkPhoneAvailable(e,"86").then(function(a){return!a.data||!a.data.result||b.reject(a.data)},function(){})}}}}]),account.directive("sendCodeButton",["$interval","mainServer",function(a,b){return{restrict:"E",scope:{phone:"=",region:"=",available:"=",startTime:"@timespan",loading:"="},template:'<span class="sendCode" ng-show="codeTime==0"  ng-click="sendCode()"><a href="javascript:void 0">发送验证码</a></span><span class="sec" ng-show="codeTime>0">{{codeTime}} s</span>',link:function(c,d,e){c.codeTime=0,c.startTime=c.startTime||60,c.region=c.region||"86",c.sendCode=function(){0==c.codeTime&&c.available&&b.user.sendCode(c.phone,"86").success(function(b){200==b.code?(c.loading=!0,c.codeTime=c.startTime,c.interval=a(function(){c.codeTime>0?c.codeTime=c.codeTime-1:(c.loading=!1,a.cancel(c.interval))},1e3)):5e3==b.code&&webimutil.Helper.alertMessage.error("发送频率过快，请稍后再发",2)}).error(function(a,b){400==b&&webimutil.Helper.alertMessage.error("无效手机号",2)})}}}}]);var conversationCtr=angular.module("webim.conversation.controller",["webim.main.server","webim.conversation.server"]),IMGDOMAIN="http://7xogjk.com1.z0.glb.clouddn.com/",FILEDOMAIN="http://o83059m7d.bkt.clouddn.com/",UPLOADDOMAIN="//upload.qiniu.com",UPLOADDOMAIN_BASE64="//upload.qiniu.com/putb64/-1";conversationCtr.controller("conversationController",["$scope","$state","mainDataServer","conversationServer","mainServer","RongIMSDKServer","$http","$timeout","$location","$anchorScroll",function(a,b,c,d,e,f,g,h,i,j){function k(){w==webimmodel.conversationType.Group&&f.sendReceiptResponse(w,v).then(function(){},function(a){console.log("sendReadReceiptResponseMessage error",a.errorCode)})}function l(){if(w==webimmodel.conversationType.Private){var a=c.contactsList.getFriendById(v);a||c.loginUser.id;a&&e.friend.getProfile(v).success(function(a){var b=new webimmodel.Friend({id:a.result.user.id,name:a.result.user.nickname,imgSrc:a.result.user.portraitUri});b.displayName=a.result.displayName,b.mobile=a.result.user.phone,b=c.contactsList.updateOrAddFriend(b),c.conversation.updateConversationDetail(w,v,a.result.displayName||a.result.user.nickname,a.result.user.portraitUri),d.updateHistoryMessagesCache(v,w,a.result.displayName||a.result.user.nickname,a.result.user.portraitUri)})}}function m(b){var c=d.historyMessagesCache[b.conversationType+"_"+b.targetId]=d.historyMessagesCache[b.conversationType+"_"+b.targetId]||[];0==c.length&&(c.push(new webimmodel.GetHistoryPanel),b.sentTime.toLocaleDateString()!=(new Date).toLocaleDateString()&&c.push(new webimmodel.TimePanl(b.sentTime))),d.addHistoryMessages(b.targetId,b.conversationType,b),b.messageType==webimmodel.MessageType.ImageMessage?setTimeout(function(){a.$broadcast("msglistchange")},200):a.$broadcast("msglistchange")}function n(a,b){var d=new RongIMLib.Message;return d.content=a,d.conversationType=w,d.targetId=v,d.sentTime=(new Date).getTime()-RongIMLib.RongIMClient.getInstance().getDeltaTime(),d.messageDirection=RongIMLib.MessageDirection.SEND,d.messageType=b,d.senderUserId=c.loginUser.id,d.messageId=(RongIMLib.MessageIdHandler.messageId+1).toString(),d}function o(b){var c=d.historyMessagesCache[b.conversationType+"_"+b.targetId]=d.historyMessagesCache[b.conversationType+"_"+b.targetId]||[];0==c.length&&(c.push(new webimmodel.GetHistoryPanel),b.sentTime.toLocaleDateString()!=(new Date).toLocaleDateString()&&c.push(new webimmodel.TimePanl(b.sentTime))),d.addHistoryMessages(b.targetId,b.conversationType,b),b.messageType==webimmodel.MessageType.ImageMessage?setTimeout(function(){a.$broadcast("msglistchange")},200):a.$broadcast("msglistchange")}function p(a,b,c){for(var d={exist:!1,id:"0",name:"",everychar:""},e=0;e<b.length;e++)if(b[e].name==a){d.exist=!0,d.id=b[e].id,d.name=b[e].name,d.everychar=b[e].everychar,c&&b.splice(e,1);break}return d}function q(a){var b=a.split("@"),c=[];if(b.length>1)for(var d=1;d<b.length;d++){var e=b[d];e.indexOf(" ")>-1&&(e=e.slice(0,e.indexOf(" ")));var f=p(e,B,!1);f.exist&&-1===c.indexOf(f.id)&&c.push(f.id)}return c}function r(a){var b=document.getElementsByClassName("load-container")[0];b.style.visibility=a?"visible":"hidden"}function s(b,c,e){if(1==b)a.uploadStatus.show=!1,webimutil.Helper.alertMessage.error("上传图片出错！",2);else{var f=d.getMessageById(a.currentConversation.targetId,a.currentConversation.targetType,c);f&&(f.content.state=webimmodel.FileState.Failed)}}function t(b,c){var d={domain:UPLOADDOMAIN_BASE64,fileType:1,data:UploadClient.dataType.data,getToken:function(a){f.getFileToken(this.fileType).then(function(b){a(b.token)},function(a){console.log("getFileToken error:"+a)})}};UploadClient.initImgBase64(d,function(c){c.upload(b,{onError:function(a){M.onError(a,d.fileType)},onProgress:function(a,b){M.onProgress(a,b,d.fileType)},onCompleted:function(b){r(!1),a.showPasteDiv(!1),M.onCompleted(b,d.fileType)}})})}function u(b){new RegExp("^data:image/[^;]+;base64,");if(b.clipboardData.items)for(var c=0;c<b.clipboardData.items.length;c++){var d=b.clipboardData.items[c];if(d.type.indexOf("image")>-1){var e=new FileReader,f=d.getAsFile();e.onloadend=function(){var b=e.result;document.getElementsByClassName("picContent")[0].src=b,a.showPasteDiv(!0)},e.readAsDataURL(f),z=f,b.preventDefault(),!0;break}}}var v=b.params.targetId,w=Number(b.params.targetType),x=new webimmodel.Conversation;x.targetId=v,x.targetType=w,a.currentConversation=x,a.mainData=c,a.uploads={};var y,z=null,A=w==webimmodel.conversationType.Private?"0":v,B=[],C=null;if(a.$emit("refreshSelectCon",w+"_"+v),a.cursorPos=-1,a.searchStr="",a.lastSearchStr="",a.defaultSearch=!1,"0"!=A){if(a.groupInfo=c.contactsList.getGroupById(A),a.groupInfo){y=webimutil.Helper.cloneObject(a.groupInfo.memberList);for(var D=y.length-1;D>=0;D--)y[D].id===c.loginUser.id&&y.splice(D,1)}a.showGroupList=webimutil.Helper.cloneObject(y)}a.initAtDiv=function(){var a=$("#atList");if(a){var b=a.find(".selected");b&&b.removeClass("selected"),a.scrollTop(0)}$("div.arobase").find("ul>li:first-child").addClass("selected")},a.moveToItem=function(a){if(a&&a.$index){var b=$("div.arobase").find("ul"),c=b.find(".selected"),d=b.find("li:nth-child("+(a.$index+1)+")");d.length&&(c.removeClass("selected"),d.addClass("selected"))}},a.selectMember=function(b){var c=document.getElementById("message-content"),d=a.cursorPos;if(a.atShow=!1,-1==a.cursorPos||c.textContent.length<=d)a.currentConversation.draftMsg=c.innerHTML+b.name+" ";else{var e=new RegExp(a.searchStr,"i");a.currentConversation.draftMsg=c.textContent.slice(0,d)+b.name+" "+c.textContent.slice(d).replace(e,"")}for(var f=!1,g=0;g<B.length;g++)if(B[g].id==b.id){f=!0;break}f||B.push({id:b.id,name:b.name,everychar:b.everychar}),setTimeout(function(){a.setFocus(c,d+b.name.length+1)},0),a.cursorPos=-1,a.lastSearchStr=a.searchStr,a.defaultSearch=!1;var h=$("#atList");if(h){var i=h.find(".selected");i&&i.removeClass("selected"),h.scrollTop(0)}},a.getCaretPosition=function(a){var b,c,d=0;if(window.getSelection)b=window.getSelection(),b.rangeCount&&(c=b.getRangeAt(0),c.commonAncestorContainer.parentNode==a&&(d=c.endOffset));else if(document.selection&&document.selection.createRange&&(c=document.selection.createRange(),c.parentElement()==a)){var e=document.createElement("span");a.insertBefore(e,a.firstChild);var f=c.duplicate();f.moveToElementText(e),f.setEndPoint("EndToEnd",c),d=f.text.length}return d},a.searchfriend=function(b){if(a.groupInfo.memberList){if(""==b)a.showGroupList=webimutil.Helper.cloneObject(y);else{var d=c.contactsList.find(b,y);a.showGroupList=webimutil.Helper.cloneObject(d)}setTimeout(function(){$("div.arobase").find("ul>li:first-child").addClass("selected")})}},A&&a.$watch("searchStr",function(b,c){b!==c&&a.searchfriend(b)}),a.setFocus=function(a,b){a.focus();var c,d=a.firstChild;if(void 0!==window.getSelection&&void 0!==document.createRange){c=document.createRange(),-1==b?c.selectNodeContents(a):(c.setStart(d,b),c.setEnd(d,b)),c.collapse(!1);var e=window.getSelection();e.removeAllRanges(),e.addRange(c)}else void 0!==document.body.createTextRange&&(c=document.selection.createRange(),this.last=c,c.moveToElementText(a),c.select())},webimutil.Helper.os.mac?webimutil.Helper.browser.safari&&angular.element(document.getElementsByClassName("expressionWrap")).css("top","-230px"):(angular.element(document.getElementsByClassName("expressionWrap")).css("top","-250px"),angular.element(document.getElementsByClassName("expressionWrap")).css("padding","5px 18px")),a.messagesloading=!0,a.showCutScreen=!1,window.Electron&&window.Electron.appInfo&&window.Electron.appInfo.version>"1.0.1"&&(a.showCutScreen=!0),a.scrollTo=function(a){i.hash(a),j()},f.getConversation(w,v).then(function(b){if(b)c.conversation.currentConversation=c.conversation.getConversation(w,v),a.currentConversation=c.conversation.currentConversation;else{var d=c.conversation.createConversation(w,v);c.conversation.currentConversation=d,a.currentConversation=d}a.currentConversation.draftMsg=f.getDraft(w,v)},function(){}),f.clearUnreadCount(w,v),d.historyMessagesCache[w+"_"+v]=d.historyMessagesCache[w+"_"+v]||[],a.conversationServer=d,l();var E=d.historyMessagesCache[w+"_"+v];if(0==E.length)d.getHistory(v,w,0,5).then(function(b){b&&d.unshiftHistoryMessages(v,w,new webimmodel.GetMoreMessagePanel),d.conversationMessageList=E,d.conversationMessageListShow.length=0,d.conversationMessageListShow=webimutil.Helper.cloneObject(E),setTimeout(function(){adjustScrollbars(),a.messagesloading=!1},0);var c=d.conversationMessageListShow[d.conversationMessageListShow.length-1];c&&c.messageUId&&c.sentTime&&(d.sendReadReceiptMessage(v,w,c.messageUId,c.sentTime.getTime()),d.sendSyncReadStatusMessage(v,w,c.sentTime.getTime()),C=c.messageUId)},function(a){d.conversationMessageList=E,d.conversationMessageListShow.length=0,d.conversationMessageListShow=webimutil.Helper.cloneObject(E),setTimeout(function(){adjustScrollbars()},0)});else{d.conversationMessageList=E,d.conversationMessageListShow.length=0,d.conversationMessageListShow=webimutil.Helper.cloneObject(E);var F=d.conversationMessageListShow[d.conversationMessageListShow.length-1];F&&F.messageUId&&F.sentTime&&(d.sendReadReceiptMessage(v,w,F.messageUId,F.sentTime.getTime()),d.sendSyncReadStatusMessage(v,w,F.sentTime.getTime()),C=F.messageUId),setTimeout(function(){adjustScrollbars(),a.messagesloading=!1},0)}var G=d.atMessagesCache[w+"_"+v];if(G&&G.length>0){var H=G[0].messageUId;setTimeout(function(){a.scrollTo(H)},0),G.length=0}a.tofriendinfo=function(){a.currentConversation.targetType==webimmodel.conversationType.Private?b.go("main.friendinfo",{userid:v,groupid:A,targetid:v,conversationtype:w}):b.go("main.groupinfo",{groupid:v,conversationtype:w})},a.touserinfo=function(a){b.go("main.friendinfo",{userid:a,groupid:A,targetid:v,conversationtype:w})},a.sendReadReceiptRequestMessage=function(a){if(w==webimmodel.conversationType.Group){var b=new RongIMLib.ReadReceiptRequestMessage({messageUId:a});f.sendMessage(w,v,b).then(function(){},function(a){console.log("sendReadReceiptRequestMessage error",a.errorCode)})}},k(),a.sendTypingStatusMessage=function(){if(w==webimmodel.conversationType.Private){var a=RongIMLib.TypingStatusMessage.obtain("RC:TxtMsg",null);f.sendMessage(w,v,a).then(function(){},function(a){console.log("sendTypingStatusMessage error",a.errorCode)})}},a.sendRecallCommandMessage=function(a){if(w==webimmodel.conversationType.Private||w==webimmodel.conversationType.Group){var b=new RongIMLib.RecallCommandMessage({messageUId:a});f.sendMessage(w,v,b).then(function(){},function(a){console.log("sendRecallCommandMessage error",a.errorCode)})}},a.delAtContent=function(b){var c=a.currentConversation.draftMsg.slice(0,b),d=document.getElementById("message-content"),e=c.split("@");if(e.length>1){p(e[e.length-1],B,!0).exist&&(b>=d.textContent.length?(d.textContent=c.slice(0,c.lastIndexOf("@"))+a.currentConversation.draftMsg.slice(b),a.setFocus(d,-1)):(d.textContent=c.slice(0,c.lastIndexOf("@"))+a.currentConversation.draftMsg.slice(b),a.setFocus(d,b-e[e.length-1].length-1)),a.defaultSearch=!0)}},a.sendBtn=function(){var b=document.querySelector(".no_network");if(!b||"visible"!=b.style.visibility){if($("div.arobase").is(":visible")){var c=$("div.arobase").find(".selected").index(),e=a.showGroupList[c];return void a.selectMember(e)}var g=a.currentConversation.draftMsg;if(""==(g=g.replace(/(^\s*)|(\s*$)/g,"")))return void webimutil.Helper.alertMessage.error("消息内容不能为空",2);if(g=g.replace(/&lt;div&gt;/gi,"<br>").replace(/&lt;\/div&gt;/gi,""),g=g.replace(/^<br>$/i,""),g=g.replace(/<br>/gi,"\n"),g=g.replace(/&amp;/gi,"&"),g=g.replace(/&lt;/gi,"<").replace(/&gt;/gi,">"),a.showemoji=!1,!w&&!v)return void webimutil.Helper.alertMessage.error("请选择一个会话对象",2);var h=RongIMLib.RongIMEmoji.symbolToEmoji(g);if(""!=h){var i=RongIMLib.TextMessage.obtain(h),j=!1,k=q(h);if(k&&k.length>0&&(j=!0),j){var l=new RongIMLib.MentionedInfo;l.type=webimmodel.AtTarget.Part,l.userIdList=k,i.mentionedInfo=l}var m=n(i,webimmodel.MessageType.TextMessage),p=webimmodel.Message.convertMsg(m);d.addHistoryMessages(v,w,p),a.$emit("msglistchange"),a.currentConversation.draftMsg="";var r=document.getElementById("message-content");webimutil.Helper.getFocus(r),f.sendMessage(w,v,i,j&&(w==webimmodel.conversationType.Group||w==webimmodel.conversationType.Discussion)).then(function(b){B=[];var c=webimmodel.Message.convertMsg(b);d.messageAddUserInfo(c),a.mainData.conversation.updateConStatic(c,!0,!0),d.updateSendMessage(v,w,c)},function(a){var b="";switch(a.errorCode){case RongIMLib.ErrorCode.TIMEOUT:break;case RongIMLib.ErrorCode.REJECTED_BY_BLACKLIST:b="您的消息已经发出，但被对方拒收";break;case RongIMLib.ErrorCode.NOT_IN_GROUP:b="你不在该群组中"}if(console.log("消息发送失败,错误代码:"+a.errorCode),b){var c=webimutil.Helper.cloneObject(a.message);c.content=b,c.panelType=webimmodel.PanelType.InformationNotification,o(c)}})}}},a.back=function(){b.go("main")},a.sendImg=function(){},a.showPasteDiv=function(a){var b=document.getElementsByClassName("previewPic")[0],c=document.getElementsByClassName("previewPicLayer")[0];a?(b.style.visibility="visible",c.style.visibility="visible",b.focus()):(b.style.visibility="hidden",c.style.visibility="hidden",r(!1))},a.uploadPasteImage=function(){var a=new RegExp("^data:image/[^;]+;base64,"),b=document.getElementsByClassName("picContent")[0],c=b.src;c=c.replace(a,""),r(!0),t(c,z)},a.takeScreenShot=function(){if(window.Electron){if(void 0===window.Electron.screenShot)return void console.log("您的app版本过低,不支持截图功能");window.Electron.screenShot()}},a.$on("showPasteDiv",function(b,c){a.showPasteDiv(c)}),a.$on("uploadPasteImage",function(b){a.uploadPasteImage()}),a.$watch("currentConversation.draftMsg",function(b,d){b!==d&&(f.setDraft(+a.currentConversation.targetType,a.currentConversation.targetId,b),c.conversation.setDraft(a.currentConversation.targetType,a.currentConversation.targetId,b))}),a.getHistoryMessage=function(){d.historyMessagesCache[w+"_"+v]=[];var a=d.getLastMessageTime(v,w);d.getHistory(v,w,a,5).then(function(a){d.conversationMessageList=d.historyMessagesCache[w+"_"+v],a&&d.unshiftHistoryMessages(v,w,new webimmodel.GetMoreMessagePanel),d.conversationMessageListShow.length=0,d.conversationMessageListShow=webimutil.Helper.cloneObject(d.conversationMessageList)})},a.getMoreMessage=function(){d.historyMessagesCache[w+"_"+v].shift();var a=d.getLastMessageTime(v,w);d.getHistory(v,w,a,5).then(function(a){a&&d.unshiftHistoryMessages(v,w,new webimmodel.GetMoreMessagePanel);var b=document.getElementById("Messages");if(b){var c=b.scrollHeight-b.scrollTop;d.conversationMessageListShow.length=0,d.conversationMessageListShow=webimutil.Helper.cloneObject(d.conversationMessageList),h(function(){b.scrollTop=b.scrollHeight-c},0)}})},a.$on("msglistchange",function(){setTimeout(function(){adjustScrollbars()},0)}),a.showemoji=!1,a.emojiList=RongIMLib.RongIMEmoji.emojis.slice(0,60),a.uploadStatus={show:!1,progress:0,cancle:function(){a.uploadStatus.show=!1,a.uploadStatus.progress=0}};var I={4:function(a){var b=a.name||"",c=b.lastIndexOf(".")+1,d=b.substring(c);return new RongIMLib.FileMessage({name:a.name,size:a.size,type:d,fileUrl:a.downloadUrl})},1:function(a){return new RongIMLib.ImageMessage({content:a.thumbnail,imageUri:a.downloadUrl})}},J=function(a){return I[a.fileType](a)},K={4:function(a,b){f.getFileUrl(4,a.filename,a.name).then(function(c){a.downloadUrl=c.downloadUrl;var d=J(a);b(d)},function(a){console.log("getFileUrl error:"+a)})},1:function(a,b){f.getFileUrl(1,a.filename,null).then(function(c){a.downloadUrl=c.downloadUrl;var d=J(a);b(d)},function(a){console.log("getFileUrl error:"+a)})}},L=function(a,b){K[a.fileType](a,b)},M={onError:function(a,b,c){s(b,c,a)},onProgress:function(b,c,e,f){var g=Math.floor(b/c*100);if(1==e)a.uploadStatus.progress=g+"%";else if(g>0){var h=d.getMessageById(a.currentConversation.targetId,a.currentConversation.targetType,f);h.content.extra=g+"%",h.content.state=h.content.state==webimmodel.FileState.Uploading?-1:webimmodel.FileState.Uploading}setTimeout(function(){a.$apply()})},onCompleted:function(b,c,e){b.fileType=c,webimutil.Helper.compressImage(b.thumbnail,function(g){b.thumbnail=g,L(b,function(b){f.sendMessage(a.currentConversation.targetType,a.currentConversation.targetId,b).then(function(b){if(1==c)d.addHistoryMessages(a.currentConversation.targetId,a.currentConversation.targetType,webimmodel.Message.convertMsg(b));else{var f=d.getMessageById(a.currentConversation.targetId,a.currentConversation.targetType,e);f.content.fileUrl=b.content.fileUrl,f.content.state=webimmodel.FileState.Success}})})}),a.uploadStatus.show=!1,a.uploadStatus.progress=0,setTimeout(function(){a.$emit("msglistchange"),a.$emit("conversationChange")},200),a.$apply()}},N=document.getElementById("upload-file");N.onchange=function(){var b=this.files[0],d=new webimmodel.Message,e=Date.now().toString();d.conversationType=a.currentConversation.targetType,d.objectName="RC:FileMsg",d.messageDirection=webimmodel.MessageDirection.SEND,d.messageId=e,d.messageUId=e,d.senderUserId=c.loginUser.id,d.sentTime=new Date,d.targetId=a.currentConversation.targetId,d.messageType=webimmodel.MessageType.FileMessage;var g=new webimmodel.FileMessage;g.name=b.oldName||b.name,g.size=b.size,g.type=b.name.replace(/.+\./,"").toLowerCase(),g.state=webimmodel.FileState.Uploading,d.content=g,m(d),a.$apply();var h={domain:UPLOADDOMAIN,fileType:4,getToken:function(a){f.getFileToken(this.fileType).then(function(b){a(b.token)},function(a){console.log("getFileToken error:"+a)})}};UploadClient.initFile(h,function(c){N.value="",a.uploads[e]=c,c.upload(b,{onError:function(a){M.onError(a,h.fileType,e)},onProgress:function(a,b){M.onProgress(a,b,h.fileType,e)},onCompleted:function(a){M.onCompleted(a,h.fileType,e)}})})};var O=document.getElementById("upload-image");O.onchange=function(){var b=this.files[0],c={domain:UPLOADDOMAIN,fileType:1,getToken:function(a){f.getFileToken(this.fileType).then(function(b){a(b.token)},function(a){console.log("getFileToken error:"+a)})}};UploadClient.initImage(c,function(d){O.value="",a.uploadStatus.show=!0,d.upload(b,{onError:function(a){M.onError(a,c.fileType)},onProgress:function(a,b){M.onProgress(a,b,c.fileType)},onCompleted:function(a){M.onCompleted(a,c.fileType)}})})},setTimeout(function(){var a=document.getElementById("message-content");webimutil.Helper.getFocus(a)}),document.getElementById("message-content").addEventListener("paste",u),a.$on("$destroy",function(){if(d.clearHistoryMessages(a.currentConversation.targetId,a.currentConversation.targetType),w==webimmodel.conversationType.Group){var b=d.conversationMessageListShow[d.conversationMessageListShow.length-1],c=b&&C!=b.messageUId;b&&b.messageUId&&b.sentTime&&c&&d.sendSyncReadStatusMessage(v,w,b.sentTime.getTime())}})}]);var webimutil;!function(a){function b(a,b,c){c=c||0,jQuery.layer({type:1,title:!1,area:["auto","auto"],border:[0],shade:[.1,"#000"],time:c,shadeClose:!0,closeBtn:[0,!1],page:{html:'<div id="showMesBox" class="'+(b?"successMes":"unsuccessMes")+'" style="width:240px; height:130px; overflow:auto"> <div class="showMesTop"><span class="showMesIco"></span></div> <div class="showMesBot">'+a+"</div></div>"}})}function c(a){if(!a)return null;var b;if("[object Array]"==Object.prototype.toString.call(a)){b=[];for(var d=a.length;d--;)b[d]=c(a[d]);return b}if("object"==typeof a){b={};for(var e in a)b[e]=a[e];return b}return a}var d=function(){function a(){}return a.setCookie=function(a,b,c){if(c){var d=new Date;d.setDate(d.getDate()+c),document.cookie=a+"="+encodeURI(b)+";expires="+d.toUTCString()}else document.cookie=a+"="+encodeURI(b)+";"},a.getCookie=function(a){var b=document.cookie.indexOf(a+"=");if(-1!=b){var c=document.cookie.indexOf(";",b);return-1==c&&(c=document.cookie.length),decodeURI(document.cookie.substring(b+a.length+1,c))}return""},a.removeCookie=function(a){this.getCookie(a)&&this.setCookie(a,"con",-1)},a}();a.CookieHelper=d;var e=window.navigator.userAgent.toLowerCase(),f=function(){function d(){}return d.portraitColors=["#e97ffb","#00b8d4","#82b2ff","#f3db73","#f0857c"],d.cloneObject=c,d.alertMessage={error:function(a,c){b(a,!1,c)},success:function(a,c){b(a,!0,c)}},d.escapeSymbol={escapeHtml:function(a){return a?(a=a.replace(/</g,"&lt;"),a=a.replace(/>/g,"&gt;"),a=a.replace(/"/g,"&quot;"),a=a.replace(/'/g,"&#039;")):""},replaceSymbol:function(a){return a?(a=a.replace(/&lt;/g,"<"),a=a.replace(/&gt;/g,">"),a=a.replace(/&quot;/g,'"')):""}},d.getFocus=function(b){if(b.focus(),b.createTextRange){var c=b.createTextRange();c.moveStart("character",b.value.length),c.collapse(!0),c.select()}else if(b.selectionStart)b.selectionStart=b.value.length;else if(window.getSelection&&b.lastChild){var d=window.getSelection(),e=document.createRange();a.Helper.browser.msie?e.setStart(b.lastChild,b.lastChild.length):e.setStart(b.firstChild,b.firstChild.length),d.removeAllRanges(),d.addRange(e)}},d.browser={version:(e.match(/.+(?:rv|it|ra|chrome|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(e),opera:/opera|opr/.test(e),msie:/msie|trident/.test(e)&&!/opera/.test(e),chrome:/chrome/.test(e),mozilla:/mozilla/.test(e)&&!/(compatible|webkit|like gecko)/.test(e)},d.os={mac:e.match(/Mac\s+OS/i)},d.showBigImage=function(a){var b=document.createElement("div");b.className="rong-big-image-box",b.style.display="none";var c=document.createElement("img");c.className="rong-big-image",c.src=a,c.style.display="none";var d=function(){document.body.appendChild(b),document.body.appendChild(c)},e=function(){document.body.removeChild(b),document.body.removeChild(c)},f=document.createElement("span");f.className="rong-big-image-close",f.textContent="×",b.onclick=e,b.appendChild(f),d(),b.style.display="block",c.style.display="block"},d.compressImage=function(b,c){var d=55490;if(!b)return c(b);if(b.length<d)return c(b);var e=new Image,f="data:image/jpg;base64,";e.src=f+b,e.onload=function(g){var h=e.width,i=e.height,j=d/b.length,k=document.createElement("canvas"),l=k.getContext("2d"),m=document.createAttribute("width");m.nodeValue=h;var n=document.createAttribute("height");if(n.nodeValue=i,k.setAttributeNode(m),k.setAttributeNode(n),l.fillStyle="#fff",l.fillRect(0,0,h,i),l.drawImage(e,0,0,h,i),b=k.toDataURL("image/jpeg",j),b=b.substring(f.length+1),b.length>d)return a.Helper.compressImage(b,c);c(b)},e.onerror=function(){c(b.substring(0,d))}},d}();a.Helper=f;var g=function(){function a(){}return a.getThumbnail=function(b,c,d){var e=document.createElement("canvas"),f=e.getContext("2d"),g=new Image;g.onload=function(){var a,h,i=g.width*g.height,j=0,k=0,l=240,m=240;if(i>c){var n=Math.sqrt(i/c);n=Math.ceil(100*n)/100,a=g.width/n,h=g.height/n}else a=g.width,h=g.height;e.width=a,e.height=h,f.drawImage(g,0,0,a,h);try{if(e.width>l||e.height>m){a>l&&(k=(a-l)/2,a=l),h>m&&(j=(h-m)/2,h=m);var o=f.getImageData(k,j,a,h);f.createImageData(a,h),e.width=a,e.height=h,f.putImageData(o,0,0)}var p=e.toDataURL("image/jpeg",.5);d(b,p)}catch(q){d(b,null)}},g.src=a.getFullPath(b)},a.getFullPath=function(a){return window.URL=window.URL||window.webkitURL,window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(a):null},a}();a.ImageHelper=g;var h=function(){function a(){}return a.downloadFile=function(a){if(this.isChrome||this.isSafari){var b=document.createElement("a");if(b.href=a,void 0!==b.download){var c=a.substring(a.lastIndexOf("/")+1,a.length);b.download=c}if(document.createEvent){var d=document.createEvent("MouseEvents");return d.initEvent("click",!0,!0),b.dispatchEvent(d),!0}}window.open(a+"?download")},a.isChrome=navigator.userAgent.toLowerCase().indexOf("chrome")>-1,a.isSafari=navigator.userAgent.toLowerCase().indexOf("safari")>-1,a}();a.DownloadHelper=h;var i={a:"啊阿锕",ai:"埃挨哎唉哀皑癌蔼矮艾碍爱隘诶捱嗳嗌嫒瑷暧砹锿霭",an:"鞍氨安俺按暗岸胺案谙埯揞犴庵桉铵鹌顸黯",ang:"肮昂盎",ao:"凹敖熬翱袄傲奥懊澳坳拗嗷噢岙廒遨媪骜聱螯鏊鳌鏖",ba:"芭捌扒叭吧笆八疤巴拔跋靶把耙坝霸罢爸茇菝萆捭岜灞杷钯粑鲅魃",bai:"白柏百摆佰败拜稗薜掰鞴",ban:"斑班搬扳般颁板版扮拌伴瓣半办绊阪坂豳钣瘢癍舨",bang:"邦帮梆榜膀绑棒磅蚌镑傍谤蒡螃",bao:"苞胞包褒雹保堡饱宝抱报暴豹鲍爆勹葆宀孢煲鸨褓趵龅",bo:"剥薄玻菠播拨钵波博勃搏铂箔伯帛舶脖膊渤泊驳亳蕃啵饽檗擘礴钹鹁簸跛",bei:"杯碑悲卑北辈背贝钡倍狈备惫焙被孛陂邶埤蓓呗怫悖碚鹎褙鐾",ben:"奔苯本笨畚坌锛",beng:"崩绷甭泵蹦迸唪嘣甏",bi:"逼鼻比鄙笔彼碧蓖蔽毕毙毖币庇痹闭敝弊必辟壁臂避陛匕仳俾芘荜荸吡哔狴庳愎滗濞弼妣婢嬖璧贲畀铋秕裨筚箅篦舭襞跸髀",bian:"鞭边编贬扁便变卞辨辩辫遍匾弁苄忭汴缏煸砭碥稹窆蝙笾鳊",biao:"标彪膘表婊骠飑飙飚灬镖镳瘭裱鳔",bie:"鳖憋别瘪蹩鳘",bin:"彬斌濒滨宾摈傧浜缤玢殡膑镔髌鬓",bing:"兵冰柄丙秉饼炳病并禀邴摒绠枋槟燹",bu:"捕卜哺补埠不布步簿部怖拊卟逋瓿晡钚醭",ca:"擦嚓礤",cai:"猜裁材才财睬踩采彩菜蔡",can:"餐参蚕残惭惨灿骖璨粲黪",cang:"苍舱仓沧藏伧",cao:"操糙槽曹草艹嘈漕螬艚",ce:"厕策侧册测刂帻恻",ceng:"层蹭噌",cha:"插叉茬茶查碴搽察岔差诧猹馇汊姹杈楂槎檫钗锸镲衩",chai:"拆柴豺侪茈瘥虿龇",chan:"搀掺蝉馋谗缠铲产阐颤冁谄谶蒇廛忏潺澶孱羼婵嬗骣觇禅镡裣蟾躔",chang:"昌猖场尝常长偿肠厂敞畅唱倡伥鬯苌菖徜怅惝阊娼嫦昶氅鲳",chao:"超抄钞朝嘲潮巢吵炒怊绉晁耖",che:"车扯撤掣彻澈坼屮砗",chen:"郴臣辰尘晨忱沉陈趁衬称谌抻嗔宸琛榇肜胂碜龀",cheng:"撑城橙成呈乘程惩澄诚承逞骋秤埕嵊徵浈枨柽樘晟塍瞠铖裎蛏酲",chi:"吃痴持匙池迟弛驰耻齿侈尺赤翅斥炽傺墀芪茌搋叱哧啻嗤彳饬沲媸敕胝眙眵鸱瘛褫蚩螭笞篪豉踅踟魑",chong:"充冲虫崇宠茺忡憧铳艟",chou:"抽酬畴踌稠愁筹仇绸瞅丑俦圳帱惆溴妯瘳雠鲋",chu:"臭初出橱厨躇锄雏滁除楚础储矗搐触处亍刍憷绌杵楮樗蜍蹰黜",chuan:"揣川穿椽传船喘串掾舛惴遄巛氚钏镩舡",chuang:"疮窗幢床闯创怆",chui:"吹炊捶锤垂陲棰槌",chun:"春椿醇唇淳纯蠢促莼沌肫朐鹑蝽",chuo:"戳绰蔟辶辍镞踔龊",ci:"疵茨磁雌辞慈瓷词此刺赐次荠呲嵯鹚螅糍趑",cong:"聪葱囱匆从丛偬苁淙骢琮璁枞",cu:"凑粗醋簇猝殂蹙",cuan:"蹿篡窜汆撺昕爨",cui:"摧崔催脆瘁粹淬翠萃悴璀榱隹",cun:"村存寸磋忖皴",cuo:"撮搓措挫错厝脞锉矬痤鹾蹉躜",da:"搭达答瘩打大耷哒嗒怛妲疸褡笪靼鞑",dai:"呆歹傣戴带殆代贷袋待逮怠埭甙呔岱迨逯骀绐玳黛",dan:"耽担丹单郸掸胆旦氮但惮淡诞弹蛋亻儋卩萏啖澹檐殚赕眈瘅聃箪",dang:"当挡党荡档谠凼菪宕砀铛裆",dao:"刀捣蹈倒岛祷导到稻悼道盗叨啁忉洮氘焘忑纛",de:"德得的锝",deng:"蹬灯登等瞪凳邓噔嶝戥磴镫簦",di:"堤低滴迪敌笛狄涤翟嫡抵底地蒂第帝弟递缔氐籴诋谛邸坻莜荻嘀娣柢棣觌砥碲睇镝羝骶",dian:"颠掂滇碘点典靛垫电佃甸店惦奠淀殿丶阽坫埝巅玷癜癫簟踮",diao:"碉叼雕凋刁掉吊钓调轺铞蜩粜貂",die:"跌爹碟蝶迭谍叠佚垤堞揲喋渫轶牒瓞褶耋蹀鲽鳎",ding:"丁盯叮钉顶鼎锭定订丢仃啶玎腚碇町铤疔耵酊",dong:"东冬董懂动栋侗恫冻洞垌咚岽峒夂氡胨胴硐鸫",dou:"兜抖斗陡豆逗痘蔸钭窦窬蚪篼酡",du:"都督毒犊独读堵睹赌杜镀肚度渡妒芏嘟渎椟橐牍蠹笃髑黩",duan:"端短锻段断缎彖椴煅簖",dui:"堆兑队对怼憝碓",dun:"墩吨蹲敦顿囤钝盾遁炖砘礅盹镦趸",duo:"掇哆多夺垛躲朵跺舵剁惰堕咄哚缍柁铎裰踱",e:"蛾峨鹅俄额讹娥恶厄扼遏鄂饿噩谔垩垭苊莪萼呃愕屙婀轭曷腭硪锇锷鹗颚鳄",en:"恩蒽摁唔嗯",er:"而儿耳尔饵洱二贰迩珥铒鸸鲕",fa:"发罚筏伐乏阀法珐垡砝",fan:"藩帆番翻樊矾钒繁凡烦反返范贩犯饭泛蘩幡犭梵攵燔畈蹯",fang:"坊芳方肪房防妨仿访纺放匚邡彷钫舫鲂",fei:"菲非啡飞肥匪诽吠肺废沸费芾狒悱淝妃绋绯榧腓斐扉祓砩镄痱蜚篚翡霏鲱",fen:"芬酚吩氛分纷坟焚汾粉奋份忿愤粪偾瀵棼愍鲼鼢",feng:"丰封枫蜂峰锋风疯烽逢冯缝讽奉凤俸酆葑沣砜",fu:"佛否夫敷肤孵扶拂辐幅氟符伏俘服浮涪福袱弗甫抚辅俯釜斧脯腑府腐赴副覆赋复傅付阜父腹负富讣附妇缚咐匐凫郛芙苻茯莩菔呋幞滏艴孚驸绂桴赙黻黼罘稃馥虍蚨蜉蝠蝮麸趺跗鳆",ga:"噶嘎蛤尬呷尕尜旮钆",gai:"该改概钙盖溉丐陔垓戤赅胲",gan:"干甘杆柑竿肝赶感秆敢赣坩苷尴擀泔淦澉绀橄旰矸疳酐",gang:"冈刚钢缸肛纲岗港戆罡颃筻",gong:"杠工攻功恭龚供躬公宫弓巩汞拱贡共蕻廾咣珙肱蚣蛩觥",gao:"篙皋高膏羔糕搞镐稿告睾诰郜蒿藁缟槔槁杲锆",ge:"哥歌搁戈鸽胳疙割革葛格阁隔铬个各鬲仡哿塥嗝纥搿膈硌铪镉袼颌虼舸骼髂",gei:"给",gen:"根跟亘茛哏艮",geng:"耕更庚羹埂耿梗哽赓鲠",gou:"钩勾沟苟狗垢构购够佝诟岣遘媾缑觏彀鸲笱篝鞲",gu:"辜菇咕箍估沽孤姑鼓古蛊骨谷股故顾固雇嘏诂菰哌崮汩梏轱牯牿胍臌毂瞽罟钴锢瓠鸪鹄痼蛄酤觚鲴骰鹘",gua:"刮瓜剐寡挂褂卦诖呱栝鸹",guai:"乖拐怪哙",guan:"棺关官冠观管馆罐惯灌贯倌莞掼涫盥鹳鳏",guang:"光广逛犷桄胱疒",gui:"瑰规圭硅归龟闺轨鬼诡癸桂柜跪贵刽匦刿庋宄妫桧炅晷皈簋鲑鳜",gun:"辊滚棍丨衮绲磙鲧",guo:"锅郭国果裹过馘蠃埚掴呙囗帼崞猓椁虢锞聒蜮蜾蝈",ha:"哈",hai:"骸孩海氦亥害骇咴嗨颏醢",han:"酣憨邯韩含涵寒函喊罕翰撼捍旱憾悍焊汗汉邗菡撖阚瀚晗焓颔蚶鼾",hen:"夯痕很狠恨",hang:"杭航沆绗珩桁",hao:"壕嚎豪毫郝好耗号浩薅嗥嚆濠灏昊皓颢蚝",he:"呵喝荷菏核禾和何合盒貉阂河涸赫褐鹤贺诃劾壑藿嗑嗬阖盍蚵翮",hei:"嘿黑",heng:"哼亨横衡恒訇蘅",hong:"轰哄烘虹鸿洪宏弘红黉讧荭薨闳泓",hou:"喉侯猴吼厚候后堠後逅瘊篌糇鲎骺",hu:"呼乎忽瑚壶葫胡蝴狐糊湖弧虎唬护互沪户冱唿囫岵猢怙惚浒滹琥槲轷觳烀煳戽扈祜鹕鹱笏醐斛",hua:"花哗华猾滑画划化话劐浍骅桦铧稞",huai:"槐徊怀淮坏还踝",huan:"欢环桓缓换患唤痪豢焕涣宦幻郇奂垸擐圜洹浣漶寰逭缳锾鲩鬟",huang:"荒慌黄磺蝗簧皇凰惶煌晃幌恍谎隍徨湟潢遑璜肓癀蟥篁鳇",hui:"灰挥辉徽恢蛔回毁悔慧卉惠晦贿秽会烩汇讳诲绘诙茴荟蕙哕喙隳洄彗缋珲晖恚虺蟪麾",hun:"荤昏婚魂浑混诨馄阍溷缗",
  huo:"豁活伙火获或惑霍货祸攉嚯夥钬锪镬耠蠖",ji:"击圾基机畸稽积箕肌饥迹激讥鸡姬绩缉吉极棘辑籍集及急疾汲即嫉级挤几脊己蓟技冀季伎祭剂悸济寄寂计记既忌际妓继纪居丌乩剞佶佴脔墼芨芰萁蒺蕺掎叽咭哜唧岌嵴洎彐屐骥畿玑楫殛戟戢赍觊犄齑矶羁嵇稷瘠瘵虮笈笄暨跻跽霁鲚鲫髻麂",jia:"嘉枷夹佳家加荚颊贾甲钾假稼价架驾嫁伽郏拮岬浃迦珈戛胛恝铗镓痂蛱笳袈跏",jian:"歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僭谏谫菅蒹搛囝湔蹇謇缣枧柙楗戋戬牮犍毽腱睑锏鹣裥笕箴翦趼踺鲣鞯",jiang:"僵姜将浆江疆蒋桨奖讲匠酱降茳洚绛缰犟礓耩糨豇",jiao:"蕉椒礁焦胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫佼僬茭挢噍峤徼姣纟敫皎鹪蛟醮跤鲛",jie:"窖揭接皆秸街阶截劫节桔杰捷睫竭洁结解姐戒藉芥界借介疥诫届偈讦诘喈嗟獬婕孑桀獒碣锴疖袷颉蚧羯鲒骱髫",jin:"巾筋斤金今津襟紧锦仅谨进靳晋禁近烬浸尽卺荩堇噤馑廑妗缙瑾槿赆觐钅锓衿矜",jing:"劲荆兢茎睛晶鲸京惊精粳经井警景颈静境敬镜径痉靖竟竞净刭儆阱菁獍憬泾迳弪婧肼胫腈旌",jiong:"炯窘冂迥扃",jiu:"揪究纠玖韭久灸九酒厩救旧臼舅咎就疚僦啾阄柩桕鹫赳鬏",ju:"鞠拘狙疽驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧倨讵苣苴莒掬遽屦琚枸椐榘榉橘犋飓钜锔窭裾趄醵踽龃雎鞫",juan:"捐鹃娟倦眷卷绢鄄狷涓桊蠲锩镌隽",jue:"撅攫抉掘倔爵觉决诀绝厥劂谲矍蕨噘崛獗孓珏桷橛爝镢蹶觖",jun:"均菌钧军君峻俊竣浚郡骏捃狻皲筠麇",ka:"喀咖卡佧咔胩",ke:"咯坷苛柯棵磕颗科壳咳可渴克刻客课岢恪溘骒缂珂轲氪瞌钶疴窠蝌髁",kai:"开揩楷凯慨剀垲蒈忾恺铠锎",kan:"刊堪勘坎砍看侃凵莰莶戡龛瞰",kang:"康慷糠扛抗亢炕坑伉闶钪",kao:"考拷烤靠尻栲犒铐",ken:"肯啃垦恳垠裉颀",keng:"吭忐铿",kong:"空恐孔控倥崆箜",kou:"抠口扣寇芤蔻叩眍筘",ku:"枯哭窟苦酷库裤刳堀喾绔骷",kua:"夸垮挎跨胯侉",kuai:"块筷侩快蒯郐蒉狯脍",kuan:"宽款髋",kuang:"匡筐狂框矿眶旷况诓诳邝圹夼哐纩贶",kui:"亏盔岿窥葵奎魁傀馈愧溃馗匮夔隗揆喹喟悝愦阕逵暌睽聩蝰篑臾跬",kun:"坤昆捆困悃阃琨锟醌鲲髡",kuo:"括扩廓阔蛞",la:"垃拉喇蜡腊辣啦剌摺邋旯砬瘌",lai:"莱来赖崃徕涞濑赉睐铼癞籁",lan:"蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥啉岚懔漤榄斓罱镧褴",lang:"琅榔狼廊郎朗浪莨蒗啷阆锒稂螂",lao:"捞劳牢老佬姥酪烙涝唠崂栳铑铹痨醪",le:"勒乐肋仂叻嘞泐鳓",lei:"雷镭蕾磊累儡垒擂类泪羸诔荽咧漯嫘缧檑耒酹",ling:"棱冷拎玲菱零龄铃伶羚凌灵陵岭领另令酃塄苓呤囹泠绫柃棂瓴聆蛉翎鲮",leng:"楞愣",li:"厘梨犁黎篱狸离漓理李里鲤礼莉荔吏栗丽厉励砾历利傈例俐痢立粒沥隶力璃哩俪俚郦坜苈莅蓠藜捩呖唳喱猁溧澧逦娌嫠骊缡珞枥栎轹戾砺詈罹锂鹂疠疬蛎蜊蠡笠篥粝醴跞雳鲡鳢黧",lian:"俩联莲连镰廉怜涟帘敛脸链恋炼练挛蔹奁潋濂娈琏楝殓臁膦裢蠊鲢",liang:"粮凉梁粱良两辆量晾亮谅墚椋踉靓魉",liao:"撩聊僚疗燎寥辽潦了撂镣廖料蓼尥嘹獠寮缭钌鹩耢",lie:"列裂烈劣猎冽埒洌趔躐鬣",lin:"琳林磷霖临邻鳞淋凛赁吝蔺嶙廪遴檩辚瞵粼躏麟",liu:"溜琉榴硫馏留刘瘤流柳六抡偻蒌泖浏遛骝绺旒熘锍镏鹨鎏",long:"龙聋咙笼窿隆垄拢陇弄垅茏泷珑栊胧砻癃",lou:"楼娄搂篓漏陋喽嵝镂瘘耧蝼髅",lu:"芦卢颅庐炉掳卤虏鲁麓碌露路赂鹿潞禄录陆戮垆摅撸噜泸渌漉璐栌橹轳辂辘氇胪镥鸬鹭簏舻鲈",lv:"驴吕铝侣旅履屡缕虑氯律率滤绿捋闾榈膂稆褛",luan:"峦孪滦卵乱栾鸾銮",lue:"掠略锊",lun:"轮伦仑沦纶论囵",luo:"萝螺罗逻锣箩骡裸落洛骆络倮荦摞猡泺椤脶镙瘰雒",ma:"妈麻玛码蚂马骂嘛吗唛犸嬷杩麽",mai:"埋买麦卖迈脉劢荬咪霾",man:"瞒馒蛮满蔓曼慢漫谩墁幔缦熳镘颟螨鳗鞔",mang:"芒茫盲忙莽邙漭朦硭蟒",meng:"氓萌蒙檬盟锰猛梦孟勐甍瞢懵礞虻蜢蠓艋艨黾",miao:"猫苗描瞄藐秒渺庙妙喵邈缈缪杪淼眇鹋蜱",mao:"茅锚毛矛铆卯茂冒帽貌贸侔袤勖茆峁瑁昴牦耄旄懋瞀蛑蝥蟊髦",me:"么",mei:"玫枚梅酶霉煤没眉媒镁每美昧寐妹媚坶莓嵋猸浼湄楣镅鹛袂魅",men:"门闷们扪玟焖懑钔",mi:"眯醚靡糜迷谜弥米秘觅泌蜜密幂芈冖谧蘼嘧猕獯汨宓弭脒敉糸縻麋",mian:"棉眠绵冕免勉娩缅面沔湎腼眄",mie:"蔑灭咩蠛篾",min:"民抿皿敏悯闽苠岷闵泯珉",ming:"明螟鸣铭名命冥茗溟暝瞑酩",miu:"谬",mo:"摸摹蘑模膜磨摩魔抹末莫墨默沫漠寞陌谟茉蓦馍嫫镆秣瘼耱蟆貊貘",mou:"谋牟某厶哞婺眸鍪",mu:"拇牡亩姆母墓暮幕募慕木目睦牧穆仫苜呒沐毪钼",na:"拿哪呐钠那娜纳内捺肭镎衲箬",nai:"氖乃奶耐奈鼐艿萘柰",nan:"南男难囊喃囡楠腩蝻赧",nao:"挠脑恼闹孬垴猱瑙硇铙蛲",ne:"淖呢讷",nei:"馁",nen:"嫩能枘恁",ni:"妮霓倪泥尼拟你匿腻逆溺伲坭猊怩滠昵旎祢慝睨铌鲵",nian:"蔫拈年碾撵捻念廿辇黏鲇鲶",niang:"娘酿",niao:"鸟尿茑嬲脲袅",nie:"捏聂孽啮镊镍涅乜陧蘖嗫肀颞臬蹑",nin:"您柠",ning:"狞凝宁拧泞佞蓥咛甯聍",niu:"牛扭钮纽狃忸妞蚴",nong:"脓浓农侬",nu:"奴努怒呶帑弩胬孥驽",nv:"女恧钕衄",nuan:"暖",nuenue:"虐",nue:"疟谑",nuo:"挪懦糯诺傩搦喏锘",ou:"哦欧鸥殴藕呕偶沤怄瓯耦",pa:"啪趴爬帕怕琶葩筢",pai:"拍排牌徘湃派俳蒎",pan:"攀潘盘磐盼畔判叛爿泮袢襻蟠蹒",pang:"乓庞旁耪胖滂逄",pao:"抛咆刨炮袍跑泡匏狍庖脬疱",pei:"呸胚培裴赔陪配佩沛掊辔帔淠旆锫醅霈",pen:"喷盆湓",peng:"砰抨烹澎彭蓬棚硼篷膨朋鹏捧碰坯堋嘭怦蟛",pi:"砒霹批披劈琵毗啤脾疲皮匹痞僻屁譬丕陴邳郫圮鼙擗噼庀媲纰枇甓睥罴铍痦癖疋蚍貔",pian:"篇偏片骗谝骈犏胼褊翩蹁",piao:"飘漂瓢票剽嘌嫖缥殍瞟螵",pie:"撇瞥丿苤氕",pin:"拼频贫品聘拚姘嫔榀牝颦",ping:"乒坪苹萍平凭瓶评屏俜娉枰鲆",po:"坡泼颇婆破魄迫粕叵鄱溥珀钋钷皤笸",pou:"剖裒踣",pu:"扑铺仆莆葡菩蒲埔朴圃普浦谱曝瀑匍噗濮璞氆镤镨蹼",qi:"期欺栖戚妻七凄漆柒沏其棋奇歧畦崎脐齐旗祈祁骑起岂乞企启契砌器气迄弃汽泣讫亟亓圻芑萋葺嘁屺岐汔淇骐绮琪琦杞桤槭欹祺憩碛蛴蜞綦綮趿蹊鳍麒",qia:"掐恰洽葜",qian:"牵扦钎铅千迁签仟谦乾黔钱钳前潜遣浅谴堑嵌欠歉佥阡芊芡荨掮岍悭慊骞搴褰缱椠肷愆钤虔箝",qiang:"枪呛腔羌墙蔷强抢嫱樯戗炝锖锵镪襁蜣羟跫跄",qiao:"橇锹敲悄桥瞧乔侨巧鞘撬翘峭俏窍劁诮谯荞愀憔缲樵毳硗跷鞒",qie:"切茄且怯窃郄唼惬妾挈锲箧",qin:"钦侵亲秦琴勤芹擒禽寝沁芩蓁蕲揿吣嗪噙溱檎螓衾",qing:"青轻氢倾卿清擎晴氰情顷请庆倩苘圊檠磬蜻罄箐謦鲭黥",qiong:"琼穷邛茕穹筇銎",qiu:"秋丘邱球求囚酋泅俅氽巯艽犰湫逑遒楸赇鸠虬蚯蝤裘糗鳅鼽",qu:"趋区蛆曲躯屈驱渠取娶龋趣去诎劬蕖蘧岖衢阒璩觑氍祛磲癯蛐蠼麴瞿黢",quan:"圈颧权醛泉全痊拳犬券劝诠荃獾悛绻辁畎铨蜷筌鬈",que:"缺炔瘸却鹊榷确雀阙悫",qun:"裙群逡",ran:"然燃冉染苒髯",rang:"瓤壤攘嚷让禳穰",rao:"饶扰绕荛娆桡",ruo:"惹若弱",re:"热偌",ren:"壬仁人忍韧任认刃妊纫仞荏葚饪轫稔衽",reng:"扔仍",ri:"日",rong:"戎茸蓉荣融熔溶容绒冗嵘狨缛榕蝾",rou:"揉柔肉糅蹂鞣",ru:"茹蠕儒孺如辱乳汝入褥蓐薷嚅洳溽濡铷襦颥",ruan:"软阮朊",rui:"蕊瑞锐芮蕤睿蚋",run:"闰润",sa:"撒洒萨卅仨挲飒",sai:"腮鳃塞赛噻",san:"三叁伞散彡馓氵毵糁霰",sang:"桑嗓丧搡磉颡",sao:"搔骚扫嫂埽臊瘙鳋",se:"瑟色涩啬铩铯穑",sen:"森",seng:"僧",sha:"莎砂杀刹沙纱傻啥煞脎歃痧裟霎鲨",shai:"筛晒酾",shan:"珊苫杉山删煽衫闪陕擅赡膳善汕扇缮剡讪鄯埏芟潸姗骟膻钐疝蟮舢跚鳝",shang:"墒伤商赏晌上尚裳垧绱殇熵觞",shao:"梢捎稍烧芍勺韶少哨邵绍劭苕潲蛸笤筲艄",she:"奢赊蛇舌舍赦摄射慑涉社设厍佘猞畲麝",shen:"砷申呻伸身深娠绅神沈审婶甚肾慎渗诜谂吲哂渖椹矧蜃",sheng:"声生甥牲升绳省盛剩胜圣丞渑媵眚笙",shi:"师失狮施湿诗尸虱十石拾时什食蚀实识史矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试谥埘莳蓍弑唑饣轼耆贳炻礻铈铊螫舐筮豕鲥鲺",shou:"收手首守寿授售受瘦兽扌狩绶艏",shu:"蔬枢梳殊抒输叔舒淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树束戍竖墅庶数漱恕倏塾菽忄沭涑澍姝纾毹腧殳镯秫鹬",shua:"刷耍唰涮",shuai:"摔衰甩帅蟀",shuan:"栓拴闩",shuang:"霜双爽孀",shui:"谁水睡税",shun:"吮瞬顺舜恂",shuo:"说硕朔烁蒴搠嗍濯妁槊铄",si:"斯撕嘶思私司丝死肆寺嗣四伺似饲巳厮俟兕菥咝汜泗澌姒驷缌祀祠锶鸶耜蛳笥",song:"松耸怂颂送宋讼诵凇菘崧嵩忪悚淞竦",sou:"搜艘擞嗽叟嗖嗾馊溲飕瞍锼螋",su:"苏酥俗素速粟僳塑溯宿诉肃夙谡蔌嗉愫簌觫稣",suan:"酸蒜算",sui:"虽隋随绥髓碎岁穗遂隧祟蓑冫谇濉邃燧眭睢",sun:"孙损笋荪狲飧榫跣隼",suo:"梭唆缩琐索锁所唢嗦娑桫睃羧",ta:"塌他它她塔獭挞蹋踏闼溻遢榻沓",tai:"胎苔抬台泰酞太态汰邰薹肽炱钛跆鲐",tan:"坍摊贪瘫滩坛檀痰潭谭谈坦毯袒碳探叹炭郯蕈昙钽锬覃",tang:"汤塘搪堂棠膛唐糖傥饧溏瑭铴镗耥螗螳羰醣",thang:"倘躺淌",theng:"趟烫",tao:"掏涛滔绦萄桃逃淘陶讨套挑鼗啕韬饕",te:"特",teng:"藤腾疼誊滕",ti:"梯剔踢锑提题蹄啼体替嚏惕涕剃屉荑悌逖绨缇鹈裼醍",tian:"天添填田甜恬舔腆掭忝阗殄畋钿蚺",tiao:"条迢眺跳佻祧铫窕龆鲦",tie:"贴铁帖萜餮",ting:"厅听烃汀廷停亭庭挺艇莛葶婷梃蜓霆",tong:"通桐酮瞳同铜彤童桶捅筒统痛佟僮仝茼嗵恸潼砼",tou:"偷投头透亠",tu:"凸秃突图徒途涂屠土吐兔堍荼菟钍酴",tuan:"湍团疃",tui:"推颓腿蜕褪退忒煺",tun:"吞屯臀饨暾豚窀",tuo:"拖托脱鸵陀驮驼椭妥拓唾乇佗坨庹沱柝砣箨舄跎鼍",wa:"挖哇蛙洼娃瓦袜佤娲腽",wai:"歪外",wan:"豌弯湾玩顽丸烷完碗挽晚皖惋宛婉万腕剜芄苋菀纨绾琬脘畹蜿箢",wang:"汪王亡枉网往旺望忘妄罔尢惘辋魍",wei:"威巍微危韦违桅围唯惟为潍维苇萎委伟伪尾纬未蔚味畏胃喂魏位渭谓尉慰卫倭偎诿隈葳薇帏帷崴嵬猥猬闱沩洧涠逶娓玮韪軎炜煨熨痿艉鲔",wen:"瘟温蚊文闻纹吻稳紊问刎愠阌汶璺韫殁雯",weng:"嗡翁瓮蓊蕹",wo:"挝蜗涡窝我斡卧握沃莴幄渥杌肟龌",wu:"巫呜钨乌污诬屋无芜梧吾吴毋武五捂午舞伍侮坞戊雾晤物勿务悟误兀仵阢邬圬芴庑怃忤浯寤迕妩骛牾焐鹉鹜蜈鋈鼯",xi:"昔熙析西硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭席习媳喜铣洗系隙戏细僖兮隰郗茜葸蓰奚唏徙饩阋浠淅屣嬉玺樨曦觋欷熹禊禧钸皙穸蜥蟋舾羲粞翕醯鼷",xia:"瞎虾匣霞辖暇峡侠狭下厦夏吓掀葭嗄狎遐瑕硖瘕罅黠",xian:"锨先仙鲜纤咸贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线冼藓岘猃暹娴氙祆鹇痫蚬筅籼酰跹",xiang:"相厢镶香箱襄湘乡翔祥详想响享项巷橡像向象芗葙饷庠骧缃蟓鲞飨",xiao:"萧硝霄削哮嚣销消宵淆晓小孝校肖啸笑效哓咻崤潇逍骁绡枭枵筱箫魈",xie:"楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻谢屑偕亵勰燮薤撷廨瀣邂绁缬榭榍歙躞",xin:"薪芯锌欣辛新忻心信衅囟馨莘歆铽鑫",xing:"星腥猩惺兴刑型形邢行醒幸杏性姓陉荇荥擤悻硎",xiong:"兄凶胸匈汹雄熊芎",xiu:"休修羞朽嗅锈秀袖绣莠岫馐庥鸺貅髹",xu:"墟戌需虚嘘须徐许蓄酗叙旭序畜恤絮婿绪续讴诩圩蓿怵洫溆顼栩煦砉盱胥糈醑",xuan:"轩喧宣悬旋玄选癣眩绚儇谖萱揎馔泫洵渲漩璇楦暄炫煊碹铉镟痃",xue:"靴薛学穴雪血噱泶鳕",xun:"勋熏循旬询寻驯巡殉汛训讯逊迅巽埙荀薰峋徇浔曛窨醺鲟",ya:"压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶伢揠吖岈迓娅琊桠氩砑睚痖",yan:"焉咽阉烟淹盐严研蜒岩延言颜阎炎沿奄掩眼衍演艳堰燕厌砚雁唁彦焰宴谚验厣靥赝俨偃兖讠谳郾鄢芫菸崦恹闫阏洇湮滟妍嫣琰晏胭腌焱罨筵酽魇餍鼹",yang:"殃央鸯秧杨扬佯疡羊洋阳氧仰痒养样漾徉怏泱炀烊恙蛘鞅",yao:"邀腰妖瑶摇尧遥窑谣姚咬舀药要耀夭爻吆崾徭瀹幺珧杳曜肴鹞窈繇鳐",ye:"椰噎耶爷野冶也页掖业叶曳腋夜液谒邺揶馀晔烨铘",yi:"一壹医揖铱依伊衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑易邑屹亿役臆逸肄疫亦裔意毅忆义益溢诣议谊译异翼翌绎刈劓佾诒圪圯埸懿苡薏弈奕挹弋呓咦咿噫峄嶷猗饴怿怡悒漪迤驿缢殪贻旖熠钇镒镱痍瘗癔翊衤蜴舣羿翳酏黟",yin:"茵荫因殷音阴姻吟银淫寅饮尹引隐印胤鄞堙茚喑狺夤氤铟瘾蚓霪龈",ying:"英樱婴鹰应缨莹萤营荧蝇迎赢盈影颖硬映嬴郢茔莺萦撄嘤膺滢潆瀛瑛璎楹鹦瘿颍罂",yo:"哟唷",yong:"拥佣臃痈庸雍踊蛹咏泳涌永恿勇用俑壅墉慵邕镛甬鳙饔",you:"幽优悠忧尤由邮铀犹油游酉有友右佑釉诱又幼卣攸侑莸呦囿宥柚猷牖铕疣蝣鱿黝鼬",yu:"迂淤于盂榆虞愚舆余俞逾鱼愉渝渔隅予娱雨与屿禹宇语羽玉域芋郁吁遇喻峪御愈欲狱育誉浴寓裕预豫驭禺毓伛俣谀谕萸蓣揄喁圄圉嵛狳饫庾阈妪妤纡瑜昱觎腴欤於煜燠聿钰鹆瘐瘀窳蝓竽舁雩龉",yuan:"鸳渊冤元垣袁原援辕园员圆猿源缘远苑愿怨院塬沅媛瑗橼爰眢鸢螈鼋",yue:"曰约越跃钥岳粤月悦阅龠樾刖钺",yun:"耘云郧匀陨允运蕴酝晕韵孕郓芸狁恽纭殒昀氲",za:"匝砸杂拶咂",zai:"栽哉灾宰载再在咱崽甾",zan:"攒暂赞瓒昝簪糌趱錾",zang:"赃脏葬奘戕臧",zao:"遭糟凿藻枣早澡蚤躁噪造皂灶燥唣缫",ze:"责择则泽仄赜啧迮昃笮箦舴",zei:"贼",zen:"怎谮",zeng:"增憎曾赠缯甑罾锃",zha:"扎喳渣札轧铡闸眨栅榨咋乍炸诈揸吒咤哳怍砟痄蚱齄",zhai:"摘斋宅窄债寨砦",zhan:"瞻毡詹粘沾盏斩辗崭展蘸栈占战站湛绽谵搌旃",zhang:"樟章彰漳张掌涨杖丈帐账仗胀瘴障仉鄣幛嶂獐嫜璋蟑",zhao:"招昭找沼赵照罩兆肇召爪诏棹钊笊",zhe:"遮折哲蛰辙者锗蔗这浙谪陬柘辄磔鹧褚蜇赭",zhen:"珍斟真甄砧臻贞针侦枕疹诊震振镇阵缜桢榛轸赈胗朕祯畛鸩",zheng:"蒸挣睁征狰争怔整拯正政帧症郑证诤峥钲铮筝",zhi:"芝枝支吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒卮陟郅埴芷摭帙忮彘咫骘栉枳栀桎轵轾攴贽膣祉祗黹雉鸷痣蛭絷酯跖踬踯豸觯",zhong:"中盅忠钟衷终种肿重仲众冢锺螽舂舯踵",zhou:"舟周州洲诌粥轴肘帚咒皱宙昼骤啄着倜诹荮鬻纣胄碡籀舳酎鲷",zhu:"珠株蛛朱猪诸诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注祝驻伫侏邾苎茱洙渚潴驺杼槠橥炷铢疰瘃蚰竺箸翥躅麈",zhua:"抓",zhuai:"拽",zhuan:"专砖转撰赚篆抟啭颛",zhuang:"桩庄装妆撞壮状丬",zhui:"椎锥追赘坠缀萑骓缒",zhun:"谆准",zhuo:"捉拙卓桌琢茁酌灼浊倬诼廴蕞擢啜浞涿杓焯禚斫",zi:"兹咨资姿滋淄孜紫仔籽滓子自渍字谘嵫姊孳缁梓辎赀恣眦锱秭耔笫粢觜訾鲻髭",zong:"鬃棕踪宗综总纵腙粽",zou:"邹走奏揍鄹鲰",zu:"租足卒族祖诅阻组俎菹啐徂驵蹴",zuan:"钻纂攥缵",zui:"嘴醉最罪",zun:"尊遵撙樽鳟",zuo:"昨左佐柞做作坐座阝阼胙祚酢",cou:"薮楱辏腠",nang:"攮哝囔馕曩",o:"喔",dia:"嗲",chuai:"嘬膪踹",cen:"岑涔",diu:"铥",nou:"耨",fou:"缶",bia:"髟"},j=function(){function a(){}return a.getPortraitChar=function(a){var b;return a.length&&(b=a.substr(0,1).toUpperCase()),b},a.getPortraitChar2=function(b){var c;return b&&(c=a.convertToABC(b.charAt(0)).pinyin.charAt(0).toUpperCase(),c=/[A-Z]/gi.test(c)?c:"~"),c},a.convertToABC=function(b){for(var c=/[0-9a-zA-Z\-]/,d={pinyin:"",first:""},e=0,f=b.length;e<f;e++){var g=b.substr(e,1);if(c.test(g))d.pinyin+=g,d.first+=g;else{var h=a.arraySearch(g)||"";d.pinyin+=h,d.first+=h.substr(0,1)}}return d},a.arraySearch=function(a){for(var b in i)if(-1!==i[b].indexOf(a))return b.substr(0,1).toUpperCase()+b.substr(1,b.length);return null},a}();a.ChineseCharacter=j;var k=function(){function a(){}return a.isNotificationSupported=function(){return"function"==typeof Notification||"object"==typeof Notification},a.requestPermission=function(){a.isNotificationSupported()&&Notification.requestPermission(function(a){})},a.onclick=function(a){},a.showNotification=function(b){if(!a.isNotificationSupported())return void console.log("the current browser does not support Notification API");if("granted"!==Notification.permission)return void console.log("the current page has not been granted for notification");if(document.hidden&&a.desktopNotification){var c=b.title;delete b.title;var d=new Notification(c,b);d.onshow=function(){setTimeout(function(){d.close()},5e3)},d.onclick=function(){window.focus(),a.onclick(d),d.close()},d.onerror=function(){},d.onclose=function(){}}},a.desktopNotification=!0,a}();a.NotificationHelper=k}(webimutil||(webimutil={}));var conversationDire=angular.module("webim.conversation.directive",["webim.main.server","webim.conversation.server"]);conversationDire.directive("atshowDire",function(){return{restrict:"A",require:"?ngModel",link:function(a,b,c,d){a.atShow=!1,a.initAtDiv(),b.bind("click",function(b){a.cursorPos=document.getSelection().focusOffset});var e=0;b.bind("keydown",function(b){if(a.atShow&&(38==b.keyCode||40==b.keyCode)){var c,d=$(b.target).parent().find("div.arobase>ul"),f=d.find(".selected");if(0==f.length&&(f=d.find("li:first-child")),f.length&&(38==b.keyCode?c=f.prev():40==b.keyCode&&(c=f.next()),c.length&&(f.removeClass("selected"),c.addClass("selected")),c&&c.position())){var g=$("#atList"),h=c.position().top;1==c.index()&&(e=0),h>=g.height()?(e+=36,g.scrollTop(e)):h<0&&(e-=36,g.scrollTop(e))}return void b.preventDefault()}}),b.bind("keyup",function(b){var c=b.keyCode,d=document.getElementById("message-content"),e=a.getCaretPosition(d);if(a.showGroupList){if(d.textContent.length>500&&8!=c)return void b.preventDefault();if(38==b.keyCode||40==b.keyCode)return void b.preventDefault();if("@"==d.textContent.substr(e-1,1)){var f="";if(e>1){f=d.textContent.substr(e-2,1);if(/^[A-Za-z0-9]+$/.test(f))return}a.atShow=!0;if(0==$(b.target).parent().find("div.arobase>ul").find(".selected").length){$("#atList").scrollTop(0);$("div.arobase").find("ul>li:first-child").addClass("selected")}a.searchStr=a.defaultSearch?a.lastSearchStr:"",a.cursorPos=e,a.$apply();var d=document.getElementById("message-content"),g=document.getElementById("TestInput"),h=window.getComputedStyle(d,null),i=d.clientWidth-80,j=document.getSelection(),k=d.textContent.slice(0,j.focusOffset);g.style.visibility="visible",g.innerText=k,g.style.fontSize=h.getPropertyValue("font-size"),g.style.fontFamily=h.getPropertyValue("font-family"),g.style.visibility="hidden";var l=(g.clientWidth+1)%i,m=(g.clientWidth+1)/i;a.showGroupList.length>6||a.showGroupList.length;$("div.arobase").css("bottom",d.clientHeight-m*g.clientHeight),$("div.arobase").css("left",l)}else{if(!a.atShow){var d=document.getElementById("message-content"),k=d.textContent.slice(0,e);return 8==c&&k.indexOf("@")>-1?a.delAtContent(e):16!==c&&(a.defaultSearch=!1),void a.$apply()}if(c>=48&&c<=57||c>=65&&c<=90||32==c||13==c){var k=d.textContent.slice(0,e),n=k.split("@");if(n.length>1){var o=n[n.length-1];a.searchStr=o,a.$apply()}}else 8==c&&a.searchStr?a.searchStr.length>0&&(a.searchStr=a.searchStr.substr(0,a.searchStr.length-1),a.$apply()):16!=c&&(a.atShow=!1,a.initAtDiv())}}})}}}),conversationDire.directive("tagInput",function(){return{restrict:"E",template:'<div class="input-tag" data-ng-repeat="tag in tagArray()">{{tag}}</div>',scope:{inputTags:"=taglist",autocomplete:"=autocomplete"},link:function(a,b,c){a.defaultWidth=200,a.autocomplete,a.tagArray=function(){return void 0===a.inputTags?[]:a.inputTags.split(",").filter(function(a){return""!==a})},a.addTag=function(){var b;if(0!==a.tagText.length)return b=a.tagArray(),b.push(a.tagText),a.inputTags=b.join(","),a.tagText=""},a.deleteTag=function(b){var c;return c=a.tagArray(),c.length>0&&0===a.tagText.length&&void 0===b?c.pop():void 0!==b&&c.splice(b,1),a.inputTags=c.join(",")},b.bind("keydown",function(b){var c;if(c=b.which,9!==c&&13!==c||b.preventDefault(),8===c)return a.$apply("deleteTag()")})}}}),conversationDire.directive("conversationItem",["$timeout",function(a){return{restrict:"EA",templateUrl:"assets/template/messagetemplate.html",scope:{item:"="},link:function(b,c,d){b.item.senderUserId&&a(function(){angular.element(c[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[b.item.senderUserId.charCodeAt(0)%webimutil.Helper.portraitColors.length])},50),b.sendReadReceiptRequestMessage=function(a){b.$parent.sendReadReceiptRequestMessage(a)}}}}]),conversationDire.directive("contenteditableDire",function(){return{restrict:"A",require:"?ngModel",link:function(a,b,c,d){function e(a){return a.replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f(){var a=b.html();a=a.replace(/^<br>$/i,""),a=a.replace(/<br>/gi,"\n"),a=e(a),c.stripBr&&"<br>"==a&&(a=""),d.$setViewValue(a)}var g,h=b[0];b.bind("input propertychange keydown",function(){g&&(new Date).getTime()-g>6e3?(a.sendTypingStatusMessage(),g=(new Date).getTime()):g||(g=(new Date).getTime(),a.sendTypingStatusMessage()),h.innerHTML==c.placeholder||""===h.innerHTML||"<br>"==h.innerHTML?b.empty():h.style.color=""}),d&&(b.bind("paste",function(a){var b="",c=!1,d=(a.clipboardData||a.originalEvent.clipboardData).items;if(d)for(var e=0;e<d.length;e++){var f=d[e];if(f.type.indexOf("image")>-1){c=!0;break}}a.preventDefault(),c||((a.originalEvent||a).clipboardData?(b=(a.originalEvent||a).clipboardData.getData("text/plain"),document.execCommand("insertText",!1,b)):window.clipboardData&&(b=window.clipboardData.getData("Text"),document.selection.createRange().pasteHTML(b)))}),d.$render=function(){b.html(d.$viewValue||"")},webimutil.Helper.browser.msie?b.bind("keyup paste",f):b.bind("input",f))}}}),conversationDire.directive("preplaceholderasdfrs",[function(){return{}}]),conversationDire.directive("ctrlEnterKeys",["$timeout","mainDataServer","conversationServer",function(a,b,c){return{restrict:"A",require:"?ngModel",scope:{fun:"&",ctrlenter:"=",content:"="},link:function(a,b,c,d){a.ctrlenter=a.ctrlenter||!1,b.bind("keypress",function(b){a.ctrlenter?(!0===b.ctrlKey&&13===b.keyCode||10===b.keyCode)&&(a.fun(),a.$parent.$apply(),b.preventDefault()):!1!==b.ctrlKey||!1!==b.shiftKey||13!==b.keyCode&&10!==b.keyCode?!0===b.ctrlKey&&13===b.keyCode||b.keyCode:(a.fun(),a.$parent.$apply(),b.preventDefault())})}}}]),conversationDire.directive("emoji",[function(){return{restrict:"E",scope:{item:"=",content:"="},template:'<div style="display:inline-block"></div>',replace:!0,link:function(a,b,c){b.append(a.item),b.on("click",function(){a.$parent.currentConversation.draftMsg=a.$parent.currentConversation.draftMsg.replace(/\n$/,""),a.$parent.currentConversation.draftMsg=a.$parent.currentConversation.draftMsg+a.item.children[0].getAttribute("name"),a.$parent.$apply();var b=document.getElementById("message-content");webimutil.Helper.getFocus(b)}),webimutil.Helper.os.mac?webimutil.Helper.browser.safari&&angular.element(b[0]).css("padding-top","5px"):(angular.element(b[0]).css("padding-bottom","5px"),angular.element(b[0]).css("padding-right","4px"))}}}]),conversationDire.directive("voiceMessage",["$timeout",function(a){return{restrict:"E",scope:{item:"="},template:'<div class=""><div class="Message-audio"><span class="Message-entry" style=""><span class="audioBox clearfix"  ng-class="{\'animate\':isplaying}" ng-click="play()"><i></i><i></i><i></i><i></i></span><span class="audioTimer">{{item.duration}}”</span><span class="audioState" ng-show="item.isUnReade"></span></span></div></div>',link:function(b,c,d){b.item.duration=parseInt(b.item.duration||b.item.content.length/1024),RongIMLib.RongIMVoice.preLoaded(b.item.content),b.play=function(){RongIMLib.RongIMVoice.stop(),b.isplaying?(b.isplaying=!1,a.cancel(b.timeoutid)):(b.item.isUnReade=!1,RongIMLib.RongIMVoice.play(b.item.content,b.item.duration),b.isplaying=!0,b.timeoutid&&a.cancel(b.timeoutid),b.timeoutid=a(function(){b.isplaying=!1},1e3*b.item.duration))}}}}]),conversationDire.directive("textMessage",[function(){return{restrict:"E",scope:{item:"=",message:"="},template:'<div class="" id="{{message.messageUId}}"><div class="Message-text"><pre class="Message-entry" ng-bind-html="content|trustHtml"></pre><br></span></div></div>',replace:!0,link:function(a,b,c){var d=/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/gi,e=[],f=!1;a.isAtAll=!1,a.isAtPart=!1,a.$parent.item.mentionedInfo&&a.$parent.item.mentionedInfo.type==webimmodel.AtTarget.All&&(a.isAtAll=!0),a.$parent.item.mentionedInfo&&a.$parent.item.mentionedInfo.type==webimmodel.AtTarget.Part&&(a.isAtPart=!0),a.itemid=a.$parent.item.messageUId,a.content=a.item.content.replace(d,function(a){return e.push(a),"[email`"+(e.length-1)+"]"});var g=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi;a.content=a.content.replace(g,function(a,b){return b?'<a target="_blank" href="'+a+'">'+a+"</a>":'<a target="_blank" href="//'+a+'">'+a+"</a>"});for(var h=0,i=e.length;h<i;h++)a.content=a.content.replace("[email`"+h+"]",'<a href="mailto:'+e[h]+'">'+e[h]+"<a>");a.sendReadReceiptRequestMessage=function(){a.$parent.sendReadReceiptRequestMessage(a.message.messageUId)},a.message.receiptResponse||a.message.conversationType!=webimmodel.conversationType.Group||a.message.messageDirection!=webimmodel.MessageDirection.SEND||(f=!0),a.requestShow=f,$(b).contextmenu(function(a){return console.log("显示右键菜单",a.which,a.currentTarget.id,a),!1})}}}]),conversationDire.directive("imageMessage",[function(){return{restrict:"E",scope:{item:"="},template:'<div class="" id={{itemid}}><div class="Message-img"><span id="{{\'rebox_\'+$id}}" ng-click="showBigImage()"   class="Message-entry gallery" style="">\x3c!-- <p>发给您一张示意图</p> --\x3e<a><img ng-src="{{getImageContent()}}"  data-image="{{item.imageUri}}" alt=""/></a></span></div></div>',link:function(a,b,c){var d=new Image;a.itemid=a.$parent.item.messageUId,d.src=a.item.imageUri,a.getImageContent=function(){var b=a.item,c=b.imageUri;return-1!==c.indexOf(".gif")?c:b.content||"../../static/images/barBg.png"},a.showBigImage=function(){webimutil.Helper.showBigImage(a.item.imageUri)}}}}]),conversationDire.directive("bigImage",[function(){return{restrict:"E",scope:{show:"=",imagesrc:"="},template:'<div class="bigimage-background"><div class="bigimage"><img src="imagesrc"></img></div></div>',link:function(a,b,c){}}}]),conversationDire.directive("richcontentMessage",[function(){return{restrict:"E",scope:{item:"="},template:'    <a href="{{item.url}}" target="_blank"><div class="" ><div class="Message-image-text"><span class="Message-entry" style=""><div class="image-textBox"><h4>{{item.title}}</h4><div class="cont clearfix"><img ng-src="{{item.imageUri||\'assets/img/imageText.png\'}}" alt=""/><div>{{item.content}}</div></div></div></span></div></div></a>'}}]),conversationDire.directive("locationMessage",[function(){return{restrict:"E",scope:{item:"="},template:' <div class=""><div class="Message-map"><span class="Message-entry" style=""><div class="mapBox"><img ng-src="{{item.content||\'assets/img/barBg.png\'}}" alt=""/><span>{{item.poi}}</span></div></span></div></div>'}}]),conversationDire.directive("fileMessage",[function(){return{restrict:"E",scope:{item:"="},template:'<div class="" id="{{itemid}}"><div class="upload_file"><div class="out_border"><div class="file_type fl"><img ng-src="{{imgType}}"></div><div class="file_name fl"><p class="p1">{{showName}}</p><p class="p2">{{showSize}}</p><div class="up_process"><div></div></div></div><a ng-show="isover" href="{{item.fileUrl}}" download><div class="file_btn fr"></div></a><div ng-show="isuploading" class="file_btn_close fr" ng-click="Cancel()"></div></div></div></div>',link:function(a,b,c){function d(a){return null==a?0:("string"!=typeof a&&(a+=""),a.replace(/[^\x00-\xff]/g,"01").length)}function e(a,b,c){var d="",e=0;if(c)for(var f=0;f<a.length&&e<b;f++)a.charCodeAt(f)>127||94==a.charCodeAt(f)?e+=2:e++,d+=a[f];else for(var f=a.length-1;f>-1&&e<b;f--)a.charCodeAt(f)>127||94==a.charCodeAt(f)?e+=2:e++,d=a[f]+d;return d}function f(a){return Math.ceil(100*a)/100}function g(){switch(a.isover=a.item.state==webimmodel.FileState.Success,a.isuploading=a.item.state==webimmodel.FileState.Uploading||-1==a.item.state,a.item.state){case webimmodel.FileState.Canceled:i="已取消",angular.element(b[0].getElementsByClassName("up_process")[0]).css("display","none");break;case webimmodel.FileState.Failed:i="上传失败",angular.element(b[0].getElementsByClassName("up_process")[0]).css("display","none");break;case-1:case webimmodel.FileState.Uploading:var c=a.item.size/1024;i=c>=1024?f(c/1024)+" M":f(c)+" K",angular.element(b[0].getElementsByClassName("up_process")[0]).css("display","block"),angular.element(b[0].getElementsByClassName("up_process")[0].children[0]).css("width",a.item.extra);break;case webimmodel.FileState.Success:var c=a.item.size/1024;i=c>=1024?f(c/1024)+" M":f(c)+" K",angular.element(b[0].getElementsByClassName("up_process")[0].children[0]).css("width","100%"),angular.element(b[0].getElementsByClassName("up_process")[0]).css("display","none"),"function"!=typeof p&&"object"!=typeof p||p(),b[0].getElementsByClassName("file_btn")[0].parentElement.href=a.item.fileUrl}a.showSize=i}var h="undefined",i="",j="",k=20;j=a.item.name,window.Electron&&angular.element(b[0].getElementsByTagName("a")[0]).attr("target","_blank");var l=d(j),m=a.item.name.replace(/.+\./,"");if(l>k){var n=a.item.name.substr(0,a.item.name.lastIndexOf(".")),o=k-10-3-m.length-1;j=e(n,10,!0),j+="...",j+=e(n,o,!1),j=j+"."+m}if(a.showName=j,a.itemid=a.$parent.item.messageUId,a.Cancel=function(){a.item.state=1;var b=a.$parent.$parent.$parent.$parent.uploads[a.itemid];b&&b.cancel()},a.Download=function(){},a.item.type)switch(a.item.type.toLowerCase()){case"doc":case"mp3":case"mp4":case"txt":case"xlsx":case"pdf":h=a.item.type.toLowerCase();break;case"bmp":case"cod":case"gif":case"ief":case"jpe":case"jpeg":case"jpg":case"jfif":case"svg":case"tif":case"tiff":case"ras":case"ico":case"pbm":case"pgm":case"png":case"pnm":case"xbm":case"xpm":case"xwd":case"rgb":h="pic";break;case"docx":case"dot":h="doc";break;case"xls":case"xla":case"xlc":case"xlm":case"xlt":case"xlw":h="xlsx";break;case"wav":case"wma":case"au":case"snd":case"mid":case"rmi":case"aif":case"aifc":case"aiff":case"m3u":case"ra":case"ram":h="mp3";break;case"avi":case"rmvb":case"mp2":case"mpa":case"mpe":case"mpeg":case"mpg":case"mpv2":case"mov":case"qt":case"lsf":case"lsx":case"asf":case"asr":case"asx":case"avi":case"movie":case"wmv":h="mp4";break;case"log":case"html":case"stm":case"uls":case"bas":case"c":case"h":case"rtx":case"sct":case"tsv":case"htt":case"htc":case"etx":case"vcf":h="txt"}h="assets/img/"+h+".png",a.imgType=h,g();var p=a.$watch("item.state",function(a,b){a!==b&&g()});$(b).contextmenu(function(a){return console.log("显示右键菜单",a.which,a.currentTarget.firstChild.id,a),!1})}}}]),conversationDire.directive("dateMessage",[function(){return{restrict:"E",scope:{date:"="},template:'<div class="Messages-date"><b style="cursor: default;">{{date|historyTime}}</b></div>',link:function(a,b,c){}}}]),conversationDire.directive("getHistoryMessage",[function(){return{restrict:"E",scope:{myclick:"&"},template:'<div class="Messages-getHistory"><b ng-click="myclick()" class="" style="cursor: pointer;">查看历史消息</b></div>',link:function(a,b,c){}}}]),conversationDire.directive("getMoreMessage",[function(){return{restrict:"E",scope:{myclick:"&"},template:'<div class="Messages-getHistory"><b ng-click="myclick()" class="" style="cursor: pointer;">获取更多历史消息</b></div>'}}]);var __extends=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},webimmodel;!function(a){var b=function(){function a(a){a&&(this.title=a.title,this.targetId=a.targetId,this.targetType=a.targetType,this.lastTime=a.lastTime,this.lastMsg=a.lastMsg,this.unReadNum=a.unReadNum,this.draftMsg=a.draftMsg,this.firstchar=a.firstchar)}return a.prototype.setpinying=function(a){this.pinyin=a.pinyin,this.everychar=a.everychar},a.convertToWebIM=function(b,c){var d;b.latestMessage&&b.sentTime&&(d=new Date(b.sentTime));var e="";return b.latestMessage&&(e=g.messageToNotification(b.latestMessage,c,!1)),new a({title:b.conversationTitle||"",targetId:b.targetId||"",targetType:b.conversationType||"",lastTime:d||new Date,lastMsg:e||"",unReadNum:b.unreadMessageCount,draftMsg:b.draft||""})},a}();a.Conversation=b,function(a){a[a.SEND=1]="SEND",a[a.RECEIVE=2]="RECEIVE"}(a.MessageDirection||(a.MessageDirection={}));a.MessageDirection;!function(a){a[a.READ=1]="READ",a[a.LISTENED=2]="LISTENED",a[a.DOWNLOADED=4]="DOWNLOADED"}(a.ReceivedStatus||(a.ReceivedStatus={}));a.ReceivedStatus;!function(a){a[a.SENDING=10]="SENDING",a[a.FAILED=20]="FAILED",a[a.SENT=30]="SENT",a[a.RECEIVED=40]="RECEIVED",a[a.READ=50]="READ",a[a.DESTROYED=60]="DESTROYED"}(a.SentStatus||(a.SentStatus={}));a.SentStatus;!function(a){a[a.Message=1]="Message",a[a.InformationNotification=2]="InformationNotification",a[a.System=103]="System",a[a.Time=104]="Time",a[a.getHistory=105]="getHistory",a[a.getMore=106]="getMore",a[a.Other=0]="Other"}(a.PanelType||(a.PanelType={}));var c=a.PanelType;!function(a){a[a.All=1]="All",a[a.Part=2]="Part"}(a.AtTarget||(a.AtTarget={}));a.AtTarget;a.MessageType={DiscussionNotificationMessage:"DiscussionNotificationMessage",TextMessage:"TextMessage",ImageMessage:"ImageMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",UnknownMessage:"UnknownMessage",SuspendMessage:"SuspendMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",ReadReceiptMessage:"ReadReceiptMessage",TypingStatusMessage:"TypingStatusMessage",FileMessage:"FileMessage",GroupNotificationMessage:"GroupNotificationMessage",RecallCommandMessage:"RecallCommandMessage",InviteMessage:"InviteMessage",HungupMessage:"HungupMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",SyncReadStatusMessage:"SyncReadStatusMessage"},function(a){a[a.Private=1]="Private",a[a.Discussion=2]="Discussion",a[a.Group=3]="Group",a[a.ChartRoom=4]="ChartRoom",a[a.CustomerService=5]="CustomerService",a[a.System=6]="System",a[a.AppPublicService=7]="AppPublicService",a[a.PublicService=8]="PublicService"}(a.conversationType||(a.conversationType={}));a.conversationType;!function(a){a[a.ApplyFriend=1]="ApplyFriend",a[a.AgreedFriend=2]="AgreedFriend",a[a.WarningNotice=101]="WarningNotice",a[a.System=102]="System"}(a.NoticePanelType||(a.NoticePanelType={}));var d=a.NoticePanelType;!function(a){a[a.Requesting=10]="Requesting",a[a.Requested=11]="Requested",a[a.Agreed=20]="Agreed",a[a.Ignored=21]="Ignored",a[a.Deleted=30]="Deleted",a[a.GroupNotification=101]="GroupNotification"}(a.FriendStatus||(a.FriendStatus={}));a.FriendStatus;!function(a){a[a.ApplyGroup=1]="ApplyGroup",a[a.InviteAddGroup=2]="InviteAddGroup",a[a.KickOutGroup=3]="KickOutGroup",a[a.AcceptApplyGroup=101]="AcceptApplyGroup",a[a.RejectApplyGroup=102]="RejectApplyGroup",a[a.AcceptInviteAddGroup=201]="AcceptInviteAddGroup",a[a.RejectInviteAddGroup=202]="RejectInviteAddGroup"}(a.CommandNotificationMessageType||(a.CommandNotificationMessageType={}));a.CommandNotificationMessageType;!function(a){a[a.Uploading=0]="Uploading",a[a.Canceled=1]="Canceled",a[a.Failed=2]="Failed",a[a.Success=3]="Success"}(a.FileState||(a.FileState={}));var e=a.FileState,f=function(){function a(a){this.panelType=a}return a}();a.ChatPanel=f;var g=function(b){function f(a,d,e,f,g,h,i,j,k,l,m,n,o){b.call(this,c.Message)}return __extends(f,b),f.formatGIFMsg=function(a){if("RC:GIFMsg"==a.objectName&&"UnknownMessage"==a.messageType){a.objectName="RC:ImgMsg";var b=a.content,c=b.message,d=c.content;a.content=new RongIMLib.ImageMessage({content:d.remoteUrl,imageUri:d.remoteUrl}),a.messageType="ImageMessage"}return a},f.convertMsg=function(b){var c=new f;switch(c.conversationType=b.conversationType,c.extra=b.extra,c.objectName=b.objectName,c.messageDirection=b.messageDirection,c.messageId=b.messageId,c.messageUId=b.messageUId,c.receivedStatus=b.receivedStatus,c.receivedTime=new Date(b.receivedTime),c.senderUserId=b.senderUserId,c.sentStatus=b.sendStatusMessage,c.sentTime=new Date(b.sentTime),c.targetId=b.targetId,c.messageType=b.messageType,c.messageType){case a.MessageType.TextMessage:var g=new j,k=b.content.content;k=k.replace(/</gi,"&lt;").replace(/>/gi,"&gt;"),RongIMLib.RongIMEmoji&&RongIMLib.RongIMEmoji.emojiToHTML&&(k=RongIMLib.RongIMEmoji.emojiToHTML(k)),g.content=k,c.content=g,c.mentionedInfo=b.content.mentionedInfo,c.receiptResponse=b.receiptResponse;break;case a.MessageType.ImageMessage:var p=new l,k=b.content.content||"";"string"==typeof k&&-1==k.indexOf("base64,")&&-1==k.indexOf("http")&&(k="data:image/png;base64,"+k),p.content=k,p.imageUri=b.content.imageUri,c.content=p;break;case a.MessageType.VoiceMessage:var r=new m;r.content=b.content.content,r.duration=b.content.duration,c.content=r;break;case a.MessageType.RichContentMessage:var s=new o;s.content=b.content.content,s.title=b.content.title,s.imageUri=b.content.imageUri,s.url=b.content.url,c.content=s;break;case a.MessageType.LocationMessage:var t=new n,k=b.content.content||"";"string"==typeof k&&-1==k.indexOf("base64,")&&(k="data:image/png;base64,"+k),t.content=k,t.latiude=b.content.latiude,t.longitude=b.content.longitude,t.poi=b.content.poi,c.content=t;break;case a.MessageType.FileMessage:var u=new q,k=b.content.content||"";u.name=b.content.name,u.size=b.content.size,u.type=b.content.type,u.fileUrl=b.content.fileUrl,u.extra=b.content.extra,u.state=e.Success,c.content=u;break;case a.MessageType.InformationNotificationMessage:c.content=b.content.message,c.panelType=a.PanelType.InformationNotification;break;case a.MessageType.ContactNotificationMessage:var v=new h;switch(v.content=b.content.message,v.operation=b.content.operation,v.sourceUserId=b.content.sourceUserId,v.targetUserId=b.content.targetUserId,v.message=b.content.content,v.operation){case"Request":v.noticeType=d.ApplyFriend;break;case"AcceptResponse":v.noticeType=d.AgreedFriend,v.content="同意加为好友";break;case"RejectResponse":console.log("拒绝好友通知消息未支持")}c.content=v;break;case a.MessageType.CommandNotificationMessage:var w=new i;w.noticeType=d.WarningNotice,w.data=b.content.data,w.name=b.content.name,c.content=w;break;case a.MessageType.DiscussionNotificationMessage:if("RC:DizNtf"==b.objectName){var x=new a.InformationNotificationMessage;x.content=b.content.message,c.content=x,c.panelType=a.PanelType.InformationNotification}else console.log("has unknown message type "+b.messageType);break;case a.MessageType.ReadReceiptMessage:case a.MessageType.TypingStatusMessage:break;case a.MessageType.RecallCommandMessage:c.content="撤回了一条消息",c.panelType=a.PanelType.InformationNotification;break;case a.MessageType.InviteMessage:case a.MessageType.HungupMessage:c.content="当前版本暂不支持查看此消息",c.panelType=a.PanelType.InformationNotification;break;case a.MessageType.ReadReceiptRequestMessage:c.content=b.content.messageUId;break;case a.MessageType.ReadReceiptResponseMessage:c.content=b.content.receiptMessageDic,c.receiptResponse=b.receiptResponse;break;case a.MessageType.SyncReadStatusMessage:break;default:if("ST:GrpNtf"==b.objectName){var x=new a.InformationNotificationMessage;x.content=b.content.message,c.content=x,c.panelType=a.PanelType.InformationNotification}else"RC:RLStart"==b.objectName||"RC:RL"==b.objectName||"RC:RcCmd"==b.objectName||(c.content="当前版本暂不支持查看此消息",c.panelType=a.PanelType.InformationNotification,console.log("has unknown message type "+b.messageType))}return c.content&&(c.content.userInfo=b.content.userInfo),c},f.messageToNotification=function(b,c,d){if(!b)return null;var e,f=b.messageType
  ;if(f==a.MessageType.ImageMessage||"RC:GIFMsg"==b.objectName)e="[图片]";else if(f==a.MessageType.LocationMessage)e="[位置]";else if(f==a.MessageType.RichContentMessage)e="[图文]";else if(f==a.MessageType.VoiceMessage)e="[语音]";else if(f==a.MessageType.FileMessage)e="[文件] "+b.content.name;else if(f==a.MessageType.ContactNotificationMessage||f==a.MessageType.CommandNotificationMessage||f==a.MessageType.InformationNotificationMessage)e="[通知消息]";else if("ST:GrpNtf"==b.objectName){var g=b.content.data;switch(b.content.operation){case"Add":e=b.content.operatorUserId==c?g.targetUserDisplayNames?"你邀请"+g.targetUserDisplayNames.join("、")+"加入了群组":"加入群组":g.targetUserDisplayNames?g.operatorNickname+"邀请"+g.targetUserDisplayNames.join("、")+"加入了群组":"加入群组";break;case"Quit":e=g.operatorNickname+"退出了群组";break;case"Kicked":e=b.content.operatorUserId==c?g.targetUserDisplayNames?"你将"+g.targetUserDisplayNames.join("、")+"移出了群组":"移除群组":g.targetUserDisplayNames?g.operatorNickname+"将"+g.targetUserDisplayNames.join("、")+"移出了群组":"移除群组";break;case"Rename":e=b.content.operatorUserId==c?"你修改群名称为"+g.targetGroupName:g.operatorNickname+"修改群名称为"+g.targetGroupName;break;case"Create":e=b.content.operatorUserId==c?"你创建了群组":g.operatorNickname+"创建了群组";break;case"Dismiss":e=g.operatorNickname+"解散了群组",g.targetGroupName&&(e+=g.targetGroupName)}}else if("RC:DizNtf"==b.objectName){var g=b;switch(b.content.type){case 1:e=" 加入了讨论组";break;case 2:e=" 退出了讨论组";break;case 4:e=" 被踢出讨论组";break;case 3:e=" 修改了讨论组名称"}}else f==a.MessageType.TextMessage?(e=b.content?b.content.content:"",e=webimutil.Helper.escapeSymbol.escapeHtml(e),d?(e=RongIMLib.RongIMEmoji.emojiToSymbol(e),webimutil.Helper.os.mac&&(e=RongIMLib.RongIMEmoji.symbolToEmoji(e))):RongIMLib.RongIMEmoji&&RongIMLib.RongIMEmoji.emojiToHTML&&(e=RongIMLib.RongIMEmoji.emojiToHTML(e)),e=e.replace(/\n/g," "),e=e.replace(/([\w]{49,50})/g,"$1 ")):e=f==a.MessageType.RecallCommandMessage?"撤回一条消息":"[当前版本暂不支持查看此消息]";return e},f}(f);a.Message=g;var h=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b}(g);a.ContactNotificationMessage=h;var i=function(a){function b(){a.apply(this,arguments)}return __extends(b,a),b}(g);a.CommandNotificationMessage=i;var j=function(){function a(a){a=a||{},this.content=a.content,this.userInfo=a.userInfo}return a}();a.TextMessage=j;var k=function(){function a(){}return a}();a.InformationNotificationMessage=k;var l=function(){function a(){}return a}();a.ImageMessage=l;var m=function(){function a(){}return a}();a.VoiceMessage=m;var n=function(){function a(){}return a}();a.LocationMessage=n;var o=function(){function a(){}return a}();a.RichContentMessage=o;var p=function(){function a(){}return a}();a.DiscussionNotificationMessage=p;var q=function(){function a(){}return a}();a.FileMessage=q;var r=function(){function a(){}return a}();a.ReadReceiptRequestMessage=r;var s=function(){function a(){}return a}();a.ReadReceiptResponseMessage=s;var t=function(a){function b(){a.call(this,c.getHistory)}return __extends(b,a),b}(f);a.GetHistoryPanel=t;var u=function(a){function b(){a.call(this,c.getMore)}return __extends(b,a),b}(f);a.GetMoreMessagePanel=u;var v=function(a){function b(b){a.call(this,c.Time),this.sendTime=b}return __extends(b,a),b}(f);a.TimePanl=v;var w=function(){function b(b){this.content=b,this.status=a.FriendStatus.GroupNotification}return b}();a.WarningNoticeMessage=w;var x=function(){function a(a){this.id=a.id,this.name=a.name,this.portraitUri=a.portraitUri,this.content=a.content,this.status=a.status,this.timestamp=a.timestamp}return a}();a.NotificationFriend=x;var y=function(){function a(a,b,c,d,e,f,g){this.id=a,this.token=b,this.nickName=c,this.portraitUri=d,this.phone=e,this.region=f,this.firstchar=g}return a}();a.UserInfo=y;var z=function(){function a(a){this.id=a.id,this.name=a.name,this.imgSrc=a.imgSrc}return a.prototype.setpinying=function(a){this.pinyin=a.pinyin,this.everychar=a.everychar,this.firstchar=a.firstchar},a}();a.Contact=z;var A=function(a){function b(b){a.call(this,b)}return __extends(b,a),b}(z);a.Friend=A;var B=function(){function a(a,b){this.title=a,this.list=b}return a}();a.Subgroup=B;var C=function(a){function b(b){a.call(this,b),this.upperlimit=b.upperlimit,this.fact=b.fact,this.creater=b.creater,this.memberList=[]}return __extends(b,a),b}(z);a.Group=C;var D=function(a){function b(b){a.call(this,b),this.upperlimit=b.upperlimit,this.fact=b.fact,this.creater=b.creater,this.memberList=[]}return __extends(b,a),b}(z);a.Discussion=D;var E=function(a){function b(b){a.call(this,b),this.role=b.role}return __extends(b,a),b}(z);a.Member=E}(webimmodel||(webimmodel={}));var conversationServer=angular.module("webim.conversation.server",[]);conversationServer.factory("conversationServer",["$q","mainDataServer","mainServer","RongIMSDKServer",function(a,b,c,d){function e(a,c){var d=a.content,e="",f=d.operatorUserId==b.loginUser.id;switch(d.operation){case"Add":e=f?"你邀请"+d.data.data.targetUserDisplayNames.join("、")+"加入了群组":d.data.data.operatorNickname+"邀请"+d.data.data.targetUserDisplayNames.join("、")+"加入了群组",d.data.data.targetUserIds;break;case"Quit":e=d.data.data.targetUserDisplayNames.join("、")+"退出了群组",d.data.data.targetUserIds;break;case"Kicked":e=f?"你将"+d.data.data.targetUserDisplayNames.join("、")+" 移出了群组":d.data.data.operatorNickname+"将"+d.data.data.targetUserDisplayNames.join("、")+" 移出了群组",d.data.data.targetUserIds;break;case"Rename":e=f?"你修改名称为"+d.data.data.targetGroupName:d.data.data.operatorNickname+"修改群名称为"+d.data.data.targetGroupName;break;case"Create":e=d.operatorUserId==b.loginUser.id?"你创建了群组":d.data.data.operatorNickname+"创建了群组";break;case"Dismiss":e=d.data.data.operatorNickname+"解散了群组";break;default:console.log("未知群组通知")}c.content=e}function f(a,b){var d=a,e="",f=[];switch(d.content.type){case 1:e=" 加入讨论组",f=d.content.extension.split(",");break;case 2:e=" 退出讨论组",f=d.content.extension.split(",");break;case 4:e=" 被踢出讨论组",f=d.content.extension.split(",");break;case 3:e=" 讨论组更名";break;default:console.log("未知讨论组通知")}b.content=e,c.user.getBatchInfo(f).then(function(a){for(var c=a.data.result,d=[],e=0,f=c.length;e<f;e++)d.push(c[e].nickname);d&&(b.content=d.join("、")+b.content)})}function g(b,c,d,e){var f=a.defer(),g=c,h=b;return w.historyMessagesCache[g+"_"+h]||(w.historyMessagesCache[g+"_"+h]=[]),f.promise}function h(a,b,c){var d=w.historyMessagesCache[b+"_"+a]||[];d[0]&&c.messageUId&&c.messageUId===d[0].messageUId||(d[0]&&d[0].sentTime&&d[0].panelType!=webimmodel.PanelType.Time&&c.sentTime&&l(d[0].sentTime,c.sentTime)&&d.unshift(new webimmodel.TimePanl(d[0].sentTime)),p(c),d.unshift(c))}function i(a,b){for(var c=w.historyMessagesCache[b+"_"+a],d=0,e=c.length-1;e>-1;e--)if(c[e].panelType==webimmodel.PanelType.Message&&d++,d>=w.remainMessageCount&&c[e].panelType==webimmodel.PanelType.Time){c.splice(0,e),w.unshiftHistoryMessages(a,b,new webimmodel.GetMoreMessagePanel);break}}function j(a,b){for(var c=w.historyMessagesCache[b+"_"+a],d=0,e=0;e<c.length;e++)if(c[e].panelType==webimmodel.PanelType.Message){d=new Date(c[e].sentTime).getTime();break}return d}function k(a,b,c){var d=w.historyMessagesCache[b+"_"+a];if(d)for(var e=0;e<d.length;e++)if(d[e].panelType==webimmodel.PanelType.Message&&d[e].messageUId==c){e>0&&e<d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time&&d[e+1].panelType==webimmodel.PanelType.Time||e==d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time?d.splice(e-1,2):d.splice(e,1);break}if(d=w.conversationMessageList)for(var e=0;e<d.length;e++)if(d[e].panelType==webimmodel.PanelType.Message&&d[e].messageUId==c){e>0&&e<d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time&&d[e+1].panelType==webimmodel.PanelType.Time||e==d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time?d.splice(e-1,2):d.splice(e,1);break}if(d=w.conversationMessageListShow)for(var e=0;e<d.length;e++)if(d[e].panelType==webimmodel.PanelType.Message&&d[e].messageUId==c){e>0&&e<d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time&&d[e+1].panelType==webimmodel.PanelType.Time||e==d.length-1&&d[e-1].panelType==webimmodel.PanelType.Time?d.splice(e-1,2):d.splice(e,1);break}}function l(a,b){if("[object Date]"==Object.prototype.toString.call(a)&&"[object Date]"==Object.prototype.toString.call(b)){var c=a.toString(),d=b.toString();return c.substring(0,c.lastIndexOf(":"))!=d.substring(0,d.lastIndexOf(":"))}return!1}function m(a,c,d){var e=w.historyMessagesCache[c+"_"+a]||[];if(r(a,c,d.messageUId))return void console.log("exist离线消息有重复");e[e.length-1]&&e[e.length-1].panelType!=webimmodel.PanelType.Time&&e[e.length-1].sentTime&&d.sentTime&&l(e[e.length-1].sentTime,d.sentTime)&&(e.push(new webimmodel.TimePanl(d.sentTime)),c==b.conversation.currentConversation.targetType&&a==b.conversation.currentConversation.targetId&&w.conversationMessageListShow.push(new webimmodel.TimePanl(d.sentTime))),p(d),e.push(d),w.conversationMessageListShow.push(d),console.log("输出消息列表，消息已发出",w.conversationMessageListShow)}function n(a,b,c){w.atMessagesCache[b+"_"+a]||(w.atMessagesCache[b+"_"+a]=[]);var d={messageUId:c.messageUId,mentionedInfo:c.mentionedInfo};w.atMessagesCache[b+"_"+a].push(d)}function o(a,b,c){w.withDrawMessagesCache[b+"_"+a]||(w.withDrawMessagesCache[b+"_"+a]=[]),w.withDrawMessagesCache[b+"_"+a].push(c)}function p(a){if(!a.senderUserId)return a;var c;if(1==a.messageDirection)a.senderUserName=b.loginUser.nickName,a.imgSrc=b.loginUser.portraitUri,a.senderUserImgSrc=b.loginUser.firstchar;else{switch(a.conversationType){case webimmodel.conversationType.Private:c=b.contactsList.getFriendById(a.senderUserId),c||(c=b.contactsList.getNonFriendById(a.senderUserId));break;case webimmodel.conversationType.Group:c=b.contactsList.getGroupMember(a.targetId,a.senderUserId);break;case webimmodel.conversationType.Discussion:c=b.contactsList.getDiscussionMember(a.targetId,a.senderUserId);break;case webimmodel.conversationType.System:c=new webimmodel.Contact,c.name="系统消息";break;default:console.log("暂不支持此会话类型")}if(c)a.senderUserName=c.displayName||c.name,a.senderUserImgSrc=c.firstchar,a.imgSrc=c.imgSrc;else{if("__system__"==a.senderUserId)return;a.senderUserName="企业用户",a.senderUserImgSrc=webimutil.ChineseCharacter.getPortraitChar("企业用户"),a.imgSrc="http://121.41.9.232:8051/house.png";var d=new webimmodel.Friend({id:a.senderUserId,name:a.senderUserName+"(非好友)",imgSrc:a.imgSrc});d.firstchar=a.senderUserImgSrc,b.contactsList.addNonFriend(d)}}return a}function q(a,b,c,d){var e=w.historyMessagesCache[b+"_"+a];angular.forEach(e,function(b,e){b.panelType==webimmodel.PanelType.Message&&b.senderUserId==a&&(b.senderUserName=c,b.imgSrc=d)})}function r(a,b,c){var d=w.historyMessagesCache[b+"_"+a],e=!0;return!!c&&(angular.forEach(d,function(a,b){e&&a.panelType==webimmodel.PanelType.Message&&a.messageUId==c&&(e=!1)}),!e)}function s(a,b,c){for(var d=w.historyMessagesCache[b+"_"+a],e=d.length-1;e>-1;e--)if(d[e].panelType==webimmodel.PanelType.Message&&void 0==d[e].messageUId&&d[e].messageDirection==webimmodel.MessageDirection.SEND&&d[e].messageId==c.messageId){d[e].messageUId=c.messageUId,d[e].sentStatus=webimmodel.SentStatus.SENT,d.splice(e,1,c);break}}function t(a,b,c){var d=w.historyMessagesCache[b+"_"+a],e=!0,f=null;return angular.forEach(d,function(a,b){e&&a.panelType==webimmodel.PanelType.Message&&a.messageUId==c&&(e=!1,f=a)}),f}function u(a,b,c,e){var f=c,g=e;if(b==webimmodel.conversationType.Private){var h=RongIMLib.ReadReceiptMessage.obtain(f,g,1);d.sendMessage(b,a,h).then(function(){},function(a){console.log("sendReadReceiptMessage error",a.errorCode)})}}function v(a,b,c){if(b==webimmodel.conversationType.Group){var e=new RongIMLib.SyncReadStatusMessage({lastMessageSendTime:c});d.sendMessage(b,a,e).then(function(){},function(a){console.log("sendSyncReadStatusMessage error",a.errorCode)})}}var w={};return w.atMessagesCache={},w.historyMessagesCache={},w.conversationMessageList=[],w.conversationMessageListShow=[],w.pullMessageTime=null,w.remainMessageCount=5,w.withDrawMessagesCache={},w.getHistory=g,w.addHistoryMessages=m,w.messageAddUserInfo=p,w.unshiftHistoryMessages=h,w.asyncConverGroupNotifition=e,w.asyncConverDiscussionNotifition=f,w.updateHistoryMessagesCache=q,w.checkMessageExist=r,w.addAtMessage=n,w.clearHistoryMessages=i,w.getLastMessageTime=j,w.getMessageById=t,w.updateSendMessage=s,w.delWithDrawMessage=k,w.addWithDrawMessageCache=o,w.sendReadReceiptMessage=u,w.sendSyncReadStatusMessage=v,w}]);var createDiscussion=angular.module("webim.creatediscussion",[]);createDiscussion.controller("creatediscussionController",["$scope","$state",function(a,b){a.discussionName="",a.submite=function(){var c=(a.discussionName||"").trim();c.length>=2&&c.length<=32?b.go("main.discussionaddmember",{iscreate:"true",idorname:a.discussionName}):webimutil.Helper.alertMessage.error("名称长度2-32",2)},document.getElementById("discussionName").onkeydown=function(b){13!=b.keyCode&&10!=b.keyCode||a.submite()},a.back=function(){b.go("main")}}]);var discussionAddMember=angular.module("webim.discussionaddmember",[]);discussionAddMember.controller("discussionaddmemberController",["$scope","$state","$stateParams","mainDataServer","mainServer","RongIMSDKServer",function(a,b,c,d,e,f){if(a.save=function(){throw new Error("Not implemented yet")},a.idorname=c.idorname,a.isLoading=!1,"true"==c.iscreate){var g=[].concat.apply([],d.contactsList.subgroupList.map(function(a){return a.list}));g=g.filter(function(a,b,c){return a.id!=d.loginUser.id}),a.friendList=webimutil.Helper.cloneObject(g),a.searchfriend=function(b){if(""==b)a.friendList=webimutil.Helper.cloneObject(g);else{var c=d.contactsList.find(b,g);a.friendList=webimutil.Helper.cloneObject(c)}},a.save=function(){if(!a.isLoading){var c=[],e=[],g=[],h="";if(a.friendList.forEach(function(a){a.isSelected&&(c.push(a.id+""),g.push(a),e.push(a.name+""))}),c.length<1)return void webimutil.Helper.alertMessage.error("至少要有1个组成员",2);h=e.join(","),h&&h.length>40&&(h=h.substring(0,40)),a.isLoading=!0,c.push(d.loginUser.id),f.createDiscussion(h,c).then(function(e){var f=new webimmodel.Discussion({id:e.data,name:h,imgSrc:"",upperlimit:500,fact:1,creater:d.loginUser.id,isOpen:!0});d.contactsList.addDiscussion(f),d.contactsList.addDiscussionMember(f.id,new webimmodel.Member({id:d.loginUser.id,name:d.loginUser.nickName,imgSrc:d.loginUser.portraitUri,role:"0"}));for(var i=0,j=g.length;i<j;i++){var k=new webimmodel.Member({id:g[i].id,name:g[i].name,imgSrc:g[i].imgSrc,role:"1"});d.contactsList.addDiscussionMember(f.id,k)}g=void 0,c=void 0,webimutil.Helper.alertMessage.success("创建成功！",2),b.go("main.chat",{targetId:f.id,targetType:webimmodel.conversationType.Discussion}),a.isLoading=!1},function(){a.isLoading=!1,webimutil.Helper.alertMessage.error("失败",2)}),console.log(a.friendList.filter(function(a){return a.isSelected}))}},a.back=function(){b.go("main.creatediscussion")}}else{for(var g=[].concat.apply([],d.contactsList.subgroupList.map(function(a){return a.list})),h=d.contactsList.getDiscussionById(a.idorname).memberList,i={},j=0,k=h.length;j<k;j++)i[h[j].id]=!0;g=g.filter(function(a,b,c){return!i[a.id]}),a.friendList=webimutil.Helper.cloneObject(g),a.searchfriend=function(b){if(""==b)a.friendList=webimutil.Helper.cloneObject(g);else{var c=d.contactsList.find(b,g);a.friendList=webimutil.Helper.cloneObject(c)}},a.save=function(){if(!a.isLoading){a.isLoading=!0;var c=[],e=[];if(a.friendList.forEach(function(a){a.isSelected&&(c.push(a.id+""),e.push(a))}),c.length<1)return void webimutil.Helper.alertMessage.error("至少要选择1个成员",2);f.addMemberToDiscussion(a.idorname,c,{onSuccess:function(){for(var f=0,g=e.length;f<g;f++){var h=new webimmodel.Member({id:e[f].id,name:e[f].name,imgSrc:e[f].imgSrc,role:"1"});d.contactsList.addDiscussionMember(a.idorname,h)}e=void 0,c=void 0,b.go("main.discussioninfo",{discussionid:a.idorname}),webimutil.Helper.alertMessage.success("添加成功！",2)},onError:function(){a.isLoading=!1,webimutil.Helper.alertMessage.error("失败",2)}})}},a.back=function(){b.go("main.discussioninfo",{discussionid:c.idorname})}}}]);var discussionInfo=angular.module("webim.discussioninfo",[]);discussionInfo.controller("discussioninfoController",["$scope","$state","$stateParams","mainDataServer","mainServer","RongIMSDKServer",function(a,b,c,d,e,f){function g(){i&&"0"!=i?b.go("main.chat",{targetId:h,targetType:i}):b.go("main")}a.$on("$viewContentLoaded",function(){angular.element(document.getElementById("portrait")).css("background-color",webimutil.Helper.portraitColors[a.discussionInfo.id.charCodeAt(0)%webimutil.Helper.portraitColors.length])}),a.isEditable=!0,a.back=function(){g()};var h=c.discussionid,i=c.conversationtype;a.discussionInfo=d.contactsList.getDiscussionById(h),a.discussionInfo||(webimutil.Helper.alertMessage.error("您不在此讨论组中",2),g()),a.discussionInfo.creater==d.loginUser.id&&(a.discussionInfo.isCreater=!0),a.quitDiscussion=function(){f.quitDiscussion(h,{onSuccess:function(){d.contactsList.removeDiscussion(h),f.removeConversation(webimmodel.conversationType.Discussion,h).then(function(){setTimeout(function(){a.$emit("conversationChange")},200),b.go("main"),webimutil.Helper.alertMessage.success("退出成功",2)},function(){setTimeout(function(){a.$emit("conversationChange")},200),b.go("main"),webimutil.Helper.alertMessage.success("退出成功删除会话失败",2)})},onError:function(){webimutil.Helper.alertMessage.error("退出失败",2)}})},a.kickMember=function(){var b=a.selMember;b&&f.removeMemberFromDiscussion(h,b,{onSuccess:function(){d.contactsList.removeDiscussionMember(h,b),a.isEditable=!0},onError:function(){webimutil.Helper.alertMessage.error("删除失败",2)}})},a.toChat=function(){b.go("main.chat",{targetId:a.discussionInfo.id,targetType:webimmodel.conversationType.Discussion},{location:"replace"})},a.addmember=function(){b.go("main.discussionaddmember",{iscreate:"false",idorname:a.discussionInfo.id})},a.dismiss=function(){},a.getSelect=function(b){a.selMember=b}}]),discussionInfo.directive("discussionMember",["$state","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"=",isshow:"=",updateSelect:"&"},template:'<li class="chat_item groupUser_item"><div class="select"  ng-show="isshow"><input type="radio" class="hide" ng-disabled="item.id==loginUserid" id="{{item.id}}" value="{{item.id}}" ng-model="selMember" data-count="" name="rdMember" ng-click="updateSelect({val: selMember})"><label for="{{item.id}}"></label></div><div ng-click="showinfo()"><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.name}}</span></h3></div></div></li>',link:function(c,d,e){angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),c.showinfo=function(){a.go("main.friendinfo",{userid:c.item.id,discussionid:c.$parent.discussionInfo.id,targetid:c.$parent.discussionInfo.id,conversationtype:a.params.conversationtype})},c.loginUserid=b.loginUser.id}}}]);var addfirendCtr=angular.module("webim.addfirend",["webim.main.server"]);addfirendCtr.controller("searchfriendController",["$scope","$state","mainServer",function(a,b,c){a.friendlist=[],a.searchfriend=function(b){a.friendlist=[],/^1[3-9][0-9]{9,9}$/.test(b)&&(a.getresultnull=!1,c.user.getUserByPhone("86",b).success(function(b){if(200==b.code){var c=new webimmodel.UserInfo;c.id=b.result.id,c.nickName=b.result.nickname,c.portraitUri=b.result.portraitUri,c.firstchar=webimutil.ChineseCharacter.getPortraitChar(b.result.nickname),c.phone="",c.region="",a.friendlist.push(c)}}).error(function(b){console.log(b),a.getresultnull=!0}))},a.back=function(){window.history.back()}}]),addfirendCtr.controller("applyfriendController",["$scope","$state","$stateParams","mainServer","mainDataServer",function(a,b,c,d,e){var f=c.userId,g=c.userName,h=c.groupid,i=c.targetid,j=c.conversationtype,k="我是"+e.loginUser.nickName;if(a.title=g,a.applyfriendbtn=function(){var c=f;return a.message?c?void d.friend.invite(c,a.message).success(function(a){b.go("main.friendinfo",{userid:f,groupid:h,targetid:i,conversationtype:j});var d=a.result.action;if("Added"==d){var k=new webimmodel.Friend({id:c,name:g,imgSrc:""});k.imgSrc="http://7xogjk.com1.z0.glb.clouddn.com/Fj5qqhBzlcmqf35GFF_xmmLyI8o3",e.contactsList.addFriend(k),webimutil.Helper.alertMessage.success("已成为好友！",2)}else"Sent"==d?webimutil.Helper.alertMessage.success("发送成功！",2):console.log(a)}).error(function(a,b){400==b?webimutil.Helper.alertMessage.error("已经是好友！",2):console.log(a)}):void webimutil.Helper.alertMessage.error("添加用户为空！",2):void webimutil.Helper.alertMessage.error("消息不可为空！",2)},a.back=function(){j?b.go("main.friendinfo",{userid:f,groupid:h,targetid:i,conversationtype:j}):b.go("main.searchfriend")},"0"!=h&&""!=h){var l=e.contactsList.getGroupById(h)?e.contactsList.getGroupById(h).name:h;k="我是“"+l+"群”的"+e.loginUser.nickName}a.getInfo=function(){return k}}]),addfirendCtr.directive("addfirenditem",["$state","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<li class="chat_item joinGroup_item addFriends_item"><div class="photo"><img class="img" ng-show="item.portraitUri" ng-src="{{item.portraitUri||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.portraitUri">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.nickName}}</span></h3><button class="functionBoxBtn" ng-click="applyfriendsrc()" ng-show="!isself">加好友</button></div></li>',link:function(c,d,e){angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),c.applyfriendsrc=function(){if(b.contactsList.getFriendById(c.item.id))return void webimutil.Helper.alertMessage.error("此人已经是您的好友！",2);a.go("main.applyfriend",{userId:c.item.id,userName:c.item.nickName})},c.isself=b.loginUser.id==c.item.id,c.isself&&angular.element(d[0].getElementsByClassName("info")[0]).css("border","none")}}}]);var friendinfo=angular.module("webim.editfriendinfo",["webim.main.server"]);friendinfo.controller("editfriendinfoController",["$scope","$state","$stateParams","$window","mainDataServer","mainServer","RongIMSDKServer",function(a,b,c,d,e,f,g){function h(){a.user.id&&angular.element(document.getElementById("portrait")).css("background-color",webimutil.Helper.portraitColors[a.user.id.charCodeAt(0)%webimutil.Helper.portraitColors.length])}a.$on("$viewContentLoaded",function(){h()});var i=c.userid,j=c.groupid,k=c.targetid,l=c.conversationtype,m=e.contactsList.getFriendById(i),n=m?null:e.contactsList.getGroupMember(l?k:j,i),o=e.loginUser.id==i;a.user=new webimmodel.UserInfo,a.isself=o,a.isfriend=!!m,m?(a.user.id=m.id,a.user.nickName=m.name,a.user.portraitUri=m.imgSrc,a.user.firstchar=m.firstchar,a.user.displayName=m.displayName):n?(a.user.id=n.id,a.user.nickName=n.name,a.user.portraitUri=n.imgSrc,a.user.firstchar=n.firstchar):o?(a.user.id=e.loginUser.id,a.user.nickName=e.loginUser.nickName,a.user.portraitUri=e.loginUser.portraitUri,a.user.firstchar=e.loginUser.firstchar):f.user.getInfo(i).then(function(b){a.user.id=b.data.result.id,a.user.nickName=b.data.result.nickname,a.user.portraitUri=b.data.result.portraitUri,a.user.firstchar=webimutil.ChineseCharacter.getPortraitChar(b.data.result.nickname),a.user.displayName=b.data.result.displayName,h()});var p=function(b){f.user.addToBlackList(b).success(function(){e.blackList.add(new webimmodel.Friend({id:a.user.id,name:a.user.nickName,imgSrc:a.user.portraitUri}))})},q=function(a){f.user.removeFromBlackList(a).success(function(){e.blackList.remove(a)})};a.user.inBlackList=!!e.blackList.getById(i);var r=!1;a.removeFriend=function(){r||(r=!0,f.friend.setDisplayName(a.user.id,"").success(function(){}).error(function(){console.log("删除好友昵称失败")}),f.friend.delete(a.user.id).success(function(){g.removeConversation(webimmodel.conversationType.Private,a.user.id).then(function(){r=!1,e.contactsList.removeFriend(a.user.id)||console.log("删除好友失败"),b.go("main")},function(){console.log("删除失败")})}).error(function(){r=!1,webimutil.Helper.alertMessage.error("删除失败",2)}))},a.switchchange=function(){a.user.inBlackList?p(a.user.id):q(a.user.id)},a.back=function(){window.history.back()},a.save=function(){a.modifyName.$valid&&(f.friend.setDisplayName(a.user.id,a.user.displayName).success(function(){var b=e.contactsList.getFriendById(a.user.id),c=webimutil.Helper.cloneObject(b),d=e.conversation.getConversation(1,a.user.id);if(d&&(d.title=a.user.displayName),b){b.displayName=a.user.displayName,e.contactsList.updateOrAddFriend(b);webimutil.ChineseCharacter.getPortraitChar2(c.displayName||c.name)!=webimutil.ChineseCharacter.getPortraitChar2(b.displayName||b.name)&&e.contactsList.removeFriendFromSubgroup(c)}a.back()}),a.editable=!1)}}]);var friendinfo=angular.module("webim.friendinfo",["webim.main.server"]);friendinfo.controller("friendinfoController",["$scope","$rootScope","$state","$stateParams","$window","mainDataServer","mainServer",function(a,b,c,d,e,f,g){function h(){i&&angular.element(document.getElementById("portrait")).css("background-color",webimutil.Helper.portraitColors[i.charCodeAt(0)%webimutil.Helper.portraitColors.length])}a.$on("$viewContentLoaded",function(){h()});var i=d.userid,j=d.groupid,k=d.targetid,l=d.conversationtype,m=f.contactsList.getFriendById(i),n=m?null:f.contactsList.getGroupMember(l?k:j,i),o=m?null:f.loginUser.id==i;a.isfriend=!!m,a.isself=!!o,a.user=new webimmodel.UserInfo,m?g.friend.getProfile(i).success(function(b){var c=new webimmodel.Friend({id:b.result.user.id,name:b.result.user.nickname,imgSrc:b.result.user.portraitUri});c.displayName=b.result.displayName,c.mobile=b.result.user.phone,c=f.contactsList.updateOrAddFriend(c),f.conversation.updateConversationDetail(webimmodel.conversationType.Private,i,b.result.displayName||b.result.user.nickname,b.result.user.portraitUri),a.user.id=c.id,a.user.nickName=c.name,a.user.portraitUri=c.imgSrc,a.user.firstchar=c.firstchar,a.user.displayName=c.displayName,a.user.mobile=c.mobile}):n?(a.user.id=n.id,a.user.nickName=n.name,a.user.portraitUri=n.imgSrc,a.user.firstchar=n.firstchar):o?(a.user.id=f.loginUser.id,a.user.nickName=f.loginUser.nickName,a.user.portraitUri=f.loginUser.portraitUri,a.user.firstchar=f.loginUser.firstchar):g.user.getInfo(i).then(function(b){a.user.id=b.data.result.id,a.user.nickName=b.data.result.nickname,a.user.portraitUri=b.data.result.portraitUri,a.user.firstchar=webimutil.ChineseCharacter.getPortraitChar(b.data.result.nickname),h()}),a.edit=function(){c.go("main.editfriendinfo",{userid:i,groupid:j,targetid:k,conversationtype:l})},a.toAddFriend=function(){c.go("main.applyfriend",{userId:a.user.id,userName:a.user.nickName,groupid:j,targetid:k,conversationtype:l})},a.toConversation=function(){c.go("main.chat",{targetId:a.user.id,targetType:webimmodel.conversationType.Private},{location:"replace"})},a.back=function(){window.history.back()}}]);var addgroup=angular.module("webim.addgroup",[]);addgroup.controller("searchgroupController",["$scope","$state",function(a,b){a.grouplist=[],a.searchgroup=function(b){a.grouplist=[{groupName:"群组一（静态数据）",groupId:"group1"},{groupName:"群组二（静态数据）",groupId:"group2"}]},a.back=function(){window.history.back()}}]),addgroup.controller("applygroupController",["$scope","$state","$stateParams","mainServer","mainDataServer",function(a,b,c,d,e){a.back=function(){b.go("main.searchgroup")}}]),addgroup.directive("addgroupitem",["$state","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<li class="chat_item joinGroup_item"><div class="photo"><img class="img" src="assets/img/barBg.png" alt=""></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.groupName}}</span></h3><p class="msg ng-scope"><span>( 28/500 )</span></p><button class="functionBoxBtn" ng-click="applygroupsrc()">申请</button></div></li>',link:function(c,d,e){c.applygroupsrc=function(){if(b.contactsList.getGroupById(c.item.groupId))return void alert("您已经在群组里");a.go("main.applygroup",{groupId:c.item.groupId})}}}}]);var createGroup=angular.module("webim.creategroup",[]);createGroup.controller("creategroupController",["$scope","$state",function(a,b){a.groupName="",a.submite=function(){var c=(a.groupName||"").trim();c.length>=2&&c.length<=10?b.go("main.groupaddmember",{iscreate:"true",idorname:a.groupName}):webimutil.Helper.alertMessage.error("名称长度2-10",2)},document.getElementById("groupName").onkeydown=function(b){13!=b.keyCode&&10!=b.keyCode||a.submite()},a.back=function(){window.history.back()}}]);var groupAddMember=angular.module("webim.groupaddmember",[]);groupAddMember.controller("groupaddmemberController",["$scope","$state","$stateParams","mainDataServer","mainServer",function(a,b,c,d,e){if(a.save=function(){throw new Error("Not implemented yet")},a.idorname=c.idorname,a.isLoading=!1,"true"==c.iscreate){var f=[].concat.apply([],d.contactsList.subgroupList.map(function(a){return a.list}));f=f.filter(function(a,b,c){return a.id!=d.loginUser.id});var g=webimutil.Helper.cloneObject(f);a.friendList=webimutil.Helper.cloneObject(f),a.searchfriend=function(b){if(""==b)a.friendList.length=0,a.friendList=webimutil.Helper.cloneObject(g);else{var c=d.contactsList.find(b,g);a.friendList.length=0,a.friendList=webimutil.Helper.cloneObject(c)}},a.save=function(){if(!a.isLoading){var c=[],f=[];if(a.friendList.forEach(function(a){a.isSelected&&(c.push(a.id+""),f.push(a))}),c.length<1)return void webimutil.Helper.alertMessage.error("至少要有1个群成员",2);a.isLoading=!0,c.push(d.loginUser.id),e.group.create(a.idorname,c).success(function(e){if(200==e.code){var g=new webimmodel.Group({id:e.result.id,name:a.idorname,imgSrc:"",upperlimit:500,fact:1,creater:d.loginUser.id});d.contactsList.addGroup(g),d.contactsList.addGroupMember(g.id,new webimmodel.Member({id:d.loginUser.id,name:d.loginUser.nickName,imgSrc:d.loginUser.portraitUri,role:"0"}));for(var h=0,i=f.length;h<i;h++){var j=new webimmodel.Member({id:f[h].id,name:f[h].name,imgSrc:f[h].imgSrc,role:"1"});d.contactsList.addGroupMember(g.id,j)}f=void 0,c=void 0,webimutil.Helper.alertMessage.success("创建成功！",2),b.go("main.chat",{targetId:g.id,targetType:webimmodel.conversationType.Group})}else 1e3==e.code&&webimutil.Helper.alertMessage.error("群组超过上限",2);a.isLoading=!1}).error(function(b){a.isLoading=!1,webimutil.Helper.alertMessage.error("失败",2)}),console.log(a.friendList.filter(function(a){return a.isSelected}))}},a.back=function(){b.go("main.creategroup")},a.syncState=function(a,b){g.forEach(function(c){c.id==a&&(c.isSelected=b)})}}else{for(var f=[].concat.apply([],d.contactsList.subgroupList.map(function(a){return a.list})),h=d.contactsList.getGroupById(a.idorname).memberList,i={},j=0,k=h.length;j<k;j++)i[h[j].id]=!0;f=f.filter(function(a,b,c){return!i[a.id]});var g=webimutil.Helper.cloneObject(f);a.friendList=webimutil.Helper.cloneObject(f),a.searchfriend=function(b){if(""==b)a.friendList=webimutil.Helper.cloneObject(g);else{var c=d.contactsList.find(b,g);a.friendList=webimutil.Helper.cloneObject(c)}},a.save=function(){if(!a.isLoading){a.isLoading=!0;var c=[],f=[];if(a.friendList.forEach(function(a){a.isSelected&&(c.push(a.id+""),f.push(a))}),c.length<1)return void webimutil.Helper.alertMessage.error("至少要选择1个成员",2);e.group.addMember(a.idorname,c).success(function(e){if(200==e.code){for(var g=0,h=f.length;g<h;g++){var i=new webimmodel.Member({id:f[g].id,name:f[g].name,imgSrc:f[g].imgSrc,role:"1"});d.contactsList.addGroupMember(a.idorname,i)}f=void 0,c=void 0,b.go("main.groupinfo",{groupid:a.idorname}),webimutil.Helper.alertMessage.success("添加成功！",2)}a.isLoading=!1}).error(function(b){a.isLoading=!1,webimutil.Helper.alertMessage.error("失败",2)})}},a.back=function(){b.go("main.groupinfo",{groupid:c.idorname})},a.syncState=function(a,b){g.forEach(function(c){c.id==a&&(c.isSelected=b)})}}}]),groupAddMember.directive("searchitem",function(){return{restrict:"E",scope:{item:"="},
  template:'<li class="chat_item joinGroup_item addFriends_item"><div class="select"><input type="checkbox" class="hide" id="{{item.id}}" ng-change="syncState()" ng-model="item.isSelected" value="136" data-count="" name=""><label for="{{item.id}}"></label></div><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.name}}</span></h3></div></li>',link:function(a,b,c){angular.element(b[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[a.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),a.syncState=function(){a.$parent.syncState(a.item.id,a.item.isSelected)}}}});var groupInfo=angular.module("webim.goupinfo",[]);groupInfo.controller("groupinfoController",["$scope","$rootScope","$state","$stateParams","mainDataServer","mainServer","RongIMSDKServer",function(a,b,c,d,e,f,g){function h(){j&&"0"!=j?c.go("main.chat",{targetId:i,targetType:j}):c.go("main")}a.$on("$viewContentLoaded",function(){angular.element(document.getElementById("portrait")).css("background-color",webimutil.Helper.portraitColors[a.groupInfo.id.charCodeAt(0)%webimutil.Helper.portraitColors.length])}),a.isEditable=!1,a.back=function(){h()};var i=d.groupid,j=d.conversationtype;a.groupInfo=e.contactsList.getGroupById(i),a.groupInfo||(webimutil.Helper.alertMessage.error("您不在此群组中",2),h()),a.groupInfo.creater==e.loginUser.id&&(a.groupInfo.isCreater=!0),a.quitGroup=function(){f.group.quit(i).success(function(b){200==b.code&&(e.contactsList.removeGroup(i),g.removeConversation(webimmodel.conversationType.Group,i).then(function(){setTimeout(function(){a.$emit("conversationChange")},200),c.go("main"),webimutil.Helper.alertMessage.success("退出成功",2)},function(){setTimeout(function(){a.$emit("conversationChange")},200),c.go("main"),webimutil.Helper.alertMessage.success("退出成功删除会话失败",2)}))}).error(function(){webimutil.Helper.alertMessage.error("退出失败",2)})},a.kickMember=function(){var b=[];a.groupInfo.memberList.filter(function(a){if(a.isSelected)return b.push(a.id)}),f.group.kickMember(i,b).success(function(c){if(200==c.code){for(var d=0,f=b.length;d<f;d++)e.contactsList.removeGroupMember(i,b[d]);a.isEditable=!1}}).error(function(a){console.log(a),webimutil.Helper.alertMessage.error("删除失败",2)})},a.toChat=function(){c.go("main.chat",{targetId:a.groupInfo.id,targetType:webimmodel.conversationType.Group},{location:"replace"})},a.toBulletin=function(){c.go("main.groupbulletin",{groupid:i})},a.addmember=function(){c.go("main.groupaddmember",{iscreate:"false",idorname:a.groupInfo.id})},a.dismiss=function(){f.group.dismissGroup(i).success(function(b){200==b.code&&(e.contactsList.removeGroup(i),g.removeConversation(webimmodel.conversationType.Group,i).then(function(){setTimeout(function(){a.$emit("conversationChange")},200),c.go("main"),webimutil.Helper.alertMessage.success("解散成功",2)},function(){setTimeout(function(){a.$emit("conversationChange")},200),c.go("main"),webimutil.Helper.alertMessage.success("解散成功删除会话失败",2)}))}).error(function(){})}}]),groupInfo.controller("groupbulletinController",["$scope","$state","$stateParams","mainServer","mainDataServer","RongIMSDKServer","conversationServer",function(a,b,c,d,e,f,g){function h(a,b){var c=new RongIMLib.Message;return c.content=a,c.conversationType=j,c.targetId=i,c.sentTime=(new Date).getTime()-RongIMLib.RongIMClient.getInstance().getDeltaTime(),c.messageDirection=RongIMLib.MessageDirection.SEND,c.messageType=b,c.senderUserId=e.loginUser.id,c}var i=c.groupid,j=RongIMLib.ConversationType.GROUP,k=$("div.previewPicLayer");a.isActive=!1,a.showDialog1=!1,a.showDialog2=!1,a.groupbulletinbtn=function(){return a.showDialog1=!0,k.css("visibility","visible"),a.message?i?void 0:void webimutil.Helper.alertMessage.error("群信息不可为空！",2):void webimutil.Helper.alertMessage.error("消息不可为空！",2)},a.back=function(){b.go("main.groupinfo",{groupid:i,conversationtype:j})},a.cancelbtn=function(){a.showDialog1=!1,a.showDialog2=!0},a.cancelbtn2=function(){a.showDialog1=!1,a.showDialog2=!1,k.css("visibility","hidden")},a.quitbtn=function(){a.showDialog1=!1,a.showDialog2=!1,k.css("visibility","hidden"),b.go("main.groupinfo",{groupid:i,conversationtype:j})},a.publicbtn=function(){a.showDialog1=!1,k.css("visibility","hidden");var c=RongIMLib.TextMessage.obtain("@所有人\n"+a.message),d=new RongIMLib.MentionedInfo;d.type=webimmodel.AtTarget.All,d.userIdList=[""],c.mentionedInfo=d,f.sendMessage(j,i,c,!0).then(function(a){webimutil.Helper.alertMessage.success("发布成功",2),b.go("main.groupinfo",{groupid:i,conversationtype:j})},function(a){var b="";switch(a.errorCode){case RongIMLib.ErrorCode.REJECTED_BY_BLACKLIST:b="您的消息已经发出，但被对方拒收";break;case RongIMLib.ErrorCode.NOT_IN_GROUP:b="你不在该群组中"}if(b){var c=webimutil.Helper.cloneObject(a.message);c.content=b,c.panelType=webimmodel.PanelType.InformationNotification}});var e=h(c,webimmodel.MessageType.TextMessage);g.addHistoryMessages(i,j,webimmodel.Message.convertMsg(e)),a.mainData.conversation.updateConStatic(webimmodel.Message.convertMsg(e),!0,!0)},a.$watch("message",function(b,c){b!==c&&(b.length>0?a.isActive=!0:a.isActive=!1)})}]),groupInfo.directive("member",["$state","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"=",isshow:"="},template:'<li class="chat_item groupUser_item"><div class="select"  ng-show="isshow"><input type="checkbox" class="hide" ng-disabled="item.id==loginUserid" id="{{item.id}}" value="136" ng-model="item.isSelected" data-count="" name=""><label for="{{item.id}}"></label></div><div ng-click="showinfo()"><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{showName}}</span></h3></div></div></li>',link:function(c,d,e){angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]);var f=b.contactsList.getFriendById(c.item.id);f&&(c.showName=f.displayName||f.name),c.showName=c.item.displayName||c.showName||c.item.name,c.showinfo=function(){a.go("main.friendinfo",{userid:c.item.id,groupid:c.$parent.groupInfo.id,targetid:c.$parent.groupInfo.id,conversationtype:a.params.conversationtype})},c.loginUserid=b.loginUser.id,c.$watch("item.isSelected",function(a,b){})}}}]);var mainServer=angular.module("webim.main.server",[]);mainServer.factory("mainServer",["$http","$q","appconfig",function(a,b,c){var d=c.getBaseUrl();return{user:{sendCode:function(b,c){return a({method:"POST",url:d+"/user/send_code_yp",data:{phone:b,region:c}})},verifyCode:function(b,c,e){return a({method:"POST",url:d+"/user/verify_code_yp",data:{phone:b,region:c,code:e}})},checkUsernameAvailable:function(b){return a({method:"POST",url:d+"/user/check_username_available",data:{username:b}})},checkPhoneAvailable:function(b,c){return a({method:"POST",url:d+"/user/check_phone_available",data:{phone:b,region:c}})},signup:function(b,c,e){return a({method:"POST",url:d+"/user/register",data:{nickname:b,password:c,verification_token:e}})},signin:function(b,c,e){return a({method:"POST",url:d+"/user/login",data:{phone:b,region:c,password:e}})},logout:function(){return a({method:"POST",url:d+"/user//logout"})},getInfo:function(b){return a({method:"get",url:d+"/user/"+b})},getBatchInfo:function(b){var c=b.join("&id=");return a({method:"get",url:d+"/user/batch?id="+c})},setNickName:function(b){return a({method:"POST",url:d+"/user/set_nickname",data:{nickname:b}})},getUserByPhone:function(b,c){return a({method:"get",url:d+"/user/find/"+b+"/"+c})},resetPassword:function(b,c){return a({method:"POST",url:d+"/user/reset_password",data:{password:b,verification_token:c}})},modefiyPassword:function(b,c){return a({method:"POST",url:d+"/user/change_password",data:{newPassword:b,oldPassword:c}})},getToken:function(){return a({method:"get",url:d+"/user/get_token"})},getBlackList:function(){return a({method:"get",url:d+"/user/blacklist"})},addToBlackList:function(b){return a({method:"POST",url:d+"/user/add_to_blacklist",data:{friendId:b}})},removeFromBlackList:function(b){return a({method:"POST",url:d+"/user/remove_from_blacklist",data:{friendId:b}})},sync:function(b){return a({method:"get",url:d+"/user/sync",data:{version:b}})},getMyGroups:function(){return a({method:"get",url:d+"/user/groups"})},getImageToken:function(){return a({method:"get",url:d+"/user/get_image_token"})}},friend:{invite:function(b,c){return a({method:"POST",url:d+"/friendship/invite",data:{friendId:b,message:c}})},getAll:function(){return a({method:"get",url:d+"/friendship/all"})},agree:function(b){return a({method:"POST",url:d+"/friendship/agree",data:{friendId:b}})},ignore:function(b){return a({method:"POST",url:d+"/friendship/ignore",data:{friendId:b}})},delete:function(b){return a({method:"POST",url:d+"/friendship/delete",data:{friendId:b}})},getProfile:function(b){return a({method:"get",url:d+"/friendship/"+b+"/profile"})},setDisplayName:function(b,c){return a({method:"POST",url:d+"/friendship/set_display_name",data:{friendId:b,displayName:c}})}},group:{create:function(b,c){return a({method:"POST",url:d+"/group/create",data:{name:b,memberIds:c}})},rename:function(b,c){return a({method:"POST",url:d+"/group/rename",data:{name:c,groupId:b}})},getById:function(b){return a({method:"get",url:d+"/group/"+b})},getGroupMember:function(b){return a({method:"get",url:d+"/group/"+b+"/members"})},addMember:function(b,c){return a({method:"POST",url:d+"/group/add",data:{groupId:b,memberIds:c}})},kickMember:function(b,c){return a({method:"POST",url:d+"/group/kick",data:{groupId:b,memberIds:c}})},dismissGroup:function(b){return a({method:"POST",url:d+"/group/dismiss",data:{groupId:b}})},quit:function(b){return a({method:"POST",url:d+"/group/quit",data:{groupId:b}})}}}}]),mainServer.factory("mainDataServer",["$q","RongIMSDKServer","mainServer",function(a,b,c){var d={};d.loginUser={},d.isConnected=!1,d.isTyping=!1,d.conversation={totalUnreadCount:0,lastOfflineMsg:null,conversations:[],currentConversation:{},parseConversation:function(a){var e=webimmodel.Conversation.convertToWebIM(a,d.loginUser.id),f=0;switch(a.unreadMessageCount&&(f=a.unreadMessageCount),a.conversationType){case RongIMLib.ConversationType.CHATROOM:e.title="聊天室"+a.targetId;break;case RongIMLib.ConversationType.GROUP:var g=d.contactsList.getGroupById(a.targetId);if(f=0,g){if(e.lastMsg&&"ST:GrpNtf"!=a.latestMessage.objectName&&"RC:InfoNtf"!=a.latestMessage.objectName){var h="";if(a.mentionedMsg){e.mentionedInfo=a.mentionedMsg.mentionedInfo;var i=e.mentionedInfo.type,j=e.mentionedInfo.userIdList;if(i==webimmodel.AtTarget.All)h="[有人@我]";else if(i==webimmodel.AtTarget.Part)for(var k=0;k<j.length;k++)if(j[k]==d.loginUser.id){h="[有人@我]";break}e.atStr=h}var l=d.contactsList.getGroupMember(g.id,a.latestMessage.senderUserId);l?e.lastMsg=l.name+"："+e.lastMsg:a.latestMessage.senderUserId}a.conversationTitle=g?g.name:"未知群组",e.title=g?g.name:"未知群组"}else"__system__"==a.targetId||function(a,b,d){c.group.getById(a).success(function(a){d.conversationTitle=a.result.name,b.title=a.result.name;var c=webimutil.ChineseCharacter.convertToABC(a.result.name),e=webimutil.ChineseCharacter.getPortraitChar(a.result.name);b.setpinying({pinyin:c.pinyin,everychar:c.first,firstchar:e}),b.imgSrc=a.result.portraitUri})}(a.targetId,e,a);e.lastMsg&&"ST:GrpNtf"==a.latestMessage.objectName&&"Create"==a.latestMessage.content.operation&&a.latestMessage.content.operatorUserId==d.loginUser.id&&(e.lastMsg="你 创建了群组"),e.firstchar=g?g.firstchar:"",e.imgSrc=g?g.imgSrc:"",e.firstchar=g?g.firstchar:"",e.everychar=g?g.everychar:"";break;case RongIMLib.ConversationType.PRIVATE:if(a.latestMessage.messageType==webimmodel.MessageType.ContactNotificationMessage){b.removeConversation(RongIMLib.ConversationType.PRIVATE,a.targetId).then(function(){});break}f=0;var m=d.contactsList.getFriendById(a.targetId||a.senderUserId);if(m)a.conversationTitle=m.displayName||m.name,e.title=m.displayName||m.name,e.firstchar=m.firstchar,e.imgSrc=m.imgSrc,e.firstchar=m.firstchar,e.everychar=m.everychar;else if(a.targetId){var m=d.contactsList.getNonFriendById(a.targetId||a.senderUserId);m?(a.conversationTitle=m.displayName||m.name,e.title=m.displayName||m.name,e.firstchar=m.firstchar,e.imgSrc=m.imgSrc):function(a,b){b.firstchar=webimutil.ChineseCharacter.getPortraitChar("企业用户");var c=webimutil.ChineseCharacter.convertToABC("企业用户"),e=webimutil.ChineseCharacter.getPortraitChar("wjl");b.setpinying({pinyin:c.pinyin,everychar:c.first,firstchar:e}),b.imgSrc="http://121.41.9.232:8051/house.png";var f=new webimmodel.Friend({id:a,name:b.title,imgSrc:b.imgSrc});f.firstchar=e,d.contactsList.addNonFriend(f),b.title="企业用户"}(a.targetId||a.senderUserId,e)}break;case RongIMLib.ConversationType.SYSTEM:case RongIMLib.ConversationType.DISCUSSION:case RongIMLib.ConversationType.CUSTOMER_SERVICE:}return{item:e,removeUnreadCount:f}},updateConversations:function(){var c=a.defer(),e=0;return b.getConversationList().then(function(a){RongIMLib.RongIMClient.getInstance().sortConversationList(a),d.conversation.conversations=[];for(var b=0,f=a.length;b<f;b++){var g=d.conversation.parseConversation(a[b]);e-=g.removeUnreadCount,a[b].conversationType!=RongIMLib.ConversationType.CUSTOMER_SERVICE&&a[b].conversationType!=RongIMLib.ConversationType.DISCUSSION&&a[b].conversationType!=RongIMLib.ConversationType.SYSTEM&&a[b].conversationType!=RongIMLib.ConversationType.CHATROOM&&(d.conversation.conversations.push(g.item),e+=a[b].unreadMessageCount)}d.conversation.totalUnreadCount=e,c.resolve()},function(){c.reject()}),c.promise},createConversation:function(a,e){var f=new webimmodel.Conversation;switch(f.targetId=e,f.targetType=a,a){case webimmodel.conversationType.Private:var g=d.contactsList.getFriendById(e);g?(f.title=g.displayName||g.name,f.firstchar=g.firstchar,f.imgSrc=g.imgSrc):c.user.getInfo(e).success(function(a){f.title=a.result.nickname+"(非好友)",f.firstchar=webimutil.ChineseCharacter.getPortraitChar(a.result.nickname),f.imgSrc=a.result.portraitUri}).error(function(){});break;case webimmodel.conversationType.Group:var h=d.contactsList.getGroupById(e);h?(f.title=h.name,f.firstchar=h.firstchar):c.group.getById(e).success(function(a){f.title=a.result.name,f.firstchar=webimutil.ChineseCharacter.getPortraitChar(a.result.name);var b=webimutil.ChineseCharacter.convertToABC(a.result.name),c=webimutil.ChineseCharacter.getPortraitChar(a.result.name);f.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),f.imgSrc=a.result.portraitUri}).error(function(){});break;case webimmodel.conversationType.Discussion:var i=d.contactsList.getDiscussionById(e);i?(f.title=i.name,f.firstchar=i.firstchar):b.getDiscussion(e).then(function(a){var b=a.data;f.title=b.name,f.firstchar=webimutil.ChineseCharacter.getPortraitChar(b.name)},function(){f.title="未知讨论组"});break;default:console.log("暂不支持创建此类型会话")}return f},getConversation:function(a,b){for(var c=0,e=d.conversation.conversations.length;c<e;c++)if(d.conversation.conversations[c].targetType==a&&d.conversation.conversations[c].targetId==b)return d.conversation.conversations[c];return null},updateConversationTitle:function(a,b,c){for(var e=0,f=d.conversation.conversations.length;e<f;e++)if(d.conversation.conversations[e].targetType==a&&d.conversation.conversations[e].targetId==b)return d.conversation.conversations[e].title=c,!0;return!1},updateConversationDetail:function(a,b,c,e){for(var f=0,g=d.conversation.conversations.length;f<g;f++)if(d.conversation.conversations[f].targetType==a&&d.conversation.conversations[f].targetId==b)return d.conversation.conversations[f].title=c,d.conversation.conversations[f].imgSrc=e,!0;return!1},updateConStatic:function(a,c,e){var f=a.conversationType,g=a.targetId;f==webimmodel.conversationType.Discussion||f==webimmodel.conversationType.System&&a.messageType!=webimmodel.MessageType.ContactNotificationMessage||f==webimmodel.conversationType.ChartRoom||a.messageType!=webimmodel.MessageType.ReadReceiptMessage&&a.messageType!=webimmodel.MessageType.TypingStatusMessage&&a.messageType!=webimmodel.MessageType.SyncReadStatusMessage&&a.messageType!=webimmodel.MessageType.ReadReceiptRequestMessage&&a.messageType!=webimmodel.MessageType.ReadReceiptResponseMessage&&b.getConversation(f,g).then(function(h){if(h){for(var i,j=d.conversation.parseConversation(h),k=0,l=d.conversation.totalUnreadCount,m=!1,n=0,o=d.conversation.conversations.length;n<o;n++)if(i=d.conversation.conversations[n],i.targetType==f&&i.targetId==g){k=i.unReadNum,0==n?(m=!0,i.lastMsg=j.item.lastMsg,i.unReadNum=j.item.unReadNum,i.lastTime=j.item.lastTime,a.senderUserId==d.loginUser.id?(b.clearUnreadCount(d.conversation.currentConversation.targetType,d.conversation.currentConversation.targetId),l-=k,j.item.unReadNum=0,i.atStr=""):i.atStr=j.item.atStr):d.conversation.conversations.splice(n,1);break}e&&f==d.conversation.currentConversation.targetType&&g==d.conversation.currentConversation.targetId?(b.clearUnreadCount(d.conversation.currentConversation.targetType,d.conversation.currentConversation.targetId),l-=k,j.item.unReadNum=0,j.item.atStr=""):a.senderUserId==d.loginUser.id?(b.clearUnreadCount(d.conversation.currentConversation.targetType,d.conversation.currentConversation.targetId),l-=k,j.item.unReadNum=0,j.item.atStr=""):l=l-k+j.item.unReadNum,d.conversation.totalUnreadCount=l,c&&!m&&d.conversation.conversations.unshift(j.item)}else console.log("无法获取该会话",f,g)},function(a){console.log("RongIMSDKServer.getConversation err:"+a,f,g)})},setDraft:function(a,b,c){for(var e=0,f=d.conversation.conversations.length;e<f;e++)if(d.conversation.conversations[e].targetType==a&&d.conversation.conversations[e].targetId==b)return d.conversation.conversations[e].draftMsg=c,!0;return!1},clearMessagesUnreadStatus:function(a,b){for(var c=0,e=d.conversation.conversations.length;c<e;c++)if(d.conversation.conversations[c].targetType==a&&d.conversation.conversations[c].targetId==b)return d.conversation.conversations[c].unReadNum=0,!0;return!1},find:function(a,b){var c=/^[0-9a-zA-Z\-]+$/,a=a.trim(),d=[];if(c.test(a))for(var e=0;e<b.length;e++){var f=b[e];-1===f.everychar.toLowerCase().indexOf(a.toLowerCase())&&-1===f.pinyin.toLowerCase().indexOf(a.toLowerCase())||d.push(f)}else if(""!==a)for(var e=0;e<b.length;e++){var f=b[e];-1!==f.title.indexOf(a)&&d.push(f)}return d}},d.blackList={list:[],add:function(a){a.firstchar=webimutil.ChineseCharacter.getPortraitChar(a.name),this.list.push(a)},remove:function(a){for(var b=0,c=this.list.length;b<c;b++)if(this.list[b].id==a)return this.list.splice(b,1),!0;return!1},getById:function(a){for(var b=0,c=this.list.length;b<c;b++)if(this.list[b].id==a)return this.list[b];return null}};var e={nonFriendList:[],groupList:[],subgroupList:[],discussionList:[],getGroupById:function(a){for(var b=0;b<this.groupList.length;b++){var c=this.groupList[b];if(c.id==a)return c}return null},updateGroupNameById:function(a,b){for(var c=0;c<this.groupList.length;c++){var d=this.groupList[c];if(d.id==a){d.name=b;var e=webimutil.ChineseCharacter.convertToABC(b),f=webimutil.ChineseCharacter.getPortraitChar(b);return d.setpinying({pinyin:e.pinyin,everychar:e.first,firstchar:f}),!0}}return!1},getDiscussionById:function(a){for(var b=0;b<this.discussionList.length;b++){var c=this.discussionList[b];if(c.id==a)return c}return null},getFriendById:function(a){for(var b=0,c=this.subgroupList.length;b<c;b++)for(var d=this.subgroupList[b].list,e=0,f=d.length;e<f;e++)if(d[e].id==a)return d[e];return null},quickGetFriend:function(a,b){for(var c=0,d=this.subgroupList.length;c<d;c++){var e=this.subgroupList[c].list;if(this.subgroupList[c].title==b)for(var f=0,g=e.length;f<g;f++)if(e[f].id==a)return e[f]}return null},addFriend:function(a){var b=webimutil.ChineseCharacter.convertToABC(a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.name);if(a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),c=webimutil.ChineseCharacter.getPortraitChar2(a.name),!this.quickGetFriend(a.id,c)){for(var d=0,e=this.subgroupList.length;d<e;d++)if(this.subgroupList[d].title==c)return this.subgroupList[d].list.push(a),a;return this.subgroupList.push(new webimmodel.Subgroup(c,[a])),this.subgroupList.sort(function(a,b){return a.title.charCodeAt(0)-b.title.charCodeAt(0)}),a}},removeFriend:function(a){for(var b=0,c=this.subgroupList.length;b<c;b++)for(var e=this.subgroupList[b].list,f=0,g=e.length;f<g;f++)if(e[f].id==a)return e.splice(f,1),0===e.length&&this.subgroupList.splice(b,1),d.conversation.updateConversations(),!0;return!1},removeFriendFromSubgroup:function(a){var b=webimutil.ChineseCharacter.convertToABC(a.displayName||a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.displayName||a.name);a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),c=webimutil.ChineseCharacter.getPortraitChar2(a.displayName||a.name);for(var d=0,e=this.subgroupList.length;d<e;d++)if(this.subgroupList[d].title==c){for(var f=0,g=this.subgroupList[d].list.length;f<g;f++)if(this.subgroupList[d].list[f].id==a.id){this.subgroupList[d].list.splice(f,1);break}if(this.subgroupList[d].list.length)break;this.subgroupList.splice(d,1);break}},updateOrAddFriend:function(a){var b=webimutil.ChineseCharacter.convertToABC(a.displayName||a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.displayName||a.name);a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),c=webimutil.ChineseCharacter.getPortraitChar2(a.displayName||a.name);var d=this.quickGetFriend(a.id,c);if(d)return angular.extend(d,a),d;for(var e=0,f=this.subgroupList.length;e<f;e++)if(this.subgroupList[e].title==c)return this.subgroupList[e].list.push(a),a;return this.subgroupList.push(new webimmodel.Subgroup(c,[a])),this.subgroupList.sort(function(a,b){return a.title.charCodeAt(0)-b.title.charCodeAt(0)}),a},addGroup:function(a){if(!e.getGroupById(a.id)){var b=webimutil.ChineseCharacter.convertToABC(a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.name);a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),this.groupList.push(a)}},removeGroup:function(a){for(var b=0,c=this.groupList.length;b<c;b++)if(this.groupList[b].id==a)return this.groupList.splice(b,1),d.conversation.updateConversations(),!0;return!1},addDiscussion:function(a){if(!e.getDiscussionById(a.id)){var b=webimutil.ChineseCharacter.convertToABC(a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.name);a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),this.discussionList.push(a)}},removeDiscussion:function(a){for(var b=0,c=this.discussionList.length;b<c;b++)if(this.discussionList[b].id==a)return this.discussionList.splice(b,1),d.conversation.updateConversations(),!0;return!1},find:function(a,b){var c=/^[0-9a-zA-Z\-]+$/,a=a.trim(),d=[];if(c.test(a))for(var e=0;e<b.length;e++){var f=b[e];-1===f.everychar.toLowerCase().indexOf(a.toLowerCase())&&-1===f.pinyin.toLowerCase().indexOf(a.toLowerCase())||d.push(f)}else if(""!==a)for(var e=0;e<b.length;e++){var f=b[e];-1!==f.name.indexOf(a)&&d.push(f)}return d},getGroupMember:function(a,b){var c=this.getGroupById(a);if(c)for(var d=0,e=c.memberList.length;d<e;d++)if(c.memberList[d].id==b)return c.memberList[d];return null},addGroupMember:function(a,b){var c=this.getGroupById(a);if(c&&!e.getGroupMember(a,b.id)){var d=webimutil.ChineseCharacter.convertToABC(b.name),f=webimutil.ChineseCharacter.getPortraitChar(b.name);b.setpinying({pinyin:d.pinyin,everychar:d.first,firstchar:f}),"0"==b.role?c.memberList.unshift(b):c.memberList.push(b),c.fact=c.memberList.length}},removeGroupMember:function(a,b){var c=this.getGroupById(a);if(!c)throw Error("not found group:"+a);for(var d=0,e=c.memberList.length;d<e;d++){if(c.memberList[d].id==b)return c.memberList.splice(d,1),c.fact=c.memberList.length,!0}return!1},getDiscussionMember:function(a,b){var c=this.getDiscussionById(a);if(c)for(var d=0,e=c.memberList.length;d<e;d++)if(c.memberList[d].id==b)return c.memberList[d];return null},addDiscussionMember:function(a,b){var c=this.getDiscussionById(a);if(c&&!e.getDiscussionMember(a,b.id)){var d=webimutil.ChineseCharacter.convertToABC(b.name),f=webimutil.ChineseCharacter.getPortraitChar(b.name);b.setpinying({pinyin:d.pinyin,everychar:d.first,firstchar:f}),c.memberList.push(b),c.fact=c.memberList.length}},removeDiscussionMember:function(a,b){var c=this.getDiscussionById(a);if(!c)throw Error("not found discussion:"+a);for(var d=0,e=c.memberList.length;d<e;d++){if(c.memberList[d].id==b)return c.memberList.splice(d,1),c.fact=c.memberList.length,!0}return!1},getNonFriendById:function(a){for(var b=0,c=this.nonFriendList.length;b<c;b++)if(this.nonFriendList[b].id==a)return this.nonFriendList[b];return null},addNonFriend:function(a){if(!e.getNonFriendById(a.id)){var b=webimutil.ChineseCharacter.convertToABC(a.name),c=webimutil.ChineseCharacter.getPortraitChar(a.name);a.setpinying({pinyin:b.pinyin,everychar:b.first,firstchar:c}),this.nonFriendList.push(a)}}};return d.contactsList=e,d.notification={hasNewNotification:!1,notificationList:[],addNotification:function(a){this._findFriendApply(a)||(a.name&&(a.firstchar=webimutil.ChineseCharacter.getPortraitChar(a.name)),this.notificationList.unshift(a))},_findFriendApply:function(a){if(a.id)for(var b=0,c=this.notificationList.length;b<c;b++)if(a.id===this.notificationList[b].id&&this.notificationList[b].status==webimmodel.FriendStatus.Requested)return!0;return!1},_sort:function(){d.notification.notificationList=d.notification.notificationList.sort(function(a,b){return parseInt(a.timestamp)-parseInt(b.timestamp)})}},d}]),mainServer.factory("RongIMSDKServer",["$q",function(a){var b={};return b.init=function(a){RongIMLib.RongIMClient.init(a);var b=new RongIMLib.MessageTag(!1,!0);RongIMLib.RongIMClient.registerMessageType("GroupNotificationMessage","ST:GrpNtf",b,["operatorUserId","operation","data","message"]),RongIMLib.RongIMClient.registerMessageType("ContactNotificationMessage","ST:ContactNtf",b,["targetUserId","sourceUserId","operation","message"])},b.connect=function(b){var c=a.defer();return RongIMLib.RongIMClient.connect(b,{onSuccess:function(a){c.resolve(a)},onTokenIncorrect:function(){c.reject({tokenError:!0})},onError:function(a){c.reject({errorCode:a});var b="";switch(a){case RongIMLib.ErrorCode.TIMEOUT:b="连接超时";break;case RongIMLib.ErrorCode.UNKNOWN:b="未知错误";break;case RongIMLib.ConnectionState.UNACCEPTABLE_PROTOCOL_VERSION:b="不可接受的协议版本";break;case RongIMLib.ConnectionState.IDENTIFIER_REJECTED:b="appkey不正确";break;case RongIMLib.ConnectionState.SERVER_UNAVAILABLE:b="服务器不可用";break;case RongIMLib.ConnectionState.NOT_AUTHORIZED:b="未认证";break;case RongIMLib.ConnectionState.REDIRECT:b="重新获取导航";break;case RongIMLib.ConnectionState.APP_BLOCK_OR_DELETE:b="应用已被封禁或已被删除";break;case RongIMLib.ConnectionState.BLOCK:b="用户被封禁"}console.log("失败:"+b)}}),c.promise},b.getInstance=function(){return RongIMLib.RongIMClient.getInstance()},b.setOnReceiveMessageListener=function(a){RongIMLib.RongIMClient.setOnReceiveMessageListener(a)},b.setConnectionStatusListener=function(a){RongIMLib.RongIMClient.setConnectionStatusListener(a)},b.sendMessage=function(b,c,d,e){var f=a.defer(),g=e||!1;return RongIMLib.RongIMClient.getInstance().sendMessage(+b,c,d,{onSuccess:function(a){f.resolve(a)},onError:function(a,b){f.reject({errorCode:a,message:b});var c="";switch(a){case RongIMLib.ErrorCode.TIMEOUT:c="超时";break;case RongIMLib.ErrorCode.UNKNOWN:c="未知错误";break;case RongIMLib.ErrorCode.REJECTED_BY_BLACKLIST:c="在黑名单中，无法向对方发送消息";break;case RongIMLib.ErrorCode.NOT_IN_DISCUSSION:c="不在讨论组中";break;case RongIMLib.ErrorCode.NOT_IN_GROUP:c="不在群组中";break;case RongIMLib.ErrorCode.NOT_IN_CHATROOM:c="不在聊天室中";break;default:c=""}console.log("发送失败:"+c)}},g),f.promise},b.sendReceiptResponse=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().sendReceiptResponse(+b,c,{onSuccess:function(a){d.resolve(a)},onError:function(a,b){d.reject({errorCode:a,message:b});var c="";switch(a){case RongIMLib.ErrorCode.TIMEOUT:c="超时";break;case RongIMLib.ErrorCode.UNKNOWN:c="未知错误";break;case RongIMLib.ErrorCode.REJECTED_BY_BLACKLIST:c="在黑名单中，无法向对方发送消息";break;case RongIMLib.ErrorCode.NOT_IN_DISCUSSION:c="不在讨论组中";break;case RongIMLib.ErrorCode.NOT_IN_GROUP:c="不在群组中";break;case RongIMLib.ErrorCode.NOT_IN_CHATROOM:c="不在聊天室中";break;default:c=""}console.log("发送失败:"+c)}}),d.promise},b.reconnect=function(a){RongIMLib.RongIMClient.reconnect(a)},b.clearUnreadCount=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().clearUnreadCount(b,c,{onSuccess:function(a){d.resolve(a)},onError:function(a){d.reject(a)}}),d.promise},b.getTotalUnreadCount=function(){var b=a.defer();return RongIMLib.RongIMClient.getInstance().getTotalUnreadCount({onSuccess:function(a){b.resolve(a)},onError:function(){b.reject()}}),b.promise},b.getConversationList=function(){var b=a.defer();return RongIMLib.RongIMClient.getInstance().getConversationList({onSuccess:function(a){a=a.filter(function(a){return 6!=a.conversationType}),b.resolve(a)},onError:function(a){b.reject(a)}},null),b.promise},b.removeConversation=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().removeConversation(b,c,{onSuccess:function(a){d.resolve(a)},onError:function(a){d.reject(a)}}),d.promise},b.createConversation=function(a,b,c){RongIMLib.RongIMClient.getInstance().createConversation(a,b,c)},b.getConversation=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().getConversation(b,c,{onSuccess:function(a){d.resolve(a)},onError:function(){d.reject()}}),d.promise},b.getDraft=function(a,b){return RongIMLib.RongIMClient.getInstance().getTextMessageDraft(a,b)||""},b.setDraft=function(a,b,c){return RongIMLib.RongIMClient.getInstance().saveTextMessageDraft(a,b,c)},b.clearDraft=function(a,b){return RongIMLib.RongIMClient.getInstance().clearTextMessageDraft(a,b)},b.getHistoryMessages=function(b,c,d,e){var f=a.defer();return RongIMLib.RongIMClient.getInstance().getHistoryMessages(b,c,d,e,{onSuccess:function(a,b){f.resolve({data:a,has:b})},onError:function(a){f.reject(a)}}),f.promise},b.disconnect=function(){RongIMLib.RongIMClient.getInstance().disconnect()},b.logout=function(){RongIMLib&&RongIMLib.RongIMClient&&RongIMLib.RongIMClient.getInstance().logout()},b.createDiscussion=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().createDiscussion(b,c,{onSuccess:function(a){d.resolve({data:a})},onError:function(a){d.reject(a)}}),d.promise},b.addMemberToDiscussion=function(a,b,c){return RongIMLib.RongIMClient.getInstance().addMemberToDiscussion(a,b,c)},b.removeMemberFromDiscussion=function(a,b,c){return RongIMLib.RongIMClient.getInstance().removeMemberFromDiscussion(a,b,c)},b.setDiscussionName=function(a,b,c){return RongIMLib.RongIMClient.getInstance().setDiscussionName(a,b,c)},b.getDiscussion=function(b,c){var d=a.defer();return RongIMLib.RongIMClient.getInstance().getDiscussion(b,{onSuccess:function(a){d.resolve({data:a})},onError:function(a){d.reject(a)}}),d.promise},b.getFileToken=function(b){var c=a.defer();return RongIMLib.RongIMClient.getInstance().getFileToken(b,{onSuccess:function(a){c.resolve(a)},onError:function(a){c.reject(a)}}),c.promise},b.getFileUrl=function(b,c,d){var e=a.defer();return RongIMLib.RongIMClient.getInstance().getFileUrl(b,c,d,{onSuccess:function(a){e.resolve(a)},onError:function(a){e.reject(a)}}),e.promise},b.quitDiscussion=function(a,b){return RongIMLib.RongIMClient.getInstance().quitDiscussion(a,b)},b.registerMessageType=function(a,b,c,d){return RongIMLib.RongIMClient.registerMessageType(a,b,c,d)},b.RegisterMessage=function(){return RongIMLib.RongIMClient.RegisterMessage},b}]);var mainCtr=angular.module("webim.main.controller",["webim.main.server","webim.conversation.server"]),IMGDOMAIN="http://7xogjk.com1.z0.glb.clouddn.com/",FILEDOMAIN="http://o83059m7d.bkt.clouddn.com/"
  ;mainCtr.controller("mainController",["$scope","$state","$window","$timeout","$http","mainDataServer","conversationServer","mainServer","RongIMSDKServer","appconfig",function(a,b,c,d,e,f,g,h,i,j){function k(){a.mainData.conversation.updateConversations()}function l(b){var c=g.historyMessagesCache[b.conversationType+"_"+b.targetId]=g.historyMessagesCache[b.conversationType+"_"+b.targetId]||[];0==c.length&&(c.push(new webimmodel.GetHistoryPanel),b.sentTime.toLocaleDateString()!=(new Date).toLocaleDateString()&&c.push(new webimmodel.TimePanl(b.sentTime))),g.addHistoryMessages(b.targetId,b.conversationType,b),b.messageType==webimmodel.MessageType.ImageMessage?setTimeout(function(){a.$broadcast("msglistchange")},200):a.$broadcast("msglistchange")}function m(a){var b=document.querySelector(".no_network");b&&(b.style.visibility=a?"visible":"hidden");var c=document.querySelector(".sendBtn");c&&(c.className=a?"sendBtn disabled":"sendBtn")}function n(){v&&clearTimeout(v),v=setTimeout(function(){i.reconnect({onSuccess:function(){var a=new Date;w=0,console.log("reconnectSuccess",a.toLocaleString()),v&&clearTimeout(v),m(!1),p=!1,f.isConnected=!0,i.getConversationList().then(function(){f.conversation.updateConversations()})},onError:function(){if(f.isConnected=!1,p=!1,w<=5)n(),w+=1;else{w=0;var a=new Date;console.log("网络正常重连失败！！！",a.toLocaleString())}}})},x*w*1e3)}function o(a){var b=new Date;console.log("begin checkNetwork",b.toLocaleString()),e.get("index.html",{params:{t:Math.random()}}).success(function(){u&&clearTimeout(u),a&&a.onSuccess&&a.onSuccess()}).error(function(){m(!0),u&&clearTimeout(u),u=setTimeout(function(){o(a)},5e3)})}var p=!1;if(!f.loginUser.id){var q=webimutil.CookieHelper.getCookie("loginuserid"),r=webimutil.CookieHelper.getCookie("loginusertoken");if(!q)return void h.user.logout().success(function(){webimutil.CookieHelper.removeCookie("loginuserid"),f.loginUser=new webimmodel.UserInfo,g.historyMessagesCache.length=0,window.Electron&&window.Electron.webQuit(),b.go("account.signin")});f.loginUser.id=q,f.loginUser.token=r}f.loginUser.nickName="我",f.loginUser.firstchar="http://121.41.9.232:8051/user.png",f.loginUser.portraitUri="http://121.41.9.232:8051/user.png",a.mainData=f,a.$on("refreshSelectCon",function(b,c){a.unSelect(c)}),a.showState={isPhone:!1,isChat:!1},a.switchbtn={isFriendList:!1,issearchList:!1},a.curCon="",a.unSelect=function(b){a.curCon&&$("#"+a.curCon).removeClass("selected"),$("#"+b).addClass("selected"),a.curCon=b},a.selectGo=function(c,d){a.switchbtn.isFriendList?b.go("main.friendinfo",{userid:c,groupid:"0",targetid:"0",conversationtype:"0"}):b.go("main.chat",{targetId:c,targetType:d},{location:"replace"})},a.selectGoGroup=function(c,d){a.switchbtn.isFriendList?b.go("main.groupinfo",{groupid:c,conversationtype:"0"}):b.go("main.chat",{targetId:c,targetType:d},{location:"replace"})},a.selectMember=function(b){a.atShow=!1},a.searchControl={},a.$watch("switchbtn.isFriendList",function(b,c){b!==c&&a.searchControl.clear()}),a.search=function(b){if(b.trim()){var c=[].concat.apply([],f.contactsList.subgroupList.map(function(a){return a.list}));a.switchbtn.issearchList=!0,a.searchList={},a.searchList.friendList=f.contactsList.find(b,c)||[],a.searchList.groupList=f.contactsList.find(b,f.contactsList.groupList)||[]}else a.switchbtn.issearchList=!1},a.tonotification=function(){f.notification.hasNewNotification=!1,b.go("main.notification")},a.showPasteDiv=function(b){a.$broadcast("showPasteDiv",b)},a.uploadPasteImage=function(){a.$broadcast("uploadPasteImage")},a.checkSend=function(b){var c=document.getElementsByClassName("previewPic")[0];13===b.keyCode&&"visible"==c.style.visibility&&(a.uploadPasteImage(),b.preventDefault())},a.$on("conversationChange",function(){k()}),a.$watch("mainData.conversation.totalUnreadCount",function(a,b){a!=b&&window.Electron&&window.Electron.updateBadgeNumber(a)}),window.onfocus=function(){},a.$on("$viewContentLoaded",function(){function d(){if(document.documentElement.clientWidth<600){a.showState.isPhone=!0;var b=document.querySelector(".mainBox");b&&(b.style.width=document.documentElement.clientWidth-parseFloat(getComputedStyle(document.querySelector(".toolbar")).width)+"px")}else{a.showState.isPhone=!1;var b=document.querySelector(".mainBox");b&&(b.style.width="314px")}var c=document.getElementById("chatArea");c&&(c.style.height=document.documentElement.clientHeight-54+"px");for(var d=document.getElementsByClassName("communicateList"),e=0,f=d.length;e<f;e++)d[e].style.height=document.documentElement.clientHeight-54+"px";document.getElementById("Messages")&&(document.getElementById("Messages").style.height=document.documentElement.clientHeight-parseFloat(getComputedStyle(document.querySelector(".inputBox")).height)-parseFloat(getComputedStyle(document.querySelector(".box_hd")).height)+"px"),document.getElementById("functionBox")&&(document.getElementById("functionBox").style.height=document.documentElement.clientHeight-parseFloat(getComputedStyle(document.querySelector(".box_hd")).height)+"px")}function e(){var a=document.getElementById("Messages"),b=document.getElementsByClassName("no_network");a&&b[0]&&(b[0].style.width=getComputedStyle(document.querySelector("#Messages")).width)}b.is("main")?a.showState.isChat=!1:a.showState.isChat=!0,d(),e(),c.onresize=function(){d(),e(),a.$apply()}}),a.$on("reconnect",function(){n()}),f.notification.notificationList=[],f.contactsList.subgroupList=[],f.blackList.list=[],f.contactsList.groupList=[],i.init(j.getAppKey()),f.loginUser.token?i.connect(f.loginUser.token).then(function(a){i.getConversationList().then(function(a){f.conversation.updateConversations(),b.go("main.chat",{targetId:localStorage.getItem("chat_id"),targetType:1})})},function(a){a.tokenError&&h.user.getToken().success(function(a){"200"==a.code?i.connect(a.result.token).then(function(a){console.log("connect success2:"+a),i.getConversationList().then(function(a){f.conversation.updateConversations()})},function(a){a.tokenError&&console.log("token error")}):b.go("account.signin")}).error(function(a){b.go("account.signin")})}):h.user.getToken().success(function(a){"200"==a.code?i.connect(a.result.token).then(function(a){console.log("connect success3:"+a),i.getConversationList().then(function(a){f.conversation.updateConversations()})},function(a){a.tokenError}):b.go("account.signin")}).error(function(a){b.go("account.signin")});i.setConnectionStatusListener({onChanged:function(a){var c=new Date;switch(a){case RongIMLib.ConnectionStatus.CONNECTED:console.log("链接成功",c.toLocaleString()),f.isConnected=!0,m(!1),p=!1;break;case RongIMLib.ConnectionStatus.CONNECTING:console.log("正在链接");break;case RongIMLib.ConnectionStatus.DISCONNECTED:console.log("断开连接"),b.is("account.signin")||b.go("account.signin");break;case RongIMLib.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:console.log("其他设备登录"),b.is("account.signin")||(webimutil.Helper.alertMessage.error("您的账号在其他地方登录!"),webimutil.NotificationHelper.showNotification({title:"SealTalk",icon:"assets/img/SealTalk.ico",body:"您的账号在其他地方登录!"}),window.Electron&&window.Electron.kickedOff());break;case RongIMLib.ConnectionStatus.NETWORK_UNAVAILABLE:console.log("网络不可用",c.toLocaleString(),"isConnecting:"+p),f.isConnected=!1,m(!0),p=!0,o({onSuccess:function(){n()}})}}}),webimutil.NotificationHelper.onclick=function(a){a.data&&b.go("main.chat",{targetId:a.data.targetId,targetType:a.data.targetType})};var s,t;i.setOnReceiveMessageListener({onReceived:function(c){if(a.mainData.loginUser.hasSound){document.getElementById("playsound").play()}var d=webimmodel.Message.formatGIFMsg(c);switch(d=webimmodel.Message.convertMsg(d),""==d.targetId&&(d.targetId=f.loginUser.id),b.is("main.chat")&&i.clearUnreadCount(f.conversation.currentConversation.targetType,f.conversation.currentConversation.targetId),c.messageType){case webimmodel.MessageType.ContactNotificationMessage:if(i.clearUnreadCount(c.conversationType,c.targetId),c.hasReceivedByOtherClient)break;var e=d.content;if(i.removeConversation(d.conversationType,d.targetId).then(function(){k()}),"Request"==e.operation){b.is("main.notification")||(a.mainData.notification.hasNewNotification=!0);var j=new webimmodel.NotificationFriend({id:e.sourceUserId,name:e.senderUserName,portraitUri:e.senderUserImgSrc,content:e.content,status:webimmodel.FriendStatus.Requested+"",timestamp:d.sentTime&&d.sentTime.getTime()});j.name?f.notification.addNotification(j):h.user.getInfo(e.sourceUserId).success(function(a){j.name=a.result.nickname,j.portraitUri=a.result.portraitUri,j.firstchar=webimutil.ChineseCharacter.getPortraitChar(j.name),f.notification.addNotification(j)}).error(function(){})}else if("AcceptResponse"==e.operation){var m=f.contactsList.getFriendById(e.sourceUserId);m||h.user.getInfo(e.sourceUserId).success(function(a){var b=a.result;f.contactsList.addFriend(new webimmodel.Friend({id:b.id,name:b.nickname,imgSrc:b.portraitUri})),k()}).error(function(){f.contactsList.addFriend(new webimmodel.Friend({id:e.sourceUserId,name:"网络原因暂未取到",imgSrc:""})),k()})}break;case webimmodel.MessageType.DiscussionNotificationMessage:break;case webimmodel.MessageType.VoiceMessage:d.isUnReade=!0;case webimmodel.MessageType.TextMessage:case webimmodel.MessageType.LocationMessage:case webimmodel.MessageType.ImageMessage:case webimmodel.MessageType.RichContentMessage:case webimmodel.MessageType.FileMessage:if(b.is("main.chat")&&!document.hidden&&d.conversationType==webimmodel.conversationType.Private&&d.senderUserId==f.conversation.currentConversation.targetId&&(f.isTyping=!1),b.is("main.chat")&&!document.hidden&&d.senderUserId!=f.loginUser.id&&d.conversationType==webimmodel.conversationType.Private&&(c.offLineMessage?(f.conversation.lastOfflineMsg=c,!t&&f.conversation.lastOfflineMsg&&(t=setTimeout(function(){g.sendReadReceiptMessage(f.conversation.currentConversation.targetId,f.conversation.currentConversation.targetType,f.conversation.lastOfflineMsg.messageUId,f.conversation.lastOfflineMsg.sentTime),t=null},1e3))):g.sendReadReceiptMessage(f.conversation.currentConversation.targetId,f.conversation.currentConversation.targetType,c.messageUId,c.sentTime)),l(d),d.mentionedInfo){var n=!1;if(d.mentionedInfo.type==webimmodel.AtTarget.All&&(n=!0),d.mentionedInfo.type==webimmodel.AtTarget.Part)for(var o=0;o<d.mentionedInfo.userIdList.length;o++)d.mentionedInfo.userIdList[o]==f.loginUser.id&&(n=!0);n&&g.addAtMessage(d.targetId,d.conversationType,d)}var p=f.loginUser.id==d.senderUserId;if(p||b.is("main.chat")&&!document.hidden&&d.conversationType==f.conversation.currentConversation.targetType&&d.senderUserId==f.conversation.currentConversation.targetId){i.clearUnreadCount(d.conversationType,d.targetId);var q=f.conversation.getConversation(d.conversationType,d.targetId);q&&(q.atStr="",f.conversation.totalUnreadCount=f.conversation.totalUnreadCount-q.unReadNum,q.unReadNum=0)}else d.senderUserName?webimutil.NotificationHelper.showNotification({title:d.senderUserName,icon:"assets/img/SealTalk.ico",body:webimmodel.Message.messageToNotification(c,f.loginUser.id,!0),data:{targetId:d.targetId,targetType:d.conversationType}}):h.user.getInfo(d.senderUserId).then(function(a){d.senderUserName=a.data.result.nickname,webimutil.NotificationHelper.showNotification({title:d.senderUserName+"(非好友)",icon:"assets/img/SealTalk.ico",body:webimmodel.Message.messageToNotification(c,f.loginUser.id,!0),data:{targetId:d.targetId,targetType:d.conversationType}})});break;case webimmodel.MessageType.GroupNotificationMessage:if("ST:GrpNtf"==c.objectName&&!c.hasReceivedByOtherClient){var r=c.content,p=!1;switch(r.operatorUserId==f.loginUser.id&&(p=!0),r.operation){case"Add":var u=r.data.data.targetUserIds.join().split(","),v=c.targetId,w=u.indexOf(f.loginUser.id+"");if(-1==w)for(var x=0,y=u.length;x<y;x++)h.user.getInfo(u[x]).success(function(a){f.contactsList.addGroupMember(v,new webimmodel.Member({id:a.result.id,name:a.result.nickname,imgSrc:a.result.portraitUri,role:"1"}))}).error(function(){});else h.group.getById(v).success(function(a){var c=new webimmodel.WarningNoticeMessage(r.data.data.operatorNickname+"邀请你加入了群组");f.notification.addNotification(c),b.is("main.notification")||(f.notification.hasNewNotification=!0),f.contactsList.addGroup(new webimmodel.Group({id:a.result.id,name:a.result.name,imgSrc:a.result.portraitUri,upperlimit:500,fact:1,creater:a.result.creatorId})),h.group.getGroupMember(v).success(function(a){for(var b=a.result,c=0,d=b.length;c<d;c++){var e=new webimmodel.Member({id:b[c].user.id,name:b[c].user.nickname,imgSrc:b[c].user.portraitUri,role:b[c].role,displayName:b[c].displayName});f.contactsList.addGroupMember(v,e)}}),k()}).error(function(){});break;case"Quit":var u=r.data.data.targetUserIds.join().split(","),v=c.targetId,w=u.indexOf(f.loginUser.id+"");-1==w?f.contactsList.removeGroupMember(v,u[0]):(f.contactsList.removeGroup(v),i.removeConversation(webimmodel.conversationType.Group,v).then(function(){k()}));break;case"Kicked":var u=r.data.data.targetUserIds.join().split(","),v=c.targetId,w=(f.contactsList.getGroupById(v)&&f.contactsList.getGroupById(v).name,u.indexOf(f.loginUser.id+""));if(-1==w)for(var x=0,y=u.length;x<y;x++)f.contactsList.removeGroupMember(v,u[x]);else{var z=new webimmodel.WarningNoticeMessage(r.data.data.operatorNickname+"将你移出了群组");f.notification.addNotification(z),b.is("main.notification")||(f.notification.hasNewNotification=!0),f.contactsList.removeGroup(v),i.removeConversation(webimmodel.conversationType.Group,v).then(function(){k()}),b.is("main.chat")&&b.params.targetId==v&&b.params.targetType==webimmodel.conversationType.Group&&b.go("main")}break;case"Rename":var v=c.targetId,A=(f.contactsList.getGroupById(v)&&f.contactsList.getGroupById(v).name,p?"你":r.data.data.operatorNickname),z=new webimmodel.WarningNoticeMessage(A+" 修改群名称为"+r.data.data.targetGroupName);f.notification.addNotification(z),b.is("main.notification")||(f.notification.hasNewNotification=!0),f.contactsList.updateGroupNameById(v,r.data.data.targetGroupName),f.conversation.updateConversationTitle(webimmodel.conversationType.Group,v,r.data.data.targetGroupName);break;case"Create":var v=c.targetId;h.group.getById(v).success(function(a){var c=p?"你":r.data.data.operatorNickname,d=new webimmodel.WarningNoticeMessage(c+"创建了群组");f.notification.addNotification(d),b.is("main.notification")||(f.notification.hasNewNotification=!0),f.contactsList.addGroup(new webimmodel.Group({id:a.result.id,name:a.result.name,imgSrc:a.result.portraitUri,upperlimit:500,fact:1,creater:a.result.creatorId})),h.group.getGroupMember(v).success(function(a){for(var b=a.result,c=0,d=b.length;c<d;c++){var e=new webimmodel.Member({id:b[c].user.id,name:b[c].user.nickname,imgSrc:b[c].user.portraitUri,role:b[c].role,displayName:b[c].displayName});f.contactsList.addGroupMember(v,e)}}),k()}).error(function(){});break;case"Dismiss":var v=c.targetId,A=(f.contactsList.getGroupById(v)&&f.contactsList.getGroupById(v).name,p?"你":r.data.data.operatorNickname),z=new webimmodel.WarningNoticeMessage(A+"解散了群组");f.notification.addNotification(z),b.is("main.notification")||(f.notification.hasNewNotification=!0),f.contactsList.removeGroup(v),i.removeConversation(webimmodel.conversationType.Group,v).then(function(){k()}),b.is("main.chat")&&b.params.targetId==v&&b.params.targetType==webimmodel.conversationType.Group&&b.go("main");break;default:console.log("不支持操作类型"+r.operation)}g.asyncConverGroupNotifition(c,d),l(d)}break;case webimmodel.MessageType.InformationNotificationMessage:l(d);break;case webimmodel.MessageType.ReadReceiptMessage:if("RC:ReadNtf"==d.objectName&&d.senderUserId==f.loginUser.id){i.clearUnreadCount(d.conversationType,d.targetId);var q=f.conversation.getConversation(d.conversationType,d.targetId);q&&(q.atStr="",f.conversation.totalUnreadCount=f.conversation.totalUnreadCount-q.unReadNum,q.unReadNum=0)}break;case webimmodel.MessageType.RecallCommandMessage:if("RC:RcCmd"==d.objectName){var B=c.content;g.addWithDrawMessageCache(d.senderUserId,d.conversationType,B.messageUId),g.delWithDrawMessage(d.senderUserId,d.conversationType,B.messageUId),d.senderUserId==f.loginUser.id?d.content="你"+d.content:(g.messageAddUserInfo(d),d.content=d.senderUserName+d.content),l(d)}break;case webimmodel.MessageType.TypingStatusMessage:b.is("main.chat")&&!document.hidden&&d.conversationType==webimmodel.conversationType.Private&&d.senderUserId==f.conversation.currentConversation.targetId&&(f.isTyping=!0,s&&clearTimeout(s),s=setTimeout(function(){f.isTyping=!1,a.$apply()},6e3));break;case webimmodel.MessageType.InviteMessage:case webimmodel.MessageType.HungupMessage:l(d);break;case webimmodel.MessageType.ReadReceiptRequestMessage:b.is("main.chat")&&!document.hidden&&d.conversationType==webimmodel.conversationType.Group&&d.targetId==f.conversation.currentConversation.targetId&&i.sendReceiptResponse(d.conversationType,d.targetId).then(function(){console.log("sendReadReceiptResponseMessage success")},function(a){console.log("sendReadReceiptResponseMessage error",a.errorCode)});break;case webimmodel.MessageType.ReadReceiptResponseMessage:var C=c.content,D=C.receiptMessageDic[f.loginUser.id];if(!D)return;for(var E=0,y=D.length;E<y;E++){var F=g.getMessageById(d.targetId,d.conversationType,D[E]);F&&d.receiptResponse&&d.receiptResponse[D[E]]&&(F.receiptResponse=d.receiptResponse)}break;case webimmodel.MessageType.SyncReadStatusMessage:i.clearUnreadCount(d.conversationType,d.targetId);var q=f.conversation.getConversation(d.conversationType,d.targetId);q&&(q.atStr="",f.conversation.totalUnreadCount=f.conversation.totalUnreadCount-q.unReadNum,q.unReadNum=0);break;default:console.log(c.messageType+"：未处理")}a.mainData.conversation.updateConStatic(d,!0,b.is("main.chat")&&!document.hidden),a.$apply()}});var u,v,w=0,x=20}]);var webimApp=angular.module("webim",["ui.router","ui.event","uiSwitch","ng.shims.placeholder","webim.main.directive","webim.main.controller","webim.main.server","webim.conversation.controller","webim.conversation.directive","webim.addfirend","webim.friendinfo","webim.editfriendinfo","webim.creategroup","webim.addgroup","webim.groupaddmember","webim.goupinfo","webim.userinfo","webim.blacklist","webim.notification","webim.usermodifypassword","webim.account","webim.creatediscussion","webim.discussionaddmember","webim.discussioninfo"],function(){});webimApp.config(["$provide","$stateProvider","$urlRouterProvider","$httpProvider",function(a,b,c,d){var e=window.__sealtalk_config.serverUrl,f=window.__sealtalk_config.appkey;a.provider("appconfig",function(){this.$get=function(){return{getBaseUrl:function(){return e},getAppKey:function(){return f}}}}),d.defaults.withCredentials=!0,c.when("/main",["$state","mainDataServer","mainServer",function(a,b,c){return webimutil.CookieHelper.getCookie("loginuserid")?void(a.is("main")||a.go("main")):void a.go("account.signin")}]).when("/main/chat/:targetId/:targetType",["$state","$match","mainDataServer",function(a,b,c){if(!c.loginUser.nickName)return void a.go("main");a.transitionTo("main.chat",b)}]).when("/main/friendinfo/:userid/:groupid/:targetid/:conversationtype",["$state","$match","mainDataServer",function(a,b,c){if(!c.loginUser.nickName)return void a.go("main");a.transitionTo("main.friendinfo",b)}]).when("/main/editfriendinfo/:userid/:groupid/:targetid/:conversationtype",["$state","$match","mainDataServer",function(a,b,c){if(!c.loginUser.nickName)return void a.go("main");a.transitionTo("main.editfriendinfo",b)}]).when("/main/groupinfo/:groupid/:conversationtype",["$state","$match","mainDataServer",function(a,b,c){if(!c.loginUser.nickName)return void a.go("main");a.transitionTo("main.groupinfo",b)}]).when("/main/groupaddmember/:iscreate/:idorname",["$state","mainDataServer",function(a,b){if(!b.loginUser.nickName)return void a.go("main")}]).when("/main/discussioninfo/:discussionid/:conversationtype",["$state","$match","mainDataServer",function(a,b,c){if(!c.loginUser.nickName)return void a.go("main");a.transitionTo("main.discussioninfo",b)}]).when("/main/discussionaddmember/:iscreate/:idorname",["$state","mainDataServer",function(a,b){if(!b.loginUser.nickName)return void a.go("main")}]).when("/account",["$state",function(a){a.go("account.signin")}]).otherwise("main"),b.state("forgetPassword",{url:"/forgetPassword",templateUrl:"assets/views/forgetPassword.html"}).state("main",{url:"/main",templateUrl:"assets/views/main.html",controller:"mainController"}).state("main.chat",{url:"/chat/:targetId/:targetType",templateUrl:"assets/views/chatBox.html",controller:"conversationController"}).state("main.none",{url:"/none",template:'<div class="emptyBox"></div>'}).state("main.searchgroup",{url:"/searchgroup",templateUrl:"assets/views/searchgroup.html",controller:"searchgroupController"}).state("main.applygroup",{url:"/applygroup/:groupId/:groupName",templateUrl:"assets/views/applygroup.html",controller:"applygroupController"}).state("main.searchfriend",{url:"/searchfriend",templateUrl:"assets/views/searchfriend.html",controller:"searchfriendController"}).state("main.applyfriend",{url:"/applyfriend/:userId/:userName/:groupid/:targetid/:conversationtype",templateUrl:"assets/views/applyfriend.html",controller:"applyfriendController"}).state("main.creategroup",{url:"/creategroup",templateUrl:"assets/views/creategroup.html",controller:"creategroupController"}).state("main.groupaddmember",{url:"/groupaddmember/:iscreate/:idorname",templateUrl:"assets/views/groupaddmember.html",controller:"groupaddmemberController"}).state("main.groupinfo",{url:"/groupinfo/:groupid/:conversationtype",templateUrl:"assets/views/groupinfo.html",controller:"groupinfoController"}).state("main.groupbulletin",{url:"/groupbulletin/:groupid",templateUrl:"assets/views/groupbulletin.html",controller:"groupbulletinController"}).state("main.userinfo",{url:"/userinfo",templateUrl:"assets/views/userinfo.html",controller:"userinfoController"}).state("main.blacklist",{url:"/blacklist",templateUrl:"assets/views/blacklist.html",controller:"blacklistController"}).state("main.friendinfo",{url:"/friendinfo/:userid/:groupid/:targetid/:conversationtype",templateUrl:"assets/views/friendinfo.html",controller:"friendinfoController"}).state("main.editfriendinfo",{url:"/editfriendinfo/:userid/:groupid/:targetid/:conversationtype",templateUrl:"assets/views/editfriendinfo.html",controller:"editfriendinfoController"}).state("main.modifypassword",{url:"/modifypassword",templateUrl:"assets/views/modifypassword.html",controller:"modifypasswordController"}).state("main.notification",{url:"/notification",templateUrl:"assets/views/notification.html",controller:"notificationController"}).state("account",{url:"/account",templateUrl:"assets/views/account.html",controller:""}).state("account.signin",{url:"/signin",templateUrl:"assets/views/signin.html",controller:"signinController"}).state("account.signup",{url:"/signup",templateUrl:"assets/views/signup.html",controller:"signupController"}).state("account.forgotpassword",{url:"/forgotpassword",templateUrl:"assets/views/forgotpassword.html",controller:"forgotpasswordController"}).state("account.resetpassword",{url:"/resetpassword/:token",templateUrl:"assets/views/resetpassword.html",controller:"resetpasswordController"}).state("main.creatediscussion",{url:"/creatediscussion",templateUrl:"assets/views/creatediscussion.html",controller:"creatediscussionController"}).state("main.discussionaddmember",{url:"/discussionaddmember/:iscreate/:idorname",templateUrl:"assets/views/discussionaddmember.html",controller:"discussionaddmemberController"}).state("main.discussioninfo",{url:"/discussioninfo/:discussionid/:conversationtype",templateUrl:"assets/views/discussioninfo.html",controller:"discussioninfoController"})}]),webimApp.run(["RongIMSDKServer","$state","$rootScope",function(a,b,c){webimutil.NotificationHelper.requestPermission(),RongIMLib.RongIMVoice.init(),RongIMLib.RongIMEmoji.init(),window._open_account_settings=function(){b.go("main.userinfo")},c.$on("$stateChangeSuccess",function(a,b,c,d,e){cancelScollStyle()})}]),webimApp.filter("trustHtml",["$sce",function(a){return function(b){return a.trustAsHtml(b)}}]),webimApp.filter("showTime",["$filter",function(a){return function(b){if(b){var c=new Date;return b.toDateString()===c.toDateString()?a("date")(b,"HH:mm"):a("date")(b,"MM-dd")}}}]),webimApp.filter("selectedNum",[function(){return function(a){var b={};return b=a.filter(function(a){return a.isSelected}),b.length}}]),webimApp.filter("historyTime",["$filter",function(a){return function(b){if(b){var c=new Date;return b.toDateString()===c.toDateString()?a("date")(b,"HH:mm"):b.toDateString()===new Date(c.setTime(c.getTime()-1)).toDateString()?"昨天"+a("date")(b,"HH:mm"):a("date")(b,"yyyy-MM-dd HH:mm")}}}]);var mainDire=angular.module("webim.main.directive",["webim.main.server"]);mainDire.directive("conversation",["$state","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<div class="chatList" ng-class="{selected:isCurrentConversation}" id="{{item.targetType}}_{{item.targetId}}"><div class="chat_item online slide-left"><div class="ext"><p class="attr clearfix timer"><span class="pull-left">{{item.lastTime|showTime}}</span></p><p class="attr clearfix"><span class="badge" ng-if="item.unReadNum>0">{{item.unReadNum>99?"99+":item.unReadNum}}</span><i class="no-remind" ng-show="false"></i></p></div><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div><i class="Presence Presence--stacked Presence--mainBox" ng-show="{{item.targetType==4}}"></i></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.title}}</span></h3><p class="msg ng-scope" ><span class="at_show" ng-show="item.atStr">{{item.atStr}}</span><span ng-bind-html="item.lastMsg|trustHtml" class="ng-binding"></span></p></div></div></div>',link:function(c,d,e,f){c.item.targetId?c.item.targetType==webimmodel.conversationType.Discussion?c.item.imgSrc="assets/img/room_icon.png":angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.targetId.charCodeAt(0)%webimutil.Helper.portraitColors.length]):c.item.imgSrc="assets/img/barBg.png",d.bind("click",function(){if(c.$parent.unSelect(c.item.targetType+"_"+c.item.targetId),c.$parent.$apply(),b.conversation.totalUnreadCount=b.conversation.totalUnreadCount-c.item.unReadNum,c.item.unReadNum=0,c.item.atStr="",c.item.targetType==webimmodel.conversationType.System)return void a.go("main.notification");a.is("main")||a.is("main.none")?a.go("main.chat",{targetId:c.item.targetId,targetType:c.item.targetType}):a.go("main.chat",{targetId:c.item.targetId,targetType:c.item.targetType},{location:"replace"})})}}}]),mainDire.directive("addbtn",[function(){return{restrict:"EA",link:function(a,b,c){function d(){this.style.display="none",document.removeEventListener("click",e,!1)}var e;b.bind("click",function(){var a=b.find("ul")[0],c=getComputedStyle(a,null).display;c&&"none"!=c?a.style.display="none":(a.style.display="block",e=function(){d.call(a)},setTimeout(function(){document.addEventListener("click",e,!1)},0))})}}}]),mainDire.directive("groupitem",["$state",function(a){return{restrict:"E",scope:{item:"="},template:'<div class="notice_item "><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.name}}</span></h3></div><div class="botDivider"></div></div>',replace:!0,link:function(a,b,c){angular.element(b[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[a.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),b.on("click",function(){a.$parent.selectGoGroup(a.item.id,webimmodel.conversationType.Group)})}}}]),mainDire.directive("frienditem",["$state",function(a){return{restrict:"E",scope:{item:"="},replace:!0,template:'<div class="members_item "><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.displayName||item.name}}</span></h3></div><div class="botDivider"></div></div>',link:function(a,b,c){angular.element(b[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[a.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),b.on("click",function(){a.$parent.selectGo(a.item.id,webimmodel.conversationType.Private)})}}}]),mainDire.directive("searchInput",["$timeout",function(a){return{restrict:"E",scope:{search:"&",showText:"@",delayTime:"@",focus:"&",control:"="},template:'<form class="searchArea"><div class="form-group"><input type="text" class="form-control" id="{{id}}" ng-model="content" placeholder="{{showText||\'搜索\'}}"><i class="clearInputBtn" ng-show="content.length>0" ng-click="clear()"></i><label class="" for="{{id}}"></label></div></form>',link:function(b,c,d){b.id="groupSearch"+b.$id,b.clear=function(){b.content="",document.getElementById(b.id).focus()},b.delayTime=parseInt(b.delayTime)||800;var e=c.find("input");b.content="",e.on("blur",function(a){angular.element(this).val().trim()||angular.element(this).parent().removeClass("isfocus")}),e.on("focus",function(a){angular.element(this).parent().addClass("isfocus")});var f;b.$watch("content",function(c,d){c!==d&&(a.cancel(f),f=a(function(){b.search({content:b.content})},b.delayTime))}),b.internalControl=b.control||{},b.internalControl.clear=function(){b.content=""}}}}]),mainDire.directive("inputWrap",[function(){return{restrict:"E",scope:{message:"=",maxlength:"=",loadedfocus:"@"},template:'<div class="input-wrap"><div class="textarea-wrap" style="height: 140px;"><div class="textarea-bg" style="display: block;" ng-show="showplaceholder"><span class="prompt-text">请输入验证消息</span></div><textarea class="joinGroupInfo textarea" ng-model="message"></textarea></div><div class="wordsLen"><span class="word_start">{{message.length}}</span>/{{maxlength}}</div></div>',link:function(a,b,c){a.showplaceholder=!0,a.maxlength=a.maxlength||64;var d=a.$parent.getInfo();d&&(a.message=d),a.loadedfocus&&(angular.element(b).find("textarea")[0].focus(),a.showplaceholder=!0),b.find("textarea").bind("focus",function(){}),b.find("textarea").bind("blur",function(){a.message&&a.message.length||(a.showplaceholder=!0),a.$apply()}),b.find("textarea").bind("input propertychange",function(){a.message&&a.message.length?a.showplaceholder=!1:a.showplaceholder=!0,a.$apply()}),a.message=a.message||"",a.message&&(a.showplaceholder=!1),a.$watch("message",function(b,c){b.length>a.maxlength&&(a.message=b.substring(0,a.maxlength))})}}}]),mainDire.directive("pwMatch",[function(){return{require:"ngModel",link:function(a,b,c,d){var e=c.pwMatch.trim().split("."),f=function(a){var b=document.forms[e[0]],c=b[e[1]].value,f=a==c;return d.$setValidity("pwmatch",f),f?c:void 0};d.$parsers.push(f),d.$formatters.push(f)}}}]),mainDire.directive("myFocus",[function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){d.$focused=!1,b.on("focus",function(){a.$apply(function(){d.$focused=!0})}).on("blur",function(){a.$apply(function(){d.$focused=!1})}),b.on("keydown",function(a){13!==a.keyCode&&10!==a.keyCode||setTimeout(function(){b[0].blur()})})}}}]);var notification=angular.module("webim.notification",[]);notification.controller("notificationController",["$scope","$state","mainDataServer",function(a,b,c){a.back=function(){b.go("main")},a.notificationList=c.notification.notificationList}]),notification.directive("applyfriendNotice",["mainServer","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},
  template:'<li class="clearfix"><div class="center">请求添加你为好友</div><div class="left"><div class="photo"><img class="img" ng-show="item.portraitUri" ng-src="{{item.portraitUri||\'./assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.portraitUri">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.name}}</span></h3><p class="remarks"><span class="ng-binding ng-scope">{{item.content}}</span></p></div></div><div class="right"><button class="functionBoxBtn" ng-show="!item.isFriend">接受</button><p class="" ng-show="item.isFriend">已添加</p></div></li>',link:function(c,d,e){angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),d.find("button").on("click",function(){b.contactsList.getFriendById(c.item.id)?(c.item.isFriend=!0,c.item.status=webimmodel.FriendStatus.Agreed,webimutil.Helper.alertMessage.error("已经是好友了")):a.friend.agree(c.item.id).success(function(){c.item.isFriend=!0,c.item.status=webimmodel.FriendStatus.Agreed,b.contactsList.addFriend(new webimmodel.Friend({id:c.item.id,name:c.item.name,imgSrc:c.item.portraitUri}))}).error(function(a){console.log(a)})})}}}]),notification.directive("applygroupNotice",["mainServer","RongIMSDKServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<li class="clearfix"><div class="center">申请加入“{{item.data.groupName}}”</div><div class="left"><div class="photo"><img class="img" ng-src="{{item.senderUserImgSrc||\'./assets/img/barBg.png\'}}" alt=""></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.senderUserName}}</span></h3><p><span class="ng-binding ng-scope">{{item.data.message}}</span></p></div></div><div class="right"><button class="functionBoxBtn" ng-show="!agree">通过</button><p class="hide">已通过</p></div></li>',link:function(a,b,c){b.find("button").on("click",function(){})}}}]),notification.directive("inviteAddGroup",["mainServer","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<li class="clearfix  systemMes" ><div class="left"><div class="photo"><img class="img" ng-src="{{item.senderUserImgSrc||\'./assets/img/barBg.png\'}}" alt=""></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.senderUserName}}</span></h3><p><span class="ng-binding ng-scope"></span></p></div></div><div class="center">{{item.senderUserName}}邀请加入“{{item.data.groupName}}”</div><div class="right"><button class="functionBoxBtn"  ng-show="!agree">通过</button><p class="hide">已通过</p></div></li>',link:function(a,b,c){}}}]),notification.directive("warningNotice",[function(){return{restrict:"E",scope:{item:"="},template:'<li class="clearfix systemMes"><div class="left"><div class="photo"><img class="img" src="./assets/img/barBg.png" alt=""></div><div class="info"><h3 class="nickname"><span class="nickname_text"></span></h3><p><span class="ng-binding ng-scope"></span></p></div></div><div class="center">{{item.content}}</div><div class="right"><button class="functionBoxBtn hide">通过</button><p class="">已通过</p></div></li>',link:function(a,b,c){if(a.item.operation&&"AcceptResponse"==a.item.operation)a.item.content=a.item.senderUserName+a.item.content;else if(a.item.data)switch(a.item.data.type){case webimmodel.CommandNotificationMessageType.AcceptApplyGroup:a.item.content=a.item.content+a.item.data.groupName;break;case webimmodel.CommandNotificationMessageType.AcceptInviteAddGroup:a.item.content=a.item.data.userName+a.item.content+a.item.data.groupName}}}}]);var userinfo=angular.module("webim.blacklist",["webim.main.server"]);userinfo.controller("blacklistController",["$scope","$state","mainDataServer",function(a,b,c){a.back=function(){b.go("main.userinfo")},a.blacklist=c.blackList.list}]),userinfo.directive("blackitem",["mainServer","mainDataServer",function(a,b){return{restrict:"E",scope:{item:"="},template:'<li class="chat_item groupUser_item"><div class="photo"><img class="img" ng-show="item.imgSrc" ng-src="{{item.imgSrc||\'assets/img/barBg.png\'}}" alt=""><div class="portrait" ng-show="!item.imgSrc">{{item.firstchar}}</div></div><div class="info"><h3 class="nickname"><span class="nickname_text">{{item.name}}</span></h3><div class="reject"><a href="javascript:void 0">移出黑名单</a></div></div></li>',link:function(c,d,e){angular.element(d[0].getElementsByClassName("portrait")[0]).css("background-color",webimutil.Helper.portraitColors[c.item.id.charCodeAt(0)%webimutil.Helper.portraitColors.length]),d.find("a").on("click",function(){a.user.removeFromBlackList(c.item.id).success(function(){b.blackList.remove(c.item.id)}).error(function(a){console.log(a)})})}}}]);var modifypassword=angular.module("webim.usermodifypassword",["webim.main.server"]);modifypassword.controller("modifypasswordController",["$scope","$state","mainServer","mainDataServer","conversationServer",function(a,b,c,d,e){function f(){c.user.logout().success(function(){webimutil.CookieHelper.removeCookie("loginuserid"),d.loginUser=new webimmodel.UserInfo,e.historyMessagesCache.length=0,window.Electron&&window.Electron.webQuit(),b.go("account.signin")})}a.user={oldpassword:"",newpassword:"",repeatpassword:""},a.validate={oldpassworderror:!1},a.$watch("user.oldpassword",function(){a.validate.oldpassworderror=!1}),a.back=function(){b.go("main.userinfo")},a.save=function(){a.formModifyPWD.$valid&&c.user.modefiyPassword(a.user.newpassword,a.user.oldpassword).success(function(b){200==b.code?(f(),webimutil.Helper.alertMessage.success("修改成功,请重新登录",2)):1e3==b.code&&(a.validate.oldpassworderror=!0)}).error(function(a){})},a.validRepeatPwd=function(){var b=angular.element(document.getElementById("newPW")),c=angular.element(document.getElementById("renewPW"));if(c.val()){var d=c.val()!=b.val();a.formModifyPWD.repeatpassword.$setValidity("pwmatch",!d)}}}]);var userinfo=angular.module("webim.userinfo",[]);userinfo.controller("userinfoController",["$scope","$state","mainServer","mainDataServer","conversationServer",function(a,b,c,d,e){a.$on("$viewContentLoaded",function(){angular.element(document.getElementById("portrait")).css("background-color",webimutil.Helper.portraitColors[d.loginUser.id.charCodeAt(0)%webimutil.Helper.portraitColors.length])}),a.loginUser=d.loginUser,a.editable=!1,a.newName=d.loginUser.nickName,a.edit=function(){a.editable=!0,a.newName=d.loginUser.nickName,setTimeout(function(){var a=document.getElementById("editName");a.focus(),a.select()},0)},a.save=function(){a.modifyName.$valid&&(c.user.setNickName(a.newName).success(function(){d.loginUser.nickName=a.newName,d.loginUser.firstchar=webimutil.ChineseCharacter.getPortraitChar(a.newName)}),a.editable=!1)},a.logout=function(){c.user.logout().success(function(){webimutil.CookieHelper.removeCookie("loginuserid"),d.loginUser=new webimmodel.UserInfo,e.historyMessagesCache.length=0,window.Electron&&window.Electron.webQuit(),b.go("account.signin")})},a.back=function(){a.editable?a.editable=!1:window.history.back()}}]);