import{a as e,d as t,i as n}from"./objectSpread2-DtFdQpqy.js";import{a as r,n as i}from"./preload-helper-EQ20WQt-.js";import{M as a,c as o,o as s,w as c}from"./prop-types-DdDwMzX7.js";import{at as l,i as u}from"./poll-9cD-z1op.js";import{Bt as d,Ht as f,Ni as p,Ut as m,Vt as h,ea as g,ko as _}from"./time-BE5vfriQ.js";import{t as v}from"./helmet-xJbX5x_5.js";import{t as y}from"./streaming-4dcMOrhn.js";import{t as b}from"./column-CvSGioVA.js";import{t as x}from"./intl-DxYtUOxD.js";import{an as S}from"./status_quoted-I7FHuyaO.js";import{f as C}from"./account-DMgquuP2.js";import{a as w}from"./columns_area-CKo_cVx6.js";import{t as T}from"./dismissable_banner-Bwf4DGzR.js";import{t as E}from"./status_list_container-qh8nysy7.js";import{t as D}from"./setting_toggle-C08Fw62u.js";var O=t(r());u();var k=i(),A=x(class extends O.PureComponent{render(){let{settings:e,onChange:t}=this.props;return(0,k.jsx)(`div`,{className:`column-settings`,children:(0,k.jsx)(`section`,{children:(0,k.jsx)(`div`,{className:`column-settings__row`,children:(0,k.jsx)(D,{settings:e,settingPath:[`other`,`onlyMedia`],onChange:t,label:(0,k.jsx)(s,{id:`community.column_settings.media_only`,defaultMessage:`Media only`})})})})})}}),j=_((e,{columnId:t})=>{let n=t,r=e.getIn([`settings`,`columns`]),i=r.findIndex(e=>e.get(`uuid`)===n);return{settings:n&&i>=0?r.get(i).get(`params`):e.getIn([`settings`,`community`])}},(e,{columnId:t})=>({onChange(n,r){e(t?h(t,n,r):g([`community`,...n],r))}}))(A);e();var M=o({title:{id:`column.community`,defaultMessage:`Local timeline`}}),N=(e,{columnId:t})=>{let n=t,r=e.getIn([`settings`,`columns`]),i=r.findIndex(e=>e.get(`uuid`)===n),a=t&&i>=0?r.get(i).getIn([`params`,`other`,`onlyMedia`]):e.getIn([`settings`,`community`,`other`,`onlyMedia`]),o=e.getIn([`timelines`,`community${a?`:media`:``}`]);return{hasUnread:!!o&&o.get(`unread`)>0,onlyMedia:a}},P=class extends O.PureComponent{constructor(...e){super(...e),n(this,`handlePin`,()=>{let{columnId:e,dispatch:t,onlyMedia:n}=this.props;t(e?m(e):d(`COMMUNITY`,{other:{onlyMedia:n}}))}),n(this,`handleMove`,e=>{let{columnId:t,dispatch:n}=this.props;n(f(t,e))}),n(this,`handleHeaderClick`,()=>{this.column.scrollTop()}),n(this,`setRef`,e=>{this.column=e}),n(this,`handleLoadMore`,e=>{let{dispatch:t,onlyMedia:n}=this.props;t(p({maxId:e,onlyMedia:n}))})}componentDidMount(){let{dispatch:e,onlyMedia:t}=this.props,{signedIn:n}=this.props.identity;e(p({onlyMedia:t})),n&&(this.disconnect=e(y({onlyMedia:t})))}componentDidUpdate(e){let{signedIn:t}=this.props.identity;if(e.onlyMedia!==this.props.onlyMedia){let{dispatch:e,onlyMedia:n}=this.props;this.disconnect&&this.disconnect(),e(p({onlyMedia:n})),t&&(this.disconnect=e(y({onlyMedia:n})))}}componentWillUnmount(){this.disconnect&&(this.disconnect(),this.disconnect=null)}render(){let{intl:e,hasUnread:t,columnId:n,multiColumn:r,onlyMedia:i}=this.props,{signedIn:o,permissions:l}=this.props.identity,u=!!n,d=S(o,l,a)?(0,k.jsx)(s,{id:`empty_column.community`,defaultMessage:`The local timeline is empty. Write something publicly to get the ball rolling!`}):(0,k.jsx)(s,{id:`empty_column.disabled_feed`,defaultMessage:`This feed has been disabled by your server administrators.`});return(0,k.jsxs)(b,{bindToDocument:!r,ref:this.setRef,label:e.formatMessage(M.title),children:[(0,k.jsx)(w,{icon:`users`,iconComponent:C,active:t,title:e.formatMessage(M.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:u,multiColumn:r,children:(0,k.jsx)(j,{columnId:n})}),(0,k.jsx)(E,{prepend:(0,k.jsx)(T,{id:`community_timeline`,children:(0,k.jsx)(s,{id:`dismissable_banner.community_timeline`,defaultMessage:`These are the most recent public posts from people whose accounts are hosted by {domain}.`,values:{domain:c}})}),trackScroll:!u,scrollKey:`community_timeline-${n}`,timelineId:`community${i?`:media`:``}`,onLoadMore:this.handleLoadMore,emptyMessage:d,bindToDocument:!r}),(0,k.jsxs)(v,{children:[(0,k.jsx)(`title`,{children:e.formatMessage(M.title)}),(0,k.jsx)(`meta`,{name:`robots`,content:`noindex`})]})]})}};n(P,`defaultProps`,{onlyMedia:!1});var F=l(_(N)(x(P)));export{F as default};
//# sourceMappingURL=community_timeline-GDXHXyZZ.js.map