(function(e){function t(t){for(var s,o,a=t[0],c=t[1],l=t[2],d=0,u=[];d{this.$emit("success",t,e.file)}).catch(t=>{this.$emit("fail",t,e.file)}).finally(()=>{this.loading&&this.loading.close()})},beforeUpload(e){if(this.fileTypes&&this.fileTypes.length>0){let t=e.type,i=this.fileTypes.find(e=>e.toLowerCase()===t);if(void 0===i)return this.$message.error("文件格式错误,请上传以下格式的文件:"+this.fileTypes.join("、")),!1}return this.maxSize&&e.size>this.maxSize?(this.$message.error(`文件大小不能超过 ${this.fileSizeStr}!`),!1):(this.$emit("before",e),!0)}},computed:{fileSizeStr(){return this.maxSize>1048576?Math.round(this.maxSize/1024/1024)+"M":this.maxSize>1024?Math.round(this.maxSize/1024)+"KB":this.maxSize+"B"}}}),r=n,a=i("c08c"),c=Object(a["a"])(r,s,o,!1,null,null,null);t["a"]=c.exports},"1a8f":function(e,t,i){e.exports=i.p+"img/40.2b8929bd.gif"},"25a1":function(e,t){e.exports="data:image/gif;base64,R0lGODlhUABQAPcxANi7Mv/uRLmbKP/rPv/jRodoHf/xUf/mS/LSNf/wTv/dMKKCIv/sU//pSZd5I0UoEf/lNUwuE8KqNFY4FXdYG2BCFoBnJenTQGlKFz0gD+/aR/zfNbCZNP/1V6aLK+TJNtG7PXBSGf/pT+G7K+vGLf/vSv/yVerAKv/hMZJxHv/2Xf/gQ9exKf/ZMf/eOP/aM//oOfTdPP/nQf/iPv/VMP/IK/mxHv/PLP/SLf/PMP/3dP/LK/y7KfiqD+yIEvelDf2/LP/3bf/+4f/6p//92P/ELfWjCP/HMPisEfaiDP/AKv/LHO6NEferC/+3Df++J//DKf/LL/mzIf/KNvu5J/3BLv/HGviuGv/CFvqvEv/7tP/6mvmuD//JMv/7rv/xS/+8Ef/xXf/yc//ZOf/xbP+9Kv/jUP/xZf/dPv/eTf/2ZP/0UPGWDv/tZP/ZPvq2JPy0Gv/uWv/qX//VSPSeC/SZEP+4Iv/ye/23I/y0H//0iv63HvuyE/yoD//4e//9z//0mv/bS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1goQUihUIkmWCBUKYayOcdkOKFqEjikSCqKmkRmatqxlEQQAh+QQFGQAUACwYAB4AHwAMAAAGhECKcEgsGoWqY9FgUjpNTMayUUpYDc5plXoYcrfVrBDM4ApnhG9g7Rys39y0a46W2WH4vHvP18vpJHQzEHqFhn6AFAWBdIQAMYSRkhAIAJJzJClCDi8KnnMLYhScn54OQxGWnS8sBaIULKstLBFEExInIwIPrxQPAiMjEhNHD7y9qMdCQQAh+QQFMgAjACwYAB4AHwAMAAAGbsCRcEgsGoWdYzGRUDoNTdES4MCEOFInkSGxVCwgwlASyZgzjoZW2PA8zg+J8FOBm0FPIegNn1xGAnZmCyMDThAFghkSComCIRtaGnWChBSKFQiSZYIFQphrI5x2Q4oWoSOKRIKoqaRGZq2rGURBADs="},"28f3":function(e,t,i){e.exports=i.p+"img/5.11e27819.gif"},3251:function(e,t,i){},"32c6":function(e,t,i){e.exports=i.p+"img/19.89260df5.gif"},"34cb":function(e,t,i){e.exports=i.p+"img/2.302b51b8.gif"},"36a4":function(e,t,i){e.exports=i.p+"img/27.65ed7407.gif"},"37bf":function(e,t,i){e.exports=i.p+"img/47.b4ac667a.gif"},3854:function(e,t,i){e.exports=i.p+"img/25.6f582617.gif"},"3c08":function(e,t,i){"use strict";i("dba4")},"3d2d":function(e,t,i){e.exports=i.p+"img/41.0b009f7b.gif"},"3dfc":function(e,t,i){e.exports=i.p+"img/4.be67348c.gif"},"3f29":function(e,t,i){e.exports=i.p+"img/9.0b2dd09a.gif"},4036:function(e,t,i){"use strict";var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"head-image",style:{cursor:e.isShowUserInfo?"pointer":null},on:{click:function(t){return e.showUserInfo(t)}}},[t("img",{directives:[{name:"show",rawName:"v-show",value:e.url,expression:"url"}],staticClass:"avatar-image",style:e.avatarImageStyle,attrs:{src:e.url,loading:"lazy"}}),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.url,expression:"!url"}],staticClass:"avatar-text",style:e.avatarTextStyle},[e._v(" "+e._s(e.avaterText))]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.online,expression:"online"}],staticClass:"online",attrs:{title:"用户当前在线"}}),e._t("default")],2)},o=[],n={name:"headImage",data(){return{colors:["#5daa31","#c7515a","#e03697","#85029b","#c9b455","#326eb6"]}},props:{id:{type:Number},size:{type:Number,default:42},width:{type:Number},height:{type:Number},radius:{type:String,default:"50%"},url:{type:String},name:{type:String,default:null},online:{type:Boolean,default:!1},isShowUserInfo:{type:Boolean,default:!0}},methods:{showUserInfo(e){this.isShowUserInfo&&this.id&&this.id>0&&this.$http({url:"/user/find/"+this.id,method:"get"}).then(t=>{let i={x:e.x+30,y:e.y};this.$eventBus.$emit("openUserInfo",t,i)})},isChinese(e){return e>=19968&&e<=40869}},computed:{avatarImageStyle(){let e=this.width?this.width:this.size,t=this.height?this.height:this.size;return`width:${e}px; height:${t}px;\n\t\t\t\t\tborder-radius: ${this.radius};`},avatarTextStyle(){let e=this.width?this.width:this.size,t=this.height?this.height:this.size;return`width: ${e}px;height:${t}px;\n\t\t\t\tbackground: linear-gradient(145deg,#ffffff20 25%,#00000060),${this.textColor};\n\t\t\t\tfont-size:${.4*e}px;\n\t\t\t\tborder-radius: ${this.radius};`},avaterText(){return this.name?this.isChinese(this.name.charCodeAt(0))?this.name.charAt(0):this.name.charAt(0).toUpperCase()+this.name.charAt(1):""},textColor(){if(!this.name)return"fff";let e=0;for(var t=0;t{if(!t)return i(new Error("请输入用户名"));i()},t=(e,t,i)=>{""===t&&i(new Error("请输入密码")),i()};return{loginForm:{terminal:this.$enums.TERMINAL_TYPE.WEB,userName:"",password:""},rules:{userName:[{validator:e,trigger:"blur"}],password:[{validator:t,trigger:"blur"}]}}},methods:{submitForm(e){this.$refs[e].validate(e=>{e&&this.$http({url:"/login",method:"post",data:this.loginForm}).then(e=>{this.setCookie("username",this.loginForm.userName),this.setCookie("password",this.loginForm.password),sessionStorage.setItem("accessToken",e.accessToken),sessionStorage.setItem("refreshToken",e.refreshToken),this.$message.success("登录成功"),this.$router.push("/home/chat")})})},resetForm(e){this.$refs[e].resetFields()},getCookie(e){let t=new RegExp("(^| )"+e+"=([^;]*)(;|$)"),i=document.cookie.match(t);return i?unescape(i[2]):""},setCookie(e,t){document.cookie=e+"="+escape(t)}},mounted(){this.loginForm.userName=this.getCookie("username"),this.loginForm.password=this.getCookie("password")}},b=I,A=(i("7878"),Object(h["a"])(b,g,v,!1,null,"2a0e97ff",null)),T=A.exports,S=function(){var e=this,t=e._self._c;return t("el-container",{staticClass:"register-view"},[t("div",{staticClass:"decoration decoration-1"}),t("div",{staticClass:"decoration decoration-2"}),t("div",{staticClass:"decoration decoration-3"}),t("el-form",{ref:"registerForm",staticClass:"content",attrs:{model:e.registerForm,"status-icon":"",rules:e.rules,"label-width":"80px"}},[t("div",{staticClass:"title"},[t("img",{staticClass:"logo",attrs:{src:i("5b62")}}),t("div",[e._v("欢迎成为盒子IM的用户")])]),t("el-form-item",{attrs:{label:"用户名",prop:"userName"}},[t("el-input",{attrs:{type:"userName",autocomplete:"off",placeholder:"用户名(登录使用)",maxlength:"20"},model:{value:e.registerForm.userName,callback:function(t){e.$set(e.registerForm,"userName",t)},expression:"registerForm.userName"}})],1),t("el-form-item",{attrs:{label:"昵称",prop:"nickName"}},[t("el-input",{attrs:{type:"nickName",autocomplete:"off",placeholder:"昵称",maxlength:"20"},model:{value:e.registerForm.nickName,callback:function(t){e.$set(e.registerForm,"nickName",t)},expression:"registerForm.nickName"}})],1),t("el-form-item",{attrs:{label:"密码",prop:"password"}},[t("el-input",{attrs:{type:"password",autocomplete:"off",placeholder:"密码",maxlength:"20"},model:{value:e.registerForm.password,callback:function(t){e.$set(e.registerForm,"password",t)},expression:"registerForm.password"}})],1),t("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[t("el-input",{attrs:{type:"password",autocomplete:"off",placeholder:"确认密码",maxlength:"20"},model:{value:e.registerForm.confirmPassword,callback:function(t){e.$set(e.registerForm,"confirmPassword",t)},expression:"registerForm.confirmPassword"}})],1),t("el-form-item",[t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.submitForm("registerForm")}}},[e._v("注册")]),t("el-button",{on:{click:function(t){return e.resetForm("registerForm")}}},[e._v("清空")])],1),t("div",{staticClass:"to-login"},[t("router-link",{attrs:{to:"/login"}},[e._v("已有账号,前往登录")])],1)],1),t("icp")],1)},E=[],w={name:"login",components:{Icp:C["default"]},data(){var e=(e,t,i)=>{if(!t)return i(new Error("请输入用户名"));i()},t=(e,t,i)=>{if(!t)return i(new Error("请输入昵称"));i()},i=(e,t,i)=>{if(""===t)return i(new Error("请输入密码"));i()},s=(e,t,i)=>""===t?i(new Error("请输入密码")):t!=this.registerForm.password?i(new Error("两次密码输入不一致")):void i();return{registerForm:{userName:"",nickName:"",password:"",confirmPassword:""},rules:{userName:[{validator:e,trigger:"blur"}],nickName:[{validator:t,trigger:"blur"}],password:[{validator:i,trigger:"blur"}],confirmPassword:[{validator:s,trigger:"blur"}]}}},methods:{submitForm(e){this.$refs[e].validate(e=>{e&&this.$http({url:"/register",method:"post",data:this.registerForm}).then(e=>{this.$message.success("注册成功!")})})},resetForm(e){this.$refs[e].resetFields()}}},y=w,x=(i("3c08"),Object(h["a"])(y,S,E,!1,null,"3a1e8430",null)),M=x.exports,P=function(){var e=this,t=e._self._c;return t("div",{staticClass:"home-page",on:{click:e.closeUserInfo}},[t("div",{staticClass:"app-container",class:{fullscreen:e.configStore.fullScreen}},[t("div",{staticClass:"navi-bar"},[t("div",{staticClass:"navi-bar-box"},[t("div",{staticClass:"top"},[t("div",{staticClass:"user-head-image"},[t("head-image",{attrs:{name:e.userStore.userInfo.nickName,size:38,url:e.userStore.userInfo.headImageThumb},nativeOn:{click:function(t){e.showSettingDialog=!0}}})],1),t("div",{staticClass:"menu"},[t("router-link",{staticClass:"link",attrs:{to:"/home/chat"}},[t("div",{staticClass:"menu-item"},[t("span",{staticClass:"icon iconfont icon-chat"}),t("div",{directives:[{name:"show",rawName:"v-show",value:e.unreadCount>0,expression:"unreadCount > 0"}],staticClass:"unread-text"},[e._v(e._s(e.unreadCount))])])]),t("router-link",{staticClass:"link",attrs:{to:"/home/friend"}},[t("div",{staticClass:"menu-item"},[t("span",{staticClass:"icon iconfont icon-friend"})])]),t("router-link",{staticClass:"link",attrs:{to:"/home/group"}},[t("div",{staticClass:"menu-item"},[t("span",{staticClass:"icon iconfont icon-group",staticStyle:{"font-size":"28px"}})])])],1)]),t("div",{staticClass:"botoom"},[t("div",{staticClass:"bottom-item",on:{click:e.onSwtichFullScreen}},[t("i",{staticClass:"el-icon-full-screen"})]),t("div",{staticClass:"bottom-item",on:{click:e.showSetting}},[t("span",{staticClass:"icon iconfont icon-setting",staticStyle:{"font-size":"20px"}})]),t("div",{staticClass:"bottom-item",attrs:{title:"退出"},on:{click:function(t){return e.onExit()}}},[t("span",{staticClass:"icon iconfont icon-exit"})])])])]),t("div",{staticClass:"content-box"},[t("router-view")],1),t("setting",{attrs:{visible:e.showSettingDialog},on:{close:function(t){return e.closeSetting()}}}),t("user-info",{ref:"userInfo"}),t("full-image",{ref:"fullImage"}),t("rtc-private-video",{ref:"rtcPrivateVideo"}),t("rtc-group-video",{ref:"rtcGroupVideo"})],1)])},k=[],R=(i("6345"),i("7e02"),i("b357"),i("4036")),N=function(){var e=this,t=e._self._c;return t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"setting",attrs:{title:"设置",visible:e.visible,width:"420px","before-close":e.onClose},on:{"update:visible":function(t){e.visible=t}}},[t("el-form",{ref:"settingForm",attrs:{model:e.userInfo,"label-width":"80px",rules:e.rules,size:"small"}},[t("el-form-item",{staticStyle:{"margin-bottom":"0 !important"},attrs:{label:"头像"}},[t("file-upload",{staticClass:"avatar-uploader",attrs:{action:e.imageAction,showLoading:!0,maxSize:e.maxSize,isPermanent:!0,fileTypes:["image/jpeg","image/png","image/jpg","image/webp"]},on:{success:e.onUploadSuccess}},[e.userInfo.headImage?t("img",{staticClass:"avatar",attrs:{src:e.userInfo.headImage}}):t("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),t("el-form-item",{attrs:{label:"用户名"}},[t("el-input",{attrs:{disabled:"",autocomplete:"off",size:"small"},model:{value:e.userInfo.userName,callback:function(t){e.$set(e.userInfo,"userName",t)},expression:"userInfo.userName"}})],1),t("el-form-item",{attrs:{prop:"nickName",label:"昵称"}},[t("el-input",{attrs:{autocomplete:"off",size:"small",maxlength:"20"},model:{value:e.userInfo.nickName,callback:function(t){e.$set(e.userInfo,"nickName",t)},expression:"userInfo.nickName"}})],1),t("el-form-item",{attrs:{label:"性别"}},[t("el-radio-group",{model:{value:e.userInfo.sex,callback:function(t){e.$set(e.userInfo,"sex",t)},expression:"userInfo.sex"}},[t("el-radio",{attrs:{label:0}},[e._v("男")]),t("el-radio",{attrs:{label:1}},[e._v("女")])],1)],1),t("el-form-item",{attrs:{label:"个性签名"}},[t("el-input",{attrs:{type:"textarea",rows:3,maxlength:"64"},model:{value:e.userInfo.signature,callback:function(t){e.$set(e.userInfo,"signature",t)},expression:"userInfo.signature"}})],1)],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){return e.onClose()}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit()}}},[e._v("确 定")])],1)],1)},D=[],G=(i("8dc0"),i("1a05")),O={name:"setting",components:{FileUpload:G["a"]},data(){return{userInfo:{},maxSize:5242880,action:"/image/upload",rules:{nickName:[{required:!0,message:"请输入昵称",trigger:"blur"}]}}},methods:{onClose(){this.$emit("close")},onSubmit(){this.$refs["settingForm"].validate(e=>{if(!e)return!1;this.$http({url:"/user/update",method:"put",data:this.userInfo}).then(()=>{this.userStore.setUserInfo(this.userInfo),this.$emit("close"),this.$message.success("修改成功")})})},onUploadSuccess(e,t){this.userInfo.headImage=e.originUrl,this.userInfo.headImageThumb=e.thumbUrl}},props:{visible:{type:Boolean}},computed:{imageAction(){return"/image/upload?thumbSize=20"}},watch:{visible:function(){let e=this.userStore.userInfo;this.userInfo=JSON.parse(JSON.stringify(e))}}},F=O,_=(i("d57c"),Object(h["a"])(F,N,D,!1,null,"2ead587e",null)),U=_.exports,$=function(){var e=this,t=e._self._c;return e.show?t("div",{staticClass:"user-info",style:{left:e.pos.x+"px",top:e.pos.y+"px"},on:{click:function(e){e.stopPropagation()}}},[t("div",{staticClass:"user-info-box"},[t("div",{staticClass:"avatar"},[t("head-image",{attrs:{name:e.user.nickName,url:e.user.headImageThumb,size:60,online:e.user.online,radius:"10%"},nativeOn:{click:function(t){return e.showFullImage()}}})],1),t("div",{staticClass:"info-card"},[t("div",{staticClass:"header"},[t("div",{staticClass:"nick-name"},[e._v(e._s(e.user.nickName))]),0==e.user.sex?t("div",{staticClass:"icon iconfont icon-man",staticStyle:{color:"darkblue"}}):e._e(),1==e.user.sex?t("div",{staticClass:"icon iconfont icon-girl",staticStyle:{color:"darkred"}}):e._e()]),t("div",{staticClass:"info-item"},[e._v(" 用户名: "+e._s(e.user.userName)+" ")]),t("div",{staticClass:"info-item"},[e._v(" 个性签名: "+e._s(e.user.signature)+" ")])])]),t("el-divider",{attrs:{"content-position":"center"}}),t("div",{staticClass:"btn-group"},[e.isFriend?t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSendMessage()}}},[e._v("发消息")]):t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onAddFriend()}}},[e._v("加为好友")])],1)],1):e._e()},L=[],j={name:"userInfo",components:{HeadImage:R["a"]},data(){return{show:!1,user:{},pos:{x:0,y:0}}},methods:{open(e,t){this.show=!0,this.user=e;let i=document.documentElement.clientWidth,s=document.documentElement.clientHeight;this.pos.x=Math.min(t.x,i-350),this.pos.y=Math.min(t.y,s-200)},close(){this.show=!1},onSendMessage(){let e=this.user,t={type:"PRIVATE",targetId:e.id,showName:e.nickName,headImage:e.headImageThumb};this.isFriend&&(t.isDnd=this.friendInfo.isDnd),this.chatStore.openChat(t),this.chatStore.setActiveChat(0),"/home/chat"!=this.$route.path&&this.$router.push("/home/chat"),this.show=!1},onAddFriend(){this.$http({url:"/friend/add",method:"post",params:{friendId:this.user.id}}).then(()=>{this.$message.success("添加成功,对方已成为您的好友");let e={id:this.user.id,nickName:this.user.nickName,headImage:this.user.headImageThumb,online:this.user.online,deleted:!1};this.friendStore.addFriend(e)})},showFullImage(){this.user.headImage&&this.$eventBus.$emit("openFullImage",this.user.headImage)}},computed:{isFriend(){return this.friendStore.isFriend(this.user.id)},friendInfo(){return this.friendStore.findFriend(this.user.id)}}},B=j,V=(i("b599"),Object(h["a"])(B,$,L,!1,null,"4e44d474",null)),z=V.exports,Q=function(){var e=this,t=e._self._c;return e.show?t("div",{staticClass:"full-image",attrs:{"before-close":e.close,modal:!0}},[t("div",{staticClass:"mask"}),t("div",{staticClass:"image-box"},[t("img",{attrs:{src:e.url}})]),t("div",{staticClass:"close",on:{click:e.close}},[t("i",{staticClass:"el-icon-close"})])]):e._e()},Y=[],H={name:"fullImage",data(){return{show:!1,url:""}},methods:{open(e){this.show=!0,this.url=e},close(){this.show=!1}}},W=H,J=(i("6e32"),Object(h["a"])(W,Q,Y,!1,null,"7e5ab892",null)),Z=J.exports,K=function(){var e=this,t=e._self._c;return t("div",[t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],attrs:{top:"5vh","custom-class":"rtc-private-video-dialog",title:e.title,width:e.width,visible:e.showRoom,"close-on-click-modal":!1,"close-on-press-escape":!1,"before-close":e.onQuit},on:{"update:visible":function(t){e.showRoom=t}}},[t("div",{staticClass:"rtc-private-video"},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.isVideo,expression:"isVideo"}],staticClass:"rtc-video-box"},[t("div",{directives:[{name:"loading",rawName:"v-loading",value:!e.isChating,expression:"!isChating"}],staticClass:"rtc-video-friend",attrs:{"element-loading-text":"等待对方接听...","element-loading-background":"rgba(0, 0, 0, 0.1)"}},[t("head-image",{staticClass:"friend-head-image",attrs:{id:e.friend.id,size:80,name:e.friend.nickName,url:e.friend.headImage,isShowUserInfo:!1,radius:"0"}}),t("video",{ref:"remoteVideo",attrs:{autoplay:""}})],1),t("div",{staticClass:"rtc-video-mine"},[t("video",{ref:"localVideo",attrs:{autoplay:""}})])]),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.isVideo,expression:"!isVideo"},{name:"loading",rawName:"v-loading",value:!e.isChating,expression:"!isChating"}],staticClass:"rtc-voice-box",attrs:{"element-loading-text":"等待对方接听...","element-loading-background":"rgba(0, 0, 0, 0.1)"}},[t("head-image",{staticClass:"friend-head-image",attrs:{id:e.friend.id,size:200,name:e.friend.nickName,url:e.friend.headImage,isShowUserInfo:!1}},[t("div",{staticClass:"rtc-voice-name"},[e._v(e._s(e.friend.nickName))])])],1),t("div",{staticClass:"rtc-control-bar"},[t("div",{staticClass:"icon iconfont icon-phone-reject reject",staticStyle:{color:"red"},attrs:{title:"取消"},on:{click:function(t){return e.onQuit()}}})])])]),!e.isHost&&e.isWaiting?t("rtc-private-acceptor",{ref:"acceptor",attrs:{friend:e.friend,mode:e.mode},on:{accept:e.onAccept,reject:e.onReject}}):e._e()],1)},q=[],X=function(){var e=this,t=e._self._c;return t("div",{staticClass:"rtc-private-acceptor"},[t("head-image",{attrs:{id:e.friend.id,name:e.friend.nickName,url:e.friend.headImage,size:100,isShowUserInfo:!1}}),t("div",{staticClass:"acceptor-text"},[e._v(" "+e._s(e.tip)+" ")]),t("div",{staticClass:"btn-group"},[t("div",{staticClass:"icon iconfont icon-phone-accept accept",attrs:{title:"接受"},on:{click:function(t){return e.$emit("accept")}}}),t("div",{staticClass:"icon iconfont icon-phone-reject reject",attrs:{title:"拒绝"},on:{click:function(t){return e.$emit("reject")}}})])],1)},ee=[],te={name:"rtcPrivateAcceptor",components:{HeadImage:R["a"]},data(){return{}},props:{mode:{type:String},friend:{type:Object}},computed:{tip(){let e="video"==this.mode?"视频":"语音";return`${this.friend.nickName} 请求和您进行${e}通话...`}}},ie=te,se=(i("f6b7"),Object(h["a"])(ie,X,ee,!1,null,"03714a01",null)),oe=se.exports;class ne{constructor(){this.configuration={},this.stream=null}}ne.prototype.isEnable=function(){return window.RTCPeerConnection=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,window.RTCSessionDescription=window.RTCSessionDescription||window.webkitRTCSessionDescription||window.mozRTCSessionDescription,window.RTCIceCandidate=window.RTCIceCandidate||window.webkitRTCIceCandidate||window.mozRTCIceCandidate,!!window.RTCPeerConnection},ne.prototype.init=function(e){this.configuration=e},ne.prototype.setupPeerConnection=function(e){this.peerConnection=new RTCPeerConnection(this.configuration),this.peerConnection.ontrack=t=>{e(t.streams[0])}},ne.prototype.setStream=function(e){this.stream&&this.peerConnection.removeStream(this.stream),e&&e.getTracks().forEach(t=>{this.peerConnection.addTrack(t,e)}),this.stream=e},ne.prototype.onIcecandidate=function(e){this.peerConnection.onicecandidate=t=>{t.candidate&&e(t.candidate)}},ne.prototype.onStateChange=function(e){this.peerConnection.oniceconnectionstatechange=t=>{let i=t.target.iceConnectionState;console.log("ICE连接状态变化: : "+i),e(i)}},ne.prototype.createOffer=function(){return new Promise((e,t)=>{const i={offerToRecieveAudio:1,offerToRecieveVideo:1};this.peerConnection.createOffer(i).then(t=>{this.peerConnection.setLocalDescription(t),e(t)}).catch(e=>{t(e)})})},ne.prototype.createAnswer=function(e){return new Promise((t,i)=>{this.setRemoteDescription(e);const s={offerToRecieveAudio:1,offerToRecieveVideo:1};this.peerConnection.createAnswer(s).then(e=>{this.peerConnection.setLocalDescription(e),t(e)}).catch(e=>{i(e)})})},ne.prototype.setRemoteDescription=function(e){this.peerConnection.setRemoteDescription(new RTCSessionDescription(e))},ne.prototype.addIceCandidate=function(e){this.peerConnection.addIceCandidate(new RTCIceCandidate(e))},ne.prototype.close=function(e){this.peerConnection&&(this.peerConnection.close(),this.peerConnection.onicecandidate=null,this.peerConnection.onaddstream=null,this.peerConnection=null)};var re=ne;class ae{constructor(){this.stream=null}}ae.prototype.isEnable=function(){return!!navigator&&!!navigator.mediaDevices&&!!navigator.mediaDevices.getUserMedia},ae.prototype.openVideo=function(){return new Promise((e,t)=>{this.stream&&this.close();let i={video:!0,audio:{echoCancellation:!0,noiseSuppression:!0}};navigator.mediaDevices.getUserMedia(i).then(t=>{console.log("摄像头打开"),this.stream=t,e(t)}).catch(e=>{console.log(e),console.log("摄像头未能正常打开"),t({code:0,message:"摄像头未能正常打开"})})})},ae.prototype.openAudio=function(){return new Promise((e,t)=>{let i={video:!1,audio:{echoCancellation:!0,noiseSuppression:!0}};navigator.mediaDevices.getUserMedia(i).then(t=>{this.stream=t,e(t)}).catch(()=>{console.log("麦克风未能正常打开"),t({code:0,message:"麦克风未能正常打开"})})})},ae.prototype.close=function(){this.stream&&this.stream.getTracks().forEach(e=>{e.stop()})};var ce=ae,le=i("5dfe"),de=i("7deb"),ue=i.n(de);const he=le["a"].create({baseURL:"http://localhost:8888",timeout:3e4,withCredentials:!0});he.interceptors.request.use(e=>{let t=sessionStorage.getItem("accessToken");return t&&(e.headers.accessToken=encodeURIComponent(t)),e},e=>Promise.reject(e)),he.interceptors.response.use(async e=>{if(200==e.data.code)return e.data.data;if(400!=e.data.code){if(401==e.data.code){console.log("token失效,尝试重新获取");let t=sessionStorage.getItem("refreshToken");t||(location.href="/");const i=await he({method:"put",url:"/refreshToken",headers:{refreshToken:t}}).catch(()=>{location.href="/"});return sessionStorage.setItem("accessToken",i.accessToken),sessionStorage.setItem("refreshToken",i.refreshToken),he(e.config)}return Object(de["Message"])({message:e.data.message,type:"error",duration:1500,customClass:"element-error-message-zindex"}),Promise.reject(e.data)}location.href="/"},e=>{switch(e.response.status){case 400:Object(de["Message"])({message:e.response.data,type:"error",duration:1500,customClass:"element-error-message-zindex"});break;case 401:location.href="/";break;case 405:Object(de["Message"])({message:"http请求方式有误",type:"error",duration:1500,customClass:"element-error-message-zindex"});break;case 404:case 500:Object(de["Message"])({message:"服务器出了点小差,请稍后再试",type:"error",duration:1500,customClass:"element-error-message-zindex"});break;case 501:Object(de["Message"])({message:"服务器不支持当前请求所需要的某个功能",type:"error",duration:1500,customClass:"element-error-message-zindex"});break}return Promise.reject(e)});var fe=he;class pe{}pe.prototype.call=function(e,t,i){return fe({url:`/webrtc/private/call?uid=${e}&mode=${t}`,method:"post",data:JSON.stringify(i),headers:{"Content-Type":"application/json; charset=utf-8"}})},pe.prototype.accept=function(e,t){return fe({url:"/webrtc/private/accept?uid="+e,method:"post",data:JSON.stringify(t),headers:{"Content-Type":"application/json; charset=utf-8"}})},pe.prototype.handup=function(e){return fe({url:"/webrtc/private/handup?uid="+e,method:"post"})},pe.prototype.cancel=function(e){return fe({url:"/webrtc/private/cancel?uid="+e,method:"post"})},pe.prototype.reject=function(e){return fe({url:"/webrtc/private/reject?uid="+e,method:"post"})},pe.prototype.failed=function(e,t){return fe({url:`/webrtc/private/failed?uid=${e}&reason=${t}`,method:"post"})},pe.prototype.sendCandidate=function(e,t){return fe({url:"/webrtc/private/candidate?uid="+e,method:"post",data:JSON.stringify(t),headers:{"Content-Type":"application/json; charset=utf-8"}})},pe.prototype.heartbeat=function(e){return fe({url:"/webrtc/private/heartbeat?uid="+e,method:"post"})};var me=pe,ge={name:"rtcPrivateVideo",components:{HeadImage:R["a"],RtcPrivateAcceptor:oe},data(){return{camera:new ce,webrtc:new re,API:new me,audio:new Audio,showRoom:!1,friend:{},isHost:!1,state:"CLOSE",mode:"video",localStream:null,remoteStream:null,videoTime:0,videoTimer:null,heartbeatTimer:null,candidates:[]}},methods:{open(e){this.showRoom=!0,this.mode=e.mode,this.isHost=e.isHost,this.friend=e.friend,this.isHost&&this.onCall()},initAudio(){let e=i("cffd");this.audio.src=e,this.audio.loop=!0},initRtc(){this.webrtc.init(this.configuration),this.webrtc.setupPeerConnection(e=>{this.$refs.remoteVideo.srcObject=e,this.remoteStream=e}),this.webrtc.onIcecandidate(e=>{"CHATING"==this.state?this.API.sendCandidate(this.friend.id,e):this.candidates.push(e)}),this.webrtc.onStateChange(e=>{"connected"==e?console.log("webrtc连接成功"):"disconnected"==e&&console.log("webrtc连接断开")})},onCall(){this.checkDevEnable()||this.close(),this.initRtc(),this.startHeartBeat(),this.openStream().then(()=>{this.webrtc.setStream(this.localStream),this.webrtc.createOffer().then(e=>{this.API.call(this.friend.id,this.mode,e).then(()=>{this.state="WAITING",this.audio.play()}).catch(()=>{this.close()})})}).catch(()=>{this.close()})},onAccept(){if(!this.checkDevEnable())return this.API.failed(this.friend.id,"对方设备不支持通话"),void this.close();this.showRoom=!0,this.state="CHATING",this.audio.pause(),this.initRtc(),this.openStream().finally(()=>{this.webrtc.setStream(this.localStream),this.webrtc.createAnswer(this.offer).then(e=>{this.API.accept(this.friend.id,e),this.startChatTime(),this.waitTimer&&clearTimeout(this.waitTimer)})})},onReject(){this.API.reject(this.friend.id),this.close()},onHandup(){this.API.handup(this.friend.id),this.$message.success("您已挂断,通话结束"),this.close()},onCancel(){this.API.cancel(this.friend.id),this.$message.success("已取消呼叫,通话结束"),this.close()},onRTCMessage(e){if(e.type==this.$enums.MESSAGE_TYPE.RTC_CALL_VOICE||e.type==this.$enums.MESSAGE_TYPE.RTC_CALL_VIDEO||!this.isClose)switch(e.type){case this.$enums.MESSAGE_TYPE.RTC_CALL_VOICE:this.onRTCCall(e,"voice");break;case this.$enums.MESSAGE_TYPE.RTC_CALL_VIDEO:this.onRTCCall(e,"video");break;case this.$enums.MESSAGE_TYPE.RTC_ACCEPT:this.onRTCAccept(e);break;case this.$enums.MESSAGE_TYPE.RTC_REJECT:this.onRTCReject(e);break;case this.$enums.MESSAGE_TYPE.RTC_CANCEL:this.onRTCCancel(e);break;case this.$enums.MESSAGE_TYPE.RTC_FAILED:this.onRTCFailed(e);break;case this.$enums.MESSAGE_TYPE.RTC_HANDUP:this.onRTCHandup(e);break;case this.$enums.MESSAGE_TYPE.RTC_CANDIDATE:this.onRTCCandidate(e);break}},onRTCCall(e,t){this.offer=JSON.parse(e.content),this.isHost=!1,this.mode=t,this.$http({url:"/friend/find/"+e.sendId,method:"get"}).then(e=>{this.friend=e,this.state="WAITING",this.audio.play(),this.startHeartBeat(),this.waitTimer=setTimeout(()=>{this.API.failed(this.friend.id,"对方无应答"),this.$message.error("您未接听"),this.close()},3e4)})},onRTCAccept(e){if(e.selfSend)this.$message.success("已在其他设备接听"),this.close();else{let t=JSON.parse(e.content);this.webrtc.setRemoteDescription(t),this.state="CHATING",this.audio.pause(),this.candidates.forEach(e=>{this.API.sendCandidate(this.friend.id,e)}),this.startChatTime()}},onRTCReject(e){e.selfSend?(this.$message.success("已在其他设备拒绝"),this.close()):(this.$message.error("对方拒绝了您的通话请求"),this.close())},onRTCFailed(e){this.$message.error(e.content),this.close()},onRTCCancel(){this.$message.success("对方取消了呼叫"),this.close()},onRTCHandup(){this.$message.success("对方已挂断"),this.close()},onRTCCandidate(e){let t=JSON.parse(e.content);this.webrtc.addIceCandidate(t)},openStream(){return new Promise((e,t)=>{this.isVideo?this.camera.openVideo().then(t=>{this.localStream=t,this.$nextTick(()=>{this.$refs.localVideo.srcObject=t,this.$refs.localVideo.muted=!0}),e(t)}).catch(e=>{this.$message.error("打开摄像头失败"),console.log("本摄像头打开失败:"+e.message),t(e)}):this.camera.openAudio().then(t=>{this.localStream=t,this.$refs.localVideo.srcObject=t,this.$refs.localVideo.muted=!0,e(t)}).catch(e=>{this.$message.error("打开麦克风失败"),console.log("打开麦克风失败:"+e.message),t(e)})})},startChatTime(){this.videoTime=0,this.videoTimer&&clearInterval(this.videoTimer),this.videoTimer=setInterval(()=>{this.videoTime++},1e3)},checkDevEnable(){return this.camera.isEnable()?!!this.webrtc.isEnable()||(this.message.error("初始化RTC失败,原因可能是: 1.服务器缺少ssl证书 2.您的设备不支持WebRTC"),!1):(this.message.error("访问摄像头失败"),!1)},startHeartBeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>{this.API.heartbeat(this.friend.id)},15e3)},close(){this.showRoom=!1,this.camera.close(),this.webrtc.close(),this.audio.pause(),this.videoTime=0,this.videoTimer&&clearInterval(this.videoTimer),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.waitTimer&&clearTimeout(this.waitTimer),this.videoTimer=null,this.heartbeatTimer=null,this.waitTimer=null,this.state="CLOSE",this.candidates=[]},onQuit(){this.isChating?this.onHandup():this.isWaiting?this.onCancel():this.close()}},computed:{width(){return this.isVideo?"960px":"360px"},title(){let e=`${this.modeText}通话-${this.friend.nickName}`;return this.isChating?e+=`(${this.currentTime})`:this.isWaiting&&(e+="(呼叫中)"),e},currentTime(){let e=Math.floor(this.videoTime/60),t=this.videoTime%60,i=e<10?"0":"";return i+=e,i+=":",i+=t<10?"0":"",i+=t,i},configuration(){const e=this.configStore.webrtc.iceServers;return{iceServers:e}},isVideo(){return"video"==this.mode},modeText(){return this.isVideo?"视频":"语音"},isChating(){return"CHATING"==this.state},isWaiting(){return"WAITING"==this.state},isClose(){return"CLOSE"==this.state}},mounted(){this.initAudio()},created(){window.addEventListener("beforeunload",()=>{this.onQuit()})},beforeUnmount(){this.onQuit()}},ve=ge,Ce=(i("4492"),Object(h["a"])(ve,K,q,!1,null,"bb91cee2",null)),Ie=Ce.exports,be=function(){var e=this,t=e._self._c;return t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],attrs:{top:"5vh",title:"语音通话","close-on-click-modal":!1,"close-on-press-escape":!1,visible:e.isShow,width:"50%"},on:{"update:visible":function(t){e.isShow=t}}},[t("div",{staticClass:"rtc-group-video"},[t("div",{staticStyle:{"padding-top":"30px","font-weight":"600","text-align":"center","font-size":"16px"}},[e._v(" 多人音视频通话属于付费功能,如有需要请联系作者购买商业版源码... ")]),t("div",{staticStyle:{"padding-top":"50px","text-align":"center","font-size":"16px"}},[e._v(" 点击下方文档了解详细信息: ")]),t("div",{staticStyle:{"padding-top":"10px","text-align":"center","font-size":"16px"}},[t("a",{attrs:{href:"https://www.yuque.com/u1475064/imk5n2/qtezcg32q1d0dr29",target:"_blank"}},[e._v(" 盒子IM商业版付费说明 ")])])])])},Ae=[],Te={name:"rtcGroupVideo",data(){return{isShow:!1}},methods:{open(){this.isShow=!0},onRTCMessage(){}}},Se=Te,Ee=(i("6467"),Object(h["a"])(Se,be,Ae,!1,null,"4343fd10",null)),we=Ee.exports,ye={components:{HeadImage:R["a"],Setting:U,UserInfo:z,FullImage:Z,RtcPrivateVideo:Ie,RtcPrivateAcceptor:oe,RtcGroupVideo:we},data(){return{showSettingDialog:!1,lastPlayAudioTime:(new Date).getTime()-1e3,reconnecting:!1,privateMessagesBuffer:[],groupMessagesBuffer:[]}},methods:{init(){this.$eventBus.$on("openPrivateVideo",e=>{this.$refs.rtcPrivateVideo.open(e)}),this.$eventBus.$on("openGroupVideo",e=>{this.$refs.rtcGroupVideo.open(e)}),this.$eventBus.$on("openUserInfo",(e,t)=>{this.$refs.userInfo.open(e,t)}),this.$eventBus.$on("openFullImage",e=>{this.$refs.fullImage.open(e)}),this.configStore.setAppInit(!1),this.loadStore().then(()=>{this.$wsApi.connect("ws://localhost:8878/im",sessionStorage.getItem("accessToken")),this.$wsApi.onConnect(()=>{this.reconnecting?this.onReconnectWs():(this.pullOfflineMessage(),this.configStore.setAppInit(!0))}),this.$wsApi.onMessage((e,t)=>{2==e?(this.$wsApi.close(3e3),this.$alert("您已在其他地方登录,将被强制下线","强制下线通知",{confirmButtonText:"确定",callback:e=>{location.href="/"}})):3==e?!this.configStore.appInit||this.chatStore.loading?this.privateMessagesBuffer.push(t):this.handlePrivateMessage(t):4==e?!this.configStore.appInit||this.chatStore.loading?this.groupMessagesBuffer.push(t):this.handleGroupMessage(t):5==e&&this.handleSystemMessage(t)}),this.$wsApi.onClose(e=>{3e3!=e.code&&(this.reconnecting||(this.reconnectWs(),this.configStore.setAppInit(!1)))})}).catch(e=>{console.log("初始化失败",e)})},reconnectWs(){this.reconnecting=!0,this.userStore.loadUser().then(()=>{this.$message.error("连接断开,正在尝试重新连接..."),this.$wsApi.reconnect("ws://localhost:8878/im",sessionStorage.getItem("accessToken"))}).catch(()=>{setTimeout(()=>this.reconnectWs(),1e4)})},onReconnectWs(){this.reconnecting=!1;const e=[];e.push(this.friendStore.loadFriend()),e.push(this.groupStore.loadGroup()),Promise.all(e).then(()=>{this.pullOfflineMessage(),this.configStore.setAppInit(!0),this.$message.success("重新连接成功")}).catch(()=>{this.$message.error("初始化失败"),this.onExit()})},loadStore(){return this.userStore.loadUser().then(()=>{const e=[];return e.push(this.friendStore.loadFriend()),e.push(this.groupStore.loadGroup()),e.push(this.chatStore.loadChat()),e.push(this.configStore.loadConfig()),Promise.all(e)})},unloadStore(){this.friendStore.clear(),this.groupStore.clear(),this.chatStore.clear(),this.userStore.clear()},pullOfflineMessage(){this.chatStore.setLoading(!0);const e=[];e.push(this.pullPrivateOfflineMessage(this.chatStore.privateMsgMaxId)),e.push(this.pullGroupOfflineMessage(this.chatStore.groupMsgMaxId)),Promise.all(e).then(e=>{e[0].forEach(e=>this.handlePrivateMessage(e)),e[1].forEach(e=>this.handleGroupMessage(e)),this.privateMessagesBuffer.forEach(e=>this.handlePrivateMessage(e)),this.groupMessagesBuffer.forEach(e=>this.handleGroupMessage(e)),this.privateMessagesBuffer=[],this.groupMessagesBuffer=[],this.chatStore.setLoading(!1),this.chatStore.refreshChats()}).catch(e=>{console.log(e),this.$message.error("拉取离线消息失败"),this.onExit()})},pullPrivateOfflineMessage(e){return this.$http({url:"/message/private/loadOfflineMessage?minId="+e,method:"GET"})},pullGroupOfflineMessage(e){return this.$http({url:"/message/group/loadOfflineMessage?minId="+e,method:"GET"})},handlePrivateMessage(e){e.selfSend=e.sendId==this.userStore.userInfo.id;let t=e.selfSend?e.recvId:e.sendId,i={type:"PRIVATE",targetId:t};if(e.type!=this.$enums.MESSAGE_TYPE.READED)if(e.type!=this.$enums.MESSAGE_TYPE.RECEIPT)if(e.type!=this.$enums.MESSAGE_TYPE.RECALL)if(e.type!=this.$enums.MESSAGE_TYPE.FRIEND_NEW)if(e.type!=this.$enums.MESSAGE_TYPE.FRIEND_DEL){if(e.type==this.$enums.MESSAGE_TYPE.FRIEND_DND)return this.friendStore.setDnd(t,JSON.parse(e.content)),void this.chatStore.setDnd(i,JSON.parse(e.content));if(this.$msgType.isRtcPrivate(e.type))this.$refs.rtcPrivateVideo.onRTCMessage(e);else if(this.$msgType.isNormal(e.type)||this.$msgType.isTip(e.type)||this.$msgType.isAction(e.type)){let i=this.loadFriendInfo(t);this.insertPrivateMessage(i,e)}}else this.friendStore.removeFriend(t);else this.friendStore.addFriend(JSON.parse(e.content));else this.chatStore.recallMessage(e,i);else this.chatStore.readedMessage({friendId:e.sendId});else this.chatStore.resetUnreadCount(i)},insertPrivateMessage(e,t){let i={type:"PRIVATE",targetId:e.id,showName:e.nickName,headImage:e.headImage,isDnd:e.isDnd};this.chatStore.openChat(i),this.chatStore.insertMessage(t,i),e.isDnd||this.chatStore.loading||t.selfSend||!this.$msgType.isNormal(t.type)||t.status==this.$enums.MESSAGE_STATUS.READED||this.playAudioTip()},handleGroupMessage(e){e.selfSend=e.sendId==this.userStore.userInfo.id;let t={type:"GROUP",targetId:e.groupId};if(e.type!=this.$enums.MESSAGE_TYPE.READED)if(e.type!=this.$enums.MESSAGE_TYPE.RECEIPT)if(e.type!=this.$enums.MESSAGE_TYPE.RECALL)if(e.type!=this.$enums.MESSAGE_TYPE.GROUP_NEW)if(e.type!=this.$enums.MESSAGE_TYPE.GROUP_DEL){if(e.type==this.$enums.MESSAGE_TYPE.GROUP_DND)return this.groupStore.setDnd(e.groupId,JSON.parse(e.content)),void this.chatStore.setDnd(t,JSON.parse(e.content));if(this.$msgType.isRtcGroup(e.type))this.$nextTick(()=>{this.$refs.rtcGroupVideo.onRTCMessage(e)});else if(this.$msgType.isNormal(e.type)||this.$msgType.isTip(e.type)||this.$msgType.isAction(e.type)){let t=this.loadGroupInfo(e.groupId);this.insertGroupMessage(t,e)}}else this.groupStore.removeGroup(e.groupId);else this.groupStore.addGroup(JSON.parse(e.content));else this.chatStore.recallMessage(e,t);else{let i={id:e.id,groupId:e.groupId,readedCount:e.readedCount,receiptOk:e.receiptOk};this.chatStore.updateMessage(i,t)}else this.chatStore.resetUnreadCount(t)},insertGroupMessage(e,t){let i={type:"GROUP",targetId:e.id,showName:e.showGroupName,headImage:e.headImageThumb,isDnd:e.isDnd};this.chatStore.openChat(i),this.chatStore.insertMessage(t,i),e.isDnd||this.chatStore.loading||t.selfSend||!this.$msgType.isNormal(t.type)||t.status==this.$enums.MESSAGE_STATUS.READED||this.playAudioTip()},handleSystemMessage(e){if(e.type==this.$enums.MESSAGE_TYPE.USER_BANNED)return this.$wsApi.close(3e3),void this.$alert("您的账号已被管理员封禁,原因:"+e.content,"账号被封禁",{confirmButtonText:"确定",callback:()=>{this.onExit()}})},closeUserInfo(){this.$refs.userInfo.close()},onSwtichFullScreen(){this.configStore.setFullScreen(!this.configStore.fullScreen)},onExit(){this.unloadStore(),this.configStore.setAppInit(!1),this.$wsApi.close(3e3),sessionStorage.removeItem("accessToken"),location.href="/"},playAudioTip(){if((new Date).getTime()-this.lastPlayAudioTime>1e3){this.lastPlayAudioTime=(new Date).getTime();let e=new Audio,t=i("6c77");e.src=t,e.play()}},showSetting(){this.showSettingDialog=!0},closeSetting(){this.showSettingDialog=!1},loadFriendInfo(e){let t=this.friendStore.findFriend(e);return t||(t={id:e,showNickName:"未知用户",headImage:""}),t},loadGroupInfo(e){let t=this.groupStore.findGroup(e);return t||(t={id:e,showGroupName:"未知群聊",headImageThumb:""}),t}},computed:{unreadCount(){let e=0,t=this.chatStore.chats;return t.forEach(t=>{t.delete||t.isDnd||(e+=t.unreadCount)}),e}},watch:{unreadCount:{handler(e,t){let i=e>0?e+"条未读":"";this.$elm.setTitleTip(i)},immediate:!0}},mounted(){this.init()},unmounted(){this.$wsApi.close()}},xe=ye,Me=(i("e95e"),Object(h["a"])(xe,P,k,!1,null,"0ad20fee",null)),Pe=Me.exports;a["default"].use(m["a"]);var ke=new m["a"]({routes:[{path:"/",redirect:"/login"},{name:"Login",path:"/login",component:T},{name:"Register",path:"/register",component:M},{name:"Home",path:"/home",component:Pe,children:[{name:"Chat",path:"/home/chat",component:()=>Promise.all([i.e("chunk-71f61294"),i.e("chunk-fd683798")]).then(i.bind(null,"3f94"))},{name:"Friend",path:"/home/friend",component:()=>Promise.all([i.e("chunk-07988a94"),i.e("chunk-d5d63cfc")]).then(i.bind(null,"63b9"))},{name:"GROUP",path:"/home/group",component:()=>Promise.all([i.e("chunk-07988a94"),i.e("chunk-71f61294"),i.e("chunk-7d333884")]).then(i.bind(null,"5c36"))}]}]}),Re=(i("6178"),i("be35"),i("dcde")),Ne=null;let De,Ge=!1,Oe=null,Fe=null,_e=null,Ue=(e,t)=>{try{if(Ge)return;console.log("连接WebSocket"),Ne=new WebSocket(e),Ne.onmessage=function(e){let t=JSON.parse(e.data);0==t.cmd?(je.start(),Oe&&Oe(),console.log("WebSocket登录成功")):1==t.cmd?je.reset():(console.log("收到消息:",t),Fe&&Fe(t.cmd,t.data))},Ne.onclose=function(e){console.log("WebSocket连接关闭"),Ge=!1,_e&&_e(e)},Ne.onopen=function(){console.log("WebSocket连接成功"),Ge=!0;let e={cmd:0,data:{accessToken:t}};Ne.send(JSON.stringify(e))},Ne.onerror=function(e){console.log("WebSocket连接发生错误:{}",e),Le(3e3),Ge=!1,_e&&_e(e)}}catch(i){console.log("尝试创建连接失败"),$e(e,t)}},$e=(e,t)=>{console.log("尝试重新连接"),Ge||(De&&clearTimeout(De),De=setTimeout((function(){Ue(e,t)}),15e3))},Le=e=>{Ne&&Ne.close(e)},je={timeout:5e3,timeoutObj:null,start:function(){if(Ge){console.log("发送WebSocket心跳");let e={cmd:1,data:{}};Ne.send(JSON.stringify(e))}},reset:function(){clearTimeout(this.timeoutObj),this.timeoutObj=setTimeout((function(){je.start()}),this.timeout)}},Be=e=>{Ne.readyState===Ne.OPEN?Ne.send(JSON.stringify(e)):(Ne.readyState,Ne.CONNECTING,setTimeout((function(){Be(e)}),1e3))},Ve=e=>{Oe=e},ze=e=>{Fe=e},Qe=e=>{_e=e},Ye=function(e){return e>=0&&e<10},He=function(e){return e>=10&&e<20},We=function(e){return e>=20&&e<30},Je=function(e){return e>=40&&e<50},Ze=function(e){return e>=100&&e<200},Ke=function(e){return e>=200&&e<300};const qe=["憨笑","媚眼","开心","坏笑","可怜","爱心","笑哭","拍手","惊喜","打气","大哭","流泪","饥饿","难受","健身","示爱","色色","眨眼","暴怒","惊恐","思考","头晕","大吐","酷笑","翻滚","享受","鼻涕","快乐","雀跃","微笑","贪婪","红心","粉心","星星","大火","眼睛","音符","叹号","问号","绿叶","燃烧","喇叭","警告","信封","房子","礼物","点赞","举手","拍手","点头","摇头","偷瞄","庆祝","疾跑","打滚","惊吓","起跳"];let Xe=(e,t)=>e.replace(/\#[\u4E00-\u9FA5]{1,3}\;/gi,e=>et(e,t)),et=(e,t)=>{let s=e.replace(/\#|\;/gi,""),o=qe.indexOf(s);if(-1==o)return e;let n=i("642d")(`./${o}.gif`);return``},tt=e=>{let t=e.replace(/\#|\;/gi,""),s=qe.indexOf(t);if(-1==s)return"";let o=i("642d")(`./${s}.gif`);return o};var it={emoTextList:qe,transform:Xe,textToImg:et,textToUrl:tt};let st=(e,t)=>{const i=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|]|\bwww\.[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;return e.replace(i,e=>(e.startsWith("http")||(e="http://"+e),`${e}`))};var ot={replaceURLWithHTMLLinks:st};let nt=e=>e.replace(/[<>&"]/g,(function(e){return{"<":"<",">":">","&":"&",'"':"""}[e]}));var rt={html2Escape:nt};let at=e=>{var t=e.offsetTop;return null!=e.offsetParent&&(t+=at(e.offsetParent)),t},ct=e=>{var t=e.offsetLeft;return null!=e.offsetParent&&(t+=ct(e.offsetParent)),t},lt=e=>{let t="盒子IM";e&&(t=`(${e})${t}`),document.title=t};var dt={fixTop:at,fixLeft:ct,setTitleTip:lt};const ut={TEXT:0,IMAGE:1,FILE:2,AUDIO:3,VIDEO:4,RECALL:10,READED:11,RECEIPT:12,TIP_TIME:20,TIP_TEXT:21,LOADING:30,ACT_RT_VOICE:40,ACT_RT_VIDEO:41,USER_BANNED:50,FRIEND_NEW:80,FRIEND_DEL:81,FRIEND_DND:82,GROUP_NEW:90,GROUP_DEL:91,GROUP_DND:92,RTC_CALL_VOICE:100,RTC_CALL_VIDEO:101,RTC_ACCEPT:102,RTC_REJECT:103,RTC_CANCEL:104,RTC_FAILED:105,RTC_HANDUP:106,RTC_CANDIDATE:107,RTC_GROUP_SETUP:200,RTC_GROUP_ACCEPT:201,RTC_GROUP_REJECT:202,RTC_GROUP_FAILED:203,RTC_GROUP_CANCEL:204,RTC_GROUP_QUIT:205,RTC_GROUP_INVITE:206,RTC_GROUP_JOIN:207,RTC_GROUP_OFFER:208,RTC_GROUP_ANSWER:209,RTC_GROUP_CANDIDATE:210,RTC_GROUP_DEVICE:211},ht={FREE:0,WAIT_CALL:1,WAIT_ACCEPT:2,ACCEPTED:3,CHATING:4},ft={WEB:0,APP:1},pt={FAILED:-2,SENDING:-1,PENDING:0,DELIVERED:1,RECALL:2,READED:3};let mt=(e,t)=>{var i=new Date(e),s=Date.parse(new Date),o=s-i,n="";return o<=6e4?n="刚刚":o>6e4&&o<36e5?n=Math.floor(o/6e4)+"分钟前":o>=36e5&&o<864e5&&!gt(i)?n=Ct(i).substr(11,5):gt(i)?n="昨天"+Ct(i).substr(11,5):vt(i)?n=Ct(i).substr(5,t?5:14):(n=Ct(i),t&&(n=n.substr(2,8))),n},gt=e=>{var t=new Date(new Date-864e5);return t.getYear()===e.getYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()},vt=e=>e.getYear()===(new Date).getYear(),Ct=e=>{if(""===e||!e)return"";var t=new Date(e),i=t.getFullYear(),s=t.getMonth()+1;s=s<10?"0"+s:s;var o=t.getDate();o=o<10?"0"+o:o;var n=t.getHours();n=n<10?"0"+n:n;var r=t.getMinutes();r=r<10?"0"+r:r;var a=t.getSeconds();return a=a<10?"0"+a:a,i+"/"+s+"/"+o+" "+n+":"+r+":"+a};a["default"].directive("dialogDrag",{bind(e,t,i,s){const o=e.querySelector(".el-dialog__header"),n=e.querySelector(".el-dialog");o.style.cursor="move";const r=n.currentStyle||window.getComputedStyle(n,null);o.onmousedown=e=>{const t=e.clientX-o.offsetLeft,i=e.clientY-o.offsetTop,s=document.body.clientWidth,a=document.documentElement.clientHeight,c=n.offsetWidth,l=n.offsetHeight,d=n.offsetLeft,u=s-n.offsetLeft-c,h=n.offsetTop,f=a-n.offsetTop-l;let p,m;r.left.includes("%")?(p=+document.body.clientWidth*(+r.left.replace(/\%/g,"")/100),m=+document.body.clientHeight*(+r.top.replace(/\%/g,"")/100)):(p=+r.left.replace(/\px/g,""),m=+r.top.replace(/\px/g,"")),document.onmousemove=function(e){var s=e.clientX-t,o=e.clientY-i;-s>d?s=-d:s>u&&(s=u),-o>h?o=-h:o>f&&(o=f),n.style.left=s+p+"px",n.style.top=o+m+"px"},document.onmouseup=function(e){document.onmousemove=null,document.onmouseup=null}}}});i("6ace"),i("f3b6"),i("81b3"),i("eb92");var It=Object(Re["c"])("friendStore",{state:()=>({friends:[],timer:null}),actions:{setFriends(e){this.friends=e},updateFriend(e){this.friends.forEach((t,i)=>{if(t.id==e.id){let t=this.friends[i].online;Object.assign(this.friends[i],e),this.friends[i].online=t}})},removeFriend(e){this.friends.filter(t=>t.id==e).forEach(e=>e.deleted=!0)},addFriend(e){this.friends.some(t=>t.id==e.id)?this.updateFriend(e):this.friends.unshift(e)},setOnlineStatus(e){this.friends.forEach(t=>{let i=e.find(e=>t.id==e.userId);i?(t.online=!0,t.onlineWeb=i.terminals.indexOf(ft.WEB)>=0,t.onlineApp=i.terminals.indexOf(ft.APP)>=0):(t.online=!1,t.onlineWeb=!1,t.onlineApp=!1)})},refreshOnlineStatus(){let e=this.friends.filter(e=>!e.deleted).map(e=>e.id);0!=e.length&&(fe({url:"/user/terminal/online?userIds="+e.join(","),method:"GET"}).then(e=>{this.setOnlineStatus(e)}),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.refreshOnlineStatus()},3e4))},setDnd(e,t){let i=this.findFriend(e);i.isDnd=t},clear(){this.timer&&clearTimeout(this.timer),this.friends=[],this.timer=null},loadFriend(){return new Promise((e,t)=>{fe({url:"/friend/list",method:"GET"}).then(async t=>{this.setFriends(t),this.refreshOnlineStatus(),e()}).catch(e=>{t(e)})})}},getters:{isFriend:e=>t=>e.friends.filter(e=>!e.deleted).some(e=>e.id==t),findFriend:e=>t=>e.friends.find(e=>e.id==t)}}),bt=Object(Re["c"])("groupStore",{state:()=>({groups:[]}),actions:{setGroups(e){this.groups=e},addGroup(e){this.groups.some(t=>t.id==e.id)?this.updateGroup(e):this.groups.unshift(e)},removeGroup(e){this.groups.filter(t=>t.id==e).forEach(e=>e.quit=!0)},updateGroup(e){this.groups.forEach((t,i)=>{t.id==e.id&&Object.assign(this.groups[i],e)})},updateTopMessage(e,t){let i=this.findGroup(e);i&&(i.topMessage=t)},setDnd(e,t){let i=this.findGroup(e);i.isDnd=t},clear(){this.groups=[]},loadGroup(){return new Promise((e,t)=>{fe({url:"/group/list",method:"GET"}).then(t=>{this.setGroups(t),e()}).catch(e=>{t(e)})})}},getters:{findGroup:e=>t=>e.groups.find(e=>e.id==t),isGroup:e=>t=>e.groups.filter(e=>!e.quit).some(e=>e.id==t)}}),At=Object(Re["c"])("userStore",{state:()=>({userInfo:{},rtcInfo:{friend:{},mode:"video",state:ht.FREE}}),actions:{setUserInfo(e){this.userInfo=e},setRtcInfo(e){this.rtcInfo=e},setRtcState(e){this.rtcInfo.state=e},clear(){this.userInfo={},this.rtcInfo={friend:{},mode:"video",state:ht.FREE}},loadUser(){return new Promise((e,t)=>{fe({url:"/user/self",method:"GET"}).then(t=>{this.setUserInfo(t),e()}).catch(e=>{t(e)})})}}}),Tt=i("464e"),St=i.n(Tt);let Et=[];var wt=Object(Re["c"])("chatStore",{state:()=>({activeChat:null,chats:[],privateMsgMaxId:0,groupMsgMaxId:0,loading:!1}),actions:{initChats(e){this.chats=[],this.privateMsgMaxId=e.privateMsgMaxId||0,this.groupMsgMaxId=e.groupMsgMaxId||0,Et=e.chats||[]},openChat(e){let t=this.findChats(),i=null;for(let s in t)if(t[s].type==e.type&&t[s].targetId===e.targetId){i=t[s],this.moveTop(s);break}null==i&&(i={targetId:e.targetId,type:e.type,showName:e.showName,headImage:e.headImage,isDnd:e.isDnd,lastContent:"",lastSendTime:(new Date).getTime(),unreadCount:0,hotMinIdx:0,readedMessageIdx:0,messages:[],atMe:!1,atAll:!1,stored:!1,delete:!1},t.unshift(i))},setActiveChat(e){let t=this.findChats();this.activeChat=t[e]},resetUnreadCount(e){let t=this.findChats();for(let i in t)if(t[i].type==e.type&&t[i].targetId==e.targetId){t[i].unreadCount=0,t[i].atMe=!1,t[i].atAll=!1,t[i].stored=!1,this.saveToStorage();break}},readedMessage(e){let t=this.findChatByFriend(e.friendId);if(t){for(let i=t.readedMessageIdx;i0){let t=this.findChats(),i=t[e];t.splice(e,1),t.unshift(i),i.lastSendTime=(new Date).getTime(),i.stored=!1,this.saveToStorage()}},insertMessage(e,t){let i=t.type;e.id&&"PRIVATE"==i&&e.id>this.privateMsgMaxId&&(this.privateMsgMaxId=e.id),e.id&&"GROUP"==i&&e.id>this.groupMsgMaxId&&(this.groupMsgMaxId=e.id);let s=this.findChat(t),o=this.findMessage(s,e);if(o)return Object.assign(o,e),s.stored=!1,void this.saveToStorage();if(e.type==ut.IMAGE?s.lastContent="[图片]":e.type==ut.FILE?s.lastContent="[文件]":e.type==ut.AUDIO?s.lastContent="[语音]":e.type==ut.ACT_RT_VOICE?s.lastContent="[语音通话]":e.type==ut.ACT_RT_VIDEO?s.lastContent="[视频通话]":e.type!=ut.TEXT&&e.type!=ut.RECALL&&e.type!=ut.TIP_TEXT||(s.lastContent=e.content),s.lastSendTime=e.sendTime,s.sendNickName=e.sendNickName,e.selfSend||e.status==pt.READED||e.status==pt.RECALL||e.type==ut.TIP_TEXT||s.unreadCount++,!e.selfSend&&"GROUP"==s.type&&e.atUserIds&&e.status!=pt.READED){let t=At(),i=t.userInfo.id;e.atUserIds.indexOf(i)>=0&&(s.atMe=!0),e.atUserIds.indexOf(-1)>=0&&(s.atAll=!0)}(!s.lastTimeTip||s.lastTimeTip=0&&(s.messages.splice(o,1),o{if("PRIVATE"==e.type){let i=t.findFriend(e.targetId);i&&(e.isDnd=i.isDnd)}else if("GROUP"==e.type){let t=i.findGroup(e.targetId);t&&(e.isDnd=t.isDnd)}}),e.sort((e,t)=>t.lastSendTime-e.lastSendTime),St.a.driver().includes("localStorage")&&this.fliterMessage(e,1e4,1e3),e.forEach(e=>{e.hotMinIdx&&e.hotMinIdx==e.messages.length||(e.hotMinIdx=e.messages.length,e.stored=!1)}),this.chats=e,Et=null,this.saveToStorage(!0)},fliterMessage(e,t,i){let s=0;e.forEach(e=>{if(e.messages.length>i){let t=e.messages.length-i;e.messages=e.messages.slice(t)}s+=e.messages.length}),s>t&&this.fliterMessage(e,t,i/2)},saveToStorage(e){if(this.loading)return;const t=At();let i=t.userInfo.id,s="chats-"+i,o=[];const n=[];for(let a in this.chats){let t=this.chats[a],i=`${s}-${t.type}-${t.targetId}`;if(!t.stored){if(t.delete){let e=i+"-hot";n.push(St.a.removeItem(i)),n.push(St.a.removeItem(e))}else{if(e){let e=Object.assign({},t);e.messages=t.messages.slice(0,t.hotMinIdx),n.push(St.a.setItem(i,e))}let s=i+"-hot",o=Object.assign({},t);o.messages=t.messages.slice(t.hotMinIdx),n.push(St.a.setItem(s,o))}t.stored=!0}t.delete||o.push(i)}let r={privateMsgMaxId:this.privateMsgMaxId,groupMsgMaxId:this.groupMsgMaxId,systemMsgMaxSeqNo:this.systemMsgMaxSeqNo,chatKeys:o};Promise.all(n).then(()=>{St.a.setItem(s,r)}).catch(()=>{console.log("本地消息缓存存储失败")}),this.chats=this.chats.filter(e=>!e.delete)},clear(){Et=[],this.chats=[],this.activeChat=null,this.privateMsgMaxId=0,this.groupMsgMaxId=0,this.loading=!1},loadChat(){return new Promise((e,t)=>{let i=At(),s=i.userInfo.id,o="chats-"+s;St.a.getItem(o).then(t=>{if(t){if(t.chatKeys){const i=[];t.chatKeys.forEach(e=>{i.push(St.a.getItem(e)),i.push(St.a.getItem(e+"-hot"))}),Promise.all(i).then(i=>{t.chats=[];for(let e=0;e{e.status==pt.SENDING&&(e.status=pt.FAILED)});let n=Object.assign({},s,o);o&&s&&(n.messages=s.messages.concat(o.messages)),n.readedMessageIdx=n.readedMessageIdx||0,t.chats.push(n)}this.initChats(t),e()})}}else e()}).catch(e=>{console.log("加载消息失败"),t(e)})})}},getters:{isLoading:e=>()=>e.loadingPrivateMsg||e.loadingGroupMsg,findChats:e=>()=>Et&&e.loading?Et:e.chats,findChatIdx:e=>t=>{let i=e.findChats();for(let e in i)if(i[e].type==t.type&&i[e].targetId===t.targetId)return t=i[e],e},findChat:e=>t=>{let i=e.findChats(),s=e.findChatIdx(t);return i[s]},findChatByFriend:e=>t=>{let i=e.findChats();return i.find(e=>"PRIVATE"==e.type&&e.targetId==t)},findChatByGroup:e=>t=>{let i=e.findChats();return i.find(e=>"GROUP"==e.type&&e.targetId==t)},findMessage:e=>(e,t)=>{if(!e)return null;if(t.id)for(let i=e.messages.length-1;i>=0;i--){let s=e.messages[i];if(s.id&&t.id==s.id)return s;if(s.id&&s.id=0;i--){let s=e.messages[i];if(s.selfSend&&s.tmpId){if(t.tmpId==s.tmpId)return s;if(s.tmpId&&s.tmpId({appInit:!1,fullScreen:!0,webrtc:{}}),actions:{setConfig(e){this.webrtc=e.webrtc},setAppInit(e){this.appInit=e},setFullScreen(e){this.fullScreen=e},loadConfig(){return new Promise((e,t)=>{fe({url:"/system/config",method:"GET"}).then(t=>{console.log("系统配置",t),this.setConfig(t),e()}).catch(e=>{t(e)})})}}});a["default"].use(Re["a"]);const xt=Object(Re["b"])();a["default"].use(ue.a),a["default"].prototype.$wsApi=s,a["default"].prototype.$msgType=o,a["default"].prototype.$date=r,a["default"].prototype.$http=fe,a["default"].prototype.$emo=it,a["default"].prototype.$url=ot,a["default"].prototype.$str=rt,a["default"].prototype.$elm=dt,a["default"].prototype.$enums=n,a["default"].prototype.$eventBus=new a["default"],a["default"].config.productionTip=!1,new a["default"]({el:"#app",router:ke,pinia:xt,render:e=>e(p)}),a["default"].prototype.chatStore=wt(),a["default"].prototype.friendStore=It(),a["default"].prototype.groupStore=bt(),a["default"].prototype.userStore=At(),a["default"].prototype.configStore=yt()},"5b62":function(e,t,i){e.exports=i.p+"img/logo.45fcc00b.png"},"5f40":function(e,t,i){e.exports=i.p+"img/21.ec8df612.gif"},6047:function(e,t,i){e.exports=i.p+"img/34.b4c0eba4.gif"},6178:function(e,t,i){},"61f2":function(e,t,i){e.exports=i.p+"img/48.20d1ce26.gif"},6318:function(e,t,i){e.exports=i.p+"img/28.52524722.gif"},6338:function(e,t,i){"use strict";i("3251")},"642d":function(e,t,i){var s={"./0.gif":"f1c0","./1.gif":"f320","./10.gif":"d054","./11.gif":"b1c1","./12.gif":"4518","./13.gif":"a79b","./14.gif":"982d","./15.gif":"6e1f","./16.gif":"50a5","./17.gif":"25a1","./18.gif":"fd6e","./19.gif":"32c6","./2.gif":"34cb","./20.gif":"d496","./21.gif":"5f40","./22.gif":"4fc8","./23.gif":"f5d6","./24.gif":"058c","./25.gif":"3854","./26.gif":"7a13","./27.gif":"36a4","./28.gif":"6318","./29.gif":"df98","./3.gif":"d370","./30.gif":"5541","./31.gif":"8bb4","./32.gif":"cd82","./33.gif":"8e89","./34.gif":"6047","./35.gif":"7e0f","./36.gif":"846c","./37.gif":"8959","./38.gif":"ba6e","./39.gif":"5347","./4.gif":"3dfc","./40.gif":"1a8f","./41.gif":"3d2d","./42.gif":"6430","./43.gif":"a4d0","./44.gif":"680b","./45.gif":"829b","./46.gif":"9aeb","./47.gif":"37bf","./48.gif":"61f2","./49.gif":"b59b","./5.gif":"28f3","./50.gif":"e715","./51.gif":"e0c4","./52.gif":"4d66","./53.gif":"7a4c","./54.gif":"7449","./55.gif":"9216","./56.gif":"e769","./6.gif":"81f6","./7.gif":"ef96","./8.gif":"0abc","./9.gif":"3f29"};function o(e){var t=n(e);return i(t)}function n(e){if(!i.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}o.keys=function(){return Object.keys(s)},o.resolve=n,e.exports=o,o.id="642d"},6430:function(e,t,i){e.exports=i.p+"img/42.02d062c5.gif"},6467:function(e,t,i){"use strict";i("0c7f")},"680b":function(e,t,i){e.exports=i.p+"img/44.00ef8c19.gif"},"6c77":function(e,t,i){e.exports=i.p+"media/tip.8f0ca6f9.mp3"},"6e1f":function(e,t,i){e.exports=i.p+"img/15.75820281.gif"},"6e32":function(e,t,i){"use strict";i("568f")},7449:function(e,t,i){e.exports=i.p+"img/54.2030cc4e.gif"},7878:function(e,t,i){"use strict";i("c2c5")},"7a13":function(e,t,i){e.exports=i.p+"img/26.03b7a469.gif"},"7a4c":function(e,t,i){e.exports=i.p+"img/53.a59af82b.gif"},"7e0f":function(e,t,i){e.exports=i.p+"img/35.7e9e390a.gif"},"81f6":function(e,t,i){e.exports=i.p+"img/6.187a4467.gif"},"829b":function(e,t,i){e.exports=i.p+"img/45.7bab77e0.gif"},"846c":function(e,t,i){e.exports=i.p+"img/36.c4e8fcb2.gif"},86814:function(e,t,i){e.exports=i.p+"img/icp_logo.58f55c5c.png"},8959:function(e,t,i){e.exports=i.p+"img/37.418a25ff.gif"},"8bb4":function(e,t,i){e.exports=i.p+"img/31.4894333c.gif"},"8e89":function(e,t,i){e.exports=i.p+"img/33.deb9bb7e.gif"},"91f8":function(e,t,i){"use strict";var s=i("d7d9"),o=i.n(s);t["default"]=o.a},9216:function(e,t,i){e.exports=i.p+"img/55.469289a4.gif"},"97db":function(e,t,i){"use strict";i("f48f")},"982d":function(e,t,i){e.exports=i.p+"img/14.8734eba5.gif"},"9aeb":function(e,t,i){e.exports=i.p+"img/46.e9ac968c.gif"},a4d0:function(e,t,i){e.exports=i.p+"img/43.62177cf1.gif"},a79b:function(e,t,i){e.exports=i.p+"img/13.aaebd091.gif"},b1c1:function(e,t,i){e.exports=i.p+"img/11.b0d85036.gif"},b599:function(e,t,i){"use strict";i("fbf4")},b59b:function(e,t,i){e.exports=i.p+"img/49.c881faa6.gif"},b824:function(e,t,i){},ba6e:function(e,t,i){e.exports=i.p+"img/38.8f1726b9.gif"},be35:function(e,t,i){},c2c5:function(e,t,i){},cd82:function(e,t,i){e.exports=i.p+"img/32.f35d7073.gif"},cffd:function(e,t,i){e.exports=i.p+"media/call.038ab63f.wav"},d054:function(e,t,i){e.exports=i.p+"img/10.d13dcac4.gif"},d1df:function(e,t,i){},d36d:function(e,t,i){"use strict";i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return o}));var s=function(){var e=this;e._self._c,e._self._setupProxy;return e._m(0)},o=[function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"icp"},[t("img",{staticClass:"icp-icon",attrs:{src:i("86814")}}),t("a",{attrs:{target:"_blank",href:"https://beian.miit.gov.cn/"}},[e._v("粤ICP备xxxx号-1")])])}]},d370:function(e,t,i){e.exports=i.p+"img/3.7abec26c.gif"},d496:function(e,t,i){e.exports=i.p+"img/20.6428ddb3.gif"},d57c:function(e,t,i){"use strict";i("5502")},d7d9:function(e,t){},dba4:function(e,t,i){},df98:function(e,t,i){e.exports=i.p+"img/29.1659f59b.gif"},e0c4:function(e,t,i){e.exports=i.p+"img/51.5d136c53.gif"},e715:function(e,t,i){e.exports=i.p+"img/50.7614f726.gif"},e769:function(e,t,i){e.exports=i.p+"img/56.33767a85.gif"},e95e:function(e,t,i){"use strict";i("0f53")},ef96:function(e,t,i){e.exports=i.p+"img/7.fb655c96.gif"},f1c0:function(e,t,i){e.exports=i.p+"img/0.23538cb7.gif"},f320:function(e,t,i){e.exports=i.p+"img/1.41d8ebbe.gif"},f48f:function(e,t,i){},f5d6:function(e,t,i){e.exports=i.p+"img/23.071999b8.gif"},f6b7:function(e,t,i){"use strict";i("d1df")},fbf4:function(e,t,i){},fd6e:function(e,t,i){e.exports=i.p+"img/18.c47c412d.gif"}}); //# sourceMappingURL=app.f0d3498a.js.map