import{b as X,a as w,c as g,w as Y,D as a,g as P,h as s,i as c,j as n,l,u as t,T as Z,t as i,F as x,G as N,E as y,q as v,z as u,H as m,K as ee,I as te,J as se}from"./vue-y3KLWBaS.js";import{aB as oe,i as d,a4 as ae,M as S,ag as le,f as b,ax as A,b as ne,n as ie}from"./app-JmgyQoR0.js";import{M as re}from"./MkContainer-6laePfDX.js";import{M as ce}from"./MkPagination-urywMrXv.js";import{M as ue}from"./MkGalleryPostPreview-Jw-bKwU4.js";import{s as de}from"./share-available-LNRVMfAE.js";const p=h=>(te("data-v-45652cb9"),h=h(),se(),h),pe={class:"_root"},_e={key:0,class:"rkxwuolj"},he={class:"files"},ke=["src"],ve={class:"body _block"},me={class:"title"},fe={class:"description"},ge={class:"info"},ye=p(()=>t("i",{class:"ph-clock ph-bold ph-lg"},null,-1)),Me={class:"actions"},be={class:"like"},Ce=p(()=>t("i",{class:"ph-heart ph-fill ph-lg"},null,-1)),$e={key:0,class:"count"},Ie=p(()=>t("i",{class:"ph-heart ph-bold"},null,-1)),we={key:0,class:"count"},Pe={class:"other"},xe=p(()=>t("i",{class:"ph-pencil ph-bold ph-lg ph-fw ph-lg"},null,-1)),Ne=[xe],Se=p(()=>t("i",{class:"ph-repeat ph-bold ph-lg ph-fw ph-lg"},null,-1)),Ae=[Se],Be=p(()=>t("i",{class:"ph-share-network ph-bold ph-lg ph-fw ph-lg"},null,-1)),Te=[Be],Le={class:"user"},De={class:"name"},Ee=p(()=>t("i",{class:"ph-clock ph-bold ph-lg"},null,-1)),Ve={class:"sdrarzaf"},Fe=X({__name:"post",props:{postId:{}},setup(h){const B=oe(),f=h;let e=w(null),C=w(null);const T={endpoint:"users/gallery/posts",limit:6,params:g(()=>({userId:e.value.user.id}))};function L(){e.value=null,b("gallery/posts/show",{postId:f.postId}).then(o=>{e.value=o}).catch(o=>{C.value=o})}function D(){navigator.share({title:e.value.title,text:e.value.description,url:`${A}/gallery/${e.value.id}`})}function E(){ne({initialText:`${e.value.title} ${A}/gallery/${e.value.id}`})}function V(){b("gallery/posts/like",{postId:f.postId}).then(()=>{e.value.isLiked=!0,e.value.likedCount++})}async function F(){b("gallery/posts/unlike",{postId:f.postId}).then(()=>{e.value.isLiked=!1,e.value.likedCount--})}function $(){B.push(`/gallery/${e.value.id}/edit`)}Y(()=>f.postId,L,{immediate:!0});const H=g(()=>[{icon:"ph-pencil ph-bold ph-lg",text:d.ts.edit,handler:$}]),j=g(()=>[]);return ae(g(()=>e.value?{title:e.value.title,avatar:e.value.user}:null)),(o,_)=>{const z=a("MkPageHeader"),G=a("Mfm"),R=a("MkTime"),U=a("MkAvatar"),W=a("MkUserName"),q=a("MkAcct"),J=a("MkError"),K=a("MkLoading"),O=a("MkSpacer"),Q=a("MkStickyContainer"),k=P("tooltip"),M=P("click-anime");return s(),c(Q,null,{header:n(()=>[l(z,{actions:H.value,tabs:j.value},null,8,["actions","tabs"])]),default:n(()=>[l(O,{"content-max":1e3,"margin-min":16,"margin-max":32},{default:n(()=>[t("div",pe,[l(Z,{name:o.$store.state.animation?"fade":"",mode:"out-in"},{default:n(()=>[e.value?(s(),i("div",_e,[t("div",he,[(s(!0),i(x,null,N(e.value.files,r=>(s(),i("div",{key:r.id,class:"file"},[t("img",{src:r.url},null,8,ke)]))),128))]),t("div",ve,[t("div",me,y(e.value.title),1),t("div",fe,[l(G,{text:e.value.description},null,8,["text"])]),t("div",ge,[ye,l(R,{time:e.value.createdAt,mode:"detail"},null,8,["time"])]),t("div",Me,[t("div",be,[e.value.isLiked?v((s(),c(S,{key:0,class:"button",primary:"",onClick:_[0]||(_[0]=r=>F())},{default:n(()=>[Ce,e.value.likedCount>0?(s(),i("span",$e,y(e.value.likedCount),1)):m("",!0)]),_:1})),[[k,u(d).ts._gallery.unlike]]):v((s(),c(S,{key:1,class:"button",onClick:_[1]||(_[1]=r=>V())},{default:n(()=>[Ie,e.value.likedCount>0?(s(),i("span",we,y(e.value.likedCount),1)):m("",!0)]),_:1})),[[k,u(d).ts._gallery.like]])]),t("div",Pe,[o.$i&&o.$i.id===e.value.user.id?v((s(),i("button",{key:0,class:"_button",onClick:$},Ne)),[[k,u(d).ts.edit],[M]]):m("",!0),v((s(),i("button",{class:"_button",onClick:E},Ae)),[[k,u(d).ts.shareWithNote],[M]]),u(de)()?v((s(),i("button",{key:1,class:"_button",onClick:D},Te)),[[k,u(d).ts.share],[M]]):m("",!0)])]),t("div",Le,[l(U,{user:e.value.user,class:"avatar"},null,8,["user"]),t("div",De,[l(W,{user:e.value.user,style:{display:"block"}},null,8,["user"]),l(q,{user:e.value.user},null,8,["user"])]),!o.$i||o.$i.id!=e.value.user.id?(s(),c(le,{key:0,user:e.value.user,inline:!0,transparent:!1,full:!0,large:"",class:"koudoku"},null,8,["user"])):m("",!0)])]),l(re,{"max-height":300,foldable:!0,class:"other"},{header:n(()=>[Ee,ee(" "+y(u(d).ts.recentPosts),1)]),default:n(()=>[l(ce,{pagination:T},{default:n(({items:r})=>[t("div",Ve,[(s(!0),i(x,null,N(r,I=>(s(),c(ue,{key:I.id,post:I,class:"post"},null,8,["post"]))),128))])]),_:1})]),_:1})])):C.value?(s(),c(J,{key:1,onRetry:_[2]||(_[2]=r=>o.fetch())})):(s(),c(K,{key:2}))]),_:1},8,["name"])])]),_:1})]),_:1})}}}),We=ie(Fe,[["__scopeId","data-v-45652cb9"]]);export{We as default};
