import{d as ee,H as c,r as ye,e as o,f as _,j as d,k as t,w as n,A as T,x as z,q as U,Y as u,bf as a,y as H,c as ae,al as Ve,F as pe,u as de,$ as Te,a0 as ze,b as Re,h as Ce,E as Ye}from"./@vue-a481fc63.js";import{u as le}from"./vuex-44de225f.js";import{f as me,t as Je,h as Ke,i as We,_ as ie,j as Ge,k as Qe,l as Xe,m as Ze,g as et,n as tt,o as st,p as ot,q as nt,r as at,s as lt,u as it,v as ut,w as ct,x as rt,y as _t,z as ge}from"./index-4a465428.js";import{Y as ve,V as Q}from"./IEnum-5453a777.js";import{T as Ue,e as he,f as Se,g as fe,h as Le,I as pt,i as dt,j as mt,k as vt,l as ht,m as ft,n as gt,o as yt,p as kt,q as wt,r as bt,s as $t,t as xe,F as Ie,E as ce,u as re,v as _e,w as Pe}from"./@vicons-7a4ef312.js";import{j as K,e as ue,J as Oe,H as Ct,b as xt,K as It,o as ke,L as De,v as Pt,w as Tt,x as zt,y as Rt,z as Ut,B as St,M as Lt,O as Ot,i as Dt,P as Mt,a as Me,F as At,I as Et,k as qt,G as Nt,f as Bt,g as jt}from"./naive-ui-d8de3dda.js";import{p as we,_ as Ae,a as Ft,b as Ht,c as Vt}from"./content-0e30acaf.js";import{u as Ee,b as Yt}from"./vue-router-e5a2430e.js";import{_ as Jt}from"./post-skeleton-4d2b103e.js";import{l as Kt}from"./lodash-e0b37ac3.js";import{_ as Wt}from"./whisper-7dcedd50.js";import{c as Gt}from"./copy-to-clipboard-4ef7d3eb.js";import{_ as Qt}from"./main-nav.vue_vue_type_style_index_0_lang-2982e04a.js";import{W as Xt}from"./v3-infinite-loading-2c58ec2f.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-39372edb.js";import"./evtd-b614532e.js";import"./@css-render-7124a1a5.js";import"./vooks-6d99783e.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./paopao-video-player-2fe58954.js";import"./@babel-725317a4.js";import"./toggle-selection-93f4ad84.js";const Zt={class:"reply-item"},es={class:"header-wrap"},ts={class:"username"},ss={class:"reply-name"},os={class:"timestamp"},ns={class:"base-wrap"},as={class:"content"},ls={class:"reply-switch"},is={class:"time-item"},us={class:"actions"},cs={class:"upvote-count"},rs=["onClick"],_s={class:"upvote-count"},ps={key:2,class:"action-item"},ds=["onClick"],ms=ee({__name:"reply-item",props:{tweetId:{},reply:{}},emits:["focusReply","reload"],setup(E,{emit:q}){const l=E,v=le(),m=c(l.reply.is_thumbs_up==ve.YES),g=c(l.reply.is_thumbs_down==ve.YES),w=c(l.reply.thumbs_up_count),S=()=>{Je({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(f=>{m.value=!m.value,m.value?(w.value++,g.value=!1):w.value--}).catch(f=>{console.log(f)})},r=()=>{Ke({tweet_id:l.tweetId,comment_id:l.reply.comment_id,reply_id:l.reply.id}).then(f=>{g.value=!g.value,g.value&&m.value&&(w.value--,m.value=!1)}).catch(f=>{console.log(f)})},I=()=>{q("focusReply",l.reply)},R=()=>{We({id:l.reply.id}).then(f=>{window.$message.success("删除成功"),setTimeout(()=>{q("reload")},50)}).catch(f=>{console.log(f)})};return(f,C)=>{const O=ye("router-link"),p=K,x=ue,D=Oe,b=Ct;return o(),_("div",Zt,[d("div",es,[d("div",ts,[t(O,{class:"user-link",to:{name:"user",query:{s:l.reply.user.username}}},{default:n(()=>[T(z(l.reply.user.username),1)]),_:1},8,["to"]),d("span",ss,z(l.reply.at_user_id>0?"回复":":"),1),l.reply.at_user_id>0?(o(),U(O,{key:0,class:"user-link",to:{name:"user",query:{s:l.reply.at_user.username}}},{default:n(()=>[T(z(l.reply.at_user.username),1)]),_:1},8,["to"])):u("",!0)]),d("div",os,[T(z(l.reply.ip_loc)+" ",1),a(v).state.userInfo.is_admin||a(v).state.userInfo.id===l.reply.user.id?(o(),U(D,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:R},{trigger:n(()=>[t(x,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[t(p,null,{default:n(()=>[t(a(Ue))]),_:1})]),_:1})]),default:n(()=>[T(" 是否确认删除? ")]),_:1})):u("",!0)])]),d("div",ns,[d("div",as,[t(b,{"expand-trigger":"click","line-clamp":"5",tooltip:!1},{default:n(()=>[T(z(l.reply.content),1)]),_:1})]),d("div",ls,[d("span",is,z(a(me)(l.reply.created_on)),1),d("div",us,[a(v).state.userLogined?u("",!0):(o(),_("div",{key:0,class:"action-item",onClick:C[0]||(C[0]=H(()=>{},["stop"]))},[t(p,{size:"medium"},{default:n(()=>[t(a(he))]),_:1}),d("span",cs,z(w.value),1)])),a(v).state.userLogined?(o(),_("div",{key:1,class:"action-item hover",onClick:H(S,["stop"])},[t(p,{size:"medium"},{default:n(()=>[m.value?u("",!0):(o(),U(a(he),{key:0})),m.value?(o(),U(a(Se),{key:1,class:"show"})):u("",!0)]),_:1}),d("span",_s,z(w.value>0?w.value:"赞"),1)],8,rs)):u("",!0),a(v).state.userLogined?u("",!0):(o(),_("div",ps,[t(p,{size:"medium"},{default:n(()=>[t(a(fe))]),_:1})])),a(v).state.userLogined?(o(),_("div",{key:3,class:"action-item hover",onClick:H(r,["stop"])},[t(p,{size:"medium"},{default:n(()=>[g.value?u("",!0):(o(),U(a(fe),{key:0})),g.value?(o(),U(a(Le),{key:1,class:"show"})):u("",!0)]),_:1})],8,ds)):u("",!0),a(v).state.userLogined?(o(),_("span",{key:4,class:"show opacity-item reply-btn",onClick:I}," 回复 ")):u("",!0)])])])])}}});const vs=ie(ms,[["__scopeId","data-v-187a4ed3"]]),hs={class:"reply-compose-wrap"},fs={class:"reply-switch"},gs={class:"time-item"},ys={class:"actions"},ks={key:0,class:"action-item"},ws={class:"upvote-count"},bs=["onClick"],$s={class:"upvote-count"},Cs={key:2,class:"action-item"},xs=["onClick"],Is={key:0,class:"reply-input-wrap"},Ps=ee({__name:"compose-reply",props:{comment:{},atUserid:{default:0},atUsername:{default:""}},emits:["reload","reset"],setup(E,{expose:q,emit:l}){const v=E,m=le(),g=c(),w=c(!1),S=c(""),r=c(!1),I=+"300",R=c(v.comment.is_thumbs_up==ve.YES),f=c(v.comment.is_thumbs_down==ve.YES),C=c(v.comment.thumbs_up_count),O=()=>{Ge({tweet_id:v.comment.post_id,comment_id:v.comment.id}).then(b=>{R.value=!R.value,R.value?(C.value++,f.value=!1):C.value--}).catch(b=>{console.log(b)})},p=()=>{Qe({tweet_id:v.comment.post_id,comment_id:v.comment.id}).then(b=>{f.value=!f.value,f.value&&R.value&&(C.value--,R.value=!1)}).catch(b=>{console.log(b)})},x=b=>{w.value=b,b?setTimeout(()=>{var M;(M=g.value)==null||M.focus()},10):(r.value=!1,S.value="",l("reset"))},D=()=>{r.value=!0,Xe({comment_id:v.comment.id,at_user_id:v.atUserid,content:S.value}).then(b=>{x(!1),window.$message.success("评论成功"),l("reload")}).catch(b=>{r.value=!1})};return q({switchReply:x}),(b,M)=>{const s=K,y=xt,B=ue,N=It;return o(),_("div",hs,[d("div",fs,[d("span",gs,z(a(me)(b.comment.created_on)),1),d("div",ys,[a(m).state.userLogined?u("",!0):(o(),_("div",ks,[t(s,{size:"medium"},{default:n(()=>[t(a(he))]),_:1}),d("span",ws,z(C.value),1)])),a(m).state.userLogined?(o(),_("div",{key:1,class:"action-item hover",onClick:H(O,["stop"])},[t(s,{size:"medium"},{default:n(()=>[R.value?u("",!0):(o(),U(a(he),{key:0})),R.value?(o(),U(a(Se),{key:1,class:"show"})):u("",!0)]),_:1}),d("span",$s,z(C.value>0?C.value:"赞"),1)],8,bs)):u("",!0),a(m).state.userLogined?u("",!0):(o(),_("div",Cs,[t(s,{size:"medium"},{default:n(()=>[t(a(fe))]),_:1})])),a(m).state.userLogined?(o(),_("div",{key:3,class:"action-item hover",onClick:H(p,["stop"])},[t(s,{size:"medium"},{default:n(()=>[f.value?u("",!0):(o(),U(a(fe),{key:0})),f.value?(o(),U(a(Le),{key:1,class:"show"})):u("",!0)]),_:1})],8,xs)):u("",!0),a(m).state.userLogined&&!w.value?(o(),_("span",{key:4,class:"show reply-btn",onClick:M[0]||(M[0]=V=>x(!0))}," 回复 ")):u("",!0),a(m).state.userLogined&&w.value?(o(),_("span",{key:5,class:"hide reply-btn",onClick:M[1]||(M[1]=V=>x(!1))}," 取消 ")):u("",!0)])]),w.value?(o(),_("div",Is,[t(N,null,{default:n(()=>[t(y,{ref_key:"inputInstRef",ref:g,size:"small",placeholder:v.atUsername?"@"+v.atUsername:"请输入回复内容..",maxlength:a(I),value:S.value,"onUpdate:value":M[2]||(M[2]=V=>S.value=V),"show-count":"",clearable:""},null,8,["placeholder","maxlength","value"]),t(B,{type:"primary",size:"small",ghost:"",loading:r.value,onClick:D},{default:n(()=>[T(" 回复 ")]),_:1},8,["loading"])]),_:1})])):u("",!0)])}}});const Ts=ie(Ps,[["__scopeId","data-v-f9af7a93"]]),zs={class:"comment-item"},Rs={class:"nickname-wrap"},Us={class:"username-wrap"},Ss={class:"opt-wrap"},Ls={class:"timestamp"},Os=["innerHTML"],Ds={class:"reply-wrap"},Ms=ee({__name:"comment-item",props:{comment:{}},emits:["reload"],setup(E,{emit:q}){const l=E,v=le(),m=Ee(),g=c(0),w=c(""),S=c(),r=ae(()=>{let p=Object.assign({texts:[],imgs:[]},l.comment);return p.contents.map(x=>{(+x.type==1||+x.type==2)&&p.texts.push(x),+x.type==3&&p.imgs.push(x)}),p}),I=(p,x)=>{let D=p.target;if(D.dataset.detail){const b=D.dataset.detail.split(":");b.length===2&&(v.commit("refresh"),b[0]==="tag"?window.$message.warning("评论内的无效话题"):m.push({name:"user",query:{s:b[1]}}))}},R=p=>{var x,D;g.value=p.user_id,w.value=((x=p.user)==null?void 0:x.username)||"",(D=S.value)==null||D.switchReply(!0)},f=()=>{q("reload")},C=()=>{g.value=0,w.value=""},O=()=>{Ze({id:r.value.id}).then(p=>{window.$message.success("删除成功"),setTimeout(()=>{f()},50)}).catch(p=>{})};return(p,x)=>{const D=ke,b=ye("router-link"),M=K,s=ue,y=Oe,B=Ae,N=Ts,V=vs,Y=De;return o(),_("div",zs,[t(Y,{"content-indented":""},Ve({avatar:n(()=>[t(D,{round:"",size:30,src:r.value.user.avatar},null,8,["src"])]),header:n(()=>[d("span",Rs,[t(b,{onClick:x[0]||(x[0]=H(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:r.value.user.username}}},{default:n(()=>[T(z(r.value.user.nickname),1)]),_:1},8,["to"])]),d("span",Us," @"+z(r.value.user.username),1)]),"header-extra":n(()=>[d("div",Ss,[d("span",Ls,z(r.value.ip_loc),1),a(v).state.userInfo.is_admin||a(v).state.userInfo.id===r.value.user.id?(o(),U(y,{key:0,"negative-text":"取消","positive-text":"确认",onPositiveClick:O},{trigger:n(()=>[t(s,{quaternary:"",circle:"",size:"tiny",class:"del-btn"},{icon:n(()=>[t(M,null,{default:n(()=>[t(a(Ue))]),_:1})]),_:1})]),default:n(()=>[T(" 是否确认删除? ")]),_:1})):u("",!0)])]),footer:n(()=>[r.value.imgs.length>0?(o(),U(B,{key:0,imgs:r.value.imgs},null,8,["imgs"])):u("",!0),t(N,{ref_key:"replyComposeRef",ref:S,comment:r.value,"at-userid":g.value,"at-username":w.value,onReload:f,onReset:C},null,8,["comment","at-userid","at-username"]),d("div",Ds,[(o(!0),_(pe,null,de(r.value.replies,F=>(o(),U(V,{key:F.id,reply:F,"tweet-id":r.value.post_id,onFocusReply:R,onReload:f},null,8,["reply","tweet-id"]))),128))])]),_:2},[r.value.texts.length>0?{name:"description",fn:n(()=>[(o(!0),_(pe,null,de(r.value.texts,F=>(o(),_("span",{key:F.id,class:"comment-text",onClick:x[1]||(x[1]=H(P=>I(P,r.value.id),["stop"])),innerHTML:a(we)(F.content).content},null,8,Os))),128))]),key:"0"}:void 0]),1024)])}}});const As=ie(Ms,[["__scopeId","data-v-36dac8c8"]]),Es=E=>(Te("data-v-d9073453"),E=E(),ze(),E),qs={key:0,class:"compose-wrap"},Ns={class:"compose-line"},Bs={class:"compose-user"},js={class:"compose-line compose-options"},Fs={class:"attachment"},Hs={class:"submit-wrap"},Vs={class:"attachment-list-wrap"},Ys={key:1,class:"compose-wrap"},Js=Es(()=>d("div",{class:"login-wrap"},[d("span",{class:"login-banner"}," 登录后,精彩更多")],-1)),Ks={key:0,class:"login-only-wrap"},Ws={key:1,class:"login-wrap"},Gs=ee({__name:"compose-comment",props:{lock:{default:0},postId:{default:0}},emits:["post-success"],setup(E,{emit:q}){const l=E,v=le(),m=c([]),g=c(!1),w=c(!1),S=c(!1),r=c(""),I=c(),R=c("public/image"),f=c([]),C=c([]),O=c("true".toLowerCase()==="true"),p=+"300",x="/v1/attachment",D=ae(()=>"Bearer "+localStorage.getItem("PAOPAO_TOKEN")),b=Kt.debounce(h=>{et({k:h}).then(k=>{let $=[];k.suggest.map(e=>{$.push({label:e,value:e})}),m.value=$,w.value=!1}).catch(k=>{w.value=!1})},200),M=(h,k)=>{w.value||(w.value=!0,k==="@"&&b(h))},s=h=>{h.length>p?r.value=h.substring(0,p):r.value=h},y=h=>{R.value=h},B=h=>{for(let i=0;i30&&(h[i].name=$.substring(0,18)+"..."+$.substring($.length-9)+"."+e)}f.value=h},N=async h=>{var k,$;return R.value==="public/image"&&!["image/png","image/jpg","image/jpeg","image/gif"].includes((k=h.file.file)==null?void 0:k.type)?(window.$message.warning("图片仅允许 png/jpg/gif 格式"),!1):R.value==="image"&&(($=h.file.file)==null?void 0:$.size)>10485760?(window.$message.warning("图片大小不能超过10MB"),!1):!0},V=({file:h,event:k})=>{var $;try{let e=JSON.parse(($=k.target)==null?void 0:$.response);e.code===0&&R.value==="public/image"&&C.value.push({id:h.id,content:e.data.content})}catch{window.$message.error("上传失败")}},Y=({file:h,event:k})=>{var $;try{let e=JSON.parse(($=k.target)==null?void 0:$.response);if(e.code!==0){let i=e.msg||"上传失败";e.details&&e.details.length>0&&e.details.map(A=>{i+=":"+A}),window.$message.error(i)}}catch{window.$message.error("上传失败")}},F=({file:h})=>{let k=C.value.findIndex($=>$.id===h.id);k>-1&&C.value.splice(k,1)},P=()=>{g.value=!0},L=()=>{var h;g.value=!1,(h=I.value)==null||h.clear(),f.value=[],r.value="",C.value=[]},te=()=>{if(r.value.trim().length===0){window.$message.warning("请输入内容哦");return}let{users:h}=we(r.value);const k=[];let $=100;k.push({content:r.value,type:2,sort:$}),C.value.map(e=>{$++,k.push({content:e.content,type:3,sort:$})}),S.value=!0,tt({contents:k,post_id:l.postId,users:Array.from(new Set(h))}).then(e=>{window.$message.success("发布成功"),S.value=!1,q("post-success"),L()}).catch(e=>{S.value=!1})},W=h=>{v.commit("triggerAuth",!0),v.commit("triggerAuthKey",h)};return(h,k)=>{const $=ke,e=Pt,i=K,A=ue,se=Tt,G=zt,oe=Rt,ne=Ut,J=St;return o(),_("div",null,[a(v).state.userInfo.id>0?(o(),_("div",qs,[d("div",Ns,[d("div",Bs,[t($,{round:"",size:30,src:a(v).state.userInfo.avatar},null,8,["src"])]),t(e,{type:"textarea",size:"large",autosize:"",bordered:!1,options:m.value,prefix:["@"],loading:w.value,value:r.value,disabled:l.lock===1,"onUpdate:value":s,onSearch:M,onFocus:P,placeholder:l.lock===1?"泡泡已被锁定,回复功能已关闭":"快来评论两句吧..."},null,8,["options","loading","value","disabled","placeholder"])]),g.value?(o(),U(J,{key:0,ref_key:"uploadRef",ref:I,abstract:"","list-type":"image",multiple:!0,max:9,action:x,headers:{Authorization:D.value},data:{type:R.value},"file-list":f.value,onBeforeUpload:N,onFinish:V,onError:Y,onRemove:F,"onUpdate:fileList":B},{default:n(()=>[d("div",js,[d("div",Fs,[t(se,{abstract:""},{default:n(({handleClick:Z})=>[t(A,{disabled:f.value.length>0&&R.value==="public/video"||f.value.length===9,onClick:()=>{y("public/image"),Z()},quaternary:"",circle:"",type:"primary"},{icon:n(()=>[t(i,{size:"20",color:"var(--primary-color)"},{default:n(()=>[t(a(pt))]),_:1})]),_:2},1032,["disabled","onClick"])]),_:1}),t(oe,{trigger:"hover",placement:"bottom"},{trigger:n(()=>[t(G,{class:"text-statistic",type:"circle","show-indicator":!1,status:"success","stroke-width":10,percentage:r.value.length/a(p)*100},null,8,["percentage"])]),default:n(()=>[T(" "+z(r.value.length)+" / "+z(a(p)),1)]),_:1})]),d("div",Hs,[t(A,{quaternary:"",round:"",type:"tertiary",class:"cancel-btn",size:"small",onClick:L},{default:n(()=>[T(" 取消 ")]),_:1}),t(A,{loading:S.value,onClick:te,type:"primary",secondary:"",size:"small",round:""},{default:n(()=>[T(" 发布 ")]),_:1},8,["loading"])])]),d("div",Vs,[t(ne)])]),_:1},8,["headers","data","file-list"])):u("",!0)])):(o(),_("div",Ys,[Js,O.value?u("",!0):(o(),_("div",Ks,[t(A,{strong:"",secondary:"",round:"",type:"primary",onClick:k[0]||(k[0]=Z=>W("signin"))},{default:n(()=>[T(" 登录 ")]),_:1})])),O.value?(o(),_("div",Ws,[t(A,{strong:"",secondary:"",round:"",type:"primary",onClick:k[1]||(k[1]=Z=>W("signin"))},{default:n(()=>[T(" 登录 ")]),_:1}),t(A,{strong:"",secondary:"",round:"",type:"info",onClick:k[2]||(k[2]=Z=>W("signup"))},{default:n(()=>[T(" 注册 ")]),_:1})])):u("",!0)]))])}}});const Qs=ie(Gs,[["__scopeId","data-v-d9073453"]]),Xs={class:"username-wrap"},Zs={class:"options"},eo={key:0},to=["innerHTML"],so={class:"timestamp"},oo={key:0},no={key:1},ao={class:"opts-wrap"},lo=["onClick"],io={class:"opt-item"},uo=["onClick"],co=["onClick"],ro=ee({__name:"post-detail",props:{post:{}},emits:["reload"],setup(E,{emit:q}){const l=E,v="true".toLowerCase()==="true",m=le(),g=Ee(),w=c(!1),S=c(!1),r=c(!1),I=c(!1),R=c(!1),f=c(!1),C=c(!1),O=c(!1),p=c(Q.PUBLIC),x=c(!1),D=c({id:0,avatar:"",username:"",nickname:"",is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1}),b=e=>{D.value=e,x.value=!0},M=()=>{x.value=!1},s=ae({get:()=>{let e=Object.assign({texts:[],imgs:[],videos:[],links:[],attachments:[],charge_attachments:[]},l.post);return e.contents.map(i=>{(+i.type==1||+i.type==2)&&e.texts.push(i),+i.type==3&&e.imgs.push(i),+i.type==4&&e.videos.push(i),+i.type==6&&e.links.push(i),+i.type==7&&e.attachments.push(i),+i.type==8&&e.charge_attachments.push(i)}),e},set:e=>{l.post.upvote_count=e.upvote_count,l.post.comment_count=e.comment_count,l.post.collection_count=e.collection_count,l.post.is_essence=e.is_essence}}),y=e=>()=>Ce(K,null,{default:()=>Ce(e)}),B=ae(()=>{var A;let e=[];if(!m.state.userInfo.is_admin&&m.state.userInfo.id!=l.post.user.id)return e.push({label:"私信",key:"whisper",icon:y(kt)}),e;e.push({label:"删除",key:"delete",icon:y(wt)}),s.value.is_lock===0?e.push({label:"锁定",key:"lock",icon:y(bt)}):e.push({label:"解锁",key:"unlock",icon:y($t)}),m.state.userInfo.is_admin&&(s.value.is_top===0?e.push({label:"置顶",key:"stick",icon:y(xe)}):e.push({label:"取消置顶",key:"unstick",icon:y(xe)})),s.value.is_essence===0?e.push({label:"设为亮点",key:"highlight",icon:y(Ie)}):e.push({label:"取消亮点",key:"unhighlight",icon:y(Ie)});let i;return s.value.visibility===Q.PUBLIC?i={label:"公开",key:"vpublic",icon:y(ce),children:[{label:"私密",key:"vprivate",icon:y(re)},{label:"关注可见",key:"vfollowing",icon:y(_e)}]}:s.value.visibility===Q.PRIVATE?i={label:"私密",key:"vprivate",icon:y(re),children:[{label:"公开",key:"vpublic",icon:y(ce)},{label:"关注可见",key:"vfollowing",icon:y(_e)}]}:v&&s.value.visibility===Q.FRIEND?i={label:"好友可见",key:"vfriend",icon:y(Pe),children:[{label:"公开",key:"vpublic",icon:y(ce)},{label:"私密",key:"vprivate",icon:y(re)},{label:"关注可见",key:"vfollowing",icon:y(_e)}]}:i={label:"关注可见",key:"vfollowing",icon:y(_e),children:[{label:"公开",key:"vpublic",icon:y(ce)},{label:"私密",key:"vprivate",icon:y(re)}]},v&&s.value.visibility!==Q.FRIEND&&((A=i.children)==null||A.push({label:"好友可见",key:"vfriend",icon:y(Pe)})),e.push(i),e}),N=e=>{g.push({name:"post",query:{id:e}})},V=(e,i)=>{if(e.target.dataset.detail){const A=e.target.dataset.detail.split(":");if(A.length===2){m.commit("refresh"),A[0]==="tag"?g.push({name:"home",query:{q:A[1],t:"tag"}}):g.push({name:"user",query:{s:A[1]}});return}}N(i)},Y=e=>{switch(e){case"whisper":b(l.post.user);break;case"delete":r.value=!0;break;case"lock":case"unlock":I.value=!0;break;case"stick":case"unstick":R.value=!0;break;case"highlight":case"unhighlight":f.value=!0;break;case"vpublic":p.value=0,C.value=!0;break;case"vprivate":p.value=1,C.value=!0;break;case"vfriend":p.value=2,C.value=!0;break;case"vfollowing":p.value=3,C.value=!0;break}},F=()=>{nt({id:s.value.id}).then(e=>{window.$message.success("删除成功"),g.replace("/"),setTimeout(()=>{m.commit("refresh")},50)}).catch(e=>{O.value=!1})},P=()=>{at({id:s.value.id}).then(e=>{q("reload"),e.lock_status===1?window.$message.success("锁定成功"):window.$message.success("解锁成功")}).catch(e=>{O.value=!1})},L=()=>{lt({id:s.value.id}).then(e=>{q("reload"),e.top_status===1?window.$message.success("置顶成功"):window.$message.success("取消置顶成功")}).catch(e=>{O.value=!1})},te=()=>{it({id:s.value.id}).then(e=>{s.value={...s.value,is_essence:e.highlight_status},e.highlight_status===1?window.$message.success("设为亮点成功"):window.$message.success("取消亮点成功")}).catch(e=>{O.value=!1})},W=()=>{ut({id:s.value.id,visibility:p.value}).then(e=>{q("reload"),window.$message.success("修改可见性成功")}).catch(e=>{O.value=!1})},h=()=>{ct({id:s.value.id}).then(e=>{w.value=e.status,e.status?s.value={...s.value,upvote_count:s.value.upvote_count+1}:s.value={...s.value,upvote_count:s.value.upvote_count-1}}).catch(e=>{console.log(e)})},k=()=>{rt({id:s.value.id}).then(e=>{S.value=e.status,e.status?s.value={...s.value,collection_count:s.value.collection_count+1}:s.value={...s.value,collection_count:s.value.collection_count-1}}).catch(e=>{console.log(e)})},$=()=>{Gt(`${window.location.origin}/#/post?id=${s.value.id}&share=copy_link&t=${new Date().getTime()}`),window.$message.success("链接已复制到剪贴板")};return Re(()=>{m.state.userInfo.id>0&&(st({id:s.value.id}).then(e=>{w.value=e.status}).catch(e=>{console.log(e)}),ot({id:s.value.id}).then(e=>{S.value=e.status}).catch(e=>{console.log(e)}))}),(e,i)=>{const A=ke,se=ye("router-link"),G=Lt,oe=ue,ne=Ot,J=Dt,Z=Wt,be=Ft,qe=Ae,Ne=Ht,Be=Vt,$e=Mt,je=Me,Fe=De;return o(),_("div",{class:"detail-item",onClick:i[7]||(i[7]=j=>N(s.value.id))},[t(Fe,null,{avatar:n(()=>[t(A,{round:"",size:30,src:s.value.user.avatar},null,8,["src"])]),header:n(()=>[t(se,{onClick:i[0]||(i[0]=H(()=>{},["stop"])),class:"username-link",to:{name:"user",query:{s:s.value.user.username}}},{default:n(()=>[T(z(s.value.user.nickname),1)]),_:1},8,["to"]),d("span",Xs," @"+z(s.value.user.username),1),s.value.is_top?(o(),U(G,{key:0,class:"top-tag",type:"warning",size:"small",round:""},{default:n(()=>[T(" 置顶 ")]),_:1})):u("",!0),s.value.visibility==a(Q).PRIVATE?(o(),U(G,{key:1,class:"top-tag",type:"error",size:"small",round:""},{default:n(()=>[T(" 私密 ")]),_:1})):u("",!0),s.value.visibility==a(Q).FRIEND?(o(),U(G,{key:2,class:"top-tag",type:"info",size:"small",round:""},{default:n(()=>[T(" 好友可见 ")]),_:1})):u("",!0)]),"header-extra":n(()=>[d("div",Zs,[t(ne,{placement:"bottom-end",trigger:"click",size:"small",options:B.value,onSelect:Y},{default:n(()=>[t(oe,{quaternary:"",circle:""},{icon:n(()=>[t(a(K),null,{default:n(()=>[t(a(dt))]),_:1})]),_:1})]),_:1},8,["options"])]),t(J,{show:r.value,"onUpdate:show":i[1]||(i[1]=j=>r.value=j),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定删除该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:F},null,8,["show"]),t(J,{show:I.value,"onUpdate:show":i[2]||(i[2]=j=>I.value=j),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(s.value.is_lock?"解锁":"锁定")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:P},null,8,["show","content"]),t(J,{show:R.value,"onUpdate:show":i[3]||(i[3]=j=>R.value=j),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定"+(s.value.is_top?"取消置顶":"置顶")+"该泡泡动态吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:L},null,8,["show","content"]),t(J,{show:f.value,"onUpdate:show":i[4]||(i[4]=j=>f.value=j),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态"+(s.value.is_essence?"取消亮点":"设为亮点")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:te},null,8,["show","content"]),t(J,{show:C.value,"onUpdate:show":i[5]||(i[5]=j=>C.value=j),"mask-closable":!1,preset:"dialog",title:"提示",content:"确定将该泡泡动态可见度修改为"+(p.value==0?"公开":p.value==1?"私密":p.value==2?"好友可见":"关注可见")+"吗?","positive-text":"确认","negative-text":"取消",onPositiveClick:W},null,8,["show","content"]),t(Z,{show:x.value,user:D.value,onSuccess:M},null,8,["show","user"])]),footer:n(()=>[t(be,{attachments:s.value.attachments},null,8,["attachments"]),t(be,{attachments:s.value.charge_attachments,price:s.value.attachment_price},null,8,["attachments","price"]),t(qe,{imgs:s.value.imgs},null,8,["imgs"]),t(Ne,{videos:s.value.videos,full:!0},null,8,["videos"]),t(Be,{links:s.value.links},null,8,["links"]),d("div",so,[T(" 发布于 "+z(a(me)(s.value.created_on))+" ",1),s.value.ip_loc?(o(),_("span",oo,[t($e,{vertical:""}),T(" "+z(s.value.ip_loc),1)])):u("",!0),!a(m).state.collapsedLeft&&s.value.created_on!=s.value.latest_replied_on?(o(),_("span",no,[t($e,{vertical:""}),T(" 最后回复 "+z(a(me)(s.value.latest_replied_on)),1)])):u("",!0)])]),action:n(()=>[d("div",ao,[t(je,{justify:"space-between"},{default:n(()=>[d("div",{class:"opt-item hover",onClick:H(h,["stop"])},[t(a(K),{size:"20",class:"opt-item-icon"},{default:n(()=>[w.value?u("",!0):(o(),U(a(mt),{key:0})),w.value?(o(),U(a(vt),{key:1,color:"red"})):u("",!0)]),_:1}),T(" "+z(s.value.upvote_count),1)],8,lo),d("div",io,[t(a(K),{size:"20",class:"opt-item-icon"},{default:n(()=>[t(a(ht))]),_:1}),T(" "+z(s.value.comment_count),1)]),d("div",{class:"opt-item hover",onClick:H(k,["stop"])},[t(a(K),{size:"20",class:"opt-item-icon"},{default:n(()=>[S.value?u("",!0):(o(),U(a(ft),{key:0})),S.value?(o(),U(a(gt),{key:1,color:"#ff7600"})):u("",!0)]),_:1}),T(" "+z(s.value.collection_count),1)],8,uo),d("div",{class:"opt-item hover",onClick:H($,["stop"])},[t(a(K),{size:"20",class:"opt-item-icon"},{default:n(()=>[t(a(yt))]),_:1}),T(" "+z(s.value.share_count),1)],8,co)]),_:1})])]),default:n(()=>[s.value.texts.length>0?(o(),_("div",eo,[(o(!0),_(pe,null,de(s.value.texts,j=>(o(),_("span",{key:j.id,class:"post-text",onClick:i[6]||(i[6]=H(He=>V(He,s.value.id),["stop"])),innerHTML:a(we)(j.content).content},null,8,to))),128))])):u("",!0)]),_:1})])}}});const _o=E=>(Te("data-v-a8d601f1"),E=E(),ze(),E),po={key:0,class:"detail-wrap"},mo={key:1,class:"empty-wrap"},vo={key:0,class:"comment-opts-wrap"},ho=_o(()=>d("span",{class:"comment-title-item"},"评论",-1)),fo={key:2},go={key:0,class:"skeleton-wrap"},yo={key:1},ko={key:0,class:"empty-wrap"},wo={key:0,class:"load-more-spinner"},bo={key:1,class:"load-more-spinner"},$o={key:2,class:"load-more-spinner"},Co={key:3,class:"load-more-spinner"},xo={key:4,class:"load-more-spinner"},Io={key:5,class:"load-more-spinner"},X=20,Po=ee({__name:"Post",setup(E){const q=Yt(),l=c({}),v=c(!1),m=c(!1),g=c([]),w=ae(()=>+q.query.id),S=c("default"),r=c(!0);let I={loading(){},loaded(){},complete(){},error(){}};const R=P=>{S.value=P,P==="default"&&(r.value=!0),Y(I)},f=()=>{l.value={id:0},v.value=!0,_t({id:w.value}).then(P=>{v.value=!1,l.value=P,Y(I)}).catch(P=>{v.value=!1})};let C=1;const O=c(!1),p=c([]),x=P=>{O.value||ge({id:l.value.id,style:"default",page:C,page_size:X}).then(L=>{P!==null&&(I=P),L.list.length0&&(C===1?p.value=L.list:p.value.push(...L.list),g.value=p.value),I.loaded(),m.value=!1}).catch(L=>{m.value=!1,I.error()})};let D=1,b=c(!1);const M=c([]),s=P=>{b.value||ge({id:l.value.id,style:"hots",page:D,page_size:X}).then(L=>{P!==null&&(I=P),L.list.length0&&(D===1?M.value=L.list:M.value.push(...L.list),g.value=M.value),I.loaded(),m.value=!1}).catch(L=>{m.value=!1,I.error()})};let y=1,B=c(!1);const N=c([]),V=P=>{B.value||ge({id:l.value.id,style:"newest",page:y,page_size:X}).then(L=>{P!==null&&(I=P),L.list.length0&&(y===1?N.value=L.list:N.value.push(...L.list),g.value=N.value),I.loaded(),m.value=!1}).catch(L=>{m.value=!1,I.error()})},Y=P=>{w.value<1||(g.value.length===0&&(m.value=!0),S.value==="default"?(g.value=p.value,x(P)):S.value==="hots"?(g.value=M.value,s(P)):(g.value=N.value,V(P)),m.value=!1)},F=()=>{C=1,O.value=!1,p.value=[],D=1,b.value=!1,M.value=[],y=1,B.value=!1,N.value=[],Y(I)};return Re(()=>{f()}),Ye(w,()=>{w.value>0&&q.name==="post"&&f()}),(P,L)=>{const te=Qt,W=ro,h=Et,k=qt,$=Nt,e=Bt,i=jt,A=Qs,se=Jt,G=As,oe=Me,ne=At;return o(),_("div",null,[t(te,{title:"泡泡详情",back:!0}),t(ne,{class:"main-content-wrap",bordered:""},{default:n(()=>[t($,null,{default:n(()=>[t(k,{show:v.value},{default:n(()=>[l.value.id>1?(o(),_("div",po,[t(W,{post:l.value,onReload:f},null,8,["post"])])):(o(),_("div",mo,[t(h,{size:"large",description:"暂无数据"})]))]),_:1},8,["show"])]),_:1}),l.value.id>0?(o(),_("div",vo,[t(i,{type:"bar","justify-content":"end",size:"small","tab-style":"margin-left: -24px;",animated:"","onUpdate:value":R},{prefix:n(()=>[ho]),default:n(()=>[t(e,{name:"default",tab:"推荐"}),t(e,{name:"hots",tab:"热门"}),t(e,{name:"newest",tab:"最新"})]),_:1})])):u("",!0),l.value.id>0?(o(),U($,{key:1},{default:n(()=>[t(A,{lock:l.value.is_lock,"post-id":l.value.id,onPostSuccess:F},null,8,["lock","post-id"])]),_:1})):u("",!0),l.value.id>0?(o(),_("div",fo,[m.value?(o(),_("div",go,[t(se,{num:5})])):(o(),_("div",yo,[g.value.length===0?(o(),_("div",ko,[t(h,{size:"large",description:"暂无评论,快来抢沙发"})])):u("",!0),(o(!0),_(pe,null,de(g.value,J=>(o(),U($,{key:J.id},{default:n(()=>[t(G,{comment:J,onReload:F},null,8,["comment"])]),_:2},1024))),128))]))])):u("",!0),g.value.length>=X?(o(),U(oe,{key:3,justify:"center"},{default:n(()=>[t(a(Xt),{class:"load-more",slots:{complete:"没有更多数据了",error:"加载出错"},onInfinite:Y},{spinner:n(()=>[r.value&&O.value?(o(),_("span",wo)):u("",!0),!r.value&&a(b)?(o(),_("span",bo)):u("",!0),!r.value&&a(B)?(o(),_("span",$o)):u("",!0),r.value&&!O.value?(o(),_("span",Co,"加载评论")):u("",!0),!r.value&&!a(b)?(o(),_("span",xo,"加载评论")):u("",!0),!r.value&&!a(B)?(o(),_("span",Io,"加载评论")):u("",!0)]),_:1})]),_:1})):u("",!0)]),_:1})])}}});const un=ie(Po,[["__scopeId","data-v-a8d601f1"]]);export{un as default};