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