var j=Object.defineProperty;var b=(s,o,t)=>o in s?j(s,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[o]=t;var a=(s,o,t)=>b(s,typeof o!="symbol"?o+"":o,t);import{j as i}from"./client-By3tlFYA.js";import{i as g,r as f,a as I,d as S,f as v}from"./index-TEHZzOO_.js";import{H as T}from"./Helmet-BG0DmkIY.js";import{j as y,dq as _,ar as P,w as D,ag as L,d1 as w,d2 as H,ds as c}from"./useSelectableClick-BxxGQli3.js";import{S as U}from"./group-DAy9I84u.js";import{ar as $,ad as E}from"./status_quoted-B4XDAzAW.js";import{b as h}from"./streaming-CF2yiHqM.js";import{C as F}from"./column-KuFpKGtG.js";import{C as N}from"./column_header-DvgirlnX.js";import{S as R}from"./status_list_container-CBntoMBm.js";import{S as k}from"./setting_toggle-usXLV5YR.js";import{M as d}from"./message-CVkQtbZv.js";import"./short_number-C9zm8Jg6.js";import"./numbers-BLyy7tyF.js";import"./index-DkCxcZFY.js";import"./relative_timestamp-BOUL06oe.js";import"./ready-DpOgoWSg.js";import"./index-DUY7J2K7.js";import"./skeleton-CwYXpOUk.js";import"./api-C8Dh2R2O.js";import"./index-DiPYjm3h.js";import"./load_locale-CF-OtRm0.js";import"./scroll-BygYx8ga.js";import"./add-CxOAEcXl.js";import"./chevron_left-tY77j9LU.js";import"./unfold_more-Dg1Ay52N.js";import"./status_list-CRbe6f7w.js";import"./gif-9qak4M3X.js";import"./info-onfAZF3m.js";import"./follow_button-4kk1eVh_.js";import"./verified_badge-CALr0BmE.js";import"./load_gap-CrijTKMD.js";import"./scrollable_list-C9ToIjEA.js";import"./index-Cug8L038.js";import"./scroll_context-CaPHRejF.js";import"./schedule_idle_task-CDh0madc.js";import"./load_more-BrYvOBz8.js";import"./index-MzeB4jmw.js";class W extends f.PureComponent{render(){const{settings:o,onChange:t}=this.props;return i.jsx("div",{className:"column-settings",children:i.jsx("section",{children:i.jsx("div",{className:"column-settings__row",children:i.jsx(k,{settings:o,settingPath:["other","onlyMedia"],onChange:t,label:i.jsx(d,{id:"community.column_settings.media_only",defaultMessage:"Media only"})})})})})}}const q=g(W),z=(s,{columnId:o})=>{const t=o,e=s.getIn(["settings","columns"]),n=e.findIndex(m=>m.get("uuid")===t);return{settings:t&&n>=0?e.get(n).get("params"):s.getIn(["settings","community"])}},A=(s,{columnId:o})=>({onChange(t,e){s(o?_(o,t,e):P(["community",...t],e))}}),B=y(z,A)(q),p=I({title:{id:"column.community",defaultMessage:"Local timeline"}}),G=(s,{columnId:o})=>{const t=o,e=s.getIn(["settings","columns"]),n=e.findIndex(l=>l.get("uuid")===t),m=o&&n>=0?e.get(n).getIn(["params","other","onlyMedia"]):s.getIn(["settings","community","other","onlyMedia"]),r=s.getIn(["timelines","community".concat(m?":media":"")]);return{hasUnread:!!r&&r.get("unread")>0,onlyMedia:m}};class M extends f.PureComponent{constructor(){super(...arguments);a(this,"handlePin",()=>{const{columnId:t,dispatch:e,onlyMedia:n}=this.props;e(t?L(t):w("COMMUNITY",{other:{onlyMedia:n}}))});a(this,"handleMove",t=>{const{columnId:e,dispatch:n}=this.props;n(H(e,t))});a(this,"handleHeaderClick",()=>{this.column.scrollTop()});a(this,"setRef",t=>{this.column=t});a(this,"handleLoadMore",t=>{const{dispatch:e,onlyMedia:n}=this.props;e(c({maxId:t,onlyMedia:n}))})}componentDidMount(){const{dispatch:t,onlyMedia:e}=this.props,{signedIn:n}=this.props.identity;t(c({onlyMedia:e})),n&&(this.disconnect=t(h({onlyMedia:e})))}componentDidUpdate(t){const{signedIn:e}=this.props.identity;if(t.onlyMedia!==this.props.onlyMedia){const{dispatch:n,onlyMedia:m}=this.props;this.disconnect&&this.disconnect(),n(c({onlyMedia:m})),e&&(this.disconnect=n(h({onlyMedia:m})))}}componentWillUnmount(){this.disconnect&&(this.disconnect(),this.disconnect=null)}render(){const{intl:t,hasUnread:e,columnId:n,multiColumn:m,onlyMedia:r}=this.props,{signedIn:l,permissions:x}=this.props.identity,u=!!n,C=E(l,x,v)?i.jsx(d,{id:"empty_column.community",defaultMessage:"The local timeline is empty. Write something publicly to get the ball rolling!"}):i.jsx(d,{id:"empty_column.disabled_feed",defaultMessage:"This feed has been disabled by your server administrators."});return i.jsxs(F,{bindToDocument:!m,ref:this.setRef,label:t.formatMessage(p.title),children:[i.jsx(N,{icon:"users",iconComponent:U,active:e,title:t.formatMessage(p.title),onPin:this.handlePin,onMove:this.handleMove,onClick:this.handleHeaderClick,pinned:u,multiColumn:m,children:i.jsx(B,{columnId:n})}),i.jsx(R,{prepend:i.jsx($,{id:"community_timeline",children:i.jsx(d,{id:"dismissable_banner.community_timeline",defaultMessage:"These are the most recent public posts from people whose accounts are hosted by {domain}.",values:{domain:S}})}),trackScroll:!u,scrollKey:"community_timeline-".concat(n),timelineId:"community".concat(r?":media":""),onLoadMore:this.handleLoadMore,emptyMessage:C,bindToDocument:!m}),i.jsxs(T,{children:[i.jsx("title",{children:t.formatMessage(p.title)}),i.jsx("meta",{name:"robots",content:"noindex"})]})]})}}a(M,"defaultProps",{onlyMedia:!1});const wt=D(y(G)(g(M)));export{wt as default};
//# sourceMappingURL=community_timeline-index-C3C2m_PW.js.map
