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