honkoma/priv/static/packs/flavours/glitch/async/status.js

2 lines
27 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[85],{757:function(e,t,a){"use strict";a.d(t,"a",(function(){return H}));var s=a(0),i=a(8),n=a(2),o=a(7),c=a(1),l=a(3),d=a.n(l),r=a(5),u=a.n(r),p=a(14),h=a.n(p),b=a(91),g=a(93),f=a(150),m=a(468),O=a(262),j=a(316),v=a(6),k=a(469),M=a(18),y=a(83),_=a(223),C=a(535),x=a(746),I=a(12),w=a.n(I),R=a(537),D=a(23),H=function(e){function t(){for(var t,a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return t=e.call.apply(e,[this].concat(s))||this,Object(c.a)(Object(n.a)(t),"state",{height:null}),Object(c.a)(Object(n.a)(t),"handleAccountClick",(function(e){if(0===e.button&&!(e.ctrlKey||e.altKey||e.metaKey)&&t.context.router){e.preventDefault();var a=Object(i.default)({},t.context.router.history.location.state);a.mastodonBackSteps=(a.mastodonBackSteps||0)+1,t.context.router.history.push("/accounts/"+t.props.status.getIn(["account","id"]),a)}e.stopPropagation()})),Object(c.a)(Object(n.a)(t),"parseClick",(function(e,a){if(0===e.button&&!(e.ctrlKey||e.altKey||e.metaKey)&&t.context.router){e.preventDefault();var s=Object(i.default)({},t.context.router.history.location.state);s.mastodonBackSteps=(s.mastodonBackSteps||0)+1,t.context.router.history.push(a,s)}e.stopPropagation()})),Object(c.a)(Object(n.a)(t),"handleOpenVideo",(function(e,a){t.props.onOpenVideo(e,a)})),Object(c.a)(Object(n.a)(t),"setRef",(function(e){t.node=e,t._measureHeight()})),Object(c.a)(Object(n.a)(t),"handleChildUpdate",(function(){t._measureHeight()})),Object(c.a)(Object(n.a)(t),"handleModalLink",(function(e){var t;e.preventDefault(),t="A"!==e.target.nodeName?e.target.parentNode.href:e.target.href,window.open(t,"mastodon-intent","width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes")})),t}Object(o.a)(t,e);var a=t.prototype;return a._measureHeight=function(e){var t=this;this.props.measureHeight&&this.node&&(Object(x.a)((function(){return t.node&&t.setState({height:Math.ceil(t.node.scrollHeight)+1})})),this.props.onHeightChange&&e&&this.props.onHeightChange())},a.componentDidUpdate=function(e,t){this._measureHeight(t.height!==this.state.height)},a.render=function(){var e=this.props.status&&this.props.status.get("reblog")?this.props.status.get("reblog"):this.props.status,t=this.props,a=t.expanded,i=t.onToggleHidden,n=t.settings,o={boxSizing:"border-box"},c=this.props.compact;if(!e)return null;var l=null,r=null,u="",p="",h="retweet",M="";if(this.props.measureHeight&&(o.height=this.state.height+"px"),e.get("poll"))l=Object(s.a)(R.a,{pollId:e.get("poll")}),r="tasks";else if(e.get("media_attachments").size>0)if(e.get("media_attachments").some((function(e){return"unknown"===e.get("type")})))l=Object(s.a)(O.a,{media:e.get("media_attachments")});else if("audio"===e.getIn(["media_attachments",0,"type"])){var x=e.getIn(["media_attachments",0]);l=Object(s.a)(_.default,{src:x.get("url"),alt:x.get("description"),duration:x.getIn(["meta","original","duration"],0),height:110,preload:!0}),r="music"}else if("video"===e.getIn(["media_attachments",0,"type"])){var I=e.getIn(["media_attachments",0]);l=Object(s.a)(y.default,{preview:I.get("preview_url"),blurhash:I.get("blurhash"),src:I.get("url"),alt:I.get("description"),inline:!0,sensitive:e.get("sensitive"),letterbox:n.getIn(["media","letterbox"]),fullwidth:n.getIn(["media","fullwidth"]),preventPlayback:!a,onOpenVideo:this.handleOpenVideo,autoplay:!0,visible:this.props.showMedia,onToggleVisibility:this.props.onToggleMediaVisibility}),r="video-camera"}else l=Object(s.a)(m.default,{standalone:!0,sensitive:e.get("sensitive"),media:e.get("media_attachments"),letterbox:n.getIn(["media","letterbox"]),fullwidth:n.getIn(["media","fullwidth"]),hidden:!a,onOpenMedia:this.props.onOpenMedia,visible:this.props.showMedia,onToggleVisibility:this.props.onToggleMediaVisibility}),r="picture-o";else e.get("card")&&(l=Object(s.a)(k.a,{onOpenMedia:this.props.onOpenMedia,card:e.get("card")}),r="link");return e.get("application")&&(u=Object(s.a)("span",{},void 0," · ",Object(s.a)("a",{className:"detailed-status__application",href:e.getIn(["application","website"]),target:"_blank",rel:"noopener noreferrer"},void 0,e.getIn(["application","name"])))),"direct"===e.get("visibility")?h="envelope":"private"===e.get("visibility")&&(h="lock"),p="private"===e.get("visibility")?Object(s.a)(D.a,{id:h}):this.context.router?Object(s.a)(j.a,{to:"/statuses/"+e.get("id")+"/reblogs",className:"detailed-status__link"},void 0,Object(s.a)(D.a,{id:h}),Object(s.a)("span",{className:"detailed-status__reblogs"},void 0,Object(s.a)(v.c,{value:e.get("reblogs_count")}))):Object(s.a)("a",{href:"/interact/"+e.get("id")+"?type=reblog",className:"detailed-status__link",onClick:this.handleModalLink},void 0,Object(s.a)(D.a,{id:h}),Object(s.a)("span",{className:"detailed-status__reblogs"},void 0,Object(s.a)(v.c,{value:e.get("reblogs_count")}))),M=this.context.router?Object(s.a)(j.a,{to:"/statuses/"+e.get("id")+"/favourites",className:"detailed-status__link"},void 0,Object(s.a)(D.a,{id:"star"}),Object(s.a)("span",{className:"detailed-status__favorites"},void 0,Object(s.a)(v.c,{value:e.get("favourites_count")}))):Object(s.a)("a",{href:"/interact/"+e.get("id")+"?type=favourite",className:"detailed-status__link",onClick:this.handleModalLink},void 0,Object(s.a)(D.a,{id:"star"}),Object(s.a)("span",{className:"detailed-status__favorites"},void 0,Object(s.a)(v.c,{value:e.get("favourites_count")}))),Object(s.a)("div",{style:o},void 0,d.a.createElement("div",{ref:this.setRef,className:w()("detailed-status",{compact:c}),"data-status-by":e.getIn(["account","acct"])},Object(s.a)("a",{href:e.getIn(["account","url"]),onClick:this.handleAccountClick,className:"detailed-status__display-name"},void 0,Object(s.a)("div",{className:"detailed-status__display-avatar"},void 0,Object(s.a)(b.a,{account:e.get("account"),size:48})),Object(s.a)(g.a,{account:e.get("account"),localDomain:this.props.domain})),Object(s.a)(f.a,{status:e,media:l,mediaIcon:r,expanded:a,collapsed:!1,onExpandedToggle:i,parseClick:this.parseClick,onUpdate:this.handleChildUpdate,tagLinks:n.get("tag_misleading_links"),rewriteMentions:n.get("rewrite_mentions"),disabled:!0}),Object(s.a)("div",{className:"detailed-status__meta"},void 0,Object(s.a)("a",{className:"detailed-status__datetime",href:e.get("url"),target:"_blank",rel:"noopener noreferrer"},void 0,Object(s.a)(v.a,{value:new Date(e.get("created_at")),hour12:!1,year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})),u," · ",p," · ",M," · ",Object(s.a)(C.a,{visibility:e.get("visibility")}))))},t}(M.a);Object(c.a)(H,"contextTypes",{router:u.a.object}),Object(c.a)(H,"propTypes",{status:h.a.map,settings:h.a.map.isRequired,onOpenMedia:u.a.func.isRequired,onOpenVideo:u.a.func.isRequired,onToggleHidden:u.a.func,expanded:u.a.bool,measureHeight:u.a.bool,onHeightChange:u.a.func,domain:u.a.string.isRequired,compact:u.a.bool,showMedia:u.a.bool,onToggleMediaVisibility:u.a.func})},832:function(e,t,a){"use strict";a.r(t);var s,i,n,o,c,l,d,r=a(0),u=a(8),p=a(2),h=a(7),b=a(1),g=a(4),f=a.n(g),m=a(3),O=a.n(m),j=a(13),v=a(5),k=a.n(v),M=a(12),y=a.n(M),_=a(14),C=a.n(_),x=a(54),I=a(113),w=a(1029),R=a(757),D=a(39),H=a(741),S=a(6),T=a(16),B=a(145),E=Object(S.f)({delete:{id:"status.delete",defaultMessage:"Delete"},redraft:{id:"status.redraft",defaultMessage:"Delete & re-draft"},direct:{id:"status.direct",defaultMessage:"Direct message @{name}"},mention:{id:"status.mention",defaultMessage:"Mention @{name}"},reply:{id:"status.reply",defaultMessage:"Reply"},reblog:{id:"status.reblog",defaultMessage:"Boost"},reblog_private:{id:"status.reblog_private",defaultMessage:"Boost to original audience"},cannot_reblog:{id:"status.cannot_reblog",defaultMessage:"This post cannot be boosted"},favourite:{id:"status.favourite",defaultMessage:"Favourite"},bookmark:{id:"status.bookmark",defaultMessage:"Bookmark"},mute:{id:"status.mute",defaultMessage:"Mute @{name}"},muteConversation:{id:"status.mute_conversation",defaultMessage:"Mute conversation"},unmuteConversation:{id:"status.unmute_conversation",defaultMessage:"Unmute conversation"},block:{id:"status.block",defaultMessage:"Block @{name}"},report:{id:"status.report",defaultMessage:"Report @{name}"},share:{id:"status.share",defaultMessage:"Share"},pin:{id:"status.pin",defaultMessage:"Pin on profile"},unpin:{id:"status.unpin",defaultMessage:"Unpin from profile"},embed:{id:"status.embed",defaultMessage:"Embed"},admin_account:{id:"status.admin_account",defaultMessage:"Open moderation interface for @{name}"},admin_status:{id:"status.admin_status",defaultMessage:"Open this status in the moderation interface"},copy:{id:"status.copy",defaultMessage:"Copy link to status"}}),N=Object(S.g)((n=i=function(e){function t(){for(var t,a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return t=e.call.apply(e,[this].concat(s))||this,Object(b.a)(Object(p.a)(t),"handleReplyClick",(function(){t.props.onReply(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleReblogClick",(function(e){t.props.onReblog(t.props.status,e)})),Object(b.a)(Object(p.a)(t),"handleFavouriteClick",(function(e){t.props.onFavourite(t.props.status,e)})),Object(b.a)(Object(p.a)(t),"handleBookmarkClick",(function(e){t.props.onBookmark(t.props.status,e)})),Object(b.a)(Object(p.a)(t),"handleDeleteClick",(function(){t.props.onDelete(t.props.status,t.context.router.history)})),Object(b.a)(Object(p.a)(t),"handleRedraftClick",(function(){t.props.onDelete(t.props.status,t.context.router.history,!0)})),Object(b.a)(Object(p.a)(t),"handleDirectClick",(function(){t.props.onDirect(t.props.status.get("account"),t.context.router.history)})),Object(b.a)(Object(p.a)(t),"handleMentionClick",(function(){t.props.onMention(t.props.status.get("account"),t.context.router.history)})),Object(b.a)(Object(p.a)(t),"handleMuteClick",(function(){t.props.onMute(t.props.status.get("account"))})),Object(b.a)(Object(p.a)(t),"handleConversationMuteClick",(function(){t.props.onMuteConversation(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleBlockClick",(function(){t.props.onBlock(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleReport",(function(){t.props.onReport(t.props.status)})),Object(b.a)(Object(p.a)(t),"handlePinClick",(function(){t.props.onPin(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleShare",(function(){navigator.share({text:t.props.status.get("search_index"),url:t.props.status.get("url")})})),Object(b.a)(Object(p.a)(t),"handleEmbed",(function(){t.props.onEmbed(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleCopy",(function(){var e=t.props.status.get("url"),a=document.createElement("textarea");a.textContent=e,a.style.position="fixed",document.body.appendChild(a);try{a.select(),document.execCommand("copy")}catch(e){}finally{document.body.removeChild(a)}})),t}return Object(h.a)(t,e),t.prototype.render=function(){var e=this.props,t=e.status,a=e.intl,s=["public","unlisted"].includes(t.get("visibility")),i=t.get("muted"),n=[];s&&(n.push({text:a.formatMessage(E.copy),action:this.handleCopy}),n.push({text:a.formatMessage(E.embed),action:this.handleEmbed}),n.push(null)),T.m===t.getIn(["account","id"])?(s&&n.push({text:a.formatMessage(t.get("pinned")?E.unpin:E.pin),action:this.handlePinClick}),n.push(null),n.push({text:a.formatMessage(i?E.unmuteConversation:E.muteConversation),action:this.handleConversationMuteClick}),n.push(null),n.push({text:a.formatMessage(E.delete),action:this.handleDeleteClick})):(n.push({text:a.formatMessage(E.mention,{name:t.getIn(["account","username"])}),action:this.handleMentionClick}),n.push({text:a.formatMessage(E.direct,{name:t.getIn(["account","username"])}),action:this.handleDirectClick}),n.push(null),n.push({text:a.formatMessage(E.mute,{name:t.getIn(["account","username"])}),action:this.handleMuteClick}),n.push({text:a.formatMessage(E.block,{name:t.getIn(["account","username"])}),action:this.handleBlockClick}),n.push({text:a.formatMessage(E.report,{name:t.getIn(["account","username"])}),action:this.handleReport}),T.j&&(B.a||B.g)&&(n.push(null),void 0!==B.a&&n.push({text:a.formatMessage(E.admin_account,{name:t.getIn(["account","username"])}),href:Object(B.a)(t.getIn(["account","id"]))}),void 0!==B.g&&n.push({text:a.formatMessage(E.admin_status),href:Object(B.g)(t.getIn(["account","id"]),t.get("id"))})));var o="share"in navigator&&"public"===t.get("visibility")&&Object(r.a)("div",{className:"detailed-status__button"},void 0,Object(r.a)(D.a,{title:a.formatMessage(E.share),icon:"share-alt",onClick:this.handleShare})),c="direct"===t.get("visibility")||"private"===t.get("visibility")&&T.m!==t.getIn(["account","id"]),l="private"===t.get("visibility")?E.reblog_private:E.reblog;return Object(r.a)("div",{className:"detailed-status__action-bar"},void 0,Object(r.a)("div",{className:"detailed-status__button"},void 0,Object(r.a)(D.a,{title:a.formatMessage(E.reply),icon:null===t.get("in_reply_to_id",null)?"reply":"reply-all",onClick:this.handleReplyClick})),Object(r.a)("div",{className:"detailed-status__button"},void 0,Object(r.a)(D.a,{disabled:c,active:t.get("reblogged"),title:c?a.formatMessage(E.cannot_reblog):a.formatMessage(l),icon:"retweet",onClick:this.handleReblogClick})),Object(r.a)("div",{className:"detailed-status__button"},void 0,Object(r.a)(D.a,{className:"star-icon",animate:!0,active:t.get("favourited"),title:a.formatMessage(E.favourite),icon:"star",onClick:this.handleFavouriteClick})),o,Object(r.a)("div",{className:"detailed-status__button"},void 0,Object(r.a)(D.a,{className:"bookmark-icon",active:t.get("bookmarked"),title:a.formatMessage(E.bookmark),icon:"bookmark",onClick:this.handleBookmarkClick})),Object(r.a)("div",{className:"detailed-status__action-bar-dropdown"},void 0,Object(r.a)(H.a,{size:18,icon:"ellipsis-h",items:n,direction:"left",ariaLabel:"More"})))},t}(O.a.PureComponent),Object(b.a)(i,"contextTypes",{router:k.a.object}),s=n))||s,A=a(730),V=a(46),F=a(19),U=a(303),z=a(119),P=a(225),q=a(99),K=a(103),L=a(467),W=a(1121),J=a(732),Y=a(1058),G=a(42),Q=a(18),X=a(295),Z=a(257),$=a(751),ee=a(844),te=a(23);a.d(t,"default",(function(){return se}));var ae=Object(S.f)({deleteConfirm:{id:"confirmations.delete.confirm",defaultMessage:"Delete"},deleteMessage:{id:"confirmations.delete.message",defaultMessage:"Are you sure you want to delete this status?"},redraftConfirm:{id:"confirmations.redraft.confirm",defaultMessage:"Delete & redraft"},redraftMessage:{id:"confirmations.redraft.message",defaultMessage:"Are you sure you want to delete this status and re-draft it? You will lose all replies, boosts and favourites to it."},revealAll:{id:"status.show_more_all",defaultMessage:"Show more for all"},hideAll:{id:"status.show_less_all",defaultMessage:"Show less for all"},detailedStatus:{id:"status.detailed_status",defaultMessage:"Detailed conversation view"},replyConfirm:{id:"confirmations.reply.confirm",defaultMessage:"Reply"},replyMessage:{id:"confirmations.reply.message",defaultMessage:"Replying now will overwrite the message you are currently composing. Are you sure you want to proceed?"},tootHeading:{id:"column.toot",defaultMessage:"Toots and replies"}}),se=(o=Object(j.connect)((function(){var e=Object(K.f)(),t=Object(x.a)([function(e,t){return t.id},function(e){return e.getIn(["contexts","inReplyTos"])}],(function(e,t){var a=f.a.List();return a=a.withMutations((function(a){for(var s=e;s;)a.unshift(s),s=t.get(s)}))})),a=Object(x.a)([function(e,t){return t.id},function(e){return e.getIn(["contexts","replies"])},function(e){return e.get("statuses")}],(function(e,t,a){for(var s=[],i=[e];i.length>0;){var n=i.shift(),o=t.get(n);e!==n&&s.push(n),o&&o.reverse().forEach((function(e){i.unshift(e)}))}var c=s.findIndex((function(e){return a.get(e).get("in_reply_to_account_id")!==a.get(e).get("account")}));return-1!==c&&s.forEach((function(e,t){t>c&&a.get(e).get("in_reply_to_account_id")===a.get(e).get("account")&&(s.splice(t,1),s.splice(c,0,e),c+=1)})),f.a.List(s)}));return function(s,i){var n=e(s,{id:i.params.statusId}),o=f.a.List(),c=f.a.List();return n&&(o=t(s,{id:n.get("in_reply_to_id")}),c=a(s,{id:n.get("id")})),{status:n,ancestorsIds:o,descendantsIds:c,settings:s.get("local_settings"),askReplyConfirmation:s.getIn(["local_settings","confirm_before_clearing_draft"])&&0!==s.getIn(["compose","text"]).trim().length,domain:s.getIn(["meta","domain"])}}})),Object(S.g)(c=o((d=l=function(e){function t(){for(var t,a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];return t=e.call.apply(e,[this].concat(s))||this,Object(b.a)(Object(p.a)(t),"state",{fullscreen:!1,isExpanded:void 0,threadExpanded:void 0,statusId:void 0,loadedStatusId:void 0,showMedia:void 0,revealBehindCW:void 0}),Object(b.a)(Object(p.a)(t),"handleExpandedToggle",(function(){t.props.status.get("spoiler_text")&&t.setExpansion(!t.state.isExpanded)})),Object(b.a)(Object(p.a)(t),"handleToggleMediaVisibility",(function(){t.setState({showMedia:!t.state.showMedia})})),Object(b.a)(Object(p.a)(t),"handleModalFavourite",(function(e){t.props.dispatch(Object(V.p)(e))})),Object(b.a)(Object(p.a)(t),"handleFavouriteClick",(function(e,a){e.get("favourited")?t.props.dispatch(Object(V.v)(e)):a&&a.shiftKey||!T.h?t.handleModalFavourite(e):t.props.dispatch(Object(G.d)("FAVOURITE",{status:e,onFavourite:t.handleModalFavourite}))})),Object(b.a)(Object(p.a)(t),"handlePin",(function(e){e.get("pinned")?t.props.dispatch(Object(V.w)(e)):t.props.dispatch(Object(V.s)(e))})),Object(b.a)(Object(p.a)(t),"handleReplyClick",(function(e){var a=t.props,s=a.askReplyConfirmation,i=a.dispatch,n=a.intl;i(s?Object(G.d)("CONFIRM",{message:n.formatMessage(ae.replyMessage),confirm:n.formatMessage(ae.replyConfirm),onDoNotAsk:function(){return i(Object(U.b)(["confirm_before_clearing_draft"],!1))},onConfirm:function(){return i(Object(F.lb)(e,t.context.router.history))}}):Object(F.lb)(e,t.context.router.history))})),Object(b.a)(Object(p.a)(t),"handleModalReblog",(function(e){var a=t.props.dispatch;e.get("reblogged")?a(Object(V.x)(e)):a(Object(V.t)(e))})),Object(b.a)(Object(p.a)(t),"handleReblogClick",(function(e,a){var s=t.props,i=s.settings,n=s.dispatch;i.get("confirm_boost_missing_media_description")&&e.get("media_attachments").some((function(e){return!e.get("description")}))&&!e.get("reblogged")?n(Object(G.d)("BOOST",{status:e,onReblog:t.handleModalReblog,missingMediaDescription:!0})):a&&a.shiftKey||!T.b?t.handleModalReblog(e):n(Object(G.d)("BOOST",{status:e,onReblog:t.handleModalReblog}))})),Object(b.a)(Object(p.a)(t),"handleBookmarkClick",(function(e){e.get("bookmarked")?t.props.dispatch(Object(V.u)(e)):t.props.dispatch(Object(V.o)(e))})),Object(b.a)(Object(p.a)(t),"handleDeleteClick",(function(e,a,s){void 0===s&&(s=!1);var i=t.props,n=i.dispatch,o=i.intl;T.e?n(Object(G.d)("CONFIRM",{message:o.formatMessage(s?ae.redraftMessage:ae.deleteMessage),confirm:o.formatMessage(s?ae.redraftConfirm:ae.deleteConfirm),onConfirm:function(){return n(Object(I.e)(e.get("id"),a,s))}})):n(Object(I.e)(e.get("id"),a,s))})),Object(b.a)(Object(p.a)(t),"handleDirectClick",(function(e,a){t.props.dispatch(Object(F.bb)(e,a))})),Object(b.a)(Object(p.a)(t),"handleMentionClick",(function(e,a){t.props.dispatch(Object(F.hb)(e,a))})),Object(b.a)(Object(p.a)(t),"handleOpenMedia",(function(e,a){t.props.dispatch(Object(G.d)("MEDIA",{media:e,index:a}))})),Object(b.a)(Object(p.a)(t),"handleOpenVideo",(function(e,a){t.props.dispatch(Object(G.d)("VIDEO",{media:e,time:a}))})),Object(b.a)(Object(p.a)(t),"handleHotkeyOpenMedia",(function(e){var a=t.props.status;e.preventDefault(),a.get("media_attachments").size>0&&("audio"===a.getIn(["media_attachments",0,"type"])||("video"===a.getIn(["media_attachments",0,"type"])?t.handleOpenVideo(a.getIn(["media_attachments",0]),0):t.handleOpenMedia(a.get("media_attachments"),0)))})),Object(b.a)(Object(p.a)(t),"handleMuteClick",(function(e){t.props.dispatch(Object(z.g)(e))})),Object(b.a)(Object(p.a)(t),"handleConversationMuteClick",(function(e){e.get("muted")?t.props.dispatch(Object(I.j)(e.get("id"))):t.props.dispatch(Object(I.h)(e.get("id")))})),Object(b.a)(Object(p.a)(t),"handleToggleAll",(function(){var e=t.state.isExpanded;t.setState({isExpanded:!e,threadExpanded:!e})})),Object(b.a)(Object(p.a)(t),"handleBlockClick",(function(e){var a=t.props.dispatch,s=e.get("account");a(Object(P.f)(s))})),Object(b.a)(Object(p.a)(t),"handleReport",(function(e){t.props.dispatch(Object(q.k)(e.get("account"),e))})),Object(b.a)(Object(p.a)(t),"handleEmbed",(function(e){t.props.dispatch(Object(G.d)("EMBED",{url:e.get("url")}))})),Object(b.a)(Object(p.a)(t),"handleHotkeyToggleSensitive",(function(){t.handleToggleMediaVisibility()})),Object(b.a)(Object(p.a)(t),"handleHotkeyMoveUp",(function(){t.handleMoveUp(t.props.status.get("id"))})),Object(b.a)(Object(p.a)(t),"handleHotkeyMoveDown",(function(){t.handleMoveDown(t.props.status.get("id"))})),Object(b.a)(Object(p.a)(t),"handleHotkeyReply",(function(e){e.preventDefault(),t.handleReplyClick(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleHotkeyFavourite",(function(){t.handleFavouriteClick(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleHotkeyBoost",(function(){t.handleReblogClick(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleHotkeyBookmark",(function(){t.handleBookmarkClick(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleHotkeyMention",(function(e){e.preventDefault(),t.handleMentionClick(t.props.status)})),Object(b.a)(Object(p.a)(t),"handleHotkeyOpenProfile",(function(){var e=Object(u.default)({},t.context.router.history.location.state);e.mastodonBackSteps=(e.mastodonBackSteps||0)+1,t.context.router.history.push("/accounts/"+t.props.status.getIn(["account","id"]),e)})),Object(b.a)(Object(p.a)(t),"handleMoveUp",(function(e){var a=t.props,s=a.status,i=a.ancestorsIds,n=a.descendantsIds;if(e===s.get("id"))t._selectChild(i.size-1,!0);else{var o=i.indexOf(e);-1===o?(o=n.indexOf(e),t._selectChild(i.size+o,!0)):t._selectChild(o-1,!0)}})),Object(b.a)(Object(p.a)(t),"handleMoveDown",(function(e){var a=t.props,s=a.status,i=a.ancestorsIds,n=a.descendantsIds;if(e===s.get("id"))t._selectChild(i.size+1,!1);else{var o=i.indexOf(e);-1===o?(o=n.indexOf(e),t._selectChild(i.size+o+2,!1)):t._selectChild(o+1,!1)}})),Object(b.a)(Object(p.a)(t),"handleHeaderClick",(function(){t.column.scrollTop()})),Object(b.a)(Object(p.a)(t),"setExpansion",(function(e){t.setState({isExpanded:e})})),Object(b.a)(Object(p.a)(t),"setRef",(function(e){t.node=e})),Object(b.a)(Object(p.a)(t),"setColumnRef",(function(e){t.column=e})),Object(b.a)(Object(p.a)(t),"onFullScreenChange",(function(){t.setState({fullscreen:Object(Z.d)()})})),Object(b.a)(Object(p.a)(t),"shouldUpdateScroll",(function(e,t){var a=t.location;return!(((e||{}).location||{}).state||{}).mastodonModalOpen&&!(a.state&&a.state.mastodonModalOpen)})),t}Object(h.a)(t,e);var a=t.prototype;return a.componentDidMount=function(){Object(Z.a)(this.onFullScreenChange),this.props.dispatch(Object(I.f)(this.props.params.statusId));var e=this.props,t=e.status,a=e.ancestorsIds;if(t&&a&&a.size>0){var s=this.node.querySelectorAll(".focusable")[a.size-1];window.requestAnimationFrame((function(){s.scrollIntoView(!0)}))}},t.getDerivedStateFromProps=function(e,t){var a={},s=!1;e.params.statusId&&t.statusId!==e.params.statusId&&(e.dispatch(Object(I.f)(e.params.statusId)),a.threadExpanded=void 0,a.statusId=e.params.statusId,s=!0);var i=e.settings.getIn(["media","reveal_behind_cw"]);return i!==t.revealBehindCW&&(a.revealBehindCW=i,i&&(a.showMedia=Object(ee.b)(e.status,e.settings)),s=!0),e.status&&t.loadedStatusId!==e.status.get("id")&&(a.showMedia=Object(ee.b)(e.status,e.settings),a.loadedStatusId=e.status.get("id"),a.isExpanded=Object($.a)(e.settings,e.status),s=!0),s?a:null},a._selectChild=function(e,t){var a=this.node,s=a.querySelectorAll(".focusable")[e];s&&(t&&a.scrollTop>s.offsetTop?s.scrollIntoView(!0):!t&&a.scrollTop+a.clientHeight<s.offsetTop+s.offsetHeight&&s.scrollIntoView(!1),s.focus())},a.renderChildren=function(e){var t=this;return e.map((function(e){return Object(r.a)(Y.a,{id:e,expanded:t.state.threadExpanded,onMoveUp:t.handleMoveUp,onMoveDown:t.handleMoveDown,contextType:"thread"},e)}))},a.componentDidUpdate=function(e){if(this.props.params.statusId&&(this.props.params.statusId!==e.params.statusId||e.ancestorsIds.size<this.props.ancestorsIds.size)){var t=this.props,a=t.status,s=t.ancestorsIds;if(a&&s&&s.size>0){var i=this.node.querySelectorAll(".focusable")[s.size-1];window.requestAnimationFrame((function(){i.scrollIntoView(!0)}))}}},a.componentWillUnmount=function(){Object(Z.b)(this.onFullScreenChange)},a.render=function(){this.setExpansion;var e,t,a=this.props,s=a.status,i=a.settings,n=a.ancestorsIds,o=a.descendantsIds,c=a.intl,l=a.domain,d=a.multiColumn,u=this.state,p=u.fullscreen,h=u.isExpanded;if(null===s)return Object(r.a)(A.a,{},void 0,Object(r.a)(W.a,{multiColumn:d}),Object(r.a)(w.a,{}));n&&n.size>0&&(e=Object(r.a)("div",{},void 0,this.renderChildren(n))),o&&o.size>0&&(t=Object(r.a)("div",{},void 0,this.renderChildren(o)));var b={moveUp:this.handleHotkeyMoveUp,moveDown:this.handleHotkeyMoveDown,reply:this.handleHotkeyReply,favourite:this.handleHotkeyFavourite,boost:this.handleHotkeyBoost,bookmark:this.handleHotkeyBookmark,mention:this.handleHotkeyMention,openProfile:this.handleHotkeyOpenProfile,toggleSpoiler:this.handleExpandedToggle,toggleSensitive:this.handleHotkeyToggleSensitive,openMedia:this.handleHotkeyOpenMedia};return O.a.createElement(A.a,{bindToDocument:!d,ref:this.setColumnRef,label:c.formatMessage(ae.detailedStatus)},Object(r.a)(J.a,{icon:"comment",title:c.formatMessage(ae.tootHeading),onClick:this.handleHeaderClick,showBackButton:!0,multiColumn:d,extraButton:Object(r.a)("button",{className:"column-header__button",title:c.formatMessage(h?ae.hideAll:ae.revealAll),"aria-label":c.formatMessage(h?ae.hideAll:ae.revealAll),onClick:this.handleToggleAll,"aria-pressed":h?"true":"false"},void 0,Object(r.a)(te.a,{id:s.get("hidden")?"eye-slash":"eye"}))}),Object(r.a)(L.a,{scrollKey:"thread",shouldUpdateScroll:this.shouldUpdateScroll},void 0,O.a.createElement("div",{className:y()("scrollable","detailed-status__wrapper",{fullscreen:p}),ref:this.setRef},e,Object(r.a)(X.HotKeys,{handlers:b},void 0,Object(r.a)("div",{className:"focusable",tabIndex:"0","aria-label":Object(ee.c)(c,s,!1,!s.get("hidden"))},void 0,Object(r.a)(R.a,{status:s,settings:i,onOpenVideo:this.handleOpenVideo,onOpenMedia:this.handleOpenMedia,expanded:h,onToggleHidden:this.handleExpandedToggle,domain:l,showMedia:this.state.showMedia,onToggleMediaVisibility:this.handleToggleMediaVisibility},"details-"+s.get("id")),Object(r.a)(N,{status:s,onReply:this.handleReplyClick,onFavourite:this.handleFavouriteClick,onReblog:this.handleReblogClick,onBookmark:this.handleBookmarkClick,onDelete:this.handleDeleteClick,onDirect:this.handleDirectClick,onMention:this.handleMentionClick,onMute:this.handleMuteClick,onMuteConversation:this.handleConversationMuteClick,onBlock:this.handleBlockClick,onReport:this.handleReport,onPin:this.handlePin,onEmbed:this.handleEmbed},"action-bar-"+s.get("id")))),t)))},t}(Q.a),Object(b.a)(l,"contextTypes",{router:k.a.object}),Object(b.a)(l,"propTypes",{params:k.a.object.isRequired,dispatch:k.a.func.isRequired,status:C.a.map,settings:C.a.map.isRequired,ancestorsIds:C.a.list,descendantsIds:C.a.list,intl:k.a.object.isRequired,askReplyConfirmation:k.a.bool,multiColumn:k.a.bool,domain:k.a.string.isRequired}),c=d))||c)||c)}}]);
//# sourceMappingURL=status.js.map