akkoma/priv/static/packs/features/compose.js
2020-05-20 07:55:14 +02:00

2 lines
No EOL
49 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{404:function(e,t,o){"use strict";(function(e){o.d(t,"a",(function(){return u}));var a=o(0),n=(o(9),o(6),o(8)),s=o(3),i=o.n(s),c=o(83),r=o.n(c);var l=e.env.CDN_HOST||"",u=function(e){Object(n.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e,t=this.props.emoji;if(t.custom)e=t.imageUrl;else{var o=r.a[t.native]||r.a[t.native.replace(/\uFE0F$/,"")];if(!o)return null;e=l+"/emoji/"+o.filename+".svg"}return(Object(a.a)("div",{className:"autosuggest-emoji"},void 0,Object(a.a)("img",{className:"emojione",src:e,alt:t.native||t.colons}),t.colons))},o}(i.a.PureComponent)}).call(this,o(50))},588:function(e,t,o){"use strict";var a,n,s,i=o(15),c=o(0),r=o(2),l=o(9),u=o(6),p=o(8),d=o(1),g=o(3),b=o.n(g),f=o(320),m=o(110),h=o(16),O=o.n(h),v=o(5),j=o.n(v),y=o(23),_=o(210),C=o(115),S=o(53),M=o(122),k=o(7),w=o(21),x=o(222),T=o(282);var R=Object(k.f)({cancel:{id:"reply_indicator.cancel",defaultMessage:"Cancel"}}),N=Object(k.g)((s=n=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleClick",(function(){t.props.onCancel()})),Object(d.a)(Object(r.a)(t),"handleAccountClick",(function(e){0!==e.button||e.ctrlKey||e.metaKey||(e.preventDefault(),t.context.router.history.push("/accounts/"+t.props.status.getIn(["account","id"])))})),t}return o.prototype.render=function(){var e=this.props,t=e.status,o=e.intl;if(!t)return null;var a={__html:t.get("contentHtml")},n={direction:Object(x.a)(t.get("search_index"))?"rtl":"ltr"};return Object(c.a)("div",{className:"reply-indicator"},void 0,Object(c.a)("div",{className:"reply-indicator__header"},void 0,Object(c.a)("div",{className:"reply-indicator__cancel"},void 0,Object(c.a)(S.a,{title:o.formatMessage(R.cancel),icon:"times",onClick:this.handleClick,inverted:!0})),Object(c.a)("a",{href:t.getIn(["account","url"]),onClick:this.handleAccountClick,className:"reply-indicator__display-name"},void 0,Object(c.a)("div",{className:"reply-indicator__display-avatar"},void 0,Object(c.a)(C.a,{account:t.get("account"),size:24})),Object(c.a)(M.a,{account:t.get("account")}))),Object(c.a)("div",{className:"reply-indicator__content",style:n,dangerouslySetInnerHTML:a}),t.get("media_attachments").size>0&&Object(c.a)(T.a,{compact:!0,media:t.get("media_attachments")}))},o}(w.a),Object(d.a)(n,"contextTypes",{router:j.a.object}),Object(d.a)(n,"propTypes",{status:O.a.map,onCancel:j.a.func.isRequired,intl:j.a.object.isRequired}),a=s))||a,D=Object(i.connect)((function(){var e=Object(_.f)();return function(t){return{status:e(t,{id:t.getIn(["compose","in_reply_to"])})}}}),(function(e){return{onCancel:function(){e(Object(y.M)())}}}))(N);var I=function(e){Object(p.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e=this.props.account;return(Object(c.a)("div",{className:"autosuggest-account",title:e.get("acct")},void 0,Object(c.a)("div",{className:"autosuggest-account-icon"},void 0,Object(c.a)(C.a,{account:e,size:18})),Object(c.a)(M.a,{account:e})))},o}(w.a);Object(d.a)(I,"propTypes",{account:O.a.map.isRequired});var P=Object(i.connect)((function(){var e=Object(_.d)();return function(t,o){var a=o.id;return{account:e(t,a)}}}))(I),F=o(404),q=o(421);var A=function(e){Object(p.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e=this.props.tag,t=e.history&&Object(q.a)(e.history.reduce((function(e,t){return e+1*t.uses}),0));return Object(c.a)("div",{className:"autosuggest-hashtag"},void 0,Object(c.a)("div",{className:"autosuggest-hashtag__name"},void 0,"#",Object(c.a)("strong",{},void 0,e.name)),void 0!==e.history&&Object(c.a)("div",{className:"autosuggest-hashtag__uses"},void 0,Object(c.a)(k.b,{id:"autosuggest_hashtag.per_week",defaultMessage:"{count} per week",values:{count:t}})))},o}(b.a.PureComponent),E=o(151),K=o(14),U=o.n(K);var W=function(e,t){var o,a=e.slice(0,t).search(/\S+$/),n=e.slice(t).search(/\s/);return!(o=n<0?e.slice(a):e.slice(a,n+t))||o.trim().length<3||-1===["@",":","#"].indexOf(o[0])?[null,null]:(o=o.trim().toLowerCase()).length>0?[a+1,o]:[null,null]},L=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"state",{suggestionsHidden:!0,focused:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(d.a)(Object(r.a)(t),"onChange",(function(e){var o=W(e.target.value,e.target.selectionStart),a=o[0],n=o[1];null!==n&&t.state.lastToken!==n?(t.setState({lastToken:n,selectedSuggestion:0,tokenStart:a}),t.props.onSuggestionsFetchRequested(n)):null===n&&(t.setState({lastToken:null}),t.props.onSuggestionsClearRequested()),t.props.onChange(e)})),Object(d.a)(Object(r.a)(t),"onKeyDown",(function(e){var o=t.props,a=o.suggestions,n=o.disabled,s=t.state,i=s.selectedSuggestion,c=s.suggestionsHidden;if(n)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===a.size||c?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),t.setState({suggestionsHidden:!0}));break;case"ArrowDown":a.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.min(i+1,a.size-1)}));break;case"ArrowUp":a.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.max(i-1,0)}));break;case"Enter":case"Tab":null!==t.state.lastToken&&a.size>0&&!c&&(e.preventDefault(),e.stopPropagation(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,a.get(i)))}!e.defaultPrevented&&t.props.onKeyDown&&t.props.onKeyDown(e)}})),Object(d.a)(Object(r.a)(t),"onBlur",(function(){t.setState({suggestionsHidden:!0,focused:!1})})),Object(d.a)(Object(r.a)(t),"onFocus",(function(e){t.setState({focused:!0}),t.props.onFocus&&t.props.onFocus(e)})),Object(d.a)(Object(r.a)(t),"onSuggestionClick",(function(e){var o=t.props.suggestions.get(e.currentTarget.getAttribute("data-index"));e.preventDefault(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,o),t.textarea.focus()})),Object(d.a)(Object(r.a)(t),"setTextarea",(function(e){t.textarea=e})),Object(d.a)(Object(r.a)(t),"onPaste",(function(e){e.clipboardData&&1===e.clipboardData.files.length&&(t.props.onPaste(e.clipboardData.files),e.preventDefault())})),Object(d.a)(Object(r.a)(t),"renderSuggestion",(function(e,o){var a,n,s=t.state.selectedSuggestion;return"emoji"===e.type?(a=Object(c.a)(F.a,{emoji:e}),n=e.id):"hashtag"===e.type?(a=Object(c.a)(A,{tag:e}),n=e.name):"account"===e.type&&(a=Object(c.a)(P,{id:e.id}),n=e.id),Object(c.a)("div",{role:"button",tabIndex:"0","data-index":o,className:U()("autosuggest-textarea__suggestions__item",{selected:o===s}),onMouseDown:t.onSuggestionClick},n,a)})),t}var a=o.prototype;return a.componentWillReceiveProps=function(e){e.suggestions!==this.props.suggestions&&e.suggestions.size>0&&this.state.suggestionsHidden&&this.state.focused&&this.setState({suggestionsHidden:!1})},a.render=function(){var e=this.props,t=e.value,o=e.suggestions,a=e.disabled,n=e.placeholder,s=e.onKeyUp,i=e.autoFocus,r=e.children,l=this.state.suggestionsHidden,u={direction:"ltr"};return Object(x.a)(t)&&(u.direction="rtl"),[Object(c.a)("div",{className:"compose-form__autosuggest-wrapper"},"autosuggest-wrapper",Object(c.a)("div",{className:"autosuggest-textarea"},void 0,Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,n),Object(c.a)(E.a,{inputRef:this.setTextarea,className:"autosuggest-textarea__textarea",disabled:a,placeholder:n,autoFocus:i,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:s,onFocus:this.onFocus,onBlur:this.onBlur,onPaste:this.onPaste,style:u,"aria-autocomplete":"list"}))),r),Object(c.a)("div",{className:"autosuggest-textarea__suggestions-wrapper"},"suggestions-wrapper",Object(c.a)("div",{className:"autosuggest-textarea__suggestions "+(l||o.isEmpty()?"":"autosuggest-textarea__suggestions--visible")},void 0,o.map(this.renderSuggestion)))]},o}(w.a);Object(d.a)(L,"propTypes",{value:j.a.string,suggestions:O.a.list,disabled:j.a.bool,placeholder:j.a.string,onSuggestionSelected:j.a.func.isRequired,onSuggestionsClearRequested:j.a.func.isRequired,onSuggestionsFetchRequested:j.a.func.isRequired,onChange:j.a.func.isRequired,onKeyUp:j.a.func,onKeyDown:j.a.func,onPaste:j.a.func.isRequired,autoFocus:j.a.bool}),Object(d.a)(L,"defaultProps",{autoFocus:!0});var H=o(4);var z,B=function(e,t,o){var a,n=e.slice(0,t).search(/\S+$/),s=e.slice(t).search(/\s/);return!(a=s<0?e.slice(n):e.slice(n,s+t))||a.trim().length<3||-1===o.indexOf(a[0])?[null,null]:(a=a.trim().toLowerCase()).length>0?[n+1,a]:[null,null]},G=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"state",{suggestionsHidden:!0,focused:!1,selectedSuggestion:0,lastToken:null,tokenStart:0}),Object(d.a)(Object(r.a)(t),"onChange",(function(e){var o=B(e.target.value,e.target.selectionStart,t.props.searchTokens),a=o[0],n=o[1];null!==n&&t.state.lastToken!==n?(t.setState({lastToken:n,selectedSuggestion:0,tokenStart:a}),t.props.onSuggestionsFetchRequested(n)):null===n&&(t.setState({lastToken:null}),t.props.onSuggestionsClearRequested()),t.props.onChange(e)})),Object(d.a)(Object(r.a)(t),"onKeyDown",(function(e){var o=t.props,a=o.suggestions,n=o.disabled,s=t.state,i=s.selectedSuggestion,c=s.suggestionsHidden;if(n)e.preventDefault();else if(229!==e.which&&!e.isComposing){switch(e.key){case"Escape":0===a.size||c?document.querySelector(".ui").parentElement.focus():(e.preventDefault(),t.setState({suggestionsHidden:!0}));break;case"ArrowDown":a.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.min(i+1,a.size-1)}));break;case"ArrowUp":a.size>0&&!c&&(e.preventDefault(),t.setState({selectedSuggestion:Math.max(i-1,0)}));break;case"Enter":case"Tab":null!==t.state.lastToken&&a.size>0&&!c&&(e.preventDefault(),e.stopPropagation(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,a.get(i)))}!e.defaultPrevented&&t.props.onKeyDown&&t.props.onKeyDown(e)}})),Object(d.a)(Object(r.a)(t),"onBlur",(function(){t.setState({suggestionsHidden:!0,focused:!1})})),Object(d.a)(Object(r.a)(t),"onFocus",(function(){t.setState({focused:!0})})),Object(d.a)(Object(r.a)(t),"onSuggestionClick",(function(e){var o=t.props.suggestions.get(e.currentTarget.getAttribute("data-index"));e.preventDefault(),t.props.onSuggestionSelected(t.state.tokenStart,t.state.lastToken,o),t.input.focus()})),Object(d.a)(Object(r.a)(t),"setInput",(function(e){t.input=e})),Object(d.a)(Object(r.a)(t),"renderSuggestion",(function(e,o){var a,n,s=t.state.selectedSuggestion;return"emoji"===e.type?(a=Object(c.a)(F.a,{emoji:e}),n=e.id):"hashtag"===e.type?(a=Object(c.a)(A,{tag:e}),n=e.name):"account"===e.type&&(a=Object(c.a)(P,{id:e.id}),n=e.id),Object(c.a)("div",{role:"button",tabIndex:"0","data-index":o,className:U()("autosuggest-textarea__suggestions__item",{selected:o===s}),onMouseDown:t.onSuggestionClick},n,a)})),t}var a=o.prototype;return a.componentWillReceiveProps=function(e){e.suggestions!==this.props.suggestions&&e.suggestions.size>0&&this.state.suggestionsHidden&&this.state.focused&&this.setState({suggestionsHidden:!1})},a.render=function(){var e=this.props,t=e.value,o=e.suggestions,a=e.disabled,n=e.placeholder,s=e.onKeyUp,i=e.autoFocus,r=e.className,l=e.id,u=e.maxLength,p=this.state.suggestionsHidden,d={direction:"ltr"};return Object(x.a)(t)&&(d.direction="rtl"),Object(c.a)("div",{className:"autosuggest-input"},void 0,Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,n),b.a.createElement("input",{type:"text",ref:this.setInput,disabled:a,placeholder:n,autoFocus:i,value:t,onChange:this.onChange,onKeyDown:this.onKeyDown,onKeyUp:s,onFocus:this.onFocus,onBlur:this.onBlur,style:d,"aria-autocomplete":"list",id:l,className:r,maxLength:u})),Object(c.a)("div",{className:"autosuggest-textarea__suggestions "+(p||o.isEmpty()?"":"autosuggest-textarea__suggestions--visible")},void 0,o.map(this.renderSuggestion)))},o}(w.a);Object(d.a)(G,"propTypes",{value:j.a.string,suggestions:O.a.list,disabled:j.a.bool,placeholder:j.a.string,onSuggestionSelected:j.a.func.isRequired,onSuggestionsClearRequested:j.a.func.isRequired,onSuggestionsFetchRequested:j.a.func.isRequired,onChange:j.a.func.isRequired,onKeyUp:j.a.func,onKeyDown:j.a.func,autoFocus:j.a.bool,className:j.a.string,id:j.a.string,searchTokens:j.a.arrayOf(j.a.string),maxLength:j.a.number}),Object(d.a)(G,"defaultProps",{autoFocus:!0,searchTokens:Object(H.List)(["@",":","#"])});var V,Y,X,J=Object(k.f)({add_poll:{id:"poll_button.add_poll",defaultMessage:"Add a poll"},remove_poll:{id:"poll_button.remove_poll",defaultMessage:"Remove poll"}}),Z={height:null,lineHeight:"27px"},$=Object(k.g)(z=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleClick",(function(){t.props.onClick()})),t}return o.prototype.render=function(){var e=this.props,t=e.intl,o=e.active,a=e.unavailable,n=e.disabled;return a?null:Object(c.a)("div",{className:"compose-form__poll-button"},void 0,Object(c.a)(S.a,{icon:"tasks",title:t.formatMessage(o?J.remove_poll:J.add_poll),disabled:n,onClick:this.handleClick,className:"compose-form__poll-button-icon "+(o?"active":""),size:18,inverted:!0,style:Z}))},o}(b.a.PureComponent))||z,Q=Object(i.connect)((function(e){return{unavailable:e.getIn(["compose","is_uploading"])||e.getIn(["compose","media_attachments"]).size>0,active:null!==e.getIn(["compose","poll"])}}),(function(e){return{onClick:function(){e((function(t,o){o().getIn(["compose","poll"])?e(Object(y.eb)()):e(Object(y.K)())}))}}}))($);var ee=Object(k.f)({upload:{id:"upload_button.label",defaultMessage:"Add media ({formats})"}}),te={height:null,lineHeight:"27px"},oe=Object(i.connect)((function(){return function(e){return{acceptContentTypes:e.getIn(["media_attachments","accept_content_types"])}}}))(V=Object(k.g)((X=Y=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleChange",(function(e){e.target.files.length>0&&t.props.onSelectFile(e.target.files)})),Object(d.a)(Object(r.a)(t),"handleClick",(function(){t.fileElement.click()})),Object(d.a)(Object(r.a)(t),"setRef",(function(e){t.fileElement=e})),t}return o.prototype.render=function(){var e=this.props,t=e.intl,o=e.resetFileKey,a=e.unavailable,n=e.disabled;e.acceptContentTypes;return a?null:Object(c.a)("div",{className:"compose-form__upload-button"},void 0,Object(c.a)(S.a,{icon:"paperclip",title:t.formatMessage(ee.upload,{formats:"JPEG, PNG, GIF, WebM, MP4, MOV, OGG, WAV, MP3, FLAC"}),disabled:n,onClick:this.handleClick,className:"compose-form__upload-button-icon",size:18,inverted:!0,style:te}),Object(c.a)("label",{},void 0,Object(c.a)("span",{style:{display:"none"}},void 0,t.formatMessage(ee.upload,{formats:"JPEG, PNG, GIF, WebM, MP4, MOV, OGG, WAV, MP3, FLAC"})),b.a.createElement("input",{key:o,ref:this.setRef,type:"file",multiple:!0,onChange:this.handleChange,disabled:n,style:{display:"none"}})))},o}(w.a),Object(d.a)(Y,"propTypes",{disabled:j.a.bool,unavailable:j.a.bool,onSelectFile:j.a.func.isRequired,style:j.a.object,resetFileKey:j.a.number,acceptContentTypes:O.a.listOf(j.a.string).isRequired,intl:j.a.object.isRequired}),V=X))||V)||V,ae=Object(i.connect)((function(e){return{disabled:e.getIn(["compose","is_uploading"])||e.getIn(["compose","media_attachments"]).size+e.getIn(["compose","pending_media_attachments"])>3||e.getIn(["compose","media_attachments"]).some((function(e){return["video","audio"].includes(e.get("type"))})),unavailable:null!==e.getIn(["compose","poll"]),resetFileKey:e.getIn(["compose","resetFileKey"])}}),(function(e){return{onSelectFile:function(t){e(Object(y.mb)(t))}}}))(oe);var ne,se={height:null,lineHeight:"27px",width:"23.14285722px"},ie=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleClick",(function(e){e.preventDefault(),t.props.onClick()})),t}return o.prototype.render=function(){var e=this.props,t=e.label,o=e.title,a=e.active,n=e.ariaControls;return(Object(c.a)("button",{title:o,"aria-label":o,className:"text-icon-button "+(a?"active":""),"aria-expanded":a,onClick:this.handleClick,"aria-controls":n,style:se},void 0,t))},o}(b.a.PureComponent),ce=Object(k.f)({marked:{id:"compose_form.spoiler.marked",defaultMessage:"Text is hidden behind warning"},unmarked:{id:"compose_form.spoiler.unmarked",defaultMessage:"Text is not hidden"}}),re=Object(k.g)(Object(i.connect)((function(e,t){return{label:"CW",title:t.intl.formatMessage(e.getIn(["compose","spoiler"])?ce.marked:ce.unmarked),active:e.getIn(["compose","spoiler"]),ariaControls:"cw-spoiler-input"}}),(function(e){return{onClick:function(){e(Object(y.Q)())}}}))(ie)),le=o(10),ue=o(119),pe=o.n(ue),de=o(101),ge=o(35),be=o.n(ge),fe=o(66),me=o.n(fe),he=o(27);function Oe(e){return function(){var t,o=Object(u.a)(e);if(ve()){var a=Object(u.a)(this).constructor;t=Reflect.construct(o,arguments,a)}else t=o.apply(this,arguments);return Object(l.a)(this,t)}}function ve(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var je,ye,_e,Ce,Se=Object(k.f)({public_short:{id:"privacy.public.short",defaultMessage:"Public"},public_long:{id:"privacy.public.long",defaultMessage:"Visible for all, shown in public timelines"},unlisted_short:{id:"privacy.unlisted.short",defaultMessage:"Unlisted"},unlisted_long:{id:"privacy.unlisted.long",defaultMessage:"Visible for all, but not in public timelines"},private_short:{id:"privacy.private.short",defaultMessage:"Followers-only"},private_long:{id:"privacy.private.long",defaultMessage:"Visible for followers only"},direct_short:{id:"privacy.direct.short",defaultMessage:"Direct"},direct_long:{id:"privacy.direct.long",defaultMessage:"Visible for mentioned users only"},change_privacy:{id:"privacy.change",defaultMessage:"Adjust status privacy"}}),Me=!!me.a.hasSupport&&{passive:!0},ke=function(e){Object(p.a)(t,e);Oe(t);function t(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"state",{mounted:!1}),Object(d.a)(Object(r.a)(t),"handleDocumentClick",(function(e){t.node&&!t.node.contains(e.target)&&t.props.onClose()})),Object(d.a)(Object(r.a)(t),"handleKeyDown",(function(e){var o,a=t.props.items,n=e.currentTarget.getAttribute("data-index"),s=a.findIndex((function(e){return e.value===n}));switch(e.key){case"Escape":t.props.onClose();break;case"Enter":t.handleClick(e);break;case"ArrowDown":(o=t.node.childNodes[s+1])&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"ArrowUp":(o=t.node.childNodes[s-1])&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"Tab":(o=e.shiftKey?t.node.childNodes[s-1]||t.node.lastChild:t.node.childNodes[s+1]||t.node.firstChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")),e.preventDefault(),e.stopPropagation());break;case"Home":(o=t.node.firstChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")));break;case"End":(o=t.node.lastChild)&&(o.focus(),t.props.onChange(o.getAttribute("data-index")))}})),Object(d.a)(Object(r.a)(t),"handleClick",(function(e){var o=e.currentTarget.getAttribute("data-index");e.preventDefault(),t.props.onClose(),t.props.onChange(o)})),Object(d.a)(Object(r.a)(t),"setRef",(function(e){t.node=e})),Object(d.a)(Object(r.a)(t),"setFocusRef",(function(e){t.focusedItem=e})),t}var o=t.prototype;return o.componentDidMount=function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,Me),this.focusedItem&&this.focusedItem.focus(),this.setState({mounted:!0})},o.componentWillUnmount=function(){document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,Me)},o.render=function(){var e=this,t=this.state.mounted,o=this.props,a=o.style,n=o.items,s=o.placement,i=o.value;return Object(c.a)(de.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:be()(1,{damping:35,stiffness:400}),scaleX:be()(1,{damping:35,stiffness:400}),scaleY:be()(1,{damping:35,stiffness:400})}},void 0,(function(o){var r=o.opacity,l=o.scaleX,u=o.scaleY;return(b.a.createElement("div",{className:"privacy-dropdown__dropdown "+s,style:Object(le.default)({},a,{opacity:r,transform:t?"scale("+l+", "+u+")":null,zIndex:2}),role:"listbox",ref:e.setRef},n.map((function(t){return b.a.createElement("div",{role:"option",tabIndex:"0",key:t.value,"data-index":t.value,onKeyDown:e.handleKeyDown,onClick:e.handleClick,className:U()("privacy-dropdown__option",{active:t.value===i}),"aria-selected":t.value===i,ref:t.value===i?e.setFocusRef:null},Object(c.a)("div",{className:"privacy-dropdown__option__icon"},void 0,Object(c.a)(he.a,{id:t.icon,fixedWidth:!0})),Object(c.a)("div",{className:"privacy-dropdown__option__content"},void 0,Object(c.a)("strong",{},void 0,t.text),t.meta))}))))}))},t}(b.a.PureComponent),we=Object(k.g)(ne=function(e){Object(p.a)(t,e);Oe(t);function t(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"state",{open:!1,placement:"bottom"}),Object(d.a)(Object(r.a)(t),"handleToggle",(function(e){var o=e.target;if(t.props.isUserTouching())t.state.open?t.props.onModalClose():t.props.onModalOpen({actions:t.options.map((function(e){return Object(le.default)({},e,{active:e.value===t.props.value})})),onClick:t.handleModalActionClick});else{var a=o.getBoundingClientRect().top;t.state.open&&t.activeElement&&t.activeElement.focus(),t.setState({placement:2*a<innerHeight?"bottom":"top"}),t.setState({open:!t.state.open})}})),Object(d.a)(Object(r.a)(t),"handleModalActionClick",(function(e){e.preventDefault();var o=t.options[e.currentTarget.getAttribute("data-index")].value;t.props.onModalClose(),t.props.onChange(o)})),Object(d.a)(Object(r.a)(t),"handleKeyDown",(function(e){switch(e.key){case"Escape":t.handleClose()}})),Object(d.a)(Object(r.a)(t),"handleMouseDown",(function(){t.state.open||(t.activeElement=document.activeElement)})),Object(d.a)(Object(r.a)(t),"handleButtonKeyDown",(function(e){switch(e.key){case" ":case"Enter":t.handleMouseDown()}})),Object(d.a)(Object(r.a)(t),"handleClose",(function(){t.state.open&&t.activeElement&&t.activeElement.focus(),t.setState({open:!1})})),Object(d.a)(Object(r.a)(t),"handleChange",(function(e){t.props.onChange(e)})),t}var o=t.prototype;return o.componentWillMount=function(){var e=this.props.intl.formatMessage;this.options=[{icon:"globe",value:"public",text:e(Se.public_short),meta:e(Se.public_long)},{icon:"unlock",value:"unlisted",text:e(Se.unlisted_short),meta:e(Se.unlisted_long)},{icon:"lock",value:"private",text:e(Se.private_short),meta:e(Se.private_long)},{icon:"envelope",value:"direct",text:e(Se.direct_short),meta:e(Se.direct_long)}]},o.render=function(){var e=this.props,t=e.value,o=e.intl,a=this.state,n=a.open,s=a.placement,i=this.options.find((function(e){return e.value===t}));return Object(c.a)("div",{className:U()("privacy-dropdown",s,{active:n}),onKeyDown:this.handleKeyDown},void 0,Object(c.a)("div",{className:U()("privacy-dropdown__value",{active:this.options.indexOf(i)===("bottom"===s?0:this.options.length-1)})},void 0,Object(c.a)(S.a,{className:"privacy-dropdown__value-icon",icon:i.icon,title:o.formatMessage(Se.change_privacy),size:18,expanded:n,active:n,inverted:!0,onClick:this.handleToggle,onMouseDown:this.handleMouseDown,onKeyDown:this.handleButtonKeyDown,style:{height:null,lineHeight:"27px"}})),Object(c.a)(pe.a,{show:n,placement:s,target:this},void 0,Object(c.a)(ke,{items:this.options,value:t,onClose:this.handleClose,onChange:this.handleChange,placement:s})))},t}(b.a.PureComponent))||ne,xe=o(48),Te=o(120),Re=Object(i.connect)((function(e){return{isModalOpen:"ACTIONS"===e.get("modal").modalType,value:e.getIn(["compose","privacy"])}}),(function(e){return{onChange:function(t){e(Object(y.R)(t))},isUserTouching:Te.c,onModalOpen:function(t){return e(Object(xe.d)("ACTIONS",t))},onModalClose:function(){return e(Object(xe.c)())}}}))(we),Ne=o(546),De=o(32);function Ie(e){return function(){var t,o=Object(u.a)(e);if(Pe()){var a=Object(u.a)(this).constructor;t=Reflect.construct(o,arguments,a)}else t=o.apply(this,arguments);return Object(l.a)(this,t)}}function Pe(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Fe=Object(k.f)({option_placeholder:{id:"compose_form.poll.option_placeholder",defaultMessage:"Choice {number}"},add_option:{id:"compose_form.poll.add_option",defaultMessage:"Add a choice"},remove_option:{id:"compose_form.poll.remove_option",defaultMessage:"Remove this choice"},poll_duration:{id:"compose_form.poll.duration",defaultMessage:"Poll duration"},switchToMultiple:{id:"compose_form.poll.switch_to_multiple",defaultMessage:"Change poll to allow multiple choices"},switchToSingle:{id:"compose_form.poll.switch_to_single",defaultMessage:"Change poll to allow for a single choice"},minutes:{id:"intervals.full.minutes",defaultMessage:"{number, plural, one {# minute} other {# minutes}}"},hours:{id:"intervals.full.hours",defaultMessage:"{number, plural, one {# hour} other {# hours}}"},days:{id:"intervals.full.days",defaultMessage:"{number, plural, one {# day} other {# days}}"}}),qe=Object(k.g)(je=function(e){Object(p.a)(t,e);Ie(t);function t(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleOptionTitleChange",(function(e){t.props.onChange(t.props.index,e.target.value)})),Object(d.a)(Object(r.a)(t),"handleOptionRemove",(function(){t.props.onRemove(t.props.index)})),Object(d.a)(Object(r.a)(t),"handleToggleMultiple",(function(e){t.props.onToggleMultiple(),e.preventDefault(),e.stopPropagation()})),Object(d.a)(Object(r.a)(t),"handleCheckboxKeypress",(function(e){"Enter"!==e.key&&" "!==e.key||t.handleToggleMultiple(e)})),Object(d.a)(Object(r.a)(t),"onSuggestionsClearRequested",(function(){t.props.onClearSuggestions()})),Object(d.a)(Object(r.a)(t),"onSuggestionsFetchRequested",(function(e){t.props.onFetchSuggestions(e)})),Object(d.a)(Object(r.a)(t),"onSuggestionSelected",(function(e,o,a){t.props.onSuggestionSelected(e,o,a,["poll","options",t.props.index])})),t}return t.prototype.render=function(){var e=this.props,t=e.isPollMultiple,o=e.title,a=e.index,n=e.intl;return(Object(c.a)("li",{},void 0,Object(c.a)("label",{className:"poll__option editable"},void 0,Object(c.a)("span",{className:U()("poll__input",{checkbox:t}),onClick:this.handleToggleMultiple,onKeyPress:this.handleCheckboxKeypress,role:"button",tabIndex:"0",title:n.formatMessage(t?Fe.switchToSingle:Fe.switchToMultiple),"aria-label":n.formatMessage(t?Fe.switchToSingle:Fe.switchToMultiple)}),Object(c.a)(G,{placeholder:n.formatMessage(Fe.option_placeholder,{number:a+1}),maxLength:100,value:o,onChange:this.handleOptionTitleChange,suggestions:this.props.suggestions,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSuggestionSelected,searchTokens:[":"]})),Object(c.a)("div",{className:"poll__cancel"},void 0,Object(c.a)(S.a,{disabled:a<=1,title:n.formatMessage(Fe.remove_option),icon:"times",onClick:this.handleOptionRemove}))))},t}(b.a.PureComponent))||je,Ae=Object(k.g)((Ce=_e=function(e){Object(p.a)(t,e);Ie(t);function t(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleAddOption",(function(){t.props.onAddOption("")})),Object(d.a)(Object(r.a)(t),"handleSelectDuration",(function(e){t.props.onChangeSettings(e.target.value,t.props.isMultiple)})),Object(d.a)(Object(r.a)(t),"handleToggleMultiple",(function(){t.props.onChangeSettings(t.props.expiresIn,!t.props.isMultiple)})),t}return t.prototype.render=function(){var e=this,t=this.props,o=t.options,a=t.expiresIn,n=t.isMultiple,s=t.onChangeOption,i=t.onRemoveOption,r=t.intl,l=Object(De.default)(t,["options","expiresIn","isMultiple","onChangeOption","onRemoveOption","intl"]);return o?Object(c.a)("div",{className:"compose-form__poll-wrapper"},void 0,Object(c.a)("ul",{},void 0,o.map((function(t,o){return b.a.createElement(qe,Object(le.default)({title:t,key:o,index:o,onChange:s,onRemove:i,isPollMultiple:n,onToggleMultiple:e.handleToggleMultiple},l))}))),Object(c.a)("div",{className:"poll__footer"},void 0,Object(c.a)("button",{disabled:o.size>=5,className:"button button-secondary",onClick:this.handleAddOption},void 0,Object(c.a)(he.a,{id:"plus"})," ",b.a.createElement(k.b,Fe.add_option)),Object(c.a)("select",{value:a,onChange:this.handleSelectDuration},void 0,Object(c.a)("option",{value:300},void 0,r.formatMessage(Fe.minutes,{number:5})),Object(c.a)("option",{value:1800},void 0,r.formatMessage(Fe.minutes,{number:30})),Object(c.a)("option",{value:3600},void 0,r.formatMessage(Fe.hours,{number:1})),Object(c.a)("option",{value:21600},void 0,r.formatMessage(Fe.hours,{number:6})),Object(c.a)("option",{value:86400},void 0,r.formatMessage(Fe.days,{number:1})),Object(c.a)("option",{value:259200},void 0,r.formatMessage(Fe.days,{number:3})),Object(c.a)("option",{value:604800},void 0,r.formatMessage(Fe.days,{number:7}))))):null},t}(w.a),Object(d.a)(_e,"propTypes",{options:O.a.list,expiresIn:j.a.number,isMultiple:j.a.bool,onChangeOption:j.a.func.isRequired,onAddOption:j.a.func.isRequired,onRemoveOption:j.a.func.isRequired,onChangeSettings:j.a.func.isRequired,suggestions:O.a.list,onClearSuggestions:j.a.func.isRequired,onFetchSuggestions:j.a.func.isRequired,onSuggestionSelected:j.a.func.isRequired,intl:j.a.object.isRequired}),ye=Ce))||ye,Ee=Object(i.connect)((function(e){return{suggestions:e.getIn(["compose","suggestions"]),options:e.getIn(["compose","poll","options"]),expiresIn:e.getIn(["compose","poll","expires_in"]),isMultiple:e.getIn(["compose","poll","multiple"])}}),(function(e){return{onAddOption:function(t){e(Object(y.L)(t))},onRemoveOption:function(t){e(Object(y.fb)(t))},onChangeOption:function(t,o){e(Object(y.T)(t,o))},onChangeSettings:function(t,o){e(Object(y.U)(t,o))},onClearSuggestions:function(){e(Object(y.W)())},onFetchSuggestions:function(t){e(Object(y.Z)(t))},onSuggestionSelected:function(t,o,a,n){e(Object(y.ib)(t,o,a,n))}}}))(Ae),Ke=o(319),Ue=Object(i.connect)((function(e){return{active:e.getIn(["compose","is_uploading"]),progress:e.getIn(["compose","progress"])}}))(Ke.a);var We=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleUndoClick",(function(e){e.stopPropagation(),t.props.onUndo(t.props.media.get("id"))})),Object(d.a)(Object(r.a)(t),"handleFocalPointClick",(function(e){e.stopPropagation(),t.props.onOpenFocalPoint(t.props.media.get("id"))})),t}return o.prototype.render=function(){var e=this,t=this.props.media,o=t.getIn(["meta","focus","x"]),a=t.getIn(["meta","focus","y"]),n=100*(o/2+.5),s=100*(a/-2+.5);return Object(c.a)("div",{className:"compose-form__upload",tabIndex:"0",role:"button"},void 0,Object(c.a)(de.a,{defaultStyle:{scale:.8},style:{scale:be()(1,{stiffness:180,damping:12})}},void 0,(function(o){var a=o.scale;return(Object(c.a)("div",{className:"compose-form__upload-thumbnail",style:{transform:"scale("+a+")",backgroundImage:"url("+t.get("preview_url")+")",backgroundPosition:n+"% "+s+"%"}},void 0,Object(c.a)("div",{className:U()("compose-form__upload__actions",{active:!0})},void 0,Object(c.a)("button",{className:"icon-button",onClick:e.handleUndoClick},void 0,Object(c.a)(he.a,{id:"times"})," ",Object(c.a)(k.b,{id:"upload_form.undo",defaultMessage:"Delete"})),Object(c.a)("button",{className:"icon-button",onClick:e.handleFocalPointClick},void 0,Object(c.a)(he.a,{id:"pencil"})," ",Object(c.a)(k.b,{id:"upload_form.edit",defaultMessage:"Edit"})))))})))},o}(w.a);Object(d.a)(We,"contextTypes",{router:j.a.object}),Object(d.a)(We,"propTypes",{media:O.a.map.isRequired,onUndo:j.a.func.isRequired,onOpenFocalPoint:j.a.func.isRequired});var Le=Object(i.connect)((function(e,t){var o=t.id;return{media:e.getIn(["compose","media_attachments"]).find((function(e){return e.get("id")===o}))}}),(function(e){return{onUndo:function(t){e(Object(y.kb)(t))},onOpenFocalPoint:function(t){e(Object(xe.d)("FOCAL_POINT",{id:t}))},onSubmit:function(t){e(Object(y.jb)(t))}}}))(We);var He=Object(k.f)({marked:{id:"compose_form.sensitive.marked",defaultMessage:"Media is marked as sensitive"},unmarked:{id:"compose_form.sensitive.unmarked",defaultMessage:"Media is not marked as sensitive"}}),ze=function(e){Object(p.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e=this.props,t=e.active,o=e.disabled,a=e.onClick,n=e.intl;return(Object(c.a)("div",{className:"compose-form__sensitive-button"},void 0,Object(c.a)("label",{className:U()("icon-button",{active:t}),title:n.formatMessage(t?He.marked:He.unmarked)},void 0,Object(c.a)("input",{name:"mark-sensitive",type:"checkbox",checked:t,onChange:a,disabled:o}),Object(c.a)("span",{className:U()("checkbox",{active:t})}),Object(c.a)(k.b,{id:"compose_form.sensitive.hide",defaultMessage:"Mark media as sensitive"}))))},o}(b.a.PureComponent),Be=Object(i.connect)((function(e){return{active:e.getIn(["compose","sensitive"]),disabled:e.getIn(["compose","spoiler"])}}),(function(e){return{onClick:function(){e(Object(y.O)())}}}))(Object(k.g)(ze));var Ge=function(e){Object(p.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e=this.props.mediaIds;return(Object(c.a)("div",{className:"compose-form__upload-wrapper"},void 0,Object(c.a)(Ue,{icon:"upload",message:Object(c.a)(k.b,{id:"upload_progress.label",defaultMessage:"Uploading…"})}),Object(c.a)("div",{className:"compose-form__uploads-wrapper"},void 0,e.map((function(e){return Object(c.a)(Le,{id:e},e)}))),!e.isEmpty()&&Object(c.a)(Be,{})))},o}(w.a);Object(d.a)(Ge,"propTypes",{mediaIds:O.a.list.isRequired});var Ve=Object(i.connect)((function(e){return{mediaIds:e.getIn(["compose","media_attachments"]).map((function(e){return e.get("id")}))}}))(Ge);var Ye,Xe,Je,Ze=function(e){Object(p.a)(o,e);var t;t=o;function o(){return e.apply(this,arguments)||this}return o.prototype.render=function(){var e=this.props.message;return(Object(c.a)(de.a,{defaultStyle:{opacity:0,scaleX:.85,scaleY:.75},style:{opacity:be()(1,{damping:35,stiffness:400}),scaleX:be()(1,{damping:35,stiffness:400}),scaleY:be()(1,{damping:35,stiffness:400})}},void 0,(function(t){var o=t.opacity,a=t.scaleX,n=t.scaleY;return(Object(c.a)("div",{className:"compose-form__warning",style:{opacity:o,transform:"scale("+a+", "+n+")"}},void 0,e))})))},o}(b.a.PureComponent),$e=o(22),Qe=/(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i,et=Object(i.connect)((function(e){return{needsLockWarning:"private"===e.getIn(["compose","privacy"])&&!e.getIn(["accounts",$e.n,"locked"]),hashtagWarning:"public"!==e.getIn(["compose","privacy"])&&Qe.test(e.getIn(["compose","text"])),directMessageWarning:"direct"===e.getIn(["compose","privacy"])}}))((function(e){var t=e.needsLockWarning,o=e.hashtagWarning,a=e.directMessageWarning;if(t)return Object(c.a)(Ze,{message:Object(c.a)(k.b,{id:"compose_form.lock_disclaimer",defaultMessage:"Your account is not {locked}. Anyone can follow you to view your follower-only posts.",values:{locked:Object(c.a)("a",{href:"/user-settings"},void 0,Object(c.a)(k.b,{id:"compose_form.lock_disclaimer.lock",defaultMessage:"locked"}))}})});if(o)return Object(c.a)(Ze,{message:Object(c.a)(k.b,{id:"compose_form.hashtag_warning",defaultMessage:"This toot won't be listed under any hashtag as it is unlisted. Only public toots can be searched by hashtag."})});if(a){var n=Object(c.a)("span",{},void 0,Object(c.a)(k.b,{id:"compose_form.direct_message_warning",defaultMessage:"This toot will only be sent to all the mentioned users."})," ",Object(c.a)("a",{href:"/terms",target:"_blank"},void 0,Object(c.a)(k.b,{id:"compose_form.direct_message_warning_learn_more",defaultMessage:"Learn more"})));return(Object(c.a)(Ze,{message:n}))}return null})),tt=o(79);var ot="><…    \u2028\u2029\t\n\v\f\r",at=Object(k.f)({placeholder:{id:"compose_form.placeholder",defaultMessage:"What is on your mind?"},spoiler_placeholder:{id:"compose_form.spoiler_placeholder",defaultMessage:"Write your warning here"},publish:{id:"compose_form.publish",defaultMessage:"Toot"},publishLoud:{id:"compose_form.publish_loud",defaultMessage:"{publish}!"}}),nt=Object(k.g)((Je=Xe=function(e){Object(p.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(d.a)(Object(r.a)(t),"handleChange",(function(e){t.props.onChange(e.target.value)})),Object(d.a)(Object(r.a)(t),"handleKeyDown",(function(e){13===e.keyCode&&(e.ctrlKey||e.metaKey)&&t.handleSubmit()})),Object(d.a)(Object(r.a)(t),"handleSubmit",(function(){t.props.text!==t.autosuggestTextarea.textarea.value&&t.props.onChange(t.autosuggestTextarea.textarea.value);var e=t.props,o=e.isSubmitting,a=e.isChangingUpload,n=e.isUploading,s=e.anyMedia,i=[t.props.spoilerText,t.props.text].join("");o||n||a||Object(tt.length)(i)>$e.m||0!==i.length&&0===i.trim().length&&!s||t.props.onSubmit(t.context.router?t.context.router.history:null)})),Object(d.a)(Object(r.a)(t),"onSuggestionsClearRequested",(function(){t.props.onClearSuggestions()})),Object(d.a)(Object(r.a)(t),"onSuggestionsFetchRequested",(function(e){t.props.onFetchSuggestions(e)})),Object(d.a)(Object(r.a)(t),"onSuggestionSelected",(function(e,o,a){t.props.onSuggestionSelected(e,o,a,["text"])})),Object(d.a)(Object(r.a)(t),"onSpoilerSuggestionSelected",(function(e,o,a){t.props.onSuggestionSelected(e,o,a,["spoiler_text"])})),Object(d.a)(Object(r.a)(t),"handleChangeSpoilerText",(function(e){t.props.onChangeSpoilerText(e.target.value)})),Object(d.a)(Object(r.a)(t),"handleFocus",(function(){if(t.composeForm&&!t.props.singleColumn){var e=t.composeForm.getBoundingClientRect(),o=e.left,a=e.right;(o<0||a>(window.innerWidth||document.documentElement.clientWidth))&&t.composeForm.scrollIntoView()}})),Object(d.a)(Object(r.a)(t),"setAutosuggestTextarea",(function(e){t.autosuggestTextarea=e})),Object(d.a)(Object(r.a)(t),"setSpoilerText",(function(e){t.spoilerText=e})),Object(d.a)(Object(r.a)(t),"setRef",(function(e){t.composeForm=e})),Object(d.a)(Object(r.a)(t),"handleEmojiPick",(function(e){var o=t.props.text,a=t.autosuggestTextarea.textarea.selectionStart,n=e.custom&&a>0&&!ot.includes(o[a-1]);t.props.onPickEmoji(a,e,n)})),t}var a=o.prototype;return a.componentDidUpdate=function(e){var t,o;this.props.focusDate!==e.focusDate?(this.props.preselectDate!==e.preselectDate?(t=this.props.text.length,o=this.props.text.search(/\s/)+1):"number"==typeof this.props.caretPosition?(o=this.props.caretPosition,t=this.props.caretPosition):o=t=this.props.text.length,this.autosuggestTextarea.textarea.setSelectionRange(o,t),this.autosuggestTextarea.textarea.focus()):e.isSubmitting&&!this.props.isSubmitting?this.autosuggestTextarea.textarea.focus():this.props.spoiler!==e.spoiler&&(this.props.spoiler?this.spoilerText.input.focus():this.autosuggestTextarea.textarea.focus())},a.render=function(){var e=this.props,t=e.intl,o=e.onPaste,a=e.showSearch,n=e.anyMedia,s=this.props.isSubmitting,i=[this.props.spoilerText,this.props.text].join(""),r=s||this.props.isUploading||this.props.isChangingUpload||Object(tt.length)(i)>$e.m||0!==i.length&&0===i.trim().length&&!n,l="";return l="private"===this.props.privacy||"direct"===this.props.privacy?Object(c.a)("span",{className:"compose-form__publish-private"},void 0,Object(c.a)(he.a,{id:"lock"})," ",t.formatMessage(at.publish)):"unlisted"!==this.props.privacy?t.formatMessage(at.publishLoud,{publish:t.formatMessage(at.publish)}):t.formatMessage(at.publish),Object(c.a)("div",{className:"compose-form"},void 0,Object(c.a)(et,{}),Object(c.a)(D,{}),b.a.createElement("div",{className:"spoiler-input "+(this.props.spoiler?"spoiler-input--visible":""),ref:this.setRef},b.a.createElement(G,{placeholder:t.formatMessage(at.spoiler_placeholder),value:this.props.spoilerText,onChange:this.handleChangeSpoilerText,onKeyDown:this.handleKeyDown,disabled:!this.props.spoiler,ref:this.setSpoilerText,suggestions:this.props.suggestions,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSpoilerSuggestionSelected,searchTokens:[":"],id:"cw-spoiler-input",className:"spoiler-input__input"})),b.a.createElement(L,{ref:this.setAutosuggestTextarea,placeholder:t.formatMessage(at.placeholder),disabled:s,value:this.props.text,onChange:this.handleChange,suggestions:this.props.suggestions,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,onSuggestionSelected:this.onSuggestionSelected,onPaste:o,autoFocus:!a&&!Object(Te.b)(window.innerWidth)},Object(c.a)(Ne.a,{onPickEmoji:this.handleEmojiPick}),Object(c.a)("div",{className:"compose-form__modifiers"},void 0,Object(c.a)(Ve,{}),Object(c.a)(Ee,{}))),Object(c.a)("div",{className:"compose-form__buttons-wrapper"},void 0,Object(c.a)("div",{className:"compose-form__buttons"},void 0,Object(c.a)(ae,{}),Object(c.a)(Q,{}),Object(c.a)(Re,{}),Object(c.a)(re,{})),Object(c.a)("div",{className:"character-counter__wrapper"},void 0,Object(c.a)(f.a,{max:$e.m,text:i}))),Object(c.a)("div",{className:"compose-form__publish"},void 0,Object(c.a)("div",{className:"compose-form__publish-button-wrapper"},void 0,Object(c.a)(m.a,{text:l,onClick:this.handleSubmit,disabled:r,block:!0}))))},o}(w.a),Object(d.a)(Xe,"contextTypes",{router:j.a.object}),Object(d.a)(Xe,"propTypes",{intl:j.a.object.isRequired,text:j.a.string.isRequired,suggestions:O.a.list,spoiler:j.a.bool,privacy:j.a.string,spoilerText:j.a.string,focusDate:j.a.instanceOf(Date),caretPosition:j.a.number,preselectDate:j.a.instanceOf(Date),isSubmitting:j.a.bool,isChangingUpload:j.a.bool,isUploading:j.a.bool,onChange:j.a.func.isRequired,onSubmit:j.a.func.isRequired,onClearSuggestions:j.a.func.isRequired,onFetchSuggestions:j.a.func.isRequired,onSuggestionSelected:j.a.func.isRequired,onChangeSpoilerText:j.a.func.isRequired,onPaste:j.a.func.isRequired,onPickEmoji:j.a.func.isRequired,showSearch:j.a.bool,anyMedia:j.a.bool,singleColumn:j.a.bool}),Object(d.a)(Xe,"defaultProps",{showSearch:!1}),Ye=Je))||Ye;t.a=Object(i.connect)((function(e){return{text:e.getIn(["compose","text"]),suggestions:e.getIn(["compose","suggestions"]),spoiler:e.getIn(["compose","spoiler"]),spoilerText:e.getIn(["compose","spoiler_text"]),privacy:e.getIn(["compose","privacy"]),focusDate:e.getIn(["compose","focusDate"]),caretPosition:e.getIn(["compose","caretPosition"]),preselectDate:e.getIn(["compose","preselectDate"]),isSubmitting:e.getIn(["compose","is_submitting"]),isChangingUpload:e.getIn(["compose","is_changing_upload"]),isUploading:e.getIn(["compose","is_uploading"]),showSearch:e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]),anyMedia:e.getIn(["compose","media_attachments"]).size>0}}),(function(e){return{onChange:function(t){e(Object(y.N)(t))},onSubmit:function(t){e(Object(y.jb)(t))},onClearSuggestions:function(){e(Object(y.W)())},onFetchSuggestions:function(t){e(Object(y.Z)(t))},onSuggestionSelected:function(t,o,a,n){e(Object(y.ib)(t,o,a,n))},onChangeSpoilerText:function(t){e(Object(y.P)(t))},onPaste:function(t){e(Object(y.mb)(t))},onPickEmoji:function(t,o,a){e(Object(y.bb)(t,o,a))}}}))(nt)},787:function(e,t,o){"use strict";var a=o(15),n=o(7),s=o(782),i=o(724),c=o(48),r=o(22),l=Object(n.f)({logoutMessage:{id:"confirmations.logout.message",defaultMessage:"Are you sure you want to log out?"},logoutConfirm:{id:"confirmations.logout.confirm",defaultMessage:"Log out"}});t.a=Object(n.g)(Object(a.connect)((function(e){return{account:e.getIn(["accounts",r.n])}}),(function(e,t){var o=t.intl;return{onLogout:function(){e(Object(c.d)("CONFIRM",{message:o.formatMessage(l.logoutMessage),confirm:o.formatMessage(l.logoutConfirm),onConfirm:function(){return Object(i.a)()}}))}}}))(s.a))},813:function(e,t,o){"use strict";o.r(t),o.d(t,"default",(function(){return k}));var a,n=o(0),s=o(2),i=(o(9),o(6),o(8)),c=o(1),r=o(3),l=o.n(r),u=o(588),p=o(787),d=o(15),g=o(23),b=o(322),f=o(7),m=o(781),h=o(101),O=o(35),v=o.n(O),j=o(1178),y=o(48),_=o(22),C=o(27),S=o(724);var M=Object(f.f)({start:{id:"getting_started.heading",defaultMessage:"Getting started"},home_timeline:{id:"tabs_bar.home",defaultMessage:"Home"},notifications:{id:"tabs_bar.notifications",defaultMessage:"Notifications"},public:{id:"navigation_bar.public_timeline",defaultMessage:"Federated timeline"},community:{id:"navigation_bar.community_timeline",defaultMessage:"Local timeline"},preferences:{id:"navigation_bar.preferences",defaultMessage:"Preferences"},logout:{id:"navigation_bar.logout",defaultMessage:"Logout"},compose:{id:"navigation_bar.compose",defaultMessage:"Compose new toot"},logoutMessage:{id:"confirmations.logout.message",defaultMessage:"Are you sure you want to log out?"},logoutConfirm:{id:"confirmations.logout.confirm",defaultMessage:"Log out"}}),k=Object(d.connect)((function(e,t){return{columns:e.getIn(["settings","columns"]),showSearch:t.multiColumn?e.getIn(["search","submitted"])&&!e.getIn(["search","hidden"]):t.isSearchPage}}))(a=Object(f.g)(a=function(e){Object(i.a)(o,e);var t;t=o;function o(){for(var t,o=arguments.length,a=new Array(o),n=0;n<o;n++)a[n]=arguments[n];return t=e.call.apply(e,[this].concat(a))||this,Object(c.a)(Object(s.a)(t),"handleLogoutClick",(function(e){var o=t.props,a=o.dispatch,n=o.intl;return e.preventDefault(),e.stopPropagation(),a(Object(y.d)("CONFIRM",{message:n.formatMessage(M.logoutMessage),confirm:n.formatMessage(M.logoutConfirm),onConfirm:function(){return Object(S.a)()}})),!1})),Object(c.a)(Object(s.a)(t),"onFocus",(function(){t.props.dispatch(Object(g.S)(!0))})),Object(c.a)(Object(s.a)(t),"onBlur",(function(){t.props.dispatch(Object(g.S)(!1))})),t}var a=o.prototype;return a.componentDidMount=function(){this.props.isSearchPage||this.props.dispatch(Object(g.db)())},a.componentWillUnmount=function(){this.props.isSearchPage||this.props.dispatch(Object(g.lb)())},a.render=function(){var e=this.props,t=e.multiColumn,o=e.showSearch,a=e.isSearchPage,s=e.intl,i="";if(t){var c=this.props.columns;i=Object(n.a)("nav",{className:"drawer__header"},void 0,Object(n.a)(b.a,{to:"/getting-started",className:"drawer__tab",title:s.formatMessage(M.start),"aria-label":s.formatMessage(M.start)},void 0,Object(n.a)(C.a,{id:"bars",fixedWidth:!0})),!c.some((function(e){return"HOME"===e.get("id")}))&&Object(n.a)(b.a,{to:"/timelines/home",className:"drawer__tab",title:s.formatMessage(M.home_timeline),"aria-label":s.formatMessage(M.home_timeline)},void 0,Object(n.a)(C.a,{id:"home",fixedWidth:!0})),!c.some((function(e){return"NOTIFICATIONS"===e.get("id")}))&&Object(n.a)(b.a,{to:"/notifications",className:"drawer__tab",title:s.formatMessage(M.notifications),"aria-label":s.formatMessage(M.notifications)},void 0,Object(n.a)(C.a,{id:"bell",fixedWidth:!0})),!c.some((function(e){return"COMMUNITY"===e.get("id")}))&&Object(n.a)(b.a,{to:"/timelines/public/local",className:"drawer__tab",title:s.formatMessage(M.community),"aria-label":s.formatMessage(M.community)},void 0,Object(n.a)(C.a,{id:"users",fixedWidth:!0})),!c.some((function(e){return"PUBLIC"===e.get("id")}))&&Object(n.a)(b.a,{to:"/timelines/public",className:"drawer__tab",title:s.formatMessage(M.public),"aria-label":s.formatMessage(M.public)},void 0,Object(n.a)(C.a,{id:"globe",fixedWidth:!0})),Object(n.a)("a",{href:"/user-settings",className:"drawer__tab",title:s.formatMessage(M.preferences),"aria-label":s.formatMessage(M.preferences)},void 0,Object(n.a)(C.a,{id:"cog",fixedWidth:!0})),Object(n.a)("a",{href:"/auth/sign_out",className:"drawer__tab",title:s.formatMessage(M.logout),"aria-label":s.formatMessage(M.logout),onClick:this.handleLogoutClick},void 0,Object(n.a)(C.a,{id:"sign-out",fixedWidth:!0})))}return(Object(n.a)("div",{className:"drawer",role:"region","aria-label":s.formatMessage(M.compose)},void 0,i,(t||a)&&Object(n.a)(m.a,{}),Object(n.a)("div",{className:"drawer__pager"},void 0,!a&&Object(n.a)("div",{className:"drawer__inner",onFocus:this.onFocus},void 0,Object(n.a)(p.a,{onClose:this.onBlur}),Object(n.a)(u.a,{}),"mascot && ( ",Object(n.a)("div",{className:"drawer__inner__mastodon"},void 0,Object(n.a)("img",{alt:"",draggable:"false",src:_.l}))," )"),Object(n.a)(h.a,{defaultStyle:{x:a?0:-100},style:{x:v()(o||a?0:-100,{stiffness:210,damping:20})}},void 0,(function(e){var t=e.x;return(Object(n.a)("div",{className:"drawer__inner darker",style:{transform:"translateX("+t+"%)",visibility:-100===t?"hidden":"visible"}},void 0,Object(n.a)(j.a,{})))})))))},o}(l.a.PureComponent))||a)||a}}]);
//# sourceMappingURL=compose.js.map