import{X as x}from"./MkNotes-DrVlMmnc.js";import{B as l,b as d,v as e,a9 as D,D as F,$ as v,_ as L}from"./app-QjDgb7aF.js";import{b as M,o as U,f,p as T,u as h,g as z,i as H,k,H as _,t as E,x as y,q as I,J as O,D as j,I as J,F as Q,a as B,E as K,j as R,B as W}from"./vue-Cm77DuTi.js";const Y=M({__name:"MkTimeline",props:{src:{},list:{},antenna:{},channel:{},sound:{type:Boolean}},emits:["note","queue"],setup(N,{emit:S}){const t=N;let C=B(0);const G=S;W("inChannel",f(()=>t.src==="channel"));const m=B(),i=p=>{m.value.pagingComponent?.prepend(p),G("note"),t.sound&&F(v&&p.userId===v.id?"noteMy":"note")},P=()=>{m.value.pagingComponent?.reload()},$=()=>{m.value.pagingComponent?.reload()},b=()=>{m.value.pagingComponent?.backed||m.value.pagingComponent?.reload()};let s,a,n,u,r,c;if(t.src==="antenna")s="antennas/notes",a={antennaId:t.antenna},n=l.useChannel("antenna",{antennaId:t.antenna}),n.on("note",i),r=d.ts.antennaTimelineHint,c=e.state.tlAntennaHintClosed;else if(t.src==="home")s="notes/timeline",a={withReplies:e.state.showTimelineReplies},n=l.useChannel("homeTimeline",{withReplies:e.state.showTimelineReplies}),n.on("note",i),u=l.useChannel("main"),u.on("follow",b),u.on("unfollow",b),r=d.ts._tutorial.step5_3,c=e.state.tlHomeHintClosed;else if(t.src==="local")s="notes/local-timeline",a={withReplies:e.state.showTimelineReplies},n=l.useChannel("localTimeline",{withReplies:e.state.showTimelineReplies}),n.on("note",i),r=d.ts._tutorial.step5_4,c=e.state.tlLocalHintClosed;else if(t.src==="recommended")s="notes/recommended-timeline",a={withReplies:e.state.showTimelineReplies},n=l.useChannel("recommendedTimeline",{withReplies:e.state.showTimelineReplies}),n.on("note",i),r=d.ts._tutorial.step5_6,c=e.state.tlRecommendedHintClosed;else if(t.src==="social")s="notes/hybrid-timeline",a={withReplies:e.state.showTimelineReplies},n=l.useChannel("hybridTimeline",{withReplies:e.state.showTimelineReplies}),n.on("note",i),r=d.ts._tutorial.step5_5,c=e.state.tlSocialHintClosed;else if(t.src==="global")s="notes/global-timeline",a={withReplies:e.state.showTimelineReplies},n=l.useChannel("globalTimeline",{withReplies:e.state.showTimelineReplies}),n.on("note",i),r=d.ts._tutorial.step5_7,c=e.state.tlGlobalHintClosed;else if(t.src==="mentions")s="notes/mentions",n=l.useChannel("main"),n.on("mention",i);else if(t.src==="directs"){s="notes/mentions",a={visibility:"specified"};const p=o=>{o.visibility==="specified"&&i(o)};n=l.useChannel("main"),n.on("mention",p)}else t.src==="list"?(s="notes/user-list-timeline",a={listId:t.list},n=l.useChannel("userList",{listId:t.list}),n.on("note",i),n.on("userAdded",P),n.on("userRemoved",$)):t.src==="channel"&&(s="channels/timeline",a={channelId:t.channel},n=l.useChannel("channel",{channelId:t.channel}),n.on("note",i));function q(){switch(t.src){case"home":e.set("tlHomeHintClosed",!0);break;case"local":e.set("tlLocalHintClosed",!0);break;case"recommended":e.set("tlRecommendedHintClosed",!0);break;case"social":e.set("tlSocialHintClosed",!0);break;case"global":e.set("tlGlobalHintClosed",!0);break;case"antenna":e.set("tlAntennaHintClosed",!0);break}}const A={endpoint:s,limit:10,params:a};U(()=>{n.dispose(),u&&u.dispose()});const V=f(e.makeGetterSetter("newPostsButton")),g=f(e.makeGetterSetter("newPostsGlowOpacity"));return(p,o)=>{const X=K("I18n");return R(),T(Q,null,[h(r)&&!h(c)?(R(),z(D,{key:0,closeable:!0,class:"_gap",onClose:q},{default:H(()=>[k(X,{src:h(r)},{icon:H(()=>[...o[2]||(o[2]=[])]),_:1},8,["src"])]),_:1})):_("",!0),h(C)>0?(R(),T("div",{key:1,class:y(["new",{noShadow:g.value<.05}]),style:E({"--opacity":g.value})},[I("button",{class:y(["_buttonPrimary _shadow",{instant:!p.$store.state.animation,isHidden:!V.value}]),onClick:o[0]||(o[0]=w=>m.value.scrollTop())},[O(j(h(d).ts.newNoteRecived)+" ",1),o[3]||(o[3]=I("i",{class:"ph-arrow-up ph-bold"},null,-1))],2)],6)):_("",!0),k(x,{ref_key:"tlComponent",ref:m,"no-gap":!p.$store.state.showGapBetweenNotesInTimeline,pagination:A,onQueue:o[1]||(o[1]=w=>J(C)?C.value=w:C=w)},null,8,["no-gap"])],64)}}}),te=L(Y,[["__scopeId","data-v-c867431f"]]);export{te as X};
//# sourceMappingURL=MkTimeline-BHgihgS6.js.map
