import{b as S,a as l,c as s,w as $,D as u,h as o,i as r,j as d,l as v,u as c,T as B,t as E,H as D}from"./vue-y3KLWBaS.js";import{X as H}from"./MkNoteDetailed-NHefFghY.js";import{M as L}from"./MkRemoteCaution-zbsuTKfb.js";import{a as P,i as p,a4 as R,f as T,n as V}from"./app-JmgyQoR0.js";import"./MkTab.vue_vue_type_style_index_0_lang-bgKDPAJl.js";import"./MkNote-Y7yPCL5J.js";import"./MkReactionsViewer-iZKN4Via.js";import"./MkReactionIcon.vue_vue_type_script_setup_true_lang-MnLL2GJr.js";import"./share-available-LNRVMfAE.js";import"./get-note-summary-7eDLQp-L.js";import"./MkUserCardMini-zBoyIzWP.js";import"./MkMiniChart.vue_vue_type_script_setup_true_lang-pO1kuPAx.js";import"./v4-U7xWZqn4.js";const O={class:"fcuexfpr"},X={key:0,class:"note"},j={class:"main _gap"},U={class:"note _gap"},q=S({__name:"note",props:{noteId:{}},setup(C){const m=C;let t=l(),f=l(),_=l(!1),e=l(),n=l(P.state.alwaysExpandCws);s(()=>e.value?{userId:e.value.userId,untilId:e.value.id}:null),s(()=>e.value?{userId:e.value.userId,sinceId:e.value.id}:null);function M(){t.value=null,T("notes/show",{noteId:m.noteId}).then(a=>{t.value=a,_.value=t.value.renote!=null&&t.value.text==null&&t.value.fileIds.length===0&&t.value.poll==null,e.value=_.value?t.value.renote:t.value}).catch(a=>{f.value=a})}function g(){n.value=!n.value}$(()=>m.noteId,M,{immediate:!0});const w=s(()=>e.value?[{icon:`${n.value?"ph-eye":"ph-eye-slash"} ph-bold ph-lg`,text:n.value?p.ts.collapseAllCws:p.ts.expandAllCws,handler:g}]:[]),I=s(()=>[]);return R(s(()=>e.value?{title:p.t("noteOf",{user:e.value.user.name||e.value.user.username}),subtitle:new Date(e.value.createdAt).toLocaleString(),avatar:e.value.user,path:`/notes/${e.value.id}`,share:{title:p.t("noteOf",{user:e.value.user.name||e.value.user.username}),text:e.value.text}}:null)),(a,i)=>{const x=u("MkPageHeader"),y=u("MkError"),b=u("MkLoading"),A=u("MkSpacer"),N=u("MkStickyContainer");return o(),r(N,null,{header:d(()=>[v(x,{actions:w.value,tabs:I.value,"display-back-button":!0,to:`#${a.noteId}`},null,8,["actions","tabs","to"])]),default:d(()=>[v(A,{"content-max":800,marginMin:6},{default:d(()=>[c("div",O,[v(B,{name:a.$store.state.animation?"fade":"",mode:"out-in"},{default:d(()=>{var h;return[e.value?(o(),E("div",X,[c("div",j,[c("div",U,[e.value.user.host!=null?(o(),r(L,{key:0,href:(h=e.value.url)!=null?h:e.value.uri},null,8,["href"])):D("",!0),(o(),r(H,{key:e.value.id,note:e.value,"onUpdate:note":i[0]||(i[0]=k=>e.value=k),expandAllCws:n.value,class:"note"},null,8,["note","expandAllCws"]))])])])):f.value?(o(),r(y,{key:1,onRetry:i[1]||(i[1]=k=>a.fetch())})):(o(),r(b,{key:2}))]}),_:1},8,["name"])])]),_:1})]),_:1})}}}),ne=V(q,[["__scopeId","data-v-f036fe9a"]]);export{ne as default};
