From 154dae6e3ebb5e1666625bb7a29490c486e40644 Mon Sep 17 00:00:00 2001 From: rafalp Date: Sun, 12 Nov 2023 20:36:16 +0100 Subject: [PATCH] Cast required value to str before checking its length --- frontend/src/components/form.js | 9 +++------ frontend/src/utils/validators.js | 2 +- misago/static/misago/js/misago.js | 2 +- misago/static/misago/js/misago.js.map | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/form.js b/frontend/src/components/form.js index 82c03819a3..1c36eff942 100644 --- a/frontend/src/components/form.js +++ b/frontend/src/components/form.js @@ -1,6 +1,6 @@ import React from "react" -import { required } from "misago/utils/validators" -import snackbar from "misago/services/snackbar" +import { required } from "../utils/validators" +import snackbar from "../services/snackbar" let validateRequired = required() @@ -77,10 +77,7 @@ export default class extends React.Component { optional: (this.state.validators.optional || {})[name], } - let requiredError = false - if (validators.required) { - requiredError = validateRequired(value) || false - } + let requiredError = validateRequired(value) || false if (validators.required) { if (requiredError) { diff --git a/frontend/src/utils/validators.js b/frontend/src/utils/validators.js index 02b3b27e0a..34614e50a7 100644 --- a/frontend/src/utils/validators.js +++ b/frontend/src/utils/validators.js @@ -5,7 +5,7 @@ const USERNAME_ALPHANUMERIC = new RegExp("[0-9a-z]", "i") export function required(message) { return function (value) { - if (value === false || value === null || value.trim().length === 0) { + if (value === false || value === null || String(value).trim().length === 0) { return message || gettext("This field is required.") } } diff --git a/misago/static/misago/js/misago.js b/misago/static/misago/js/misago.js index 705f84e42c..efff5547d3 100644 --- a/misago/static/misago/js/misago.js +++ b/misago/static/misago/js/misago.js @@ -1,2 +1,2 @@ -!function(){var e,t,s,a={60642:function(e,t,s){"use strict";s.d(t,{b:function(){return n},D:function(){return r}});var a=s(4942),i=s(57588),o=s.n(i);class n extends o().Component{constructor(e){super(e),(0,a.Z)(this,"hasCache",(e=>this.props.cache&&this.props.cache[e])),(0,a.Z)(this,"getCache",(async e=>{const t=this.props.cache[e];this.setState({loading:!1,error:null,data:t}),this.props.onData&&await this.props.onData(t)})),(0,a.Z)(this,"setCache",((e,t)=>{this.props.cache&&(this.props.cache[e]=t)})),(0,a.Z)(this,"request",(e=>{this.setState({loading:!0}),fetch(e,{method:"GET",credentials:"include",signal:this.signal}).then((async t=>{if(e===this.props.url)if(200==t.status){const s=await t.json();this.setState({loading:!1,error:null,data:s}),this.setCache(e,s),this.props.onData&&await this.props.onData(s)}else{const e={status:t.status};"application/json"===t.headers.get("Content-Type")&&(e.data=await t.json()),this.setState({loading:!1,error:e})}}),(t=>{e===this.props.url&&this.setState({loading:!1,error:{status:0,rejection:t}})}))})),(0,a.Z)(this,"refetch",(()=>{this.request(this.props.url)})),(0,a.Z)(this,"update",(e=>{this.setState((t=>({data:e(t.data)})))})),this.state={data:null,loading:!1,error:null},this.controller=new AbortController,this.signal=this.controller.signal}componentDidMount(){this.props.url&&!this.props.disabled&&this.request(this.props.url)}componentDidUpdate(e){const t=this.props.url,s=t&&t!==e.url,a=this.props.disabled!=e.disabled;(s||a)&&(this.props.disabled?this.controller.abort():this.hasCache(t)?this.getCache(t):(this.controller.abort(),this.controller=new AbortController,this.signal=this.controller.signal,this.request(t)))}componentWillUnmount(){this.controller.abort()}render(){return this.props.children(Object.assign({refetch:this.refetch,update:this.update},this.state))}}class r extends o().Component{constructor(e){super(e),(0,a.Z)(this,"mutate",(e=>{this.setState({loading:!0}),fetch(this.props.url,{method:this.props.method||"POST",credentials:"include",headers:l(e),body:d(e)}).then((async t=>{if(200==t.status){const s=await t.json();this.setState({loading:!1,data:s}),e.onSuccess&&await e.onSuccess(s)}else if(204==t.status)this.setState({loading:!1}),e.onSuccess&&await e.onSuccess();else{const s={status:t.status};"application/json"===t.headers.get("Content-Type")&&(s.data=await t.json()),this.setState({loading:!1,error:s}),e.onError&&await e.onError(s)}}),(async t=>{const s={status:0,rejection:t};this.setState({loading:!1,error:s}),e.onError&&await e.onError(s)}))})),this.state={data:null,loading:!1,error:null}}render(){return this.props.children(this.mutate,this.state)}}function l(e){return e.json?{"Content-Type":"application/json; charset=utf-8","X-CSRFToken":c()}:{"X-CSRFToken":c()}}function d(e){if(e.json)return JSON.stringify(e.json)}function c(){const e=window.misago_csrf;if(-1!==document.cookie.indexOf(e)){const t=new RegExp(e+"=([^;]*)"),s=document.cookie.match(t)[0];return s?s.split("=")[1]:null}return null}},49021:function(e,t,s){"use strict";s.d(t,{Lt:function(){return l},YV:function(){return p},kE:function(){return u},Aw:function(){return h},Xi:function(){return m},KE:function(){return v},iC:function(){return g}});var a=s(4942),i=s(94184),o=s.n(i),n=s(57588),r=s.n(n);class l extends r().Component{constructor(e){super(e),(0,a.Z)(this,"handleClick",(e=>{this.state.isOpen&&(!this.root.contains(e.target)||this.menu.contains(e.target)&&e.target.closest("a"))&&this.setState({isOpen:!1})})),(0,a.Z)(this,"toggle",(()=>{this.setState((e=>({isOpen:!e.isOpen})))})),(0,a.Z)(this,"close",(()=>{this.setState({isOpen:!1})})),this.state={isOpen:!1},this.root=null,this.dropdown=null}componentDidMount(){window.addEventListener("click",this.handleClick)}componentWillUnmount(){window.removeEventListener("click",this.handleClick)}componentDidUpdate(e,t){t.isOpen!==this.state.isOpen&&(this.state.isOpen&&this.props.onOpen&&this.props.onOpen(this.root),!this.state.isOpen&&this.props.onClose&&this.props.onClose(this.root))}render(){const{isOpen:e}=this.state;return r().createElement("div",{id:this.props.id,className:o()("dropdown",{open:e},this.props.className),ref:e=>{e&&!this.element&&(this.root=e)}},this.props.toggle({isOpen:e,toggle:this.toggle,aria:d(e)}),r().createElement("div",{className:o()("dropdown-menu",{"dropdown-menu-right":this.props.menuAlignRight},this.props.menuClassName),ref:e=>{e&&!this.menu&&(this.menu=e)},role:"menu"},this.props.children({isOpen:e,close:this.close})))}}function d(e){return{"aria-haspopup":"true","aria-expanded":e?"true":"false"}}var c=s(22928);function p(e){let{className:t}=e;return(0,c.Z)("li",{className:o()("divider",t)})}function u(e){let{children:t,listItem:s}=e;return s?(0,c.Z)("li",{className:"dropdown-footer"},void 0,t):(0,c.Z)("div",{className:"dropdown-footer"},void 0,t)}function h(e){let{className:t,children:s}=e;return(0,c.Z)("div",{className:o()("dropdown-header",t)},void 0,s)}function m(e){let{className:t,children:s}=e;return(0,c.Z)("li",{className:o()("dropdown-menu-item",t)},void 0,s)}function v(e){let{className:t,children:s}=e;return(0,c.Z)("div",{className:o()("dropdown-pills",t)},void 0,s)}function g(e){let{className:t,children:s}=e;return(0,c.Z)("li",{className:o()("dropdown-subheader",t)},void 0,s)}},98936:function(e,t,s){"use strict";s.d(t,{gq:function(){return n},Z6:function(){return r},kw:function(){return l}});var a=s(22928),i=s(94184),o=s.n(i);s(57588);var n=e=>{let{children:t,className:s}=e;return(0,a.Z)("div",{className:o()("flex-row",s)},void 0,t)},r=e=>{let{children:t,className:s,shrink:i}=e;return(0,a.Z)("div",{className:o()("flex-row-col",s,{"flex-row-col-shrink":i})},void 0,t)},l=e=>{let{auto:t,children:s,className:i}=e;return(0,a.Z)("div",{className:o()("flex-row-section",{"flex-row-section-auto":t},i)},void 0,s)}},66398:function(e,t,s){"use strict";s.d(t,{NX:function(){return r},PB:function(){return d},Zn:function(){return c},WI:function(){return l},WE:function(){return p},j0:function(){return u}});var a,i=s(22928),o=s(94184),n=s.n(o);function r(e){let{className:t,children:s}=e;return(0,i.Z)("ul",{className:n()("list-group",t)},void 0,s)}function l(e){let{className:t,children:s}=e;return(0,i.Z)("li",{className:n()("list-group-item",t)},void 0,s)}function d(e){let{className:t,icon:s,message:a}=e;return(0,i.Z)(l,{className:n()("list-group-empty",t)},void 0,!!s&&(0,i.Z)("div",{className:"list-group-empty-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,s)),(0,i.Z)("p",{className:"list-group-empty-message"},void 0,a))}function c(e){let{className:t,icon:s,message:a,detail:o}=e;return(0,i.Z)(l,{className:n()("list-group-error",t)},void 0,!!s&&(0,i.Z)("div",{className:"list-group-error-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,s)),(0,i.Z)("p",{className:"list-group-error-message"},void 0,a),!!o&&(0,i.Z)("p",{className:"list-group-error-detail"},void 0,o))}function p(e){let{className:t,message:s}=e;return(0,i.Z)(l,{className:n()("list-group-loading",t)},void 0,(0,i.Z)("p",{className:"list-group-loading-message"},void 0,s),a||(a=(0,i.Z)("div",{className:"list-group-loading-progress"},void 0,(0,i.Z)("div",{className:"list-group-loading-progress-bar"}))))}function u(e){let{className:t,icon:s,message:a,detail:o}=e;return(0,i.Z)(l,{className:n()("list-group-message",t)},void 0,!!s&&(0,i.Z)("div",{className:"list-group-message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,s)),(0,i.Z)("p",{className:"list-group-message-message"},void 0,a),!!o&&(0,i.Z)("p",{className:"list-group-message-detail"},void 0,o))}s(57588)},4517:function(e,t,s){"use strict";var a=s(22928),i=(s(57588),s(37424)),o=s(35486),n=s(60642);function r(e,t){let s=misago.get("NOTIFICATIONS_API")+"?limit=30";return s+="&filter="+e,t&&(t.after&&(s+="&after="+t.after),t.before&&(s+="&before="+t.before)),s}const l=(0,i.$j)((function(e){let{auth:t}=e;return t.user?{unreadNotifications:t.user.unreadNotifications}:{unreadNotifications:null}}))((function(e){let{children:t,filter:s,query:i,dispatch:l,unreadNotifications:d,disabled:c}=e;return(0,a.Z)(n.b,{url:r(s,i),disabled:c,onData:e=>{e.unreadNotifications!=d&&l((0,o.yH)({unreadNotifications:e.unreadNotifications}))}},void 0,(e=>{let{data:s,loading:a,error:i,refetch:o}=e;return t({data:s,loading:a,error:i,refetch:o})}))}));t.Z=l},63026:function(e,t,s){"use strict";var a=s(4517);t.Z=a.Z},66462:function(e,t,s){"use strict";s.d(t,{uE:function(){return _},lb:function(){return N},Pu:function(){return x}});var a=s(22928),i=(s(57588),s(66398));function o(e){let{filter:t}=e;return(0,a.Z)(i.PB,{icon:"unread"===t?"sentiment_very_satisfied":"notifications_none",message:n(t)})}function n(e){return"read"===e?pgettext("notifications list","You don't have any read notifications."):"unread"===e?pgettext("notifications list","You don't have any unread notifications."):pgettext("notifications list","You don't have any notifications.")}var r=s(94184),l=s.n(r);function d(e){let{className:t,children:s}=e;return(0,a.Z)("div",{className:l()("notifications-list",t)},void 0,(0,a.Z)(i.NX,{},void 0,s))}var c,p,u,h=s(19605);function m(e){let{notification:t}=e;return t.actor?(0,a.Z)("a",{href:t.actor.url,className:"notifications-list-item-actor",title:t.actor.username},void 0,(0,a.Z)(h.ZP,{size:30,user:t.actor})):(0,a.Z)("span",{className:"threads-list-item-last-poster",title:t.actor_name||null},void 0,c||(c=(0,a.Z)(h.ZP,{size:30})))}function v(e){let{notification:t}=e;return(0,a.Z)("a",{href:t.url,className:l()("notification-message",{"notification-message-read":t.isRead,"notification-message-unread":!t.isRead}),dangerouslySetInnerHTML:{__html:t.message}})}function g(e){let{notification:t}=e;return t.isRead?(0,a.Z)("div",{className:"notifications-list-item-read-status",title:pgettext("notification status","Read notification")},void 0,p||(p=(0,a.Z)("span",{className:"notification-read-icon"}))):(0,a.Z)("div",{className:"notifications-list-item-read-status",title:pgettext("notification status","Unread notification")},void 0,u||(u=(0,a.Z)("span",{className:"notification-unread-icon"})))}var Z=s(59581);function f(e){let{notification:t}=e;return(0,a.Z)("div",{className:"notifications-list-item-timestamp"},void 0,(0,a.Z)(Z.Z,{datetime:t.createdAt}))}function b(e){let{notification:t}=e;return(0,a.Z)(i.WI,{className:l()("notifications-list-item",{"notifications-list-item-read":t.isRead,"notifications-list-item-unread":!t.isRead})},t.id,(0,a.Z)("div",{className:"notifications-list-item-left-col"},void 0,(0,a.Z)("div",{className:"notifications-list-item-col-actor"},void 0,(0,a.Z)(m,{notification:t})),(0,a.Z)("div",{className:"notifications-list-item-col-read-icon"},void 0,(0,a.Z)(g,{notification:t}))),(0,a.Z)("div",{className:"notifications-list-item-right-col"},void 0,(0,a.Z)("div",{className:"notifications-list-item-col-message"},void 0,(0,a.Z)(v,{notification:t})),(0,a.Z)("div",{className:"notifications-list-item-col-timestamp"},void 0,(0,a.Z)(f,{notification:t}))))}function _(e){let{filter:t,items:s}=e;return(0,a.Z)(d,{className:s.length>0?"notifications-list-ready":"notifications-list-pending"},void 0,0===s.length&&(0,a.Z)(o,{filter:t}),s.map((e=>(0,a.Z)(b,{notification:e},e.id))))}function N(e){let{error:t}=e;const s=function(e){return 0===e.status?gettext("Check your internet connection and try refreshing the site."):e.data&&e.data.detail?e.data.detail:void 0}(t);return(0,a.Z)(d,{className:"notifications-list-pending"},void 0,(0,a.Z)(i.Zn,{icon:"notifications_off",message:pgettext("notifications list","Notifications could not be loaded."),detail:s}))}function x(){return(0,a.Z)(d,{className:"notifications-list-pending"},void 0,(0,a.Z)(i.WE,{message:pgettext("notifications list","Loading notifications...")}))}},64836:function(e,t,s){"use strict";s.d(t,{a:function(){return m},i:function(){return v}});var a=s(22928),i=s(4942),o=s(94184),n=s.n(o),r=s(57588),l=s.n(r),d=s(37424),c=s(993);const p="has-overlay";class u extends l().Component{constructor(e){super(e),(0,i.Z)(this,"closeOnNavigation",(e=>{e.target.closest("a")&&this.props.dispatch((0,c.xv)())})),this.scrollOrigin=null}componentDidUpdate(e){e.open!==this.props.open&&(this.props.open?(this.scrollOrigin=window.pageYOffset,document.body.classList.add(p),this.props.onOpen&&this.props.onOpen()):(document.body.classList.remove(p),window.scrollTo(0,this.scrollOrigin),this.scrollOrigin=null))}render(){return(0,a.Z)("div",{className:n()("overlay",this.props.className,{"overlay-open":this.props.open}),onClick:this.closeOnNavigation},void 0,this.props.children)}}var h,m=(0,d.$j)()(u),v=(0,d.$j)()((function(e){let{children:t,dispatch:s}=e;return(0,a.Z)("div",{className:"overlay-header"},void 0,(0,a.Z)("div",{className:"overlay-header-caption"},void 0,t),(0,a.Z)("button",{className:"btn btn-overlay-close",title:pgettext("modal","Close"),type:"button",onClick:()=>s((0,c.xv)())},void 0,h||(h=(0,a.Z)("span",{className:"material-icon"},void 0,"close"))))}))},59131:function(e,t,s){"use strict";var a=s(22928);s(57588),t.Z=e=>{let{children:t}=e;return(0,a.Z)("div",{className:"container page-container"},void 0,t)}},99755:function(e,t,s){"use strict";s.d(t,{mr:function(){return r},gC:function(){return l},sP:function(){return d},eA:function(){return c},Ql:function(){return p},bM:function(){return u},Iv:function(){return h}});var a,i=s(22928),o=s(94184),n=s.n(o);s(57588);var r=e=>{let{children:t,className:s,styleName:o}=e;return(0,i.Z)("div",{className:n()("page-header",s,o&&"page-header-"+o)},void 0,(0,i.Z)("div",{className:"page-header-bg-image"},void 0,(0,i.Z)("div",{className:"page-header-bg-overlay"},void 0,a||(a=(0,i.Z)("div",{className:"page-header-image"})),t)))},l=e=>{let{children:t,className:s,styleName:a}=e;return(0,i.Z)("div",{className:n()("page-header-banner",s,a&&"page-header-banner-"+a)},void 0,(0,i.Z)("div",{className:"page-header-banner-bg-image"},void 0,(0,i.Z)("div",{className:"page-header-banner-bg-overlay"},void 0,t)))},d=e=>{let{children:t}=e;return(0,i.Z)("div",{className:"container page-header-container"},void 0,t)},c=e=>{let{children:t,className:s}=e;return(0,i.Z)("div",{className:n()("page-header-details",s)},void 0,t)},p=e=>{let{className:t,message:s}=e;return(0,i.Z)("div",{className:n()("page-header-message",t),dangerouslySetInnerHTML:{__html:s}})},u=e=>{let{children:t,className:s}=e;return(0,i.Z)("div",{className:n()("page-header-message",s)},void 0,t)},h=e=>{let{styleName:t,header:s,message:a}=e;return(0,i.Z)(d,{},void 0,(0,i.Z)(r,{styleName:t},void 0,(0,i.Z)(l,{styleName:t},void 0,(0,i.Z)("h1",{},void 0,s)),a&&(0,i.Z)(c,{styleName:t},void 0,a)))}},40689:function(e,t,s){"use strict";s.d(t,{Z:function(){return D}});var a=s(22928),i=s(4942),o=s(94184),n=s.n(o),r=s(57588),l=s.n(r),d=s(78657),c=s(93825),p=s(59801),u=s(53904),h=s(37848),m=s(87462),v=s(82211),g=s(43345),Z=s(96359),f=s(59940);const b=["progress-bar-danger","progress-bar-warning","progress-bar-warning","progress-bar-primary","progress-bar-success"],_=[pgettext("password strength indicator","Entered password is very weak."),pgettext("password strength indicator","Entered password is weak."),pgettext("password strength indicator","Entered password is average."),pgettext("password strength indicator","Entered password is strong."),pgettext("password strength indicator","Entered password is very strong.")];var N,x,y,w=class extends l().Component{constructor(e){super(e),this._score=0,this._password=null,this._inputs=[],this.state={loaded:!1}}componentDidMount(){f.Z.load().then((()=>{this.setState({loaded:!0})}))}getScore(e,t){let s=!1;return e!==this._password&&(s=!0),t.length!==this._inputs.length?s=!0:t.map(((e,t)=>{e.trim()!==this._inputs[t]&&(s=!0)})),s&&(this._score=f.Z.scorePassword(e,t),this._password=e,this._inputs=t.map((function(e){return e.trim()}))),this._score}render(){if(!this.state.loaded)return null;let e=this.getScore(this.props.password,this.props.inputs);return(0,a.Z)("div",{className:"help-block password-strength"},void 0,(0,a.Z)("div",{className:"progress"},void 0,(0,a.Z)("div",{className:"progress-bar "+b[e],style:{width:20+20*e+"%"},role:"progress-bar","aria-valuenow":e,"aria-valuemin":"0","aria-valuemax":"4"},void 0,(0,a.Z)("span",{className:"sr-only"},void 0,_[e]))),(0,a.Z)("p",{className:"text-small"},void 0,_[e]))}},k=s(26106),C=s(47235),S=s(32233),E=s(98274),T=s(93051),L=s(55210);class P extends g.Z{constructor(e){super(e),(0,i.Z)(this,"handlePrivacyPolicyChange",(e=>{const t=e.target.value;this.handleToggleAgreement("privacyPolicy",t)})),(0,i.Z)(this,"handleTermsOfServiceChange",(e=>{const t=e.target.value;this.handleToggleAgreement("termsOfService",t)})),(0,i.Z)(this,"handleToggleAgreement",((e,t)=>{this.setState(((s,a)=>{if(null===s[e])return{errors:{...s.errors,[e]:null},[e]:t};const i=this.state.validators[e][0];return{errors:{...s.errors,[e]:[i(null)]},[e]:null}}))}));const{username:t,password:s}=this.props.criteria;let a=0;s.forEach((e=>{"MinimumLengthValidator"===e.name&&(a=e.min_length)}));const o={username:[L.lG(),L.HR(t.min_length),L.gS(t.max_length)],email:[L.Do()],password:[L.Vb(a)],captcha:c.ZP.validator()};S.Z.get("TERMS_OF_SERVICE_ID")&&(o.termsOfService=[L.fT()]),S.Z.get("PRIVACY_POLICY_ID")&&(o.privacyPolicy=[L.jA()]),this.state={isLoading:!1,username:"",email:"",password:"",captcha:"",termsOfService:null,privacyPolicy:null,validators:o,errors:{}}}clean(){return!!this.isValid()||(u.Z.error(gettext("Form contains errors.")),this.setState({errors:this.validate()}),!1)}send(){return d.Z.post(S.Z.get("USERS_API"),{username:this.state.username,email:this.state.email,password:this.state.password,captcha:this.state.captcha,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}handleSuccess(e){this.props.callback(e)}handleError(e){400===e.status?(this.setState({errors:Object.assign({},this.state.errors,e)}),e.__all__&&e.__all__.length>0?u.Z.error(e.__all__[0]):u.Z.error(gettext("Form contains errors."))):403===e.status&&e.ban?((0,T.Z)(e.ban),p.Z.hide()):u.Z.apiError(e)}render(){return(0,a.Z)("div",{className:"modal-dialog modal-register",role:"document"},void 0,(0,a.Z)("div",{className:"modal-content"},void 0,(0,a.Z)("div",{className:"modal-header"},void 0,(0,a.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,N||(N=(0,a.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,a.Z)("h4",{className:"modal-title"},void 0,pgettext("register modal title","Register"))),(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"modal-body"},void 0,(0,a.Z)(C.Z,{buttonClassName:"col-xs-12 col-sm-6",buttonLabel:pgettext("register modal field","Join with %(site)s"),formLabel:pgettext("register modal field","Or create forum account:")}),(0,a.Z)(Z.Z,{label:pgettext("register modal field","Username"),for:"id_username",validation:this.state.errors.username},void 0,(0,a.Z)("input",{type:"text",id:"id_username",className:"form-control","aria-describedby":"id_username_status",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username})),(0,a.Z)(Z.Z,{label:pgettext("register modal field","E-mail"),for:"id_email",validation:this.state.errors.email},void 0,(0,a.Z)("input",{type:"text",id:"id_email",className:"form-control","aria-describedby":"id_email_status",disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email})),(0,a.Z)(Z.Z,{label:pgettext("register modal field","Password"),for:"id_password",validation:this.state.errors.password,extra:(0,a.Z)(w,{password:this.state.password,inputs:[this.state.username,this.state.email]})},void 0,(0,a.Z)("input",{type:"password",id:"id_password",className:"form-control","aria-describedby":"id_password_status",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password})),c.ZP.component({form:this}),(0,a.Z)(k.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,a.Z)("div",{className:"modal-footer"},void 0,(0,a.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("register modal btn","Cancel")),(0,a.Z)(v.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("register modal btn","Register account"))))))}}class O extends l().Component{getLead(){return"user"===this.props.activation?pgettext("account activation required","%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===this.props.activation?pgettext("account activation required","%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in."):void 0}getSubscript(){return"user"===this.props.activation?pgettext("account activation required","We have sent an e-mail to %(email)s with link that you have to click to activate your account."):"admin"===this.props.activation?pgettext("account activation required","We will send an e-mail to %(email)s when this takes place."):void 0}render(){return(0,a.Z)("div",{className:"modal-dialog modal-message modal-register",role:"document"},void 0,(0,a.Z)("div",{className:"modal-content"},void 0,(0,a.Z)("div",{className:"modal-header"},void 0,(0,a.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,x||(x=(0,a.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,a.Z)("h4",{className:"modal-title"},void 0,pgettext("register modal title","Registration complete"))),(0,a.Z)("div",{className:"modal-body"},void 0,y||(y=(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,interpolate(this.getLead(),{username:this.props.username},!0)),(0,a.Z)("p",{},void 0,interpolate(this.getSubscript(),{email:this.props.email},!0)),(0,a.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("register modal dismiss","Ok"))))))}}var I,A=class extends l().Component{constructor(e){super(e),(0,i.Z)(this,"completeRegistration",(e=>{"active"===e.activation?(p.Z.hide(),E.Z.signIn(e)):this.setState({complete:e})})),this.state={complete:!1}}render(){return this.state.complete?(0,a.Z)(O,{activation:this.state.complete.activation,email:this.state.complete.email,username:this.state.complete.username}):l().createElement(P,(0,m.Z)({callback:this.completeRegistration},this.props))}};class R extends l().Component{constructor(e){super(e),(0,i.Z)(this,"showRegisterForm",(()=>{this.props.onClick&&this.props.onClick(),"closed"===misago.get("SETTINGS").account_activation?u.Z.info(pgettext("register form","Registration form is currently disabled by the site administrator.")):this.state.isLoaded?p.Z.show((0,a.Z)(A,{criteria:this.state.criteria})):(this.setState({isLoading:!0}),Promise.all([c.ZP.load(),d.Z.get(misago.get("AUTH_CRITERIA_API"))]).then((e=>{this.setState({isLoading:!1,isLoaded:!0,criteria:e[1]}),p.Z.show((0,a.Z)(A,{criteria:e[1]}))}),(()=>{this.setState({isLoading:!1}),u.Z.error(pgettext("register form","Registration form is currently unavailable due to an error."))})))})),this.state={isLoading:!1,isLoaded:!1,criteria:null}}render(){return(0,a.Z)("button",{className:n()("btn btn-register",this.props.className,{"btn-block":this.props.block,"btn-loading":this.state.isLoading}),disabled:this.state.isLoading,onClick:this.showRegisterForm,type:"button"},void 0,pgettext("cta","Register"),this.state.isLoading?I||(I=(0,a.Z)(h.Z,{})):null)}}var D=R},26106:function(e,t,s){"use strict";var a=s(22928),i=(s(57588),s(32233)),o=s(89627);const n=e=>{const{agreement:t,checked:s,errors:i,url:n,value:r,onChange:l}=e;if(!n)return null;const d=interpolate('%(agreement)s',{agreement:(0,o.Z)(t),url:(0,o.Z)(n)},!0),c=interpolate(pgettext("register form agreement prompt","I have read and accept %(agreement)s."),{agreement:d},!0);return(0,a.Z)("div",{className:"checkbox legal-footnote"},void 0,(0,a.Z)("label",{},void 0,(0,a.Z)("input",{checked:s,type:"checkbox",value:r,onChange:l}),(0,a.Z)("span",{dangerouslySetInnerHTML:{__html:c}})),i&&i.map(((e,t)=>(0,a.Z)("div",{className:"help-block errors"},t,e))))};t.Z=e=>{const{errors:t,privacyPolicy:s,termsOfService:o,onPrivacyPolicyChange:r,onTermsOfServiceChange:l}=e,d=i.Z.get("TERMS_OF_SERVICE_ID"),c=i.Z.get("TERMS_OF_SERVICE_URL"),p=i.Z.get("PRIVACY_POLICY_ID"),u=i.Z.get("PRIVACY_POLICY_URL");return d||p?(0,a.Z)("div",{},void 0,(0,a.Z)(n,{agreement:pgettext("register form agreement prompt","the terms of service"),checked:null!==o,errors:t.termsOfService,url:c,value:d,onChange:l}),(0,a.Z)(n,{agreement:pgettext("register form agreement prompt","the privacy policy"),checked:null!==s,errors:t.privacyPolicy,url:u,value:p,onChange:r})):null}},62989:function(e,t,s){"use strict";s.d(t,{E:function(){return S},F:function(){return L}});var a=s(22928),i=s(57588),o=s.n(i),n=s(60642),r=s(66398);function l(e){let{children:t}=e;return(0,a.Z)(r.NX,{className:"search-results-list"},void 0,t)}function d(){return(0,a.Z)(l,{},void 0,(0,a.Z)(r.j0,{message:pgettext("search cta","Enter search query (at least 3 characters).")}))}var c=s(59581);function p(e){let{post:t}=e;return(0,a.Z)(r.WI,{className:"search-result"},void 0,(0,a.Z)("a",{href:t.url.index},void 0,(0,a.Z)("div",{className:"search-result-card"},void 0,(0,a.Z)("div",{className:"search-result-name"},void 0,t.thread.title),(0,a.Z)("div",{className:"search-result-summary",dangerouslySetInnerHTML:{__html:t.content}}),(0,a.Z)("ul",{className:"search-result-details"},void 0,(0,a.Z)("li",{},void 0,(0,a.Z)("b",{},void 0,t.category.name)),(0,a.Z)("li",{},void 0,t.poster?t.poster.username:t.poster_name),(0,a.Z)("li",{},void 0,(0,a.Z)(c.Z,{datetime:t.posted_on}))))))}var u,h,m,v=s(19605);function g(e){let{user:t}=e;const s=t.title||t.rank.title;return(0,a.Z)(r.WI,{className:"search-result"},void 0,(0,a.Z)("a",{href:t.url},void 0,(0,a.Z)(v.ZP,{user:t,size:32}),(0,a.Z)("div",{className:"search-result-card"},void 0,(0,a.Z)("div",{className:"search-result-name"},void 0,t.username),(0,a.Z)("ul",{className:"search-result-details"},void 0,!!s&&(0,a.Z)("li",{},void 0,(0,a.Z)("b",{},void 0,s)),(0,a.Z)("li",{},void 0,t.rank.name),(0,a.Z)("li",{},void 0,(0,a.Z)(c.Z,{datetime:t.joined_on}))))))}function Z(e){let{query:t,results:s}=e;const i=s[0],o=s[1],{count:n}=i.results;return(0,a.Z)(l,{},void 0,o.results.results.map((e=>(0,a.Z)(g,{user:e},e.id))),i.results.results.map((e=>(0,a.Z)(p,{post:e},e.id))),n>0&&(0,a.Z)(r.WI,{},void 0,(0,a.Z)("a",{href:i.url+"?q="+encodeURIComponent(t),className:"btn btn-default btn-block"},void 0,npgettext("search results list","See all %(count)s result.","See all %(count)s results.",i.results.count).replace("%(count)s",i.results.count))))}function f(){return(0,a.Z)(l,{},void 0,(0,a.Z)(r.PB,{message:pgettext("search results","The search returned no results.")}))}function b(e){let{error:t}=e;return(0,a.Z)(l,{},void 0,(0,a.Z)(r.Zn,{message:pgettext("search results","The search could not be completed."),detail:_(t)}))}function _(e){return 0===e.status?gettext("Check your internet connection and try refreshing the site."):e.data&&e.data.detail?e.data.detail:void 0}function N(){return(0,a.Z)(l,{},void 0,(0,a.Z)(r.WE,{message:pgettext("search results","Searching...")}))}const x={};class y extends o().Component{constructor(e){super(e),this.state={query:this.props.query.trim()},this.debounce=null}componentDidUpdate(){const e=this.props.query.trim();this.state.query!=e&&(this.debounce&&window.clearTimeout(this.debounce),this.debounce=window.setTimeout((()=>{this.setState({query:e})}),750))}componentWillUnmount(){this.debounce&&window.clearTimeout(this.debounce)}render(){return(0,a.Z)(n.b,{url:(e=this.state.query,misago.get("SEARCH_API")+"?q="+encodeURIComponent(e)),cache:x,disabled:this.state.query.length<3},void 0,(e=>{let{data:t,loading:s,error:i}=e;return this.state.query.length<3?u||(u=(0,a.Z)(d,{})):s?h||(h=(0,a.Z)(N,{})):i?(0,a.Z)(b,{error:i}):function(e){if(null===e)return!0;let t=0;return e.forEach((e=>{t+=e.results.count})),0===t}(t)?m||(m=(0,a.Z)(f,{})):null!==t?(0,a.Z)(Z,{query:this.state.query,results:t}):null}));var e}}function w(e){let{query:t,setQuery:s}=e;return(0,a.Z)("div",{className:"search-input"},void 0,(0,a.Z)("input",{className:"form-control form-control-search",type:"text",placeholder:pgettext("cta","Search"),value:t,onChange:e=>s(e.target.value)}))}var k=s(4942);class C extends o().Component{constructor(e){super(e),(0,k.Z)(this,"setQuery",(e=>{this.setState({query:e})})),this.state={query:""}}render(){return this.props.children({query:this.state.query,setQuery:this.setQuery})}}function S(){return(0,a.Z)(C,{},void 0,(e=>{let{query:t,setQuery:s}=e;return(0,a.Z)("div",{className:"search-dropdown-body"},void 0,(0,a.Z)(w,{query:t,setQuery:s}),(0,a.Z)(y,{query:t}))}))}var E=s(37424),T=s(64836),L=(0,E.$j)((function(e){return{open:e.overlay.search}}))((function(e){let{open:t}=e;return(0,a.Z)(T.a,{open:t,onOpen:()=>{window.setTimeout((()=>{document.querySelector("#search-mount .form-control-search").focus()}),0)}},void 0,(0,a.Z)(T.i,{},void 0,pgettext("cta","Search")),(0,a.Z)(C,{},void 0,(e=>{let{query:t,setQuery:s}=e;return(0,a.Z)("div",{className:"search-overlay-body"},void 0,(0,a.Z)(w,{query:t,setQuery:s}),(0,a.Z)("div",{className:"search-results-container"},void 0,(0,a.Z)(y,{query:t})))})))}))},80261:function(e,t,s){"use strict";s.d(t,{Z:function(){return d}});var a,i=s(22928),o=s(94184),n=s.n(o),r=(s(57588),s(59801)),l=s(14467),d=function(e){let{block:t,className:s,onClick:o}=e;const d=misago.get("SETTINGS");return d.DELEGATE_AUTH?(0,i.Z)("a",{className:n()("btn btn-sign-in",s,{"btn-block":t}),href:d.LOGIN_URL,onClick:o},void 0,pgettext("cta","Sign in")):(0,i.Z)("button",{className:n()("btn btn-sign-in",s,{"btn-block":t}),type:"button",onClick:()=>{o&&o(),r.Z.show(a||(a=(0,i.Z)(l.Z,{})))}},void 0,pgettext("cta","Sign in"))}},6333:function(e,t,s){"use strict";s.d(t,{bS:function(){return v},Or:function(){return f}});var a,i,o,n=s(22928),r=s(94184),l=s.n(r),d=(s(57588),s(37424)),c=s(49021),p=s(40689),u=s(80261);const h=(0,d.$j)((function(e){return{isAnonymous:!e.auth.user.id}}))((function(e){let{isAnonymous:t,close:s,dropdown:r,overlay:d}=e;const h=misago.get("MISAGO_PATH"),m=misago.get("SETTINGS"),v=misago.get("extraMenuItems"),g=misago.get("extraFooterItems"),Z=misago.get("categoriesMap"),f=misago.get("usersLists"),b=m.enable_oauth2_client,_=[];misago.get("THREADS_ON_INDEX")?(_.push({title:pgettext("site nav","Threads"),url:h}),_.push({title:pgettext("site nav","Categories"),url:h+"categories/"})):(_.push({title:pgettext("site nav","Categories"),url:h}),_.push({title:pgettext("site nav","Threads"),url:h+"threads/"})),_.push({title:pgettext("site nav","Search"),url:h+"search/"});const N=[],x=misago.get("TERMS_OF_SERVICE_TITLE"),y=misago.get("TERMS_OF_SERVICE_URL");x&&y&&N.push({title:x,url:y});const w=misago.get("PRIVACY_POLICY_TITLE"),k=misago.get("PRIVACY_POLICY_URL");return w&&k&&N.push({title:w,url:k}),(0,n.Z)("ul",{className:l()("site-nav-menu",{"dropdown-menu-list":r,"overlay-menu-list":d})},void 0,t&&(0,n.Z)(c.Aw,{className:"site-nav-sign-in-message"},void 0,pgettext("cta","You are not signed in")),t&&(0,n.Z)(c.KE,{className:"site-nav-sign-in-options"},void 0,(0,n.Z)(u.Z,{onClick:s}),!b&&(0,n.Z)(p.Z,{onClick:s})),(0,n.Z)(c.iC,{},void 0,m.forum_name),_.map((e=>(0,n.Z)(c.Xi,{},e.url,(0,n.Z)("a",{href:e.url},void 0,e.title)))),v.map(((e,t)=>(0,n.Z)(c.Xi,{className:e.className},t,(0,n.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title)))),!!f.length&&(a||(a=(0,n.Z)(c.YV,{className:"site-nav-users-divider"}))),!!f.length&&(0,n.Z)(c.iC,{className:"site-nav-users"},void 0,pgettext("site nav section","Users")),f.map((e=>(0,n.Z)(c.Xi,{},e.url,(0,n.Z)("a",{href:e.url},void 0,e.name)))),i||(i=(0,n.Z)(c.YV,{className:"site-nav-categories-divider"})),(0,n.Z)(c.iC,{className:"site-nav-categories"},void 0,pgettext("site nav section","Categories")),Z.map((e=>(0,n.Z)(c.Xi,{className:"site-nav-category"},e.id,(0,n.Z)("a",{href:e.url},void 0,(0,n.Z)("span",{},void 0,e.name),(0,n.Z)("span",{className:l()("threads-list-item-category threads-list-category-label",{"threads-list-category-label-color":!!e.color}),style:{"--label-color":e.color}},void 0,e.shortName||e.name))))),(!!N.length||!!g.length)&&(o||(o=(0,n.Z)(c.YV,{className:"site-nav-footer-divider"}))),(!!N.length||!!g.length)&&(0,n.Z)(c.iC,{className:"site-nav-footer"},void 0,pgettext("site nav section","Footer")),g.map(((e,t)=>(0,n.Z)(c.Xi,{className:e.className},t,(0,n.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title)))),N.map((e=>(0,n.Z)(c.Xi,{},e.url,(0,n.Z)("a",{href:e.url},void 0,e.title)))))}));var m=h;function v(e){let{close:t}=e;return(0,n.Z)(m,{close:t,dropdown:!0})}var g=s(993),Z=s(64836),f=(0,d.$j)((function(e){return{isOpen:e.overlay.siteNav}}))((function(e){let{dispatch:t,isOpen:s}=e;return(0,n.Z)(Z.a,{open:s},void 0,(0,n.Z)(Z.i,{},void 0,pgettext("site nav title","Menu")),(0,n.Z)(m,{close:()=>t((0,g.xv)()),overlay:!0}))}))},47235:function(e,t,s){"use strict";var a,i=s(22928),o=(s(57588),s(32233));const n=e=>{let{className:t,text:s}=e;return s?(0,i.Z)("h5",{className:t||""},void 0,s):null};t.Z=e=>{const{buttonClassName:t,buttonLabel:s,formLabel:r,header:l,labelClassName:d}=e,c=o.Z.get("SOCIAL_AUTH");return 0===c.length?null:(0,i.Z)("div",{className:"form-group form-social-auth"},void 0,(0,i.Z)(n,{className:d,text:l}),(0,i.Z)("div",{className:"row"},void 0,c.map((e=>{let{pk:a,name:o,button_text:n,button_color:r,url:l}=e;const d="btn btn-block btn-default btn-social-"+a,c=r?{color:r}:null,p=n||interpolate(s,{site:o},!0);return(0,i.Z)("div",{className:t||"col-xs-12"},a,(0,i.Z)("a",{className:d,style:c,href:l},void 0,p))}))),a||(a=(0,i.Z)("hr",{})),(0,i.Z)(n,{className:d,text:r}))}},50366:function(e,t,s){"use strict";var a,i,o,n,r,l,d,c=s(22928);s(57588),t.Z=e=>{let{thread:t}=e;return(0,c.Z)("ul",{className:"thread-flags"},void 0,2==t.weight&&(0,c.Z)("li",{className:"thread-flag-pinned-globally",title:pgettext("thread flag","Pinned globally")},void 0,a||(a=(0,c.Z)("span",{className:"material-icon"},void 0,"bookmark"))),1==t.weight&&(0,c.Z)("li",{className:"thread-flag-pinned-locally",title:pgettext("thread flag","Pinned in category")},void 0,i||(i=(0,c.Z)("span",{className:"material-icon"},void 0,"bookmark_outline"))),t.best_answer&&(0,c.Z)("li",{className:"thread-flag-answered",title:pgettext("thread flag","Answered")},void 0,o||(o=(0,c.Z)("span",{className:"material-icon"},void 0,"check_circle"))),t.has_poll&&(0,c.Z)("li",{className:"thread-flag-poll",title:pgettext("thread flag","Poll")},void 0,n||(n=(0,c.Z)("span",{className:"material-icon"},void 0,"poll"))),(t.is_unapproved||t.has_unapproved_posts)&&(0,c.Z)("li",{className:"thread-flag-unapproved",title:t.is_unapproved?pgettext("thread flag","Awaiting approval"):pgettext("thread flag","Has unapproved posts")},void 0,r||(r=(0,c.Z)("span",{className:"material-icon"},void 0,"visibility"))),t.is_closed&&(0,c.Z)("li",{className:"thread-flag-closed",title:pgettext("thread flag","Closed")},void 0,l||(l=(0,c.Z)("span",{className:"material-icon"},void 0,"lock"))),t.is_hidden&&(0,c.Z)("li",{className:"thread-flag-hidden",title:pgettext("thread flag","Hidden")},void 0,d||(d=(0,c.Z)("span",{className:"material-icon"},void 0,"visibility_off"))))}},16768:function(e,t,s){"use strict";var a,i=s(22928);s(57588),t.Z=e=>{let{thread:t}=e;return(0,i.Z)("span",{className:"threads-replies",title:interpolate(npgettext("thread replies stat","%(replies)s reply","%(replies)s replies",t.replies),{replies:t.replies},!0)},void 0,a||(a=(0,i.Z)("span",{className:"material-icon"},void 0,"chat_bubble_outline")),t.replies>980?Math.round(t.replies/1e3)+"K":t.replies)}},59581:function(e,t,s){"use strict";s.d(t,{Z:function(){return S}});var a=s(22928),i=s(4942),o=s(57588),n=s.n(o);const r=window.misago_locale||"en-us",l=pgettext("time ago","moment ago"),d=pgettext("time ago","now"),c=pgettext("day at time","%(day)s at %(time)s"),p=pgettext("day at time","Tomorrow at %(time)s"),u=pgettext("day at time","Yesterday at %(time)s"),h=pgettext("short minutes","%(time)sm"),m=pgettext("short hours","%(time)sh"),v=pgettext("short days","%(time)sd"),g=new Intl.RelativeTimeFormat(r,{numeric:"always",style:"long"}),Z=(new Intl.RelativeTimeFormat(r,{numeric:"auto",style:"long"}),new Intl.DateTimeFormat(r,{dateStyle:"full",timeStyle:"medium"})),f=new Intl.DateTimeFormat(r,{month:"long",day:"numeric"}),b=new Intl.DateTimeFormat(r,{month:"short",day:"numeric"}),_=new Intl.DateTimeFormat(r,{year:"numeric",month:"long",day:"numeric"}),N=new Intl.DateTimeFormat(r,{year:"2-digit",month:"short"}),x=new Intl.DateTimeFormat(r,{weekday:"long"}),y=new Intl.DateTimeFormat(r,{timeStyle:"short"});function w(e,t){return e.getFullYear()==t.getFullYear()&&e.getMonth()==t.getMonth()&&e.getDate()==t.getDate()}class k extends n().Component{constructor(e){super(e),(0,i.Z)(this,"scheduleNextUpdate",(()=>{const e=new Date,t=Math.ceil(Math.abs(Math.round((this.date-e)/1e3)));t<3600?this.timeout=window.setTimeout((()=>{this.setState(C),this.scheduleNextUpdate()}),5e4):t<86400&&(this.timeout=window.setTimeout((()=>{this.setState(C)}),24e5))})),this.state={tick:0},this.date=new Date(e.datetime),this.timeout=null}componentDidMount(){this.scheduleNextUpdate()}componentWillUnmount(){this.timeout&&window.clearTimeout(this.timeout)}render(){const e=this.props.narrow?function(e){const t=new Date,s=Math.abs(Math.round((e-t)/1e3));if(s<60)return d;if(s<3300){const e=Math.ceil(s/60);return h.replace("%(time)s",e)}if(s<86400){const e=Math.ceil(s/3600);return m.replace("%(time)s",e)}if(s<604800){const e=Math.ceil(s/86400);return v.replace("%(time)s",e)}return e.getFullYear()===t.getFullYear()?b.format(e):N.format(e)}(this.date):function(e){const t=new Date,s=Math.round((e-t)/1e3),a=Math.abs(s),i=s<1?-1:1;if(a<90)return l;if(a<2820){const e=Math.ceil(a/60)*i;return g.format(e,"minute")}if(a<10800){const e=Math.ceil(a/3600)*i;return g.format(e,"hour")}return w(t,e)?y.format(e):function(e){const t=new Date;return t.setDate(t.getDate()-1),w(t,e)}(e)?u.replace("%(time)s",y.format(e)):function(e){const t=new Date;return t.setDate(t.getDate()+1),w(t,e)}(e)?p.replace("%(time)s",y.format(e)):s<0&&a<518400?function(e,t){return c.replace("%(day)s",e).replace("%(time)s",y.format(t))}(x.format(e),e):t.getFullYear()==e.getFullYear()?f.format(e):_.format(e)}(this.date);return(0,a.Z)("attr",{title:this.props.title?this.props.title.replace("%(timestamp)s",Z.format(this.date)):Z.format(this.date)},void 0,e)}}function C(e){return{tick:e.tick+1}}var S=k},92490:function(e,t,s){"use strict";s.d(t,{o8:function(){return n},Eg:function(){return r},Z2:function(){return l},tw:function(){return d}});var a=s(22928),i=s(94184),o=s.n(i);s(57588);var n=e=>{let{children:t,className:s}=e;return(0,a.Z)("nav",{className:o()("toolbar",s)},void 0,t)},r=e=>{let{children:t,className:s,shrink:i}=e;return(0,a.Z)("div",{className:o()("toolbar-item",s,{"toolbar-item-shrink":i})},void 0,t)},l=e=>{let{auto:t,children:s,className:i}=e;return(0,a.Z)("div",{className:o()("toolbar-section",{"toolbar-section-auto":t},i)},void 0,s)},d=e=>{let{className:t}=e;return(0,a.Z)("div",{className:o()("toolbar-spacer",t)})}},28166:function(e,t,s){"use strict";s.d(t,{o4:function(){return W},Qm:function(){return K}});var a,i,o,n,r=s(22928),l=s(4942),d=s(94184),c=s.n(d),p=s(57588),u=s.n(p),h=s(37424),m=s(59801),v=s(19605),g=s(82211),Z=s(37848),f=s(78657),b=s(53904),_=class extends u().Component{constructor(e){super(e),(0,l.Z)(this,"setGravatar",(()=>{this.callApi("gravatar")})),(0,l.Z)(this,"setGenerated",(()=>{this.callApi("generated")})),this.state={isLoading:!1}}callApi(e){if(this.state.isLoading)return!1;this.setState({isLoading:!0}),f.Z.post(this.props.user.api.avatar,{avatar:e}).then((e=>{this.setState({isLoading:!1}),b.Z.success(e.detail),this.props.onComplete(e)}),(e=>{400===e.status?(b.Z.error(e.detail),this.setState({isLoading:!1})):this.props.showError(e)}))}getGravatarButton(){return this.props.options.gravatar?(0,r.Z)(g.Z,{onClick:this.setGravatar,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-gravatar"},void 0,pgettext("avatar modal btn","Download my Gravatar")):null}getCropButton(){return this.props.options.crop_src?(0,r.Z)(g.Z,{className:"btn-default btn-block btn-avatar-crop",disabled:this.state.isLoading,onClick:this.props.showCrop},void 0,pgettext("avatar modal btn","Re-crop uploaded image")):null}getUploadButton(){return this.props.options.upload?(0,r.Z)(g.Z,{className:"btn-default btn-block btn-avatar-upload",disabled:this.state.isLoading,onClick:this.props.showUpload},void 0,pgettext("avatar modal btn","Upload new image")):null}getGalleryButton(){return this.props.options.galleries?(0,r.Z)(g.Z,{className:"btn-default btn-block btn-avatar-gallery",disabled:this.state.isLoading,onClick:this.props.showGallery},void 0,pgettext("avatar modal btn","Pick avatar from gallery")):null}getAvatarPreview(){let e={id:this.props.user.id,avatars:this.props.options.avatars};return this.state.isLoading?(0,r.Z)("div",{className:"avatar-preview preview-loading"},void 0,(0,r.Z)(v.ZP,{size:"200",user:e}),a||(a=(0,r.Z)(Z.Z,{}))):(0,r.Z)("div",{className:"avatar-preview"},void 0,(0,r.Z)(v.ZP,{size:"200",user:e}))}render(){return(0,r.Z)("div",{className:"modal-body modal-avatar-index"},void 0,(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:"col-md-5"},void 0,this.getAvatarPreview()),(0,r.Z)("div",{className:"col-md-7"},void 0,this.getGravatarButton(),(0,r.Z)(g.Z,{onClick:this.setGenerated,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-generate"},void 0,pgettext("avatar modal btn","Generate my individual avatar")),this.getCropButton(),this.getUploadButton(),this.getGalleryButton())))}},N=s(19755),x=class extends u().Component{constructor(e){super(e),(0,l.Z)(this,"cropAvatar",(()=>{if(this.state.isLoading)return!1;this.setState({isLoading:!0});let e=this.props.upload?"crop_tmp":"crop_src",t=N(".crop-form");const s=t.cropit("exportZoom"),a=t.cropit("offset");f.Z.post(this.props.user.api.avatar,{avatar:e,crop:{offset:{x:a.x*s,y:a.y*s},zoom:t.cropit("zoom")*s}}).then((e=>{this.props.onComplete(e),b.Z.success(e.detail)}),(e=>{400===e.status?(b.Z.error(e.detail),this.setState({isLoading:!1})):this.props.showError(e)}))})),this.state={isLoading:!1,deviceRatio:1}}getAvatarSize(){return this.props.upload?this.props.options.crop_tmp.size:this.props.options.crop_src.size}getImagePath(){return this.props.upload?this.props.dataUrl:this.props.options.crop_src.url}componentDidMount(){let e=N(".crop-form"),t=this.getAvatarSize();const s=e.width();for(;s{if(this.props.upload){let t=e.cropit("zoom"),s=e.cropit("imageSize");if(s.width>s.height){let a=(s.width*t-this.getAvatarSize())/-2;e.cropit("offset",{x:a,y:0})}else if(s.width{document.getElementById("avatar-hidden-upload").click()})),(0,l.Z)(this,"uploadFile",(()=>{let e=document.getElementById("avatar-hidden-upload").files[0];if(!e)return;let t=this.validateFile(e);if(t)return void b.Z.error(t);this.setState({image:e,preview:URL.createObjectURL(e),progress:0});let s=new FormData;s.append("avatar","upload"),s.append("image",e),f.Z.upload(this.props.user.api.avatar,s,(e=>{this.setState({progress:e})})).then((e=>{this.setState({options:e,uploaded:e.detail}),b.Z.info(pgettext("avatar upload modal","Your image has been uploaded and you may now crop it."))}),(e=>{400===e.status||413===e.status?(b.Z.error(e.detail),this.setState({isLoading:!1,image:null,progress:0})):this.props.showError(e)}))})),this.state={image:null,preview:null,progress:0,uploaded:null,dataUrl:null}}validateFile(e){if(e.size>this.props.options.upload.limit)return interpolate(pgettext("avatar upload modal","Selected file is too big. (%(filesize)s)"),{filesize:(0,y.Z)(e.size)},!0);let t=pgettext("avatar upload modal","Selected file type is not supported.");if(-1===this.props.options.upload.allowed_mime_types.indexOf(e.type))return t;let s=!1,a=e.name.toLowerCase();return this.props.options.upload.allowed_extensions.map((function(e){a.substr(-1*e.length)===e&&(s=!0)})),!s&&t}getUploadRequirements(e){let t=e.allowed_extensions.map((function(e){return e.substr(1)}));return interpolate(pgettext("avatar upload modal","%(files)s files smaller than %(limit)s"),{files:t.join(", "),limit:(0,y.Z)(e.limit)},!0)}getUploadButton(){return(0,r.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,r.Z)(g.Z,{className:"btn-pick-file",onClick:this.pickFile},void 0,o||(o=(0,r.Z)("div",{className:"material-icon"},void 0,"input")),pgettext("avatar upload modal field","Select file")),(0,r.Z)("p",{className:"text-muted"},void 0,this.getUploadRequirements(this.props.options.upload)))}getUploadProgressLabel(){return interpolate(pgettext("avatar upload modal field","%(progress)s % complete"),{progress:this.state.progress},!0)}getUploadProgress(){return(0,r.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,r.Z)("div",{className:"upload-progress"},void 0,(0,r.Z)("img",{src:this.state.preview}),(0,r.Z)("div",{className:"progress"},void 0,(0,r.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":"{this.state.progress}","aria-valuemin":"0","aria-valuemax":"100",style:{width:this.state.progress+"%"}},void 0,(0,r.Z)("span",{className:"sr-only"},void 0,this.getUploadProgressLabel())))))}renderUpload(){return(0,r.Z)("div",{},void 0,(0,r.Z)("input",{type:"file",id:"avatar-hidden-upload",className:"hidden-file-upload",onChange:this.uploadFile}),this.state.image?this.getUploadProgress():this.getUploadButton(),(0,r.Z)("div",{className:"modal-footer"},void 0,(0,r.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,r.Z)(g.Z,{onClick:this.props.showIndex,disabled:!!this.state.image,className:"btn-default btn-block"},void 0,pgettext("avatar upload modal btn","Cancel")))))}renderCrop(){return(0,r.Z)(x,{options:this.state.options,user:this.props.user,upload:this.state.uploaded,dataUrl:this.state.preview,onComplete:this.props.onComplete,showError:this.props.showError,showIndex:this.props.showIndex})}render(){return this.state.uploaded?this.renderCrop():this.renderUpload()}},k=s(87462),C=(s(32233),s(69130));class S extends u().Component{constructor(){super(...arguments),(0,l.Z)(this,"select",(()=>{this.props.select(this.props.id)}))}getClassName(){return this.props.selection===this.props.id?this.props.disabled?"btn btn-avatar btn-disabled avatar-selected":"btn btn-avatar avatar-selected":this.props.disabled?"btn btn-avatar btn-disabled":"btn btn-avatar"}render(){return(0,r.Z)("button",{type:"button",className:this.getClassName(),disabled:this.props.disabled,onClick:this.select},void 0,(0,r.Z)("img",{src:this.props.url}))}}class E extends u().Component{render(){return(0,r.Z)("div",{className:"avatars-gallery"},void 0,(0,r.Z)("h3",{},void 0,this.props.name),(0,r.Z)("div",{className:"avatars-gallery-images"},void 0,(0,C.Z)(this.props.images,4,null).map(((e,t)=>(0,r.Z)("div",{className:"row"},t,e.map(((e,t)=>(0,r.Z)("div",{className:"col-xs-3"},t,e?u().createElement(S,(0,k.Z)({disabled:this.props.disabled,select:this.props.select,selection:this.props.selection},e)):n||(n=(0,r.Z)("div",{className:"blank-avatar"}))))))))))}}var T,L,P,O=class extends u().Component{constructor(e){super(e),(0,l.Z)(this,"select",(e=>{this.setState({selection:e})})),(0,l.Z)(this,"save",(()=>{if(this.state.isLoading)return!1;this.setState({isLoading:!0}),f.Z.post(this.props.user.api.avatar,{avatar:"galleries",image:this.state.selection}).then((e=>{this.setState({isLoading:!1}),b.Z.success(e.detail),this.props.onComplete(e),this.props.showIndex()}),(e=>{400===e.status?(b.Z.error(e.detail),this.setState({isLoading:!1})):this.props.showError(e)}))})),this.state={selection:null,isLoading:!1}}render(){return(0,r.Z)("div",{},void 0,(0,r.Z)("div",{className:"modal-body modal-avatar-gallery"},void 0,this.props.options.galleries.map(((e,t)=>(0,r.Z)(E,{name:e.name,images:e.images,selection:this.state.selection,disabled:this.state.isLoading,select:this.select},t)))),(0,r.Z)("div",{className:"modal-footer"},void 0,(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,r.Z)(g.Z,{onClick:this.save,loading:this.state.isLoading,disabled:!this.state.selection,className:"btn-primary btn-block"},void 0,this.state.selection?pgettext("avatar gallery modal btn","Save choice"):pgettext("avatar gallery modal btn","Select avatar")),(0,r.Z)(g.Z,{onClick:this.props.showIndex,disabled:this.state.isLoading,className:"btn-default btn-block"},void 0,pgettext("avatar gallery modal btn","Cancel"))))))}},I=s(3784),A=s(6935),R=s(90287);class D extends u().Component{getErrorReason(){return this.props.reason?(0,r.Z)("p",{dangerouslySetInnerHTML:{__html:this.props.reason}}):null}render(){return(0,r.Z)("div",{className:"modal-body"},void 0,T||(T=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{className:"lead"},void 0,this.props.message),this.getErrorReason(),(0,r.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("avatar modal dismiss","Ok"))))}}var j=class extends u().Component{constructor(){super(...arguments),(0,l.Z)(this,"showError",(e=>{this.setState({error:e})})),(0,l.Z)(this,"showIndex",(()=>{this.setState({component:_})})),(0,l.Z)(this,"showUpload",(()=>{this.setState({component:w})})),(0,l.Z)(this,"showCrop",(()=>{this.setState({component:x})})),(0,l.Z)(this,"showGallery",(()=>{this.setState({component:O})})),(0,l.Z)(this,"completeFlow",(e=>{R.Z.dispatch((0,A.n1)(this.props.user,e.avatars)),this.setState({component:_,options:e})}))}componentDidMount(){f.Z.get(this.props.user.api.avatar).then((e=>{this.setState({component:_,options:e,error:null})}),(e=>{this.showError(e)}))}getBody(){return this.state?this.state.error?(0,r.Z)(D,{message:this.state.error.detail,reason:this.state.error.reason}):(0,r.Z)(this.state.component,{options:this.state.options,user:this.props.user,onComplete:this.completeFlow,showError:this.showError,showIndex:this.showIndex,showCrop:this.showCrop,showUpload:this.showUpload,showGallery:this.showGallery}):L||(L=(0,r.Z)(I.Z,{}))}getClassName(){return this.state&&this.state.error?"modal-dialog modal-message modal-change-avatar":"modal-dialog modal-change-avatar"}render(){return(0,r.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,P||(P=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,pgettext("avatar modal title","Change your avatar"))),this.getBody()))}};function U(e){return{user:e.auth.user}}var z,M,B,q,F,H,Y=s(49021);function V(){document.getElementById("hidden-logout-form").submit()}class G extends u().Component{constructor(e){super(e),(0,l.Z)(this,"changeAvatar",(()=>{this.props.close(),m.Z.show((0,h.$j)(U)(j))})),(0,l.Z)(this,"revealOptions",(()=>{this.setState({options:this.props.options,optionsMore:!1})})),e.dropdown?this.state={options:e.options.slice(0,2),optionsMore:e.options.length>2}:this.state={options:e.options,optionsMore:!1}}render(){const{user:e,close:t,dropdown:s,overlay:a}=this.props;if(!e)return null;const i=misago.get("ADMIN_URL");return(0,r.Z)("ul",{className:c()("user-nav-menu",{"dropdown-menu-list":s,"overlay-menu-list":a})},void 0,(0,r.Z)("li",{className:"dropdown-menu-item"},void 0,(0,r.Z)("a",{href:e.url,className:"user-nav-profile"},void 0,(0,r.Z)("strong",{},void 0,e.username),(0,r.Z)("small",{},void 0,pgettext("user nav","Go to your profile")))),z||(z=(0,r.Z)(Y.YV,{})),(0,r.Z)(Y.Xi,{},void 0,(0,r.Z)("a",{href:misago.get("NOTIFICATIONS_URL")},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,e.unreadNotifications?"notifications_active":"notifications_none"),pgettext("user nav","Notifications"),!!e.unreadNotifications&&(0,r.Z)("span",{className:"badge"},void 0,e.unreadNotifications))),!!e.showPrivateThreads&&(0,r.Z)(Y.Xi,{},void 0,(0,r.Z)("a",{href:misago.get("PRIVATE_THREADS_URL")},void 0,M||(M=(0,r.Z)("span",{className:"material-icon"},void 0,"inbox")),pgettext("user nav","Private threads"),!!e.unreadPrivateThreads&&(0,r.Z)("span",{className:"badge"},void 0,e.unreadPrivateThreads))),!!i&&(0,r.Z)(Y.Xi,{},void 0,(0,r.Z)("a",{href:i,target:"_blank"},void 0,B||(B=(0,r.Z)("span",{className:"material-icon"},void 0,"security")),pgettext("user nav","Admin control panel"))),q||(q=(0,r.Z)(Y.YV,{})),(0,r.Z)(Y.iC,{className:"user-nav-options"},void 0,pgettext("user nav section","Change options")),(0,r.Z)(Y.Xi,{},void 0,(0,r.Z)("button",{className:"btn-link",onClick:this.changeAvatar,type:"button"},void 0,F||(F=(0,r.Z)("span",{className:"material-icon"},void 0,"portrait")),pgettext("user nav","Change avatar"))),this.state.options.map((e=>(0,r.Z)(Y.Xi,{},e.icon,(0,r.Z)("a",{href:e.url},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,e.icon),e.name)))),(0,r.Z)(Y.Xi,{},void 0,(0,r.Z)("button",{className:c()("btn-link",{"d-none":!this.state.optionsMore}),onClick:this.revealOptions,type:"button"},void 0,H||(H=(0,r.Z)("span",{className:"material-icon"},void 0,"more_vertical")),pgettext("user nav","See more"))),!!s&&(0,r.Z)(Y.kE,{listItem:!0},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block",onClick:()=>{V(),t()},type:"button"},void 0,pgettext("user nav","Log out"))))}}var $=(0,h.$j)((function(e){const t=e.auth.user;return t.id?{user:{username:t.username,unreadNotifications:t.unreadNotifications,unreadPrivateThreads:t.unread_private_threads,showPrivateThreads:t.acl.can_use_private_threads,url:t.url},options:[...misago.get("userOptions")]}:{user:null}}))(G);function W(e){let{close:t}=e;return(0,r.Z)($,{close:t,dropdown:!0})}var Q=s(993),X=s(64836),K=(0,h.$j)((function(e){return{isOpen:e.overlay.userNav}}))((function(e){let{dispatch:t,isOpen:s}=e;return(0,r.Z)(X.a,{open:s},void 0,(0,r.Z)(X.i,{},void 0,pgettext("user nav title","Your options")),(0,r.Z)($,{close:()=>t((0,Q.xv)()),overlay:!0}),(0,r.Z)(Y.kE,{},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block",onClick:()=>{V(),t((0,Q.xv)())},type:"button"},void 0,pgettext("user nav","Log out"))))}))},19605:function(e,t,s){"use strict";s.d(t,{ZP:function(){return o}});var a=s(22928),i=(s(57588),s(32233));function o(e){const t=e.size||100,s=e.size2x||2*t;return(0,a.Z)("img",{alt:"",className:e.className||"user-avatar",src:n(e.user,t),srcSet:n(e.user,s),width:e.height||t,height:e.height||t})}function n(e,t){return e&&e.id?function(e,t){let s=e[0];return e.forEach((e=>{e.size>=t&&(s=e)})),s}(e.avatars,t).url:i.Z.get("BLANK_AVATAR_URL")}},82211:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var a,i=s(22928),o=s(57588),n=s.n(o),r=s(37848);class l extends n().Component{render(){let e="btn "+this.props.className,t=this.props.disabled;return this.props.loading&&(e+=" btn-loading",t=!0),(0,i.Z)("button",{className:e,disabled:t,onClick:this.props.onClick,type:this.props.onClick?"button":"submit"},void 0,this.props.children,this.props.loading?a||(a=(0,i.Z)(r.Z,{})):null)}}l.defaultProps={className:"btn-default",type:"submit",loading:!1,disabled:!1,onClick:null}},57026:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}});var a=s(22928);function i(e){return(0,a.Z)("select",{className:e.className||"form-control",disabled:e.disabled||!1,id:e.id||null,onChange:e.onChange,value:e.value},void 0,e.choices.map((e=>(0,a.Z)("option",{disabled:e.disabled||!1,value:e.value},e.value,"- - ".repeat(e.level)+e.label))))}s(57588)},21688:function(e,t,s){"use strict";s.d(t,{Z:function(){return x}});var a=s(22928),i=s(57588),o=s.n(i),n=s(33556);function r(e){let{display:t}=e;return t?(0,a.Z)(n.Z,{helpText:pgettext("user profile details","No profile details are editable at this time."),message:pgettext("user profile details","This option is currently unavailable.")}):null}var l,d=s(37848);function c(e){let{display:t}=e;return t?l||(l=(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(d.Z,{}))):null}var p=s(4942),u=s(60471),h=class extends o().Component{constructor(){super(...arguments),(0,p.Z)(this,"onChange",(e=>{const{field:t,onChange:s}=this.props;s(t.fieldname,e.target.value)}))}render(){const{disabled:e,field:t,value:s}=this.props,{input:i}=t;return"select"===i.type?(0,a.Z)(u.Z,{choices:i.choices,disabled:e,id:"id_"+t.fieldname,onChange:this.onChange,value:s}):"textarea"===i.type?(0,a.Z)("textarea",{className:"form-control",disabled:e,id:"id_"+t.fieldname,onChange:this.onChange,rows:"4",type:"text",value:s}):"text"===i.type?(0,a.Z)("input",{className:"form-control",disabled:e,id:"id_"+t.fieldname,onChange:this.onChange,type:"text",value:s}):null}},m=s(96359);function v(e){let{disabled:t,errors:s,fields:i,name:o,onChange:n,value:r}=e;return(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,o),i.map((e=>(0,a.Z)(m.Z,{for:"id_"+e.fieldname,helpText:e.help_text,label:e.label,validation:s[e.fieldname]},e.fieldname,(0,a.Z)(h,{disabled:t,field:e,onChange:n,value:r[e.fieldname]})))))}var g=s(82211),Z=s(43345),f=s(78657),b=s(53904),_=class extends Z.Z{constructor(e){super(e),(0,p.Z)(this,"onChange",((e,t)=>{this.setState({[e]:t})})),this.state={isLoading:!1,errors:{}};const t=e.groups.length;for(let s=0;s(0,a.Z)(v,{disabled:this.state.isLoading,errors:this.state.errors,fields:e.fields,name:e.name,onChange:this.onChange,value:this.state},t)))),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(N,{disabled:this.state.isLoading,onCancel:this.props.onCancel})," ",(0,a.Z)(g.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("user profile details form btn","Save changes"))))}};function N(e){let{onCancel:t,disabled:s}=e;return t?(0,a.Z)("button",{className:"btn btn-default",disabled:s,onClick:t,type:"button"},void 0,pgettext("user profile details form btn","Cancel")):null}var x=class extends o().Component{constructor(e){super(e),this.state={loading:!0,groups:null}}componentDidMount(){f.Z.get(this.props.api).then((e=>{this.setState({loading:!1,groups:e})}),(e=>{b.Z.apiError(e),this.props.cancel&&this.props.cancel()}))}render(){const{groups:e,loading:t}=this.state;return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("user profile details form title","Edit details"))),(0,a.Z)(c,{display:t}),(0,a.Z)(r,{display:!t&&!e.length}),(0,a.Z)(y,{api:this.props.api,display:!t&&e.length,groups:e,onCancel:this.props.onCancel,onSuccess:this.props.onSuccess}))}};function y(e){let{api:t,display:s,groups:i,onCancel:o,onSuccess:n}=e;return s?(0,a.Z)(_,{api:t,groups:i,onCancel:o,onSuccess:n}):null}},96359:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i);t.Z=class extends o().Component{isValidated(){return void 0!==this.props.validation}getClassName(){let e="form-group";return this.isValidated()&&(e+=" has-feedback",null===this.props.validation?e+=" has-success":e+=" has-error"),e}getFeedback(){return this.props.validation?(0,a.Z)("div",{className:"help-block errors"},void 0,this.props.validation.map(((e,t)=>(0,a.Z)("p",{},this.props.for+"FeedbackItem"+t,e)))):null}getFeedbackDescription(){return this.isValidated()?(0,a.Z)("span",{id:this.props.for+"_status",className:"sr-only"},void 0,this.props.validation?pgettext("field validation status","(error)"):pgettext("field validation status","(success)")):null}getHelpText(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}render(){return(0,a.Z)("div",{className:this.getClassName()},void 0,(0,a.Z)("label",{className:"control-label "+(this.props.labelClass||""),htmlFor:this.props.for||""},void 0,this.props.label+":"),(0,a.Z)("div",{className:this.props.controlClass||""},void 0,this.props.children,this.getFeedbackDescription(),this.getFeedback(),this.getHelpText(),this.props.extra||null))}}},43345:function(e,t,s){"use strict";var a=s(4942),i=s(57588),o=s.n(i),n=s(55210),r=s(53904);let l=(0,n.C1)();t.Z=class extends o().Component{constructor(){super(...arguments),(0,a.Z)(this,"bindInput",(e=>t=>{this.changeValue(e,t.target.value)})),(0,a.Z)(this,"changeValue",((e,t)=>{let s={[e]:t};const a=this.state.errors||{};a[e]=this.validateField(e,s[e]),s.errors=a,this.setState(s)})),(0,a.Z)(this,"handleSubmit",(e=>{if(e&&e.preventDefault(),!this.state.isLoading&&this.clean()){this.setState({isLoading:!0});let e=this.send();e?e.then((e=>{this.setState({isLoading:!1}),this.handleSuccess(e)}),(e=>{this.setState({isLoading:!1}),this.handleError(e)})):this.setState({isLoading:!1})}}))}validate(){let e={};if(!this.state.validators)return e;let t={required:this.state.validators.required||this.state.validators,optional:this.state.validators.optional||{}},s=[];for(let e in t.required)t.required.hasOwnProperty(e)&&t.required[e]&&s.push(e);for(let e in t.optional)t.optional.hasOwnProperty(e)&&t.optional[e]&&s.push(e);for(let t in s){let a=s[t],i=this.validateField(a,this.state[a]);null===i?e[a]=null:i&&(e[a]=i)}return e}isValid(){let e=this.validate();for(let t in e)if(e.hasOwnProperty(t)&&null!==e[t])return!1;return!0}validateField(e,t){let s=[];if(!this.state.validators)return s;let a={required:(this.state.validators.required||this.state.validators)[e],optional:(this.state.validators.optional||{})[e]},i=!1;if(a.required&&(i=l(t)||!1),a.required){if(i)s=[i];else for(let e in a.required){let i=a.required[e](t);i&&s.push(i)}return s.length?s:null}if(!1===i&&a.optional){for(let e in a.optional){let i=a.optional[e](t);i&&s.push(i)}return s.length?s:null}return!1}clean(){return!0}send(){return null}handleSuccess(e){}handleError(e){r.Z.apiError(e)}}},94417:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i);t.Z=class extends o().Component{isActive(){return this.props.isControlled?this.props.isActive:!!this.props.path&&0===document.location.pathname.indexOf(this.props.path)}getClassName(){return this.isActive()?(this.props.className||"")+" "+(this.props.activeClassName||"active"):this.props.className||""}render(){return(0,a.Z)("li",{className:this.getClassName()},void 0,this.props.children)}}},37848:function(e,t,s){"use strict";s.d(t,{Z:function(){return o}});var a,i=s(22928);function o(e){return(0,i.Z)("div",{className:e.className||"loader"},void 0,a||(a=(0,i.Z)("div",{className:"loader-spinning-wheel"})))}s(57588)},52753:function(e,t,s){"use strict";var a,i=s(22928),o=s(4942),n=(s(57588),s(82211)),r=s(43345),l=s(96359),d=s(78657),c=s(59801);function p(e){let{choices:t,onChange:s,value:a}=e;return t?(0,i.Z)(l.Z,{label:pgettext("merge threads conflict best answer","Best answer"),helpText:pgettext("merge threads conflict best answer","Select the best answer for your newly merged thread. No posts will be deleted during the merge."),for:"id_best_answer"},void 0,(0,i.Z)("select",{className:"form-control",id:"id_best_answer",onChange:s,value:a},void 0,t.map((e=>(0,i.Z)("option",{value:e[0]},e[0],e[1]))))):null}function u(e){let{choices:t,onChange:s,value:a}=e;return t?(0,i.Z)(l.Z,{label:pgettext("merge threads conflict poll","Poll"),helpText:pgettext("merge threads conflict poll","Select the poll for your newly merged thread. Rejected polls will be permanently deleted and cannot be recovered."),for:"id_poll"},void 0,(0,i.Z)("select",{className:"form-control",id:"id_poll",onChange:s,value:a},void 0,t.map((e=>(0,i.Z)("option",{value:e[0]},e[0],e[1]))))):null}t.ZP=class extends r.Z{constructor(e){super(e),(0,o.Z)(this,"handleSuccess",(e=>{this.props.onSuccess(e),c.Z.hide()})),(0,o.Z)(this,"handleError",(e=>{this.props.onError(e)})),(0,o.Z)(this,"onBestAnswerChange",(e=>{this.changeValue("bestAnswer",e.target.value)})),(0,o.Z)(this,"onPollChange",(e=>{this.changeValue("poll",e.target.value)})),this.state={isLoading:!1,bestAnswer:"0",poll:"0"}}clean(){return!this.props.polls||"0"!==this.state.poll||window.confirm(pgettext("merge threads conflict form","Are you sure you want to delete all polls?"))}send(){const e=Object.assign({},this.props.data,{best_answer:this.state.bestAnswer,poll:this.state.poll});return d.Z.post(this.props.api,e)}render(){return(0,i.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,pgettext("merge threads conflict modal title","Merge threads"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(p,{choices:this.props.bestAnswers,onChange:this.onBestAnswerChange,value:this.state.bestAnswer}),(0,i.Z)(u,{choices:this.props.polls,onChange:this.onPollChange,value:this.state.poll})),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("merge threads conflict btn","Cancel")),(0,i.Z)(n.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("merge threads conflict btn","Merge threads"))))))}}},69092:function(e,t,s){"use strict";s.d(t,{Z:function(){return h}});var a=s(94184),i=s.n(a),o=s(57588),n=s.n(o),r=s(4942),l=s(19755);const d=new RegExp("^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*");var c=new class{constructor(){(0,r.Z)(this,"render",(e=>{e&&(this.highlightCode(e),this.embedYoutubePlayers(e))})),this._youtube={}}highlightCode(e){s.e(417).then(s.bind(s,15739)).then((t=>{let{default:s}=t;const a=e.querySelectorAll("pre>code");for(let e=0;ea");for(let e=0;e');l(e).replaceWith(a),a.wrap('
')}};function p(e){const t=function(e){let t=e;return"https://"===e.substr(0,8)?t=t.substr(8):"http://"===e.substr(0,7)&&(t=t.substr(7)),"www."===t.substr(0,4)&&(t=t.substr(4)),t}(e),s=function(e){if(-1===e.indexOf("youtu"))return null;const t=e.match(d);return t?t[1]:null}(t);if(!s)return null;let a=0;if(t.indexOf("?")>0){const e=t.substr(t.indexOf("?")+1).split("&").filter((e=>"t="===e.substr(0,2)))[0];if(e){const t=e.substr(2).split("m");"s"===t[0].substr(-1)?a+=parseInt(t[0].substr(0,t[0].length-1)):(a+=60*parseInt(t[0]),t[1]&&"s"===t[1].substr(-1)&&(a+=parseInt(t[1].substr(0,t[1].length-1))))}}return{start:a,video:s}}var u=s(19755),h=class extends n().Component{componentDidMount(){c.render(this.documentNode),u(this.documentNode).find(".spoiler-reveal").click(m)}componentDidUpdate(e,t){c.render(this.documentNode),u(this.documentNode).find(".spoiler-reveal").click(m)}shouldComponentUpdate(e,t){return e.markup!==this.props.markup}render(){return n().createElement("article",{className:i()("misago-markup",this.props.className),dangerouslySetInnerHTML:{__html:this.props.markup},"data-author":this.props.author||void 0,ref:e=>{this.documentNode=e}})}};function m(e){var t=e.target;u(t).parent().parent().addClass("revealed")}},3784:function(e,t,s){"use strict";var a,i=s(22928),o=s(57588),n=s.n(o),r=s(37848);t.Z=class extends n().Component{render(){return a||(a=(0,i.Z)("div",{className:"modal-body modal-loader"},void 0,(0,i.Z)(r.Z,{})))}}},30337:function(e,t,s){"use strict";var a=s(22928),i=(s(57588),s(33556));t.Z=class extends i.Z{getHelpText(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}render(){return(0,a.Z)("div",{className:"modal-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText(),(0,a.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("modal message dismiss btn","Ok"))))}}},95187:function(e,t,s){"use strict";var a,i=s(22928),o=s(57588),n=s.n(o),r=s(37848);t.Z=class extends n().Component{render(){return a||(a=(0,i.Z)("div",{className:"panel-body panel-body-loading"},void 0,(0,i.Z)(r.Z,{className:"loader loader-spaced"})))}}},33556:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i);t.Z=class extends o().Component{getHelpText(){return this.props.helpText?(0,a.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}render(){return(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText()))}}},11005:function(e,t,s){"use strict";s.d(t,{Z:function(){return w}});var a=s(22928),i=s(57588),o=s.n(i),n=s(69092);function r(e){return e.post.content?o().createElement(l,e):o().createElement(d,e)}function l(e){return(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)(n.Z,{markup:e.post.content}))}function d(e){return(0,a.Z)("div",{className:"post-body post-body-invalid"},void 0,(0,a.Z)("p",{className:"lead"},void 0,pgettext("post body invalid","This post's contents cannot be displayed.")),(0,a.Z)("p",{className:"text-muted"},void 0,pgettext("post body invalid","This error is caused by invalid post content manipulation.")))}function c(e){let{post:t}=e;const{category:s,thread:i}=t,o=interpolate(pgettext("posts feed item header","posted %(posted_on)s"),{posted_on:t.posted_on.format("LL, LT")},!0);return(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("a",{className:"btn btn-link item-title",href:i.url},void 0,i.title),(0,a.Z)("a",{className:"btn btn-link post-category",href:s.url.index},void 0,s.name),(0,a.Z)("a",{href:t.url.index,className:"btn btn-link posted-on",title:o},void 0,t.posted_on.fromNow()))}var p,u,h=s(19605);function m(e){let{post:t}=e;return(0,a.Z)("a",{className:"btn btn-default btn-icon pull-right",href:t.url.index},void 0,(0,a.Z)("span",{className:"btn-text-left hidden-xs"},void 0,pgettext("go to post link","See post")),p||(p=(0,a.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function v(e){let{post:t}=e;return(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)(m,{post:t}),(0,a.Z)("div",{className:"media"},void 0,u||(u=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,t.poster_name)),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,pgettext("post removed poster username","Removed user")))))}function g(e){let{rank:t,title:s}=e,i=s||t.title||t.name,o="user-title";return t.css_class&&(o+=" user-title-"+t.css_class),t.is_tab?(0,a.Z)("a",{className:o,href:t.url},void 0,i):(0,a.Z)("span",{className:o},void 0,i)}function Z(e){let{post:t,poster:s}=e;return(0,a.Z)("div",{className:"post-side post-side-registered"},void 0,(0,a.Z)(m,{post:t}),(0,a.Z)("div",{className:"media"},void 0,(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("a",{href:s.url},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50,user:s}))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("a",{className:"item-title",href:s.url},void 0,s.username)),(0,a.Z)(g,{title:s.title,rank:s.rank}))))}function f(e){let{post:t,poster:s}=e;return s&&s.id?(0,a.Z)(Z,{post:t,poster:s}):(0,a.Z)(v,{post:t})}function b(e){let{post:t,poster:s}=e;const i=s||t.poster;let o="post";return i&&i.rank.css_class&&(o+=" post-"+i.rank.css_class),(0,a.Z)("li",{className:o,id:"post-"+t.id},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("div",{className:"panel-content"},void 0,(0,a.Z)(f,{post:t,poster:i}),(0,a.Z)(c,{post:t}),(0,a.Z)(r,{post:t})))))}var _,N,x=s(44039);function y(){return(0,a.Z)("ul",{className:"posts-list post-feed ui-preview"},void 0,(0,a.Z)("li",{className:"post"},void 0,(0,a.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("div",{className:"panel-content"},void 0,(0,a.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,a.Z)("div",{className:"media"},void 0,_||(_=(0,a.Z)("div",{className:"media-left"},void 0,(0,a.Z)("span",{},void 0,(0,a.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,a.Z)("div",{className:"media-body"},void 0,(0,a.Z)("div",{className:"media-heading"},void 0,(0,a.Z)("span",{className:"item-title"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," "))),(0,a.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," "))))),(0,a.Z)("div",{className:"post-heading"},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," ")),(0,a.Z)("div",{className:"post-body"},void 0,(0,a.Z)("article",{className:"misago-markup"},void 0,(0,a.Z)("p",{},void 0,(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," ")," ",(0,a.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,200)+"px"}},void 0," ")))))))))}function w(e){let{isReady:t,posts:s,poster:i}=e;return t?(0,a.Z)("ul",{className:"posts-list post-feed ui-ready"},void 0,s.map((e=>(0,a.Z)(b,{post:e,poster:i},e.id)))):N||(N=(0,a.Z)(y,{}))}},9771:function(e,t,s){"use strict";s.d(t,{mv:function(){return d},ZP:function(){return os},MO:function(){return C},Fi:function(){return v}});var a,i=s(57588),o=s.n(i),n=s(22928),r=s(4942),l=s(64646);class d extends o().Component{constructor(e){super(e),(0,r.Z)(this,"selected",(()=>{if(this.element){const e=p(this.element)||null,t=e?e.getBoundingClientRect():null;this.setState({range:e,rect:t})}})),(0,r.Z)(this,"reply",(()=>{if(l.Z.isOpen()){const e=C();e&&!e.disabled&&(e.quote(v(this.state.range)),this.setState({range:null,rect:null}),c())}else{const e=v(this.state.range);l.Z.open(Object.assign({},this.props.posting,{default:e})),this.setState({range:null,rect:null}),window.setTimeout(c,1e3)}})),(0,r.Z)(this,"render",(()=>(0,n.Z)("div",{},void 0,o().createElement("div",{ref:e=>{e&&(this.element=e)},onMouseUp:this.selected,onTouchEnd:this.selected},this.props.children),!!this.state.rect&&(0,n.Z)("div",{className:"quote-control",style:{position:"absolute",left:this.state.rect.left+window.scrollX,top:this.state.rect.bottom+window.scrollY}},void 0,a||(a=(0,n.Z)("div",{className:"quote-control-arrow"})),(0,n.Z)("div",{className:"quote-control-inner"},void 0,(0,n.Z)("button",{className:"btn quote-control-btn",type:"button",onClick:this.reply},void 0,pgettext("post reply","Quote"))))))),this.state={range:null,rect:null},this.element=null}}function c(){const e=document.querySelector("#posting-mount textarea");e.focus(),e.selectionStart=e.selectionEnd=e.value.length}const p=e=>{if(void 0===window.getSelection)return;const t=window.getSelection();if(!t)return;if("Range"!==t.type)return;if(1!==t.rangeCount)return;const s=t.getRangeAt(0);return u(s,e)&&h(s)&&m(s.cloneContents())?s:void 0},u=(e,t)=>{const s=e.commonAncestorContainer;if(s===t)return!0;let a=s.parentNode;for(;a;){if(a===t)return!0;a=a.parentNode}return!1},h=e=>{const t=e.commonAncestorContainer;if("ARTICLE"===t.nodeName)return!0;if(t.dataset&&"1"===t.dataset.noquote)return!1;let s=t.parentNode;for(;s;){if(s.dataset&&"1"===s.dataset.noquote)return!1;if("ARTICLE"===s.nodeName)return!0;s=s.parentNode}return!1},m=e=>{for(let t=0;t0)return!0;if("IMG"===s.nodeName)return!0;if(m(s))return!0}return!1};var v=e=>{const t=g(e);let s=y(e.cloneContents().childNodes,[]),a=t?`[quote="${t}"]\n`:"[quote]\n",i="\n[/quote]\n\n";const o=b(e);return o?(a+=o.syntax?`[code=${o.syntax}]\n`:"[code]\n",i="\n[/code]"+i):N(e)?(s=s.trim(),a+="`",i="`"+i):s=s.trim(),a+s+i};const g=e=>{const t=e.commonAncestorContainer;if(Z(t))return f(t);let s=t.parentNode;for(;s;){if(Z(s))return f(s);s=s.parentNode}return""},Z=e=>e.nodeType===Node.ELEMENT_NODE&&("ARTICLE"===e.nodeName||"BLOCKQUOTE"===e.nodeName&&e.dataset&&"quote"===e.dataset.block),f=e=>e.dataset&&e.dataset.author||null,b=e=>{const t=e.commonAncestorContainer;if(_(t))return x(t);let s=t.parentNode;for(;s;){if(_(s))return x(s);s=s.parentNode}return null},_=e=>"PRE"===e.nodeName,N=e=>{const t=e.commonAncestorContainer;if("CODE"===t.nodeName)return!0;let s=t.parentNode;for(;s;){if(Z(s))return!1;if("CODE"===s.nodeName)return!0;s=s.parentNode}return!1},x=e=>e.dataset?{syntax:e.dataset.syntax||null}:{syntax:null},y=(e,t)=>{let s="";for(let a=0;a{const s=e.dataset||{};if(e.nodeType===Node.TEXT_NODE)return e.textContent||"";if(e.nodeType===Node.ELEMENT_NODE){if(s.quote)return s.quote||"";if("1"===s.noquote)return""}if(e.nodeType===Node.ELEMENT_NODE&&s.quote&&s.quote.trim())return"";if("HR"===e.nodeName)return"\n\n- - -";if(w[e.nodeName]){const[s,a]=w[e.nodeName];return s+y(e.childNodes,[...t,e.nodeName])+a}if("A"===e.nodeName){const s=e.href,a=y(e.childNodes,[...t,e.nodeName]);return a?`[${a}](${s})`:`!(${s})`}if("IMG"===e.nodeName){const t=e.src,s=e.alt;return s?`![${s}](${t})`:`!(${t})`}if("DIV"===e.nodeName||"ASIDE"===e.nodeName){const a=s.block&&s.block.toUpperCase();if(a&&w[a]){const[s,i]=w[a];return s+y(e.childNodes,[...t,a])+i}return y(e.childNodes,t)}if("BLOCKQUOTE"===e.nodeName){if("spoiler"===s.block){const s=y(e.childNodes,[...t,"SPOILER"]).trim();if(!s)return"";let a="\n[spoiler]\n";return a+=s,a+="\n[/spoiler]",a}const a=y(e.childNodes,[...t,"QUOTE"]).trim();if(!a)return"";const i=f(e);let o=i?`\n[quote=${i}]\n`:"\n\n[quote]\n";return o+=a,o+="\n[/quote]",o}if("PRE"===e.nodeName){const t=s.syntax||null,a=e.querySelector("code"),i=a&&a.innerText||"";return i.trim()?"\n[code"+(t?"="+t:"")+"]"+i+"[/code]":""}if("CODE"===e.nodeName)return"`"+e.innerText+"`";if("P"===e.nodeName)return"\n"+y(e.childNodes,[...t,e.nodeName]);if("UL"===e.nodeName||"OL"===e.nodeName)return(0===t.filter((e=>"OL"===e||"UL"===e)).length?"\n":"")+y(e.childNodes,[...t,e.nodeName]);if("LI"===e.nodeName){let a="";const i=t.filter((e=>"OL"===e||"UL"===e)).length;for(let e=1;ee.id&&!e.isRemoved)).map((e=>e.id))}var A,R=s(12891),D=s(78657),j=s(53904),U=s(94184),z=s.n(U),M=s(32233),B=s(69092),q=s(59801),F=s(48772);function H(e){let{attachment:t}=e;return(0,n.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,A||(A=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Attachment details"))),(0,n.Z)("div",{className:"modal-body"},void 0,!!t.is_image&&(0,n.Z)("div",{className:"markup-editor-attachment-modal-preview"},void 0,(0,n.Z)("a",{href:t.url.index+"?shva=1",target:"_blank"},void 0,(0,n.Z)("img",{src:t.url.index+"?shva=1",alt:""}))),(0,n.Z)("div",{className:"markup-editor-attachment-modal-filename"},void 0,t.filename),(0,n.Z)("div",{className:"row markup-editor-attachment-modal-details"},void 0,(0,n.Z)("div",{className:"col-xs-12 col-md-3"},void 0,(0,n.Z)("strong",{},void 0,t.filetype+", "+(0,F.Z)(t.size)),(0,n.Z)("div",{className:"text-muted"},void 0,(0,n.Z)("small",{},void 0,pgettext("markup editor","Type and size")))),(0,n.Z)("div",{className:"col-xs-12 col-md-4"},void 0,(0,n.Z)("strong",{},void 0,(0,n.Z)("abbr",{title:t.uploaded_on.format("LLL")},void 0,t.uploaded_on.fromNow())),(0,n.Z)("div",{className:"text-muted"},void 0,(0,n.Z)("small",{},void 0,pgettext("markup editor","Uploaded at")))),(0,n.Z)("div",{className:"col-xs-12 col-md-3"},void 0,t.url.uploader?(0,n.Z)("a",{href:t.url.uploader,target:"_blank",className:"item-title"},void 0,t.uploader_name):(0,n.Z)("span",{className:"item-title"},void 0,t.uploader_name),(0,n.Z)("div",{className:"text-muted"},void 0,(0,n.Z)("small",{},void 0,pgettext("markup editor","Uploader")))))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("modal","Close")))))}const Y=(e,t,s,a,i)=>{const o=e.text||i||"";let n=e.prefix;n+=s+o+a,n+=e.suffix,t(n),window.setTimeout((()=>{W(e.textarea);const t=e.start+s.length;e.textarea.setSelectionRange(t,t+o.length)}),250)},V=(e,t,s)=>{let a=e.prefix;a+=s,a+=e.suffix,t(a),window.setTimeout((()=>{W(e.textarea);const t=e.end+s.length;e.textarea.setSelectionRange(t,t)}),250)},G=e=>{if(document.selection){e.focus();const t=document.selection.createRange(),s=t.text.length;return t.moveStart("character",-e.value.length),$(e,t.text.length-s,t.text.length)}if(e.selectionStart||"0"==e.selectionStart)return $(e,e.selectionStart,e.selectionEnd)},$=(e,t,s)=>({textarea:e,start:t,end:s,text:e.value.substring(t,s),prefix:e.value.substring(0,t),suffix:e.value.substring(s)});function W(e){const t=e.scrollTop;e.focus(),e.scrollTop=t}var Q,X,K,J,ee,te,se=e=>{var t;let{attachment:s,disabled:a,element:i,setState:o,update:r}=e;return(0,n.Z)("div",{className:"markup-editor-attachments-item"},void 0,(0,n.Z)("div",{className:"markup-editor-attachment"},void 0,(0,n.Z)("div",{className:"markup-editor-attachment-details"},void 0,s.id?(0,n.Z)("a",{className:"item-title",href:s.url.index+"?shva=1",target:"_blank",onClick:e=>{e.preventDefault(),q.Z.show(t||(t=(0,n.Z)(H,{attachment:s})))}},void 0,s.filename):(0,n.Z)("strong",{className:"item-title"},void 0,s.filename),(0,n.Z)("div",{className:"text-muted"},void 0,(0,n.Z)("ul",{className:"list-unstyled list-inline"},void 0,!s.id&&(0,n.Z)("li",{},void 0,s.progress+"%"),!!s.filetype&&(0,n.Z)("li",{},void 0,s.filetype),s.size>0&&(0,n.Z)("li",{},void 0,(0,F.Z)(s.size))))),!!s.id&&(0,n.Z)("div",{className:"markup-editor-attachment-buttons"},void 0,(0,n.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Insert into message"),type:"button",disabled:a,onClick:()=>{const e=function(e){let t="[";return e.is_image?(t+="!["+e.filename+"]",t+="("+(e.url.thumb||e.url.index)+"?shva=1)"):t+=e.filename,t+="]("+e.url.index+"?shva=1)",t}(s),t=G(i);V(t,r,e)}},void 0,Q||(Q=(0,n.Z)("span",{className:"material-icon"},void 0,"flip_to_front"))),(0,n.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Remove attachment"),type:"button",disabled:a,onClick:()=>{o((e=>{let{attachments:t}=e;if(window.confirm(pgettext("markup editor","Remove this attachment?")))return{attachments:t.filter((e=>{let{id:t}=e;return t!==s.id}))}}))}},void 0,X||(X=(0,n.Z)("span",{className:"material-icon"},void 0,"close")))),!s.id&&!!s.key&&(0,n.Z)("div",{className:"markup-editor-attachment-buttons"},void 0,s.error&&(0,n.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","See error"),type:"button",onClick:()=>{j.Z.error(interpolate(pgettext("markup editor","%(filename)s: %(error)s"),{filename:s.filename,error:s.error},!0))}},void 0,K||(K=(0,n.Z)("span",{className:"material-icon"},void 0,"warning"))),(0,n.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Remove attachment"),type:"button",disabled:a,onClick:()=>{o((e=>{let{attachments:t}=e;return{attachments:t.filter((e=>{let{key:t}=e;return t!==s.key}))}}))}},void 0,J||(J=(0,n.Z)("span",{className:"material-icon"},void 0,"close"))))))},ae=e=>{let{attachments:t,disabled:s,element:a,setState:i,update:o}=e;return(0,n.Z)("div",{className:"markup-editor-attachments"},void 0,(0,n.Z)("div",{className:"markup-editor-attachments-container"},void 0,t.map((e=>(0,n.Z)(se,{attachment:e,disabled:s,element:a,setState:i,update:o},e.key||e.id)))))},ie=s(82211),oe=e=>{let{canProtect:t,disabled:s,empty:a,preview:i,isProtected:o,submitText:r,showPreview:l,closePreview:d,enableProtection:c,disableProtection:p}=e;return(0,n.Z)("div",{className:"markup-editor-footer"},void 0,!!t&&(0,n.Z)(ie.Z,{className:"btn-default btn-icon hidden-sm hidden-md hidden-lg",title:o?pgettext("markup editor","Protected"):pgettext("markup editor","Protect"),type:"button",disabled:s,onClick:()=>{o?p():c()}},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,o?"lock":"lock_open")),!!t&&(0,n.Z)("div",{},void 0,(0,n.Z)(ie.Z,{className:"btn-default hidden-xs",type:"button",disabled:s,onClick:()=>{o?p():c()}},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,o?"lock":"lock_open"),o?pgettext("markup editor","Protected"):pgettext("markup editor","Protect"))),ee||(ee=(0,n.Z)("div",{className:"markup-editor-spacer"})),i?(0,n.Z)(ie.Z,{className:"btn-default btn-auto",type:"button",onClick:d},void 0,pgettext("markup editor","Edit")):(0,n.Z)(ie.Z,{className:"btn-default btn-auto",disabled:s||a,type:"button",onClick:l},void 0,pgettext("markup editor","Preview")),(0,n.Z)(ie.Z,{className:"btn-primary btn-auto",disabled:s||a},void 0,r||pgettext("markup editor","Post")))},ne=s(96359);class re extends o().Component{constructor(e){super(e),(0,r.Z)(this,"handleSubmit",(e=>{e.preventDefault();const{selection:t,update:s}=this.props,a=this.state.syntax.trim(),i=this.state.text.trim();if(0===i.length)return this.setState({error:gettext("This field is required.")}),!1;const o=t.prefix.trim().length?"\n\n":"";return V(Object.assign({},t,{text:i}),s,o+"```"+a+"\n"+i+"\n```\n\n"),q.Z.hide(),!1})),this.state={error:null,syntax:"",text:e.selection.text}}render(){return(0,n.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,te||(te=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Code"))),(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)(ne.Z,{for:"markup_code_syntax",label:pgettext("markup editor","Syntax highlighting")},void 0,(0,n.Z)("select",{id:"markup_code_syntax",className:"form-control",value:this.state.syntax,onChange:e=>this.setState({syntax:e.target.value})},void 0,(0,n.Z)("option",{value:""},void 0,pgettext("markup editor","No syntax highlighting")),le.map((e=>{let{value:t,name:s}=e;return(0,n.Z)("option",{value:t},t,s)})))),(0,n.Z)(ne.Z,{for:"markup_code_text",label:pgettext("markup editor","Code to insert"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,n.Z)("textarea",{id:"markup_code_text",className:"form-control",rows:"8",value:this.state.text,onChange:e=>this.setState({text:e.target.value})}))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,n.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert code"))))))}}const le=[{value:"bash",name:"Bash"},{value:"c",name:"C"},{value:"c#",name:"C#"},{value:"c++",name:"C++"},{value:"css",name:"CSS"},{value:"diff",name:"Diff"},{value:"go",name:"Go"},{value:"graphql",name:"GraphQL"},{value:"html,",name:"HTML"},{value:"xml",name:"XML"},{value:"json",name:"JSON"},{value:"java",name:"Java"},{value:"javascript",name:"JavaScript"},{value:"kotlin",name:"Kotlin"},{value:"less",name:"Less"},{value:"lua",name:"Lua"},{value:"makefile",name:"Makefile"},{value:"markdown",name:"Markdown"},{value:"objective-C",name:"Objective-C"},{value:"php",name:"PHP"},{value:"perl",name:"Perl"},{value:"plain",name:"Plain"},{value:"text",name:"text"},{value:"python",name:"Python"},{value:"repl",name:"REPL"},{value:"r",name:"R"},{value:"ruby",name:"Ruby"},{value:"rust",name:"Rust"},{value:"scss",name:"SCSS"},{value:"sql",name:"SQL"},{value:"shell",name:"Shell Session"},{value:"swift",name:"Swift"},{value:"toml",name:"TOML"},{value:"ini",name:"INI"},{value:"typescript",name:"TypeScript"},{value:"visualbasic",name:"Visual Basic .NET"},{value:"webassembly",name:"WebAssembly"},{value:"yaml",name:"YAML"}];var de,ce,pe,ue,he,me,ve,ge,Ze,fe,be,_e,Ne,xe,ye,we,ke,Ce,Se,Ee,Te,Le,Pe,Oe,Ie,Ae,Re,De,je,Ue,ze,Me,Be,qe,Fe,He,Ye,Ve,Ge,$e,We,Qe,Xe,Ke,Je,et=re;function tt(){return(0,n.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,de||(de=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup help","Formatting help"))),(0,n.Z)("div",{className:"modal-body formatting-help"},void 0,(0,n.Z)("h4",{},void 0,pgettext("markup help","Emphasis text")),(0,n.Z)(st,{markup:pgettext("markup help","_This text will have emphasis_"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("em",{},void 0,pgettext("markup help","This text will have emphasis")))}),ce||(ce=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Bold text")),(0,n.Z)(st,{markup:pgettext("markup help","**This text will be bold**"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("strong",{},void 0,pgettext("markup help","This text will be bold")))}),pe||(pe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Removed text")),(0,n.Z)(st,{markup:pgettext("markup help","~~This text will be removed~~"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("del",{},void 0,pgettext("markup help","This text will be removed")))}),ue||(ue=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Bold text (BBCode)")),(0,n.Z)(st,{markup:pgettext("markup help","[b]This text will be bold[/b]"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("b",{},void 0,pgettext("markup help","This text will be bold")))}),he||(he=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Underlined text (BBCode)")),(0,n.Z)(st,{markup:pgettext("markup help","[u]This text will be underlined[/u]"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("u",{},void 0,pgettext("markup help","This text will be underlined")))}),me||(me=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Italics text (BBCode)")),(0,n.Z)(st,{markup:pgettext("markup help","[i]This text will be in italics[/i]"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("i",{},void 0,pgettext("markup help","This text will be in italics")))}),ve||(ve=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Link")),ge||(ge=(0,n.Z)(st,{markup:"",result:(0,n.Z)("p",{},void 0,(0,n.Z)("a",{href:"#"},void 0,"example.com"))})),Ze||(Ze=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Link with text")),(0,n.Z)(st,{markup:"["+pgettext("markup help","Link text")+"](http://example.com)",result:(0,n.Z)("p",{},void 0,(0,n.Z)("a",{href:"#"},void 0,pgettext("markup help","Link text")))}),fe||(fe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Link (BBCode)")),be||(be=(0,n.Z)(st,{markup:"[url]http://example.com[/url]",result:(0,n.Z)("p",{},void 0,(0,n.Z)("a",{href:"#"},void 0,"example.com"))})),_e||(_e=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Link with text (BBCode)")),(0,n.Z)(st,{markup:"[url=http://example.com]"+pgettext("markup help","Link text")+"[/url]",result:(0,n.Z)("p",{},void 0,(0,n.Z)("a",{href:"#"},void 0,pgettext("markup help","Link text")))}),Ne||(Ne=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Image")),xe||(xe=(0,n.Z)(st,{markup:"!(http://placekitten.com/38/38)",result:(0,n.Z)("p",{},void 0,(0,n.Z)("img",{alt:"",src:"http://placekitten.com/38/38"}))})),ye||(ye=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Image with alternate text")),(0,n.Z)(st,{markup:"!["+pgettext("markup help","Image text")+"](http://placekitten.com/38/38)",result:(0,n.Z)("p",{},void 0,(0,n.Z)("img",{alt:pgettext("markup help","Image text"),src:"http://placekitten.com/38/38"}))}),we||(we=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Image (BBCode)")),ke||(ke=(0,n.Z)(st,{markup:"[img]http://placekitten.com/38/38[/img]",result:(0,n.Z)("p",{},void 0,(0,n.Z)("img",{alt:"",src:"http://placekitten.com/38/38"}))})),Ce||(Ce=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Mention user by their name")),Se||(Se=(0,n.Z)(st,{markup:"@username",result:(0,n.Z)("p",{},void 0,(0,n.Z)("a",{href:"#"},void 0,"@username"))})),Ee||(Ee=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Heading 1")),(0,n.Z)(st,{markup:pgettext("markup help","# First level heading"),result:(0,n.Z)("h1",{},void 0,pgettext("markup help","First level heading"))}),Te||(Te=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Heading 2")),(0,n.Z)(st,{markup:pgettext("markup help","## Second level heading"),result:(0,n.Z)("h2",{},void 0,pgettext("markup help","Second level heading"))}),Le||(Le=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Heading 3")),(0,n.Z)(st,{markup:pgettext("markup help","### Third level heading"),result:(0,n.Z)("h3",{},void 0,pgettext("markup help","Third level heading"))}),Pe||(Pe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Heading 4")),(0,n.Z)(st,{markup:pgettext("markup help","#### Fourth level heading"),result:(0,n.Z)("h4",{},void 0,pgettext("markup help","Fourth level heading"))}),Oe||(Oe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Heading 5")),(0,n.Z)(st,{markup:pgettext("markup help","##### Fifth level heading"),result:(0,n.Z)("h5",{},void 0,pgettext("markup help","Fifth level heading"))}),Ie||(Ie=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Unordered list")),Ae||(Ae=(0,n.Z)(st,{markup:"- Lorem ipsum\n- Dolor met\n- Vulputate lectus",result:(0,n.Z)("ul",{},void 0,(0,n.Z)("li",{},void 0,"Lorem ipsum"),(0,n.Z)("li",{},void 0,"Dolor met"),(0,n.Z)("li",{},void 0,"Vulputate lectus"))})),Re||(Re=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Ordered list")),De||(De=(0,n.Z)(st,{markup:"1. Lorem ipsum\n2. Dolor met\n3. Vulputate lectus",result:(0,n.Z)("ol",{},void 0,(0,n.Z)("li",{},void 0,"Lorem ipsum"),(0,n.Z)("li",{},void 0,"Dolor met"),(0,n.Z)("li",{},void 0,"Vulputate lectus"))})),je||(je=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Quote text")),(0,n.Z)(st,{markup:"> "+pgettext("markup help","Quoted text"),result:(0,n.Z)("blockquote",{},void 0,(0,n.Z)("p",{},void 0,pgettext("markup help","Quoted text")))}),Ue||(Ue=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Quote text (BBCode)")),(0,n.Z)(st,{markup:"[quote]\n"+pgettext("markup help","Quoted text")+"\n[/quote]",result:(0,n.Z)("aside",{className:"quote-block"},void 0,(0,n.Z)("div",{className:"quote-heading"},void 0,gettext("Quoted message:")),(0,n.Z)("blockquote",{className:"quote-body"},void 0,(0,n.Z)("p",{},void 0,pgettext("markup help","Quoted text"))))}),ze||(ze=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Quote text with author (BBCode)")),(0,n.Z)(st,{markup:'[quote="'+pgettext("markup help","Quote author")+'"]\n'+pgettext("markup help","Quoted text")+"\n[/quote]",result:(0,n.Z)("aside",{className:"quote-block"},void 0,(0,n.Z)("div",{className:"quote-heading"},void 0,pgettext("markup help","Quote author has written:")),(0,n.Z)("blockquote",{className:"quote-body"},void 0,(0,n.Z)("p",{},void 0,pgettext("markup help","Quoted text"))))}),Me||(Me=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Spoiler")),(0,n.Z)(st,{markup:"[spoiler]\n"+pgettext("markup help","Secret text")+"\n[/spoiler]",result:(0,n.Z)(at,{},void 0,pgettext("markup help","Secret text"))}),Be||(Be=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Inline code")),(0,n.Z)(st,{markup:pgettext("markup help","`Inline code`"),result:(0,n.Z)("p",{},void 0,(0,n.Z)("code",{},void 0,pgettext("markup help","Inline code")))}),qe||(qe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Code block")),Fe||(Fe=(0,n.Z)(st,{markup:'```\nalert("Hello world!");\n```',result:(0,n.Z)("pre",{},void 0,(0,n.Z)("code",{className:"hljs"},void 0,'alert("Hello world!");'))})),He||(He=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Code block with syntax highlighting")),Ye||(Ye=(0,n.Z)(st,{markup:'```python\nprint("Hello world!");\n```',result:(0,n.Z)("pre",{},void 0,(0,n.Z)("code",{className:"hljs language-python"},void 0,(0,n.Z)("span",{className:"hljs-built_in"},void 0,"print"),'("Hello world!");'))})),Ve||(Ve=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Code block (BBCode)")),Ge||(Ge=(0,n.Z)(st,{markup:'[code]\nalert("Hello world!");\n[/code]',result:(0,n.Z)("pre",{},void 0,(0,n.Z)("code",{className:"hljs"},void 0,'alert("Hello world!");'))})),$e||($e=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Code block with syntax highlighting (BBCode)")),We||(We=(0,n.Z)(st,{markup:'[code="python"]\nprint("Hello world!");\n[/code]',result:(0,n.Z)("pre",{},void 0,(0,n.Z)("code",{className:"hljs language-python"},void 0,(0,n.Z)("span",{className:"hljs-built_in"},void 0,"print"),'("Hello world!");'))})),Qe||(Qe=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Horizontal rule")),Xe||(Xe=(0,n.Z)(st,{markup:"Lorem ipsum\n- - -\nDolor met",result:(0,n.Z)("div",{},void 0,(0,n.Z)("p",{},void 0,"Lorem ipsum"),(0,n.Z)("hr",{}),(0,n.Z)("p",{},void 0,"Dolor met"))})),Ke||(Ke=(0,n.Z)("hr",{})),(0,n.Z)("h4",{},void 0,pgettext("markup help","Horizontal rule (BBCode)")),Je||(Je=(0,n.Z)(st,{markup:"Lorem ipsum\n[hr]\nDolor met",result:(0,n.Z)("div",{},void 0,(0,n.Z)("p",{},void 0,"Lorem ipsum"),(0,n.Z)("hr",{}),(0,n.Z)("p",{},void 0,"Dolor met"))}))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("modal","Close")))))}function st(e){let{markup:t,result:s}=e;return(0,n.Z)("div",{className:"formatting-help-item"},void 0,(0,n.Z)("div",{className:"formatting-help-item-markup"},void 0,(0,n.Z)("pre",{},void 0,(0,n.Z)("code",{},void 0,t))),(0,n.Z)("div",{className:"formatting-help-item-preview"},void 0,(0,n.Z)("article",{className:"misago-markup"},void 0,s)))}class at extends o().Component{constructor(e){super(e),this.state={reveal:!1}}render(){return(0,n.Z)("aside",{className:this.state.reveal?"spoiler-block revealed":"spoiler-block"},void 0,(0,n.Z)("blockquote",{className:"spoiler-body"},void 0,(0,n.Z)("p",{},void 0,this.props.children)),!this.state.reveal&&(0,n.Z)("div",{className:"spoiler-overlay"},void 0,(0,n.Z)("button",{className:"spoiler-reveal",type:"button",onClick:()=>{this.setState({reveal:!0})}},void 0,gettext("Reveal spoiler"))))}}const it=new RegExp("^(((ftps?)|(https?))://)","i");function ot(e){return it.test(e.trim())}var nt;class rt extends o().Component{constructor(e){super(e),(0,r.Z)(this,"handleSubmit",(e=>{e.preventDefault();const{selection:t,update:s}=this.props,a=this.state.text.trim(),i=this.state.url.trim();return 0===i.length?(this.setState({error:gettext("This field is required.")}),!1):(a.length>0?V(t,s,"!["+a+"]("+i+")"):V(t,s,"!("+i+")"),q.Z.hide(),!1)}));const t=e.selection.text.trim(),s=ot(t);this.state={error:null,text:s?"":t,url:s?t:""}}render(){return(0,n.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,nt||(nt=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Image"))),(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)(ne.Z,{for:"markup_image_text",label:pgettext("markup editor","Image description"),helpText:pgettext("markup editor","Optional but recommended . Will be displayed instead of image when it fails to load.")},void 0,(0,n.Z)("input",{id:"markup_image_text",className:"form-control",type:"text",value:this.state.text,onChange:e=>this.setState({text:e.target.value})})),(0,n.Z)(ne.Z,{for:"markup_image_url",label:pgettext("markup editor","Image URL"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,n.Z)("input",{id:"markup_image_url",className:"form-control",type:"text",value:this.state.url,placeholder:"http://domain.com/image.png",onChange:e=>this.setState({url:e.target.value})}))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,n.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert image"))))))}}var lt,dt=rt;class ct extends o().Component{constructor(e){super(e),(0,r.Z)(this,"handleSubmit",(e=>{e.preventDefault();const{selection:t,update:s}=this.props,a=this.state.text.trim(),i=this.state.url.trim();return 0===i.length?(this.setState({error:gettext("This field is required.")}),!1):(a.length>0?V(t,s,"["+a+"]("+i+")"):V(t,s,"<"+i+">"),q.Z.hide(),!1)}));const t=e.selection.text.trim(),s=ot(t);this.state={error:null,text:s?"":t,url:s?t:""}}render(){return(0,n.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,lt||(lt=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Link"))),(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)(ne.Z,{for:"markup_link_url",label:pgettext("markup editor","Link text"),helpText:pgettext("markup editor","Optional. Will be displayed instead of link's address.")},void 0,(0,n.Z)("input",{id:"markup_link_text",className:"form-control",type:"text",value:this.state.text,onChange:e=>this.setState({text:e.target.value})})),(0,n.Z)(ne.Z,{for:"markup_link_url",label:pgettext("markup editor","Link address"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,n.Z)("input",{id:"markup_link_url",className:"form-control",type:"text",value:this.state.url,onChange:e=>this.setState({url:e.target.value})}))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,n.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert link"))))))}}var pt,ut=ct;class ht extends o().Component{constructor(e){super(e),(0,r.Z)(this,"handleSubmit",(e=>{e.preventDefault();const{selection:t,update:s}=this.props,a=this.state.author.trim(),i=this.state.text.trim();if(0===i.length)return this.setState({error:gettext("This field is required.")}),!1;const o=t.prefix.trim().length?"\n\n":"";return V(t,s,a?o+'[quote="'+a+'"]\n'+i+"\n[/quote]\n\n":o+"[quote]\n"+i+"\n[/quote]\n\n"),q.Z.hide(),!1})),this.state={error:null,author:"",text:e.selection.text}}render(){return(0,n.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,pt||(pt=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Quote"))),(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)(ne.Z,{for:"markup_quote_author",label:pgettext("markup editor","Quote's author or source"),helpText:pgettext("markup editor",'Optional. If it\'s username, put "@" before it ("@JohnDoe").')},void 0,(0,n.Z)("input",{id:"markup_quote_author",className:"form-control",type:"text",value:this.state.author,onChange:e=>this.setState({author:e.target.value})})),(0,n.Z)(ne.Z,{for:"markup_quote_text",label:pgettext("markup editor","Quoted text"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,n.Z)("textarea",{id:"markup_quote_text",className:"form-control",rows:"8",value:this.state.text,onChange:e=>this.setState({text:e.target.value})}))),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,n.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert quote"))))))}}var mt,vt,gt=ht,Zt=e=>{let{disabled:t,icon:s,title:a,onClick:i}=e;return(0,n.Z)("button",{className:"btn btn-markup-editor",title:a,type:"button",disabled:t,onClick:i},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,s))},ft=s(54031),bt=(e,t)=>{const s=1024*M.Z.get("user").acl.max_attachment_size;if(e.size>s)return void j.Z.error(interpolate(pgettext("markup editor","File %(filename)s is bigger than %(limit)s."),{filename:e.name,limit:(0,F.Z)(s)},!0));let a={id:null,key:(0,ft.ZP)(32),error:null,uploaded_on:null,progress:0,filename:e.name,filetype:null,is_image:!1,size:e.size,url:null,uploader_name:null};t((e=>{let{attachments:t}=e;return{attachments:[a].concat(t)}}));const i=()=>{t((e=>{let{attachments:t}=e;return{attachments:t.concat()}}))},o=new FormData;o.append("upload",e),D.Z.upload(M.Z.get("ATTACHMENTS_API"),o,(e=>{a.progress=e,i()})).then((e=>{Object.assign(a,e,{uploaded_on:O()(e.uploaded_on)}),i()}),(e=>{400===e.status||413===e.status?(a.error=e.detail,j.Z.error(e.detail),i()):j.Z.apiError(e)}))};var _t=e=>{let{disabled:t,element:s,update:a,updateAttachments:i}=e;const o=[{name:pgettext("markup editor","Strong"),icon:"format_bold",onClick:()=>{Y(G(s),a,"**","**",pgettext("example markup","Strong text"))}},{name:pgettext("markup editor","Emphasis"),icon:"format_italic",onClick:()=>{Y(G(s),a,"*","*",pgettext("example markup","Text with emphasis"))}},{name:pgettext("markup editor","Strikethrough"),icon:"format_strikethrough",onClick:()=>{Y(G(s),a,"~~","~~",pgettext("example markup","Text with strikethrough"))}},{name:pgettext("markup editor","Horizontal ruler"),icon:"remove",onClick:()=>{V(G(s),a,"\n\n- - -\n\n")}},{name:pgettext("markup editor","Link"),icon:"insert_link",onClick:()=>{const e=G(s);q.Z.show((0,n.Z)(ut,{selection:e,element:s,update:a}))}},{name:pgettext("markup editor","Image"),icon:"insert_photo",onClick:()=>{const e=G(s);q.Z.show((0,n.Z)(dt,{selection:e,element:s,update:a}))}},{name:pgettext("markup editor","Quote"),icon:"format_quote",onClick:()=>{const e=G(s);q.Z.show((0,n.Z)(gt,{selection:e,element:s,update:a}))}},{name:pgettext("markup editor","Spoiler"),icon:"visibility_off",onClick:()=>{((e,t)=>{const s=G(e),a=s.prefix.trim().length?"\n\n":"";Y(s,t,a+"[spoiler]\n","\n[/spoiler]\n\n",pgettext("markup editor","Spoiler text"))})(s,a)}},{name:pgettext("markup editor","Code"),icon:"code",onClick:()=>{const e=G(s);q.Z.show((0,n.Z)(et,{selection:e,element:s,update:a}))}}];return M.Z.get("user").acl.max_attachment_size&&o.push({name:pgettext("markup editor","Upload file"),icon:"file_upload",onClick:()=>(e=>{const t=document.createElement("input");t.type="file",t.multiple="multiple",t.addEventListener("change",(function(){for(let s=0;s{let{name:a,icon:i,onClick:o}=e;return(0,n.Z)(Zt,{title:a,icon:i,disabled:t||!s,onClick:o},i)}))),(0,n.Z)("div",{className:"markup-editor-toolbar-right"},void 0,(0,n.Z)("div",{className:"markup-editor-controls-dropdown"},void 0,(0,n.Z)("button",{type:"button",className:"btn btn-markup-editor dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false",disabled:t||!s},void 0,mt||(mt=(0,n.Z)("span",{className:"material-icon"},void 0,"more_vert"))),(0,n.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,o.map((e=>{let{name:a,icon:i,onClick:o}=e;return(0,n.Z)("li",{},i,(0,n.Z)("button",{type:"button",className:"btn-link",disabled:t||!s,onClick:o},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,i),a))})))),(0,n.Z)(Zt,{title:pgettext("markup editor","Open formatting help"),icon:"help_outline",onClick:()=>{q.Z.show(vt||(vt=(0,n.Z)(tt,{})))}})))},Nt=s(19755);class xt extends o().Component{constructor(e){super(e),(0,r.Z)(this,"showPreview",(()=>{this.state.loading||(this.setState({loading:!0,preview:!0,element:null}),D.Z.post(M.Z.get("PARSE_MARKUP_API"),{post:this.props.value}).then((e=>{this.setState({loading:!1,parsed:e.parsed})}),(e=>{400===e.status?j.Z.error(e.detail):j.Z.apiError(e),this.setState({loading:!1,preview:!1})})))})),(0,r.Z)(this,"closePreview",(()=>{this.setState({loading:!1,preview:!1})})),(0,r.Z)(this,"onDrop",(e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer.files)return;const{onAttachmentsChange:t}=this.props;if(M.Z.get("user").acl.max_attachment_size)for(let s=0;s{const{onAttachmentsChange:t}=this.props,s=[];for(let t=0;t(0,n.Z)("div",{className:z()("markup-editor",{"markup-editor-focused":this.state.focused&&!this.state.preview})},void 0,(0,n.Z)(_t,{disabled:this.props.disabled||this.state.preview,element:this.state.element,update:e=>this.props.onChange({target:{value:e}}),updateAttachments:this.props.onAttachmentsChange}),this.state.preview?(0,n.Z)("div",{className:"markup-editor-preview"},void 0,this.state.loading?(0,n.Z)("div",{className:"markup-editor-preview-loading"},void 0,(0,n.Z)("div",{className:"ui-preview"},void 0,(0,n.Z)("span",{className:"ui-preview-text",style:{width:"240px"}}))):(0,n.Z)(B.Z,{className:"markup-editor-preview-contents",markup:this.state.parsed})):o().createElement("textarea",{className:"markup-editor-textarea form-control",placeholder:this.props.placeholder,value:this.props.value,disabled:this.props.disabled||this.state.loading,rows:6,ref:e=>{e&&this.state.element!==e&&(this.setState({element:e}),function(e,t){Nt(t).atwho({at:"@",displayTpl:'
  • ${username}
  • ',insertTpl:"@${username}",searchKey:"username",callbacks:{remoteFilter:function(e,t){Nt.getJSON(M.Z.get("MENTION_API"),{q:e},t)}}}),Nt(t).on("inserted.atwho",((t,s,a,i)=>{const{query:o}=i,n=a.target.innerText.trim(),r=t.target.value.substr(0,o.headPos),l=t.target.value.substr(o.endPos);t.target.value=r+n+l,e.onChange(t);const d=o.headPos+n.length;t.target.setSelectionRange(d,d),t.target.focus()}))}(this.props,e))},onChange:this.props.onChange,onDrop:this.onDrop,onFocus:()=>this.setState({focused:!0}),onPaste:this.onPaste,onBlur:()=>this.setState({focused:!1})}),this.props.attachments.length>0&&(0,n.Z)(ae,{attachments:this.props.attachments,disabled:this.props.disabled||this.state.preview,element:this.state.element,setState:this.props.onAttachmentsChange,update:e=>this.props.onChange({target:{value:e}})}),(0,n.Z)(oe,{preview:this.state.preview,canProtect:this.props.canProtect,isProtected:this.props.isProtected,disabled:this.props.disabled,empty:this.props.value.trim().length{let{children:t}=e;return(0,n.Z)("div",{className:"posting-dialog-body"},void 0,t)},Gt=e=>{let{close:t,message:s}=e;return(0,n.Z)("div",{className:"posting-dialog-error"},void 0,Lt||(Lt=(0,n.Z)("div",{className:"posting-dialog-error-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,"error_outlined"))),(0,n.Z)("div",{className:"posting-dialog-error-detail"},void 0,(0,n.Z)("p",{},void 0,s),(0,n.Z)("button",{type:"button",className:"btn btn-default",onClick:t},void 0,pgettext("modal","Close"))))},$t=e=>{let{children:t,close:s,fullscreen:a,minimize:i,minimized:o,fullscreenEnter:r,fullscreenExit:l,open:d}=e;return(0,n.Z)("div",{className:"posting-dialog-header"},void 0,(0,n.Z)("div",{className:"posting-dialog-caption"},void 0,t),o?(0,n.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Open"),type:"button",onClick:d},void 0,Pt||(Pt=(0,n.Z)("span",{className:"material-icon"},void 0,"expand_less"))):(0,n.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Minimize"),type:"button",onClick:i},void 0,Ot||(Ot=(0,n.Z)("span",{className:"material-icon"},void 0,"expand_more"))),a?(0,n.Z)("button",{className:"btn btn-posting-dialog hidden-xs",title:pgettext("dialog","Exit the fullscreen mode"),type:"button",onClick:l},void 0,It||(It=(0,n.Z)("span",{className:"material-icon"},void 0,"fullscreen_exit"))):(0,n.Z)("button",{className:"btn btn-posting-dialog hidden-xs",title:pgettext("dialog","Enter the fullscreen mode"),type:"button",onClick:r},void 0,At||(At=(0,n.Z)("span",{className:"material-icon"},void 0,"fullscreen"))),(0,n.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Cancel"),type:"button",onClick:s},void 0,Rt||(Rt=(0,n.Z)("span",{className:"material-icon"},void 0,"close"))))};function Wt(e){let{isClosed:t,isHidden:s,isPinned:a,disabled:i,options:o,close:r,open:l,hide:d,unhide:c,pinGlobally:p,pinLocally:u,unpin:h}=e;const m=function(e,t,s){const a=[];return 2===s&&a.push("bookmark"),1===s&&a.push("bookmark_outline"),e&&a.push("lock"),t&&a.push("visibility_off"),a}(t,s,a);return(0,n.Z)("div",{className:"dropdown"},void 0,(0,n.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:pgettext("post thread","Options"),"aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button",disabled:i},void 0,m.length>0?(0,n.Z)("span",{className:"btn-icons-family"},void 0,m.map((e=>(0,n.Z)("span",{className:"material-icon"},e,e)))):Dt||(Dt=(0,n.Z)("span",{className:"material-icon"},void 0,"more_horiz"))),(0,n.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,2===o.pin&&2!==a&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:p,type:"button",disabled:i},void 0,jt||(jt=(0,n.Z)("span",{className:"material-icon"},void 0,"bookmark")),pgettext("post thread","Pinned globally"))),o.pin>=a&&1!==a&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:u,type:"button",disabled:i},void 0,Ut||(Ut=(0,n.Z)("span",{className:"material-icon"},void 0,"bookmark_outline")),pgettext("post thread","Pinned in category"))),o.pin>=a&&0!==a&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:h,type:"button",disabled:i},void 0,zt||(zt=(0,n.Z)("span",{className:"material-icon"},void 0,"radio_button_unchecked")),pgettext("post thread","Not pinned"))),o.close&&!!t&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:l,type:"button",disabled:i},void 0,Mt||(Mt=(0,n.Z)("span",{className:"material-icon"},void 0,"lock_outline")),pgettext("post thread","Open"))),o.close&&!t&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:r,type:"button",disabled:i},void 0,Bt||(Bt=(0,n.Z)("span",{className:"material-icon"},void 0,"lock")),pgettext("post thread","Closed"))),o.hide&&!!s&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:c,type:"button",disabled:i},void 0,qt||(qt=(0,n.Z)("span",{className:"material-icon"},void 0,"visibility")),pgettext("post thread","Visible"))),o.hide&&!s&&(0,n.Z)("li",{},void 0,(0,n.Z)("button",{className:"btn btn-link",onClick:d,type:"button",disabled:i},void 0,Ft||(Ft=(0,n.Z)("span",{className:"material-icon"},void 0,"visibility_off")),pgettext("post thread","Hidden")))))}var Qt=class extends L.Z{constructor(e){super(e),(0,r.Z)(this,"loadSuccess",(e=>{let t=null,s=null;const a=e.map((e=>(!1===e.post||t&&e.id!=this.state.category||(t=e.id,s=e.post),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id}))));this.setState({isReady:!0,options:s,categories:a,category:t})})),(0,r.Z)(this,"loadError",(e=>{this.setState({error:e.detail})})),(0,r.Z)(this,"onCancel",(()=>{if(0===this.state.post.length&&0===this.state.title.length&&0===this.state.attachments.length)return this.minimize(),l.Z.close();window.confirm(pgettext("post thread","Are you sure you want to discard thread?"))&&(this.minimize(),l.Z.close())})),(0,r.Z)(this,"onTitleChange",(e=>{this.changeValue("title",e.target.value)})),(0,r.Z)(this,"onCategoryChange",(e=>{const t=this.state.categories.find((t=>e.target.value==t.value));let s=this.state.pin;t.post.pin&&t.post.pin{this.changeValue("post",e.target.value)})),(0,r.Z)(this,"onAttachmentsChange",(e=>{this.setState(e)})),(0,r.Z)(this,"onClose",(()=>{this.changeValue("close",!0)})),(0,r.Z)(this,"onOpen",(()=>{this.changeValue("close",!1)})),(0,r.Z)(this,"onPinGlobally",(()=>{this.changeValue("pin",2)})),(0,r.Z)(this,"onPinLocally",(()=>{this.changeValue("pin",1)})),(0,r.Z)(this,"onUnpin",(()=>{this.changeValue("pin",0)})),(0,r.Z)(this,"onHide",(()=>{this.changeValue("hide",!0)})),(0,r.Z)(this,"onUnhide",(()=>{this.changeValue("hide",!1)})),(0,r.Z)(this,"close",(()=>{this.minimize(),l.Z.close()})),(0,r.Z)(this,"minimize",(()=>{this.setState({fullscreen:!1,minimized:!0})})),(0,r.Z)(this,"open",(()=>{this.setState({minimized:!1}),this.state.fullscreen})),(0,r.Z)(this,"fullscreenEnter",(()=>{this.setState({fullscreen:!0,minimized:!1})})),(0,r.Z)(this,"fullscreenExit",(()=>{this.setState({fullscreen:!1,minimized:!1})})),this.state={isReady:!1,isLoading:!1,error:null,minimized:!1,fullscreen:!1,options:null,title:"",category:e.category||null,categories:[],post:"",attachments:[],close:!1,hide:!1,pin:0,validators:{title:(0,R.jn)(),post:(0,R.Jh)()},errors:{}}}componentDidMount(){D.Z.get(this.props.config).then(this.loadSuccess,this.loadError)}clean(){if(!this.state.title.trim().length)return j.Z.error(pgettext("posting form","You have to enter thread title.")),!1;if(!this.state.post.trim().length)return j.Z.error(pgettext("posting form","You have to enter a message.")),!1;const e=this.validate();return e.title?(j.Z.error(e.title[0]),!1):!e.post||(j.Z.error(e.post[0]),!1)}send(){return D.Z.post(this.props.submit,{title:this.state.title,category:this.state.category,post:this.state.post,attachments:I(this.state.attachments),close:this.state.close,hide:this.state.hide,pin:this.state.pin})}handleSuccess(e){this.setState({isLoading:!0}),this.close(),j.Z.success(pgettext("post thread","Your thread has been posted.")),window.location=e.url}handleError(e){if(400===e.status){const t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);j.Z.error(t[0])}else j.Z.apiError(e)}render(){const e={minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};if(this.state.error)return o().createElement(Xt,e,(0,n.Z)(Gt,{message:this.state.error,close:this.close}));if(!this.state.isReady)return o().createElement(Xt,e,(0,n.Z)("div",{className:"posting-loading ui-preview"},void 0,Ht||(Ht=(0,n.Z)(wt.o8,{className:"posting-dialog-toolbar"},void 0,(0,n.Z)(wt.Z2,{className:"posting-dialog-thread-title",auto:!0},void 0,(0,n.Z)(wt.Eg,{auto:!0},void 0,(0,n.Z)("input",{className:"form-control",disabled:!0,type:"text"}))),(0,n.Z)(wt.Z2,{className:"posting-dialog-category-select",auto:!0},void 0,(0,n.Z)(wt.Eg,{},void 0,(0,n.Z)("input",{className:"form-control",disabled:!0,type:"text"}))))),(0,n.Z)(yt,{attachments:[],value:"",submitText:pgettext("post thread submit","Start thread"),disabled:!0,onAttachmentsChange:()=>{},onChange:()=>{}})));const t=!!(this.state.options.close||this.state.options.hide||this.state.options.pin);return o().createElement(Xt,e,(0,n.Z)("form",{className:"posting-dialog-form",onSubmit:this.handleSubmit},void 0,(0,n.Z)(wt.o8,{className:"posting-dialog-toolbar"},void 0,(0,n.Z)(wt.Z2,{className:"posting-dialog-thread-title",auto:!0},void 0,(0,n.Z)(wt.Eg,{auto:!0},void 0,(0,n.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:pgettext("post thread","Thread title"),type:"text",value:this.state.title}))),(0,n.Z)(wt.Z2,{className:"posting-dialog-category-select",auto:!0},void 0,(0,n.Z)(wt.Eg,{},void 0,(0,n.Z)(T.Z,{choices:this.state.categories,disabled:this.state.isLoading,onChange:this.onCategoryChange,value:this.state.category})),t&&(0,n.Z)(wt.Eg,{shrink:!0},void 0,(0,n.Z)(Wt,{isClosed:this.state.close,isHidden:this.state.hide,isPinned:this.state.pin,disabled:this.state.isLoading,options:this.state.options,close:this.onClose,open:this.onOpen,hide:this.onHide,unhide:this.onUnhide,pinGlobally:this.onPinGlobally,pinLocally:this.onPinLocally,unpin:this.onUnpin})))),(0,n.Z)(yt,{attachments:this.state.attachments,value:this.state.post,submitText:pgettext("post thread submit","Start thread"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange})))}};const Xt=e=>{let{children:t,close:s,minimized:a,minimize:i,open:o,fullscreen:r,fullscreenEnter:l,fullscreenExit:d}=e;return(0,n.Z)(Yt,{fullscreen:r,minimized:a},void 0,(0,n.Z)($t,{fullscreen:r,fullscreenEnter:l,fullscreenExit:d,minimized:a,minimize:i,open:o,close:s},void 0,pgettext("post thread","Start new thread")),(0,n.Z)(Vt,{},void 0,t))};function Kt(e){const t=e.split(",").map((e=>e.trim().toLowerCase())).filter((e=>e.length>0));return t.filter(((e,s)=>t.indexOf(e)==s))}var Jt=class extends L.Z{constructor(e){super(e),(0,r.Z)(this,"onCancel",(()=>{if(0===this.state.post.length&&0===this.state.title.length&&0===this.state.to.length&&0===this.state.attachments.length)return this.close();window.confirm(pgettext("post thread","Are you sure you want to discard private thread?"))&&this.close()})),(0,r.Z)(this,"onToChange",(e=>{this.changeValue("to",e.target.value)})),(0,r.Z)(this,"onTitleChange",(e=>{this.changeValue("title",e.target.value)})),(0,r.Z)(this,"onPostChange",(e=>{this.changeValue("post",e.target.value)})),(0,r.Z)(this,"onAttachmentsChange",(e=>{this.setState(e)})),(0,r.Z)(this,"close",(()=>{this.minimize(),l.Z.close()})),(0,r.Z)(this,"minimize",(()=>{this.setState({fullscreen:!1,minimized:!0})})),(0,r.Z)(this,"open",(()=>{this.setState({minimized:!1}),this.state.fullscreen})),(0,r.Z)(this,"fullscreenEnter",(()=>{this.setState({fullscreen:!0,minimized:!1})})),(0,r.Z)(this,"fullscreenExit",(()=>{this.setState({fullscreen:!1,minimized:!1})}));const t=(e.to||[]).map((e=>e.username)).join(", ");this.state={isLoading:!1,error:null,minimized:!1,fullscreen:!1,to:t,title:"",post:"",attachments:[],validators:{title:(0,R.jn)(),post:(0,R.Jh)()},errors:{}}}clean(){if(!Kt(this.state.to).length)return j.Z.error(pgettext("posting form","You have to enter at least one recipient.")),!1;if(!this.state.title.trim().length)return j.Z.error(pgettext("posting form","You have to enter thread title.")),!1;if(!this.state.post.trim().length)return j.Z.error(pgettext("posting form","You have to enter a message.")),!1;const e=this.validate();return e.title?(j.Z.error(e.title[0]),!1):!e.post||(j.Z.error(e.post[0]),!1)}send(){return D.Z.post(this.props.submit,{to:Kt(this.state.to),title:this.state.title,post:this.state.post,attachments:I(this.state.attachments)})}handleSuccess(e){this.setState({isLoading:!0}),this.close(),j.Z.success(pgettext("post thread","Your thread has been posted.")),window.location=e.url}handleError(e){if(400===e.status){const t=[].concat(e.non_field_errors||[],e.to||[],e.title||[],e.post||[],e.attachments||[]);j.Z.error(t[0])}else j.Z.apiError(e)}render(){const e={minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return o().createElement(es,e,(0,n.Z)("form",{className:"posting-dialog-form",onSubmit:this.handleSubmit},void 0,(0,n.Z)(wt.o8,{className:"posting-dialog-toolbar"},void 0,(0,n.Z)(wt.Z2,{className:"posting-dialog-thread-recipients",auto:!0},void 0,(0,n.Z)(wt.Eg,{auto:!0},void 0,(0,n.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onToChange,placeholder:pgettext("post thread","Recipients, eg.: Danny, Lisa, Alice"),type:"text",value:this.state.to}))),(0,n.Z)(wt.Z2,{className:"posting-dialog-thread-title",auto:!0},void 0,(0,n.Z)(wt.Eg,{auto:!0},void 0,(0,n.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:pgettext("post thread","Thread title"),type:"text",value:this.state.title})))),(0,n.Z)(yt,{attachments:this.state.attachments,value:this.state.post,submitText:pgettext("post thread submit","Start thread"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange})))}};const es=e=>{let{children:t,close:s,minimized:a,minimize:i,open:o,fullscreen:r,fullscreenEnter:l,fullscreenExit:d}=e;return(0,n.Z)(Yt,{fullscreen:r,minimized:a},void 0,(0,n.Z)($t,{fullscreen:r,fullscreenEnter:l,fullscreenExit:d,minimized:a,minimize:i,open:o,close:s},void 0,pgettext("post thread","Start private thread")),(0,n.Z)(Vt,{},void 0,t))};var ts=class extends L.Z{constructor(e){super(e),(0,r.Z)(this,"loadSuccess",(e=>{this.setState({isReady:!0,post:e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":this.state.post}),this.quoteText=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":this.state.post})),(0,r.Z)(this,"loadError",(e=>{this.setState({error:e.detail})})),(0,r.Z)(this,"appendData",(e=>{const t=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";this.setState(((e,s)=>e.post.length>0?{post:e.post.trim()+"\n\n"+t}:{post:t})),this.open()})),(0,r.Z)(this,"onCancel",(()=>{if(this.state.post===this.quoteText&&0===this.state.attachments.length)return this.close();window.confirm(pgettext("post reply","Are you sure you want to discard your reply?"))&&this.close()})),(0,r.Z)(this,"onPostChange",(e=>{this.changeValue("post",e.target.value)})),(0,r.Z)(this,"onAttachmentsChange",(e=>{this.setState(e)})),(0,r.Z)(this,"onQuote",(e=>{this.setState((t=>{let{post:s}=t;return s.length>0?{post:s.trim()+"\n\n"+e}:{post:e}})),this.open()})),(0,r.Z)(this,"close",(()=>{this.minimize(),l.Z.close()})),(0,r.Z)(this,"minimize",(()=>{this.setState({fullscreen:!1,minimized:!0})})),(0,r.Z)(this,"open",(()=>{this.setState({minimized:!1}),this.state.fullscreen})),(0,r.Z)(this,"fullscreenEnter",(()=>{this.setState({fullscreen:!0,minimized:!1})})),(0,r.Z)(this,"fullscreenExit",(()=>{this.setState({fullscreen:!1,minimized:!1})})),this.state={isReady:!1,isLoading:!1,error:null,minimized:!1,fullscreen:!1,post:this.props.default||"",attachments:[],validators:{post:(0,R.Jh)()},errors:{}},this.quoteText=""}componentDidMount(){D.Z.get(this.props.config,this.props.context||null).then(this.loadSuccess,this.loadError),S(!1,this.onQuote)}componentWillUnmount(){E()}componentWillReceiveProps(e){const t=this.props.context,s=e.context;t&&s&&!s.reply||D.Z.get(e.config,e.context||null).then(this.appendData,j.Z.apiError)}clean(){if(!this.state.post.trim().length)return j.Z.error(pgettext("posting form","You have to enter a message.")),!1;const e=this.validate();return!e.post||(j.Z.error(e.post[0]),!1)}send(){return S(!0,this.onQuote),D.Z.post(this.props.submit,{post:this.state.post,attachments:I(this.state.attachments)})}handleSuccess(e){this.setState({isLoading:!0}),this.close(),S(!1,this.onQuote),j.Z.success(pgettext("post reply","Your reply has been posted.")),window.location=e.url.index}handleError(e){if(400===e.status){const t=[].concat(e.non_field_errors||[],e.post||[],e.attachments||[]);j.Z.error(t[0])}else j.Z.apiError(e);S(!1,this.onQuote)}render(){const e={thread:this.props.thread,minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return this.state.error?o().createElement(ss,e,(0,n.Z)(Gt,{message:this.state.error,close:this.close})):this.state.isReady?o().createElement(ss,e,(0,n.Z)("form",{className:"posting-dialog-form",method:"POST",onSubmit:this.handleSubmit},void 0,(0,n.Z)(yt,{attachments:this.state.attachments,value:this.state.post,submitText:pgettext("post reply submit","Post reply"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange}))):o().createElement(ss,e,(0,n.Z)("div",{className:"posting-loading ui-preview"},void 0,(0,n.Z)(yt,{attachments:[],value:"",submitText:pgettext("post reply submit","Post reply"),disabled:!0,onAttachmentsChange:()=>{},onChange:()=>{}})))}};const ss=e=>{let{children:t,close:s,minimized:a,minimize:i,open:o,fullscreen:r,fullscreenEnter:l,fullscreenExit:d,thread:c}=e;return(0,n.Z)(Yt,{fullscreen:r,minimized:a},void 0,(0,n.Z)($t,{fullscreen:r,fullscreenEnter:l,fullscreenExit:d,minimized:a,minimize:i,open:o,close:s},void 0,interpolate(pgettext("post reply","Reply to: %(thread)s"),{thread:c.title},!0)),(0,n.Z)(Vt,{},void 0,t))};var as=class extends L.Z{constructor(e){super(e),(0,r.Z)(this,"loadSuccess",(e=>{var t;this.originalPost=e.post,this.setState({isReady:!0,post:e.post,attachments:(t=e.attachments,t.map((e=>Object.assign({},e,{uploaded_on:O()(e.uploaded_on)})))),protect:e.is_protected,canProtect:e.can_protect})})),(0,r.Z)(this,"loadError",(e=>{this.setState({error:e.detail})})),(0,r.Z)(this,"appendData",(e=>{const t=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";this.setState(((e,s)=>e.post.length>0?{post:e.post.trim()+"\n\n"+t}:{post:t})),this.open()})),(0,r.Z)(this,"onCancel",(()=>{const e=this.state.originalPost===this.state.post,t=0===this.state.attachments.length;if(e&&t)return this.close();window.confirm(pgettext("edit reply","Are you sure you want to discard changes?"))&&this.close()})),(0,r.Z)(this,"onProtect",(()=>{this.setState({protect:!0})})),(0,r.Z)(this,"onUnprotect",(()=>{this.setState({protect:!1})})),(0,r.Z)(this,"onPostChange",(e=>{this.changeValue("post",e.target.value)})),(0,r.Z)(this,"onAttachmentsChange",(e=>{this.setState(e)})),(0,r.Z)(this,"onQuote",(e=>{this.setState((t=>{let{post:s}=t;return s.length>0?{post:s.trim()+"\n\n"+e}:{post:e}})),this.open()})),(0,r.Z)(this,"close",(()=>{this.minimize(),l.Z.close()})),(0,r.Z)(this,"minimize",(()=>{this.setState({fullscreen:!1,minimized:!0})})),(0,r.Z)(this,"open",(()=>{this.setState({minimized:!1}),this.state.fullscreen})),(0,r.Z)(this,"fullscreenEnter",(()=>{this.setState({fullscreen:!0,minimized:!1})})),(0,r.Z)(this,"fullscreenExit",(()=>{this.setState({fullscreen:!1,minimized:!1})})),this.state={isReady:!1,isLoading:!1,error:!1,minimized:!1,fullscreen:!1,post:"",attachments:[],protect:!1,canProtect:!1,validators:{post:(0,R.Jh)()},errors:{}},this.originalPost=""}componentDidMount(){D.Z.get(this.props.config).then(this.loadSuccess,this.loadError),S(!1,this.onQuote)}componentWillUnmount(){E()}componentWillReceiveProps(e){const t=this.props.context,s=e.context;t&&s&&t.reply===s.reply||D.Z.get(e.config,e.context||null).then(this.appendData,j.Z.apiError)}clean(){if(!this.state.post.trim().length)return j.Z.error(pgettext("posting form","You have to enter a message.")),!1;const e=this.validate();return!e.post||(j.Z.error(e.post[0]),!1)}send(){return S(!0,this.onQuote),D.Z.put(this.props.submit,{post:this.state.post,attachments:I(this.state.attachments),protect:this.state.protect})}handleSuccess(e){this.setState({isLoading:!0}),this.close(),S(!1,this.onQuote),j.Z.success(pgettext("edit reply","Reply has been edited.")),window.location=e.url.index}handleError(e){if(400===e.status){const t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);j.Z.error(t[0])}else j.Z.apiError(e);S(!1,this.onQuote)}render(){const e={post:this.props.post,minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return this.state.error?o().createElement(is,e,(0,n.Z)(Gt,{message:this.state.error,close:this.close})):this.state.isReady?o().createElement(is,e,(0,n.Z)("form",{className:"posting-dialog-form",method:"POST",onSubmit:this.handleSubmit},void 0,(0,n.Z)(yt,{attachments:this.state.attachments,canProtect:this.state.canProtect,isProtected:this.state.protect,enableProtection:()=>this.setState({protect:!0}),disableProtection:()=>this.setState({protect:!1}),value:this.state.post,submitText:pgettext("edit reply submit","Edit reply"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange}))):o().createElement(is,e,(0,n.Z)("div",{className:"posting-loading ui-preview"},void 0,(0,n.Z)(yt,{attachments:[],value:"",submitText:pgettext("edit reply submit","Edit reply"),disabled:!0,onAttachmentsChange:()=>{},onChange:()=>{}})))}};const is=e=>{let{children:t,close:s,minimized:a,minimize:i,open:o,fullscreen:r,fullscreenEnter:l,fullscreenExit:d,post:c}=e;return(0,n.Z)(Yt,{fullscreen:r,minimized:a},void 0,(0,n.Z)($t,{fullscreen:r,fullscreenEnter:l,fullscreenExit:d,minimized:a,minimize:i,open:o,close:s},void 0,interpolate(pgettext("edit reply","Edit reply by %(poster)s from %(date)s"),{poster:c.poster?c.poster.username:c.poster_name,date:c.posted_on.fromNow()},!0)),(0,n.Z)(Vt,{},void 0,t))};function os(e){switch(e.mode){case"START":return o().createElement(Qt,e);case"START_PRIVATE":return o().createElement(Jt,e);case"REPLY":return o().createElement(ts,e);case"EDIT":return o().createElement(as,e);default:return null}}},12891:function(e,t,s){"use strict";s.d(t,{Jh:function(){return n},jn:function(){return o}});var a=s(55210),i=s(32233);function o(){return[(0,a.Ei)(i.Z.get("SETTINGS").thread_title_length_min,((e,t)=>{const s=npgettext("thread title length validator","Thread title should be at least %(limit_value)s character long (it has %(show_value)s).","Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(s,{limit_value:e,show_value:t},!0)})),(0,a.BS)(i.Z.get("SETTINGS").thread_title_length_max,((e,t)=>{const s=npgettext("thread title length validator","Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).","Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(s,{limit_value:e,show_value:t},!0)}))]}function n(){return i.Z.get("SETTINGS").post_length_max?[r(),(0,a.BS)(i.Z.get("SETTINGS").post_length_max||1e6,((e,t)=>{const s=npgettext("post length validator","Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).","Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(s,{limit_value:e,show_value:t},!0)}))]:[r()]}function r(){return(0,a.Ei)(i.Z.get("SETTINGS").post_length_min,((e,t)=>{const s=npgettext("post length validator","Posted message should be at least %(limit_value)s character long (it has %(show_value)s).","Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(s,{limit_value:e,show_value:t},!0)}))}},60471:function(e,t,s){"use strict";var a=s(22928),i=s(4942),o=s(57588),n=s.n(o);function r(e){let{icon:t}=e;return t?(0,a.Z)("span",{className:"material-icon"},void 0,t):null}t.Z=class extends n().Component{constructor(){super(...arguments),(0,i.Z)(this,"change",(e=>()=>{this.props.onChange({target:{value:e}})}))}getChoice(){let e=null;return this.props.choices.map((t=>{t.value===this.props.value&&(e=t)})),e}getIcon(){return this.getChoice().icon}getLabel(){return this.getChoice().label}render(){return(0,a.Z)("div",{className:"btn-group btn-select-group"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-select dropdown-toggle",id:this.props.id||null,"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false","aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)(r,{icon:this.getIcon()}),this.getLabel()),(0,a.Z)("ul",{className:"dropdown-menu"},void 0,this.props.choices.map(((e,t)=>(0,a.Z)("li",{},t,(0,a.Z)("button",{type:"button",className:"btn-link",onClick:this.change(e.value)},void 0,(0,a.Z)(r,{icon:e.icon}),e.label))))))}}},14467:function(e,t,s){"use strict";var a,i=s(22928),o=(s(57588),s(32233)),n=s(82211),r=s(43345),l=s(47235),d=s(78657),c=s(59801),p=s(53904),u=s(93051),h=s(19755);t.Z=class extends r.Z{constructor(e){super(e),this.state={isLoading:!1,showActivation:!1,username:"",password:"",validators:{username:[],password:[]}}}clean(){return!!this.isValid()||(p.Z.error(pgettext("sign in modal","Fill out both fields.")),!1)}send(){return d.Z.post(o.Z.get("AUTH_API"),{username:this.state.username,password:this.state.password})}handleSuccess(){let e=h("#hidden-login-form");e.append(''),e.append(''),e.find('input[type="hidden"]').val(d.Z.getCsrfToken()),e.find('input[name="redirect_to"]').val(window.location.pathname),e.find('input[name="username"]').val(this.state.username),e.find('input[name="password"]').val(this.state.password),e.submit(),this.setState({isLoading:!0})}handleError(e){400===e.status?"inactive_admin"===e.code?p.Z.info(e.detail):"inactive_user"===e.code?(p.Z.info(e.detail),this.setState({showActivation:!0})):"banned"===e.code?((0,u.Z)(e.detail),c.Z.hide()):p.Z.error(e.detail):403===e.status&&e.ban?((0,u.Z)(e.ban),c.Z.hide()):p.Z.apiError(e)}getActivationButton(){return this.state.showActivation?(0,i.Z)("a",{className:"btn btn-success btn-block",href:o.Z.get("REQUEST_ACTIVATION_URL")},void 0,pgettext("sign in modal btn","Activate account")):null}render(){return(0,i.Z)("div",{className:"modal-dialog modal-sm modal-sign-in",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,a||(a=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,pgettext("sign in modal title","Sign in"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(l.Z,{buttonLabel:pgettext("sign in modal","Sign in with %(site)s"),formLabel:pgettext("sign in modal","Or use your forum account:"),labelClassName:"text-center"}),(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("div",{className:"control-input"},void 0,(0,i.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_username",onChange:this.bindInput("username"),placeholder:pgettext("sign in modal field","Username or e-mail"),type:"text",value:this.state.username}))),(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("div",{className:"control-input"},void 0,(0,i.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_password",onChange:this.bindInput("password"),placeholder:pgettext("sign in modal field","Password"),type:"password",value:this.state.password})))),(0,i.Z)("div",{className:"modal-footer"},void 0,this.getActivationButton(),(0,i.Z)(n.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("sign in modal btn","Sign in")),(0,i.Z)("a",{className:"btn btn-default btn-block",href:o.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,pgettext("sign in modal btn","Forgot password?"))))))}}},24678:function(e,t,s){"use strict";s.d(t,{Jj:function(){return n},pg:function(){return r}});var a=s(22928),i=s(57588),o=s.n(i);t.ZP=class extends o().Component{getClass(){return function(e){let t="";return e.is_banned?t="banned":e.is_hidden?t="offline":e.is_online_hidden?t="online":e.is_offline_hidden?t="offline":e.is_online?t="online":e.is_offline&&(t="offline"),"user-status user-"+t}(this.props.status)}render(){return(0,a.Z)("span",{className:this.getClass()},void 0,this.props.children)}};class n extends o().Component{getIcon(){return this.props.status.is_banned?"remove_circle_outline":this.props.status.is_hidden?"help_outline":this.props.status.is_online_hidden?"label":this.props.status.is_offline_hidden?"label_outline":this.props.status.is_online?"lens":this.props.status.is_offline?"panorama_fish_eye":void 0}render(){return(0,a.Z)("span",{className:"material-icon status-icon"},void 0,this.getIcon())}}class r extends o().Component{getHelp(){return e=this.props.user,(t=this.props.status).is_banned?t.banned_until?interpolate(pgettext("user status","%(username)s is banned until %(ban_expires)s"),{username:e.username,ban_expires:t.banned_until.format("LL, LT")},!0):interpolate(pgettext("user status","%(username)s is banned"),{username:e.username},!0):t.is_hidden?interpolate(pgettext("user status","%(username)s is hiding presence"),{username:e.username},!0):t.is_online_hidden?interpolate(pgettext("user status","%(username)s is online (hidden)"),{username:e.username},!0):t.is_offline_hidden?interpolate(pgettext("user status","%(username)s was last seen %(last_click)s (hidden)"),{username:e.username,last_click:t.last_click.fromNow()},!0):t.is_online?interpolate(pgettext("user status","%(username)s is online"),{username:e.username},!0):t.is_offline?interpolate(pgettext("user status","%(username)s was last seen %(last_click)s"),{username:e.username,last_click:t.last_click.fromNow()},!0):void 0;var e,t}getLabel(){return this.props.status.is_banned?pgettext("user status","Banned"):this.props.status.is_hidden?pgettext("user status","Hidden"):this.props.status.is_online_hidden?pgettext("user status","Online (hidden)"):this.props.status.is_offline_hidden?pgettext("user status","Offline (hidden)"):this.props.status.is_online?pgettext("user status","Online"):this.props.status.is_offline?pgettext("user status","Offline"):void 0}render(){return(0,a.Z)("span",{className:this.props.className||"status-label",title:this.getHelp()},void 0,this.getLabel())}}},7850:function(e,t,s){"use strict";s.d(t,{Z:function(){return f}});var a,i,o,n,r,l=s(22928),d=s(57588),c=s.n(d),p=class extends c().Component{getEmptyMessage(){return this.props.emptyMessage?this.props.emptyMessage:pgettext("username history empty","Your account has no history of name changes.")}render(){return(0,l.Z)("div",{className:"username-history ui-ready"},void 0,(0,l.Z)("ul",{className:"list-group"},void 0,(0,l.Z)("li",{className:"list-group-item empty-message"},void 0,this.getEmptyMessage())))}},u=s(19605),h=class extends c().Component{renderUserAvatar(){return this.props.change.changed_by?(0,l.Z)("a",{href:this.props.change.changed_by.url,className:"user-avatar-wrapper"},void 0,(0,l.Z)(u.ZP,{user:this.props.change.changed_by,size:"100"})):a||(a=(0,l.Z)("span",{className:"user-avatar-wrapper"},void 0,(0,l.Z)(u.ZP,{size:"100"})))}renderUsername(){return this.props.change.changed_by?(0,l.Z)("a",{href:this.props.change.changed_by.url,className:"item-title"},void 0,this.props.change.changed_by.username):(0,l.Z)("span",{className:"item-title"},void 0,this.props.change.changed_by_username)}render(){return(0,l.Z)("li",{className:"list-group-item"},this.props.change.id,(0,l.Z)("div",{className:"change-avatar"},void 0,this.renderUserAvatar()),(0,l.Z)("div",{className:"change-author"},void 0,this.renderUsername()),(0,l.Z)("div",{className:"change"},void 0,(0,l.Z)("span",{className:"old-username"},void 0,this.props.change.old_username),i||(i=(0,l.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,l.Z)("span",{className:"new-username"},void 0,this.props.change.new_username)),(0,l.Z)("div",{className:"change-date"},void 0,(0,l.Z)("abbr",{title:this.props.change.changed_on.format("LLL")},void 0,this.props.change.changed_on.fromNow())))}},m=class extends c().Component{render(){return(0,l.Z)("div",{className:"username-history ui-ready"},void 0,(0,l.Z)("ul",{className:"list-group"},void 0,this.props.changes.map((e=>(0,l.Z)(h,{change:e},e.id)))))}},v=s(44039),g=class extends c().Component{shouldComponentUpdate(){return!1}getClassName(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}render(){return(0,l.Z)("li",{className:this.getClassName()},void 0,o||(o=(0,l.Z)("div",{className:"change-avatar"},void 0,(0,l.Z)("span",{className:"user-avatar"},void 0,(0,l.Z)(u.ZP,{size:"100"})))),(0,l.Z)("div",{className:"change-author"},void 0,(0,l.Z)("span",{className:"ui-preview-text",style:{width:v.e(30,100)+"px"}},void 0," ")),(0,l.Z)("div",{className:"change"},void 0,(0,l.Z)("span",{className:"ui-preview-text",style:{width:v.e(30,70)+"px"}},void 0," "),n||(n=(0,l.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,l.Z)("span",{className:"ui-preview-text",style:{width:v.e(30,70)+"px"}},void 0," ")),(0,l.Z)("div",{className:"change-date"},void 0,(0,l.Z)("span",{className:"ui-preview-text",style:{width:v.e(80,140)+"px"}},void 0," ")))}},Z=class extends c().Component{shouldComponentUpdate(){return!1}render(){return(0,l.Z)("div",{className:"username-history ui-preview"},void 0,(0,l.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((e=>(0,l.Z)(g,{hiddenOnMobile:e>0},e)))))}},f=class extends c().Component{render(){return this.props.isLoaded?this.props.changes.length?(0,l.Z)(m,{changes:this.props.changes}):(0,l.Z)(p,{emptyMessage:this.props.emptyMessage}):r||(r=(0,l.Z)(Z,{}))}}},40429:function(e,t,s){"use strict";s.d(t,{Z:function(){return k}});var a,i=s(22928),o=s(57588),n=s.n(o),r=s(19605),l=s(24678);function d(e){let{showStatus:t,user:s}=e;return(0,i.Z)("ul",{className:"list-unstyled"},void 0,(0,i.Z)(c,{showStatus:t,user:s}),(0,i.Z)(p,{user:s}),a||(a=(0,i.Z)("li",{className:"user-stat-divider"})),(0,i.Z)(u,{user:s}),(0,i.Z)(h,{user:s}),(0,i.Z)(m,{user:s}))}function c(e){let{showStatus:t,user:s}=e;return t?(0,i.Z)("li",{className:"user-stat-status"},void 0,(0,i.Z)(l.ZP,{status:s.status},void 0,(0,i.Z)(l.pg,{status:s.status,user:s}))):null}function p(e){let{user:t}=e;const{joined_on:s}=t;let a=interpolate(pgettext("users list item","Joined on %(joined_on)s"),{joined_on:s.format("LL, LT")},!0),o=interpolate(pgettext("users list item","Joined %(joined_on)s"),{joined_on:s.fromNow()},!0);return(0,i.Z)("li",{className:"user-stat-join-date"},void 0,(0,i.Z)("abbr",{title:a},void 0,o))}function u(e){let{user:t}=e;const s=v("user-stat-posts",t.posts),a=npgettext("users list item","%(posts)s post","%(posts)s posts",t.posts);return(0,i.Z)("li",{className:s},void 0,interpolate(a,{posts:t.posts},!0))}function h(e){let{user:t}=e;const s=v("user-stat-threads",t.threads),a=npgettext("users list item","%(threads)s thread","%(threads)s threads",t.threads);return(0,i.Z)("li",{className:s},void 0,interpolate(a,{threads:t.threads},!0))}function m(e){let{user:t}=e;const s=v("user-stat-followers",t.followers),a=npgettext("users list item","%(followers)s follower","%(followers)s followers",t.followers);return(0,i.Z)("li",{className:s},void 0,interpolate(a,{followers:t.followers},!0))}function v(e,t){return 0===t?e+" user-stat-empty":e}function g(e){let{rank:t,title:s}=e,a=s||t.title||t.name,o="user-title";return t.css_class&&(o+=" user-title-"+t.css_class),t.is_tab?(0,i.Z)("a",{className:o,href:t.url},void 0,a):(0,i.Z)("span",{className:o},void 0,a)}function Z(e){let{showStatus:t,user:s}=e;const{rank:a}=s;let o="panel user-card";return a.css_class&&(o+=" user-card-"+a.css_class),(0,i.Z)("div",{className:o},void 0,(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,i.Z)("div",{className:"user-card-small-avatar"},void 0,(0,i.Z)("a",{href:s.url},void 0,(0,i.Z)(r.ZP,{size:"50",size2x:"80",user:s})))),(0,i.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,(0,i.Z)("div",{className:"user-card-avatar"},void 0,(0,i.Z)("a",{href:s.url},void 0,(0,i.Z)(r.ZP,{size:"150",size2x:"200",user:s}))),(0,i.Z)("div",{className:"user-card-username"},void 0,(0,i.Z)("a",{href:s.url},void 0,s.username)),(0,i.Z)("div",{className:"user-card-title"},void 0,(0,i.Z)(g,{rank:a,title:s.title})),(0,i.Z)("div",{className:"user-card-stats"},void 0,(0,i.Z)(d,{showStatus:t,user:s}))))))}var f,b,_,N,x=s(44039),y=class extends n().Component{shouldComponentUpdate(){return!1}render(){return(0,i.Z)("div",{className:"panel user-card user-card-preview"},void 0,(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"row"},void 0,f||(f=(0,i.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,i.Z)("div",{className:"user-card-small-avatar"},void 0,(0,i.Z)("span",{},void 0,(0,i.Z)(r.ZP,{size:"50",size2x:"80"}))))),(0,i.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,b||(b=(0,i.Z)("div",{className:"user-card-avatar"},void 0,(0,i.Z)("span",{},void 0,(0,i.Z)(r.ZP,{size:"150",size2x:"200"})))),(0,i.Z)("div",{className:"user-card-username"},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(60,150)+"px"}},void 0," ")),(0,i.Z)("div",{className:"user-card-title"},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(60,150)+"px"}},void 0," ")),(0,i.Z)("div",{className:"user-card-stats"},void 0,(0,i.Z)("ul",{className:"list-unstyled"},void 0,(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,70)+"px"}},void 0," ")),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,70)+"px"}},void 0," ")),_||(_=(0,i.Z)("li",{className:"user-stat-divider"})),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,70)+"px"}},void 0," ")),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:x.e(30,70)+"px"}},void 0," "))))))))}};function w(e){let{colClassName:t,cols:s}=e;const a=Array.apply(null,{length:s}).map(Number.call,Number);return(0,i.Z)("div",{className:"users-cards-list ui-preview"},void 0,(0,i.Z)("div",{className:"row"},void 0,a.map((e=>{let s=t;return 0!==e&&(s+=" hidden-xs"),3===e&&(s+=" hidden-sm"),(0,i.Z)("div",{className:s},e,N||(N=(0,i.Z)(y,{})))}))))}function k(e){let{cols:t,isReady:s,showStatus:a,users:o}=e,n="col-xs-12 col-sm-4";return 4===t&&(n+=" col-md-3"),s?(0,i.Z)("div",{className:"users-cards-list ui-ready"},void 0,(0,i.Z)("div",{className:"row"},void 0,o.map((e=>(0,i.Z)("div",{className:n},e.id,(0,i.Z)(Z,{showStatus:a,user:e})))))):(0,i.Z)(w,{colClassName:n,cols:t})}},82125:function(e,t,s){"use strict";var a=s(4942),i=s(57588),o=s.n(i);t.Z=class extends o().Component{constructor(e){super(e),(0,a.Z)(this,"toggleNav",(()=>{this.setState({dropdown:!this.state.dropdown})})),(0,a.Z)(this,"hideNav",(()=>{this.setState({dropdown:!1})})),this.state={dropdown:!1}}getCompactNavClassName(){return this.state.dropdown?"compact-nav open":"compact-nav"}}},7227:function(e,t,s){"use strict";var a=s(22928),i=s(4942),o=s(57588),n=s.n(o);t.Z=class extends n().Component{constructor(){super(...arguments),(0,i.Z)(this,"toggle",(()=>{this.props.onChange({target:{value:!this.props.value}})}))}getClassName(){return this.props.value?"btn btn-yes-no btn-yes-no-on":"btn btn-yes-no btn-yes-no-off"}getIcon(){return this.props.value?this.props.iconOn||"check_box":this.props.iconOff||"check_box_outline_blank"}getLabel(){return this.props.value?this.props.labelOn||pgettext("yesno switch choice","yes"):this.props.labelOff||pgettext("yesno switch choice","no")}render(){return(0,a.Z)("button",{type:"button",onClick:this.toggle,className:this.getClassName(),id:this.props.id||null,"aria-describedby":this.props["aria-describedby"]||null,disabled:this.props.disabled||!1},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,this.getIcon()),(0,a.Z)("span",{className:"btn-text"},void 0,this.getLabel()))}}},32233:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}}),s(58294),s(95377),s(68852),s(39737),s(14316),s(43204),s(7023);var a=new class{constructor(){this._initializers=[],this._context={}}addInitializer(e){this._initializers.push({key:e.name,item:e.initializer,after:e.after,before:e.before})}init(e){this._context=e,new class{constructor(e){this.isOrdered=!1,this._items=e||[]}add(e,t,s){this._items.push({key:e,item:t,after:s&&s.after||null,before:s&&s.before||null})}get(e,t){for(var s=0;s0&&t.length!==a.length;)o-=1,e.forEach(i);return s}}(this._initializers).orderedValues().forEach((e=>{e(this)}))}has(e){return!!this._context[e]}get(e,t){return this.has(e)?this._context[e]:t||void 0}pop(e){if(this.has(e)){let t=this._context[e];return this._context[e]=null,t}}};window.misago=a;var i=a},58339:function(e,t,s){"use strict";var a=s(32233),i=s(78657);a.Z.addInitializer({name:"ajax",initializer:function(){i.Z.init(a.Z.get("CSRF_COOKIE_NAME"))}})},64109:function(e,t,s){"use strict";var a=s(32233),i=s(35486),o=s(78657),n=s(53904),r=s(90287);a.Z.addInitializer({name:"auth-sync",initializer:function(e){e.get("isAuthenticated")&&window.setInterval((function(){o.Z.get(e.get("AUTH_API")).then((function(e){r.Z.dispatch((0,i.r$)(e))}),(function(e){n.Z.apiError(e)}))}),45e3)},after:"auth"})},46226:function(e,t,s){"use strict";var a=s(32233),i=s(98274),o=s(59801),n=s(90287),r=s(62833);a.Z.addInitializer({name:"auth",initializer:function(){i.Z.init(n.Z,r.Z,o.Z)},after:"store"})},93240:function(e,t,s){"use strict";var a=s(32233),i=s(78657),o=s(93825),n=s(96142),r=s(53904);a.Z.addInitializer({name:"captcha",initializer:function(e){o.ZP.init(e,i.Z,n.Z,r.Z)}})},75147:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i),n=s(32233),r=s(4942),l=s(78657);class d extends o().Component{constructor(e){super(e),(0,r.Z)(this,"handleDecline",(()=>{this.state.submiting||window.confirm(pgettext("accept agreement prompt","Declining will result in immediate deactivation and deletion of your account. This action is not reversible."))&&(this.setState({submiting:!0}),l.Z.post(this.props.api,{accept:!1}).then((()=>{window.location.reload(!0)})))})),(0,r.Z)(this,"handleAccept",(()=>{this.state.submiting||(this.setState({submiting:!0}),l.Z.post(this.props.api,{accept:!0}).then((()=>{window.location.reload(!0)})))})),this.state={submiting:!1}}render(){return(0,a.Z)("div",{},void 0,(0,a.Z)("button",{className:"btn btn-default",disabled:this.state.submiting,type:"buton",onClick:this.handleDecline},void 0,pgettext("accept agreement choice","Decline")),(0,a.Z)("button",{className:"btn btn-primary",disabled:this.state.submiting,type:"buton",onClick:this.handleAccept},void 0,pgettext("accept agreement choice","Accept and continue")))}}var c=s(4869);n.Z.addInitializer({name:"component:accept-agreement",initializer:function(e){document.getElementById("required-agreement-mount")&&(0,c.Z)((0,a.Z)(d,{api:e.get("REQUIRED_AGREEMENT_API")}),"required-agreement-mount",!1)},after:"store"})},4894:function(e,t,s){"use strict";var a=s(37424),i=s(32233),o=s(22928),n=s(57588),r=s.n(n),l=class extends r().Component{refresh(){window.location.reload()}getMessage(){return this.props.signedIn?interpolate(pgettext("auth message","You have signed in as %(username)s. Please refresh the page before continuing."),{username:this.props.signedIn.username},!0):this.props.signedOut?interpolate(pgettext("auth message","%(username)s, you have been signed out. Please refresh the page before continuing."),{username:this.props.user.username},!0):void 0}render(){let e="auth-message";return(this.props.signedIn||this.props.signedOut)&&(e+=" show"),(0,o.Z)("div",{className:e},void 0,(0,o.Z)("div",{className:"container"},void 0,(0,o.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,o.Z)("p",{},void 0,(0,o.Z)("button",{className:"btn btn-default",type:"button",onClick:this.refresh},void 0,pgettext("auth message","Reload page")),(0,o.Z)("span",{className:"hidden-xs hidden-sm"},void 0," "+pgettext("auth message","or press F5 key.")))))}};function d(e){return{user:e.auth.user,signedIn:e.auth.signedIn,signedOut:e.auth.signedOut}}var c=s(4869);i.Z.addInitializer({name:"component:auth-message",initializer:function(){(0,c.Z)((0,a.$j)(d)(l),"auth-message-mount")},after:"store"})},29223:function(e,t,s){"use strict";var a=s(32233),i=s(93051);a.Z.addInitializer({name:"component:banmed-page",initializer:function(e){e.has("BAN_MESSAGE")&&(0,i.Z)(e.get("BAN_MESSAGE"),!1)},after:"store"})},3026:function(e,t,s){"use strict";var a=s(37424),i=s(22928),o=s(4942),n=s(30381),r=s.n(n),l=s(57588),d=s.n(l);function c(e){return(0,i.Z)("div",{className:"categories-list"},void 0,(0,i.Z)("ul",{className:"list-group"},void 0,(0,i.Z)("li",{className:"list-group-item empty-message"},void 0,(0,i.Z)("p",{className:"lead"},void 0,pgettext("categories list","No categories exist or you don't have permission to see them.")))))}function p(e){let{category:t}=e;return t.description?(0,i.Z)("div",{className:"category-description",dangerouslySetInnerHTML:{__html:t.description.html}}):null}function u(e){let{category:t}=e;return(0,i.Z)("div",{className:h(t),title:m(t)},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)))}function h(e){return e.is_read?"read-status item-read":"read-status item-new"}function m(e){return e.is_closed?e.is_read?pgettext("category status","This category has no new posts. (closed)"):pgettext("category status","This category has new posts. (closed)"):e.is_read?pgettext("category status","This category has no new posts."):pgettext("category status","This category has new posts.")}function v(e){let{category:t}=e;return(0,i.Z)("div",{className:"col-xs-12 col-sm-6 col-md-6 category-main"},void 0,(0,i.Z)("div",{className:"media"},void 0,(0,i.Z)("div",{className:"media-left"},void 0,(0,i.Z)(u,{category:t})),(0,i.Z)("div",{className:"media-body"},void 0,(0,i.Z)("h4",{className:"media-heading"},void 0,(0,i.Z)("a",{href:t.url.index},void 0,t.name)),(0,i.Z)(p,{category:t}))))}var g,Z,f,b=s(19605);function _(e){let{category:t}=e;return(0,i.Z)("div",{className:"col-xs-12 col-sm-6 col-md-4 category-last-thread"},void 0,(0,i.Z)(N,{category:t}),(0,i.Z)(w,{category:t}),(0,i.Z)(k,{category:t}),(0,i.Z)(C,{category:t}))}function N(e){let{category:t}=e;return t.acl.can_browse&&t.acl.can_see_all_threads&&t.last_thread_title?(0,i.Z)("div",{className:"media"},void 0,(0,i.Z)("div",{className:"media-left hidden-xs"},void 0,(0,i.Z)(x,{category:t})),(0,i.Z)("div",{className:"media-body"},void 0,(0,i.Z)("div",{className:"media-heading"},void 0,(0,i.Z)("a",{className:"item-title thread-title",href:t.url.last_thread_new,title:t.last_thread_title},void 0,t.last_thread_title)),(0,i.Z)("ul",{className:"list-inline"},void 0,(0,i.Z)("li",{className:"category-last-thread-poster"},void 0,(0,i.Z)(y,{category:t})),g||(g=(0,i.Z)("li",{className:"divider"},void 0,"—")),(0,i.Z)("li",{className:"category-last-thread-date"},void 0,(0,i.Z)("a",{href:t.url.last_post},void 0,t.last_post_on.fromNow()))))):null}function x(e){let{category:t}=e;return t.last_poster?(0,i.Z)("a",{className:"last-poster-avatar",href:t.last_poster.url,title:t.last_poster_name},void 0,(0,i.Z)(b.ZP,{className:"media-object",size:40,user:t.last_poster})):(0,i.Z)("span",{className:"last-poster-avatar",title:t.last_poster_name},void 0,Z||(Z=(0,i.Z)(b.ZP,{className:"media-object",size:40})))}function y(e){let{category:t}=e;return t.last_poster?(0,i.Z)("a",{className:"item-title",href:t.last_poster.url},void 0,t.last_poster_name):(0,i.Z)("span",{className:"item-title"},void 0,t.last_poster_name)}function w(e){let{category:t}=e;return t.acl.can_browse&&t.acl.can_see_all_threads?t.last_thread_title?null:(0,i.Z)(S,{message:pgettext("category last thread","Empty category")}):null}function k(e){let{category:t}=e;return t.acl.can_browse?t.acl.can_see_all_threads?null:(0,i.Z)(S,{message:pgettext("category last thread","Private category")}):null}function C(e){let{category:t}=e;return t.acl.can_browse?null:(0,i.Z)(S,{message:pgettext("category last thread","Protected category")})}function S(e){let{message:t}=e;return(0,i.Z)("div",{className:"media category-thread-message"},void 0,f||(f=(0,i.Z)("div",{className:"media-left"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,i.Z)("div",{className:"media-body"},void 0,(0,i.Z)("p",{},void 0,t)))}function E(e){let{category:t}=e;return(0,i.Z)("div",{className:"col-md-2 hidden-xs hidden-sm"},void 0,(0,i.Z)("ul",{className:"list-unstyled category-stats"},void 0,(0,i.Z)(T,{threads:t.threads}),(0,i.Z)(L,{posts:t.posts})))}function T(e){let{threads:t}=e;const s=npgettext("category stats","%(threads)s thread","%(threads)s threads",t);return(0,i.Z)("li",{className:"category-stat-threads"},void 0,interpolate(s,{threads:t},!0))}function L(e){let{posts:t}=e;const s=npgettext("category stats","%(posts)s post","%(posts)s posts",t);return(0,i.Z)("li",{className:"category-stat-posts"},void 0,interpolate(s,{posts:t},!0))}function P(e){let{category:t}=e,s="btn btn-default btn-block btn-sm btn-subcategory";return t.is_read||(s+=" btn-subcategory-new"),(0,i.Z)("div",{className:"col-xs-12 col-sm-4 col-md-3"},void 0,(0,i.Z)("a",{className:s,href:t.url.index},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,function(e){return e.is_closed?e.is_read?"lock_outline":"lock":e.is_read?"chat_bubble_outline":"chat_bubble"}(t)),(0,i.Z)("span",{className:"icon-text"},void 0,t.name)))}function O(e){let{category:t,isFirst:s}=e;return s||0===t.subcategories.length?null:(0,i.Z)("div",{className:"row subcategories-list"},void 0,t.subcategories.map((e=>(0,i.Z)(P,{category:e},e.id))))}function I(e){let{category:t,isFirst:s}=e,a="list-group-item";return t.description?a+=" list-group-category-has-description":a+=" list-group-category-no-description",s&&(a+=" list-group-item-first"),t.css_class&&(a+=" list-group-category-has-flavor",a+=" list-group-item-category-"+t.css_class),(0,i.Z)("li",{className:a},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)(v,{category:t}),(0,i.Z)(E,{category:t}),(0,i.Z)(_,{category:t})),(0,i.Z)(O,{category:t,isFirst:s}))}function A(e){let{category:t}=e,s="list-group list-group-category";return t.css_class&&(s+=" list-group-category-has-flavor",s+=" list-group-category-"+t.css_class),(0,i.Z)("ul",{className:s},void 0,(0,i.Z)(I,{category:t,isFirst:!0}),t.subcategories.map((e=>(0,i.Z)(I,{category:e,isFirst:!1},e.id))))}function R(e){let{categories:t}=e;return(0,i.Z)("div",{className:"categories-list"},void 0,t.map((e=>(0,i.Z)(A,{category:e},e.id))))}var D,j=s(32233),U=s(55547);const z=function(e){return Object.assign({},e,{last_post_on:e.last_post_on?r()(e.last_post_on):null,subcategories:e.subcategories.map(z)})};var M=class extends d().Component{constructor(e){super(e),(0,o.Z)(this,"update",(e=>{this.setState({categories:e.map(z)})})),this.state={categories:j.Z.get("CATEGORIES").map(z)},this.startPolling(j.Z.get("CATEGORIES_API"))}startPolling(e){U.Z.start({poll:"categories",url:e,frequency:18e4,update:this.update})}render(){const{categories:e}=this.state;return 0===e.length?D||(D=(0,i.Z)(c,{})):(0,i.Z)(R,{categories:e})}};function B(e){return{tick:e.tick.tick}}var q=s(4869);j.Z.addInitializer({name:"component:categories",initializer:function(){document.getElementById("categories-mount")&&(0,q.Z)((0,a.$j)(B)(M),"categories-mount")},after:"store"})},73806:function(e,t,s){"use strict";var a,i=s(22928),o=s(57588),n=s.n(o),r=s(73935),l=s.n(r),d=s(37424),c=s(993),p=s(40689),u=s(80261),h=s(59801),m=s(14467);class v extends n().Component{componentDidMount(){"?modal=login"===window.document.location.search&&window.setTimeout((()=>h.Z.show(a||(a=(0,i.Z)(m.Z,{})))),300)}render(){return null}}var g=v;function Z(e){let{logo:t,logoXs:s,text:a,url:o}=e;return t?(0,i.Z)("div",{className:"navbar-branding"},void 0,(0,i.Z)("a",{href:o,className:"navbar-branding-logo"},void 0,(0,i.Z)("img",{src:t,alt:a}))):(0,i.Z)("div",{className:"navbar-branding"},void 0,!!s&&(0,i.Z)("a",{href:o,className:"navbar-branding-logo-xs"},void 0,(0,i.Z)("img",{src:s,alt:a})),!!a&&(0,i.Z)("a",{href:o,className:"navbar-branding-text"},void 0,a))}function f(e){let{items:t}=e;return(0,i.Z)("ul",{className:"navbar-extra-menu",role:"nav"},void 0,t.map(((e,t)=>(0,i.Z)("li",{className:e.className},t,(0,i.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title)))))}var b,_=s(49021),N=s(4942),x=s(63026),y=s(66462),w=s(94184),k=s.n(w);function C(e){let{children:t,showAll:s,showUnread:a,unread:o}=e;return(0,i.Z)("div",{className:"notifications-dropdown-body"},void 0,(0,i.Z)(_.Aw,{},void 0,pgettext("notifications title","Notifications")),(0,i.Z)(_.KE,{},void 0,(0,i.Z)(S,{active:!o,onClick:s},void 0,pgettext("notifications dropdown","All")),(0,i.Z)(S,{active:o,onClick:a},void 0,pgettext("notifications dropdown","Unread"))),t,(0,i.Z)(_.kE,{},void 0,(0,i.Z)("a",{className:"btn btn-default btn-block",href:misago.get("NOTIFICATIONS_URL")},void 0,pgettext("notifications","See all notifications"))))}function S(e){let{active:t,children:s,onClick:a}=e;return(0,i.Z)("button",{className:k()("btn",{"btn-primary":t,"btn-default":!t}),type:"button",onClick:a},void 0,s)}class E extends n().Component{constructor(e){super(e),(0,N.Z)(this,"render",(()=>(0,i.Z)(C,{unread:this.state.unread,showAll:()=>this.setState({unread:!1}),showUnread:()=>this.setState({unread:!0})},void 0,(0,i.Z)(x.Z,{filter:this.state.unread?"unread":"all",disabled:!this.props.active},void 0,(e=>{let{data:t,loading:s,error:a}=e;return s?b||(b=(0,i.Z)(y.Pu,{})):a?(0,i.Z)(y.lb,{error:a}):(0,i.Z)(y.uE,{filter:this.state.unread?"unread":"all",items:t?t.results:[]})}))))),this.state={unread:!1,url:""}}getApiUrl(){let e=misago.get("NOTIFICATIONS_API")+"?limit=20";return e+=this.state.unread?"&filter=unread":"",e}}var T,L=E;function P(e){let{id:t,className:s,badge:a,url:o,active:n,onClick:r}=e;const l=a?pgettext("navbar","You have unread notifications!"):pgettext("navbar","Open notifications");return(0,i.Z)("a",{id:t,className:k()("btn btn-navbar-icon",s,{active:n}),href:o,title:l,onClick:r},void 0,!!a&&(0,i.Z)("span",{className:"navbar-item-badge"},void 0,a),(0,i.Z)("span",{className:"material-icon"},void 0,a?"notifications_active":"notifications_none"))}function O(e){let{id:t,className:s,badge:a,url:o}=e;return(0,i.Z)(_.Lt,{id:t,toggle:e=>{let{isOpen:t,toggle:n}=e;return(0,i.Z)(P,{className:s,active:t,badge:a,url:o,onClick:e=>{e.preventDefault(),n()}})},menuClassName:"notifications-dropdown",menuAlignRight:!0},void 0,(e=>{let{isOpen:t}=e;return(0,i.Z)(L,{active:t})}))}function I(e){let{id:t,className:s,badge:a,url:o,active:n,onClick:r}=e;const l=a?pgettext("navbar","You have unread private threads!"):pgettext("navbar","Open private threads");return(0,i.Z)("a",{id:t,className:k()("btn btn-navbar-icon",s,{active:n}),href:o,title:l,onClick:r},void 0,!!a&&(0,i.Z)("span",{className:"navbar-item-badge"},void 0,a),T||(T=(0,i.Z)("span",{className:"material-icon"},void 0,"inbox")))}var A,R,D,j=s(62989);function U(e){let{id:t,className:s,url:a,active:o,onClick:n}=e;return(0,i.Z)("a",{id:t,className:k()("btn btn-navbar-icon",s,{active:o}),href:a,title:pgettext("navbar","Open search"),onClick:n},void 0,A||(A=(0,i.Z)("span",{className:"material-icon"},void 0,"search")))}function z(e){let{id:t,className:s,url:a}=e;return(0,i.Z)(_.Lt,{id:t,toggle:e=>{let{isOpen:t,toggle:o}=e;return(0,i.Z)(U,{className:s,active:t,url:a,onClick:e=>{e.preventDefault(),o(),window.setTimeout((()=>{document.querySelector(".search-dropdown .form-control-search").focus()}),0)}})},menuClassName:"search-dropdown",menuAlignRight:!0},void 0,(()=>R||(R=(0,i.Z)(j.E,{}))))}function M(e){let{id:t,className:s,active:a,onClick:o}=e;return(0,i.Z)("button",{id:t,className:k()("btn btn-navbar-icon",s,{active:a}),title:pgettext("navbar","Open menu"),type:"button",onClick:o},void 0,D||(D=(0,i.Z)("span",{className:"material-icon"},void 0,"menu")))}var B=s(6333);function q(e){let{id:t,className:s}=e;return(0,i.Z)(_.Lt,{id:t,toggle:e=>{let{isOpen:t,toggle:a}=e;return(0,i.Z)(M,{className:s,active:t,onClick:a})},menuClassName:"site-nav-dropdown",menuAlignRight:!0},void 0,(e=>{let{isOpen:t,close:s}=e;return(0,i.Z)(B.bS,{close:s})}))}var F=s(19605);function H(e){let{id:t,className:s,user:a,active:o,onClick:n}=e;return(0,i.Z)("a",{id:t,className:k()("btn-navbar-image",s,{active:o}),href:a.url,title:pgettext("navbar","Open your options"),onClick:n},void 0,(0,i.Z)(F.ZP,{user:a,size:34}))}var Y,V,G,$,W=s(28166);function Q(e){let{id:t,className:s,user:a}=e;return(0,i.Z)(_.Lt,{id:t,toggle:e=>{let{isOpen:t,toggle:o}=e;return(0,i.Z)(H,{className:s,active:t,user:a,onClick:e=>{e.preventDefault(),o()}})},menuClassName:"user-nav-dropdown",menuAlignRight:!0},void 0,(e=>{let{isOpen:t,close:s}=e;return(0,i.Z)(W.o4,{close:s})}))}var X,K=(0,d.$j)((function(e){const t=misago.get("SETTINGS"),s=e.auth.user;return{branding:{logo:t.logo,logoXs:t.logo_small,text:t.logo_text,url:misago.get("MISAGO_PATH")},extraMenuItems:misago.get("extraMenuItems"),user:s.id?{id:s.id,username:s.username,email:s.email,avatars:s.avatars,unreadNotifications:s.unreadNotifications,unreadPrivateThreads:s.unread_private_threads,url:s.url}:null,searchUrl:misago.get("SEARCH_URL"),notificationsUrl:misago.get("NOTIFICATIONS_URL"),privateThreadsUrl:misago.get("PRIVATE_THREADS_URL"),authDelegated:t.enable_oauth2_client,showSearch:!!s.acl.can_search,showPrivateThreads:!!s&&!!s.acl.can_use_private_threads}}))((function(e){let{dispatch:t,branding:s,extraMenuItems:a,authDelegated:o,user:r,searchUrl:l,notificationsUrl:d,privateThreadsUrl:h,showSearch:m,showPrivateThreads:v}=e;return(0,i.Z)("div",{className:"container navbar-container"},void 0,n().createElement(Z,s),(0,i.Z)("div",{className:"navbar-right"},void 0,a.length>0&&(0,i.Z)(f,{items:a}),!!m&&(0,i.Z)(z,{id:"navbar-search-dropdown",url:l}),!!m&&(0,i.Z)(U,{id:"navbar-search-overlay",url:l,onClick:e=>{t(c.UL()),e.preventDefault()}}),Y||(Y=(0,i.Z)(q,{id:"navbar-site-nav-dropdown"})),(0,i.Z)(M,{id:"navbar-site-nav-overlay",onClick:()=>{t(c.AU())}}),!!v&&(0,i.Z)(I,{id:"navbar-private-threads",badge:r.unreadPrivateThreads,url:h}),!!r&&(0,i.Z)(O,{id:"navbar-notifications-dropdown",badge:r.unreadNotifications,url:d}),!!r&&(0,i.Z)(P,{id:"navbar-notifications-overlay",badge:r.unreadNotifications,url:d,onClick:e=>{t(c.hN()),e.preventDefault()}}),!!r&&(0,i.Z)(Q,{id:"navbar-user-nav-dropdown",user:r}),!!r&&(0,i.Z)(H,{id:"navbar-user-nav-overlay",user:r,onClick:e=>{t(c.T5()),e.preventDefault()}}),!r&&(V||(V=(0,i.Z)(u.Z,{className:"btn-navbar-sign-in"}))),!r&&!o&&(G||(G=(0,i.Z)(p.Z,{className:"btn-navbar-register"}))),!r&&!o&&($||($=(0,i.Z)(g,{})))))})),J=s(90287);misago.addInitializer({name:"component:navbar",initializer:function(e){const t=document.getElementById("misago-navbar");l().render((0,i.Z)(d.zt,{store:J.Z.getStore()},void 0,X||(X=(0,i.Z)(K,{}))),t)},after:"store"})},27015:function(e,t,s){"use strict";var a,i=s(22928),o=s(57588),n=s.n(o),r=s(73935),l=s.n(r),d=s(37424),c=s(4942),p=s(63026),u=s(66462),h=s(94184),m=s.n(h),v=s(49021),g=s(64836);function Z(e){let{children:t,open:s,showAll:a,showUnread:o,unread:n}=e;return(0,i.Z)(g.a,{open:s},void 0,(0,i.Z)(g.i,{},void 0,pgettext("notifications title","Notifications")),(0,i.Z)(v.KE,{},void 0,(0,i.Z)(f,{active:!n,onClick:a},void 0,pgettext("notifications dropdown","All")),(0,i.Z)(f,{active:n,onClick:o},void 0,pgettext("notifications dropdown","Unread"))),t,(0,i.Z)(v.kE,{},void 0,(0,i.Z)("a",{className:"btn btn-default btn-block",href:misago.get("NOTIFICATIONS_URL")},void 0,pgettext("notifications","See all notifications"))))}function f(e){let{active:t,children:s,onClick:a}=e;return(0,i.Z)("button",{className:m()("btn",{"btn-primary":t,"btn-default":!t}),type:"button",onClick:a},void 0,s)}class b extends n().Component{constructor(e){super(e),(0,c.Z)(this,"render",(()=>(0,i.Z)(Z,{open:this.props.open,unread:this.state.unread,showAll:()=>this.setState({unread:!1}),showUnread:()=>this.setState({unread:!0})},void 0,(0,i.Z)(p.Z,{filter:this.state.unread?"unread":"all",disabled:!this.props.open},void 0,(e=>{let{data:t,loading:s,error:o}=e;return s?a||(a=(0,i.Z)(u.Pu,{})):o?(0,i.Z)(u.lb,{error:o}):(0,i.Z)(u.uE,{filter:this.state.unread?"unread":"all",items:t?t.results:[]})}))))),this.body=document.body,this.state={unread:!1,url:""}}getApiUrl(){let e=misago.get("NOTIFICATIONS_API")+"?limit=20";return e+=this.state.unread?"&filter=unread":"",e}componentDidUpdate(e,t){e.open!==this.props.open&&(this.props.open?this.body.classList.add("notifications-fullscreen"):this.body.classList.remove("notifications-fullscreen"))}}var _,N=(0,d.$j)((function(e){return{open:e.overlay.notifications}}))(b),x=s(90287);misago.addInitializer({name:"component:notifications-overlay",initializer:function(e){if(e.get("isAuthenticated")){const e=document.getElementById("notifications-mount");l().render((0,i.Z)(d.zt,{store:x.Z.getStore()},void 0,_||(_=(0,i.Z)(N,{}))),e)}},after:"store"})},88097:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i),n=s(73935),r=s.n(n),l=s(37424),d=s(69987),c=s(99755);function p(){return(0,a.Z)(c.Iv,{header:pgettext("notifications title","Notifications"),styleName:"notifications"})}var u=s(87462),h=s(35486),m=s(53904),v=s(60642),g=s(63026),Z=function(e){let{title:t,subtitle:s}=e;const a=[];return s&&a.push(s),t&&a.push(t),a.push(misago.get("SETTINGS").forum_name),document.title=a.join(" | "),null},f=s(59131),b=s(66462);function _(e){let{children:t}=e;return(0,a.Z)("ul",{className:"nav nav-pills"},void 0,t)}var N=s(94184),x=s.n(N);function y(e){let{active:t,link:s,icon:i,children:o}=e;return(0,a.Z)("li",{className:x()({active:t})},void 0,(0,a.Z)(d.rU,{to:s,activeClassName:""},void 0,!!i&&(0,a.Z)("span",{className:"material-icon"},void 0,i),o))}var w=s(92490);function k(e){let{filter:t}=e;const s=misago.get("NOTIFICATIONS_URL");return(0,a.Z)(w.o8,{},void 0,(0,a.Z)(w.Z2,{auto:!0},void 0,(0,a.Z)(w.Eg,{},void 0,(0,a.Z)(_,{},void 0,(0,a.Z)(y,{active:"all"===t,link:s},void 0,pgettext("notifications nav","All")),(0,a.Z)(y,{active:"unread"===t,link:s+"unread/"},void 0,pgettext("notifications nav","Unread")),(0,a.Z)(y,{active:"read"===t,link:s+"read/"},void 0,pgettext("notifications nav","Read"))))))}var C,S,E,T=s(82211);function L(e){let{baseUrl:t,data:s,disabled:i}=e;return(0,a.Z)("div",{className:"misago-pagination"},void 0,(0,a.Z)(P,{url:t,disabled:i||!s||!s.hasPrevious},void 0,pgettext("notifications pagination","Latest")),(0,a.Z)(P,{url:t+"?before="+(s?s.firstCursor:""),disabled:i||!s||!s.hasPrevious},void 0,pgettext("notifications pagination","Newer")),(0,a.Z)(P,{url:t+"?after="+(s?s.lastCursor:""),disabled:i||!s||!s.hasNext},void 0,pgettext("notifications pagination","Older")))}function P(e){let{disabled:t,children:s,url:i}=e;return t?(0,a.Z)("button",{className:"btn btn-default",type:"disabled",disabled:!0},void 0,s):(0,a.Z)(d.rU,{to:i,className:"btn btn-default",activeClassName:""},void 0,s)}function O(e){let{baseUrl:t,data:s,disabled:i,bottom:o,markAllAsRead:n}=e;return(0,a.Z)(w.o8,{},void 0,(0,a.Z)(w.Z2,{},void 0,(0,a.Z)(w.Eg,{},void 0,(0,a.Z)(L,{baseUrl:t,data:s,disabled:i}))),C||(C=(0,a.Z)(w.tw,{})),(0,a.Z)(w.Z2,{className:x()({"hidden-xs":!o})},void 0,(0,a.Z)(w.Eg,{},void 0,(0,a.Z)(T.Z,{className:"btn-default btn-block",type:"button",disabled:i||!s||!s.unreadNotifications,onClick:n},void 0,S||(S=(0,a.Z)("span",{className:"material-icon"},void 0,"done_all")),pgettext("notifications","Mark all as read")))))}function I(e){return"unread"===e?pgettext("notifications title","Unread notifications"):"read"===e?pgettext("notifications title","Read notifications"):null}var A,R=(0,l.$j)()((function(e){let{dispatch:t,location:s,route:i}=e;const{query:n}=s,{filter:r}=i.props,l=function(e){let t=misago.get("NOTIFICATIONS_URL");return"all"!==e&&(t+=e+"/"),t}(r);return(0,a.Z)(f.Z,{},void 0,(0,a.Z)(Z,{title:pgettext("notifications title","Notifications"),subtitle:I(r)}),(0,a.Z)(k,{filter:r}),(0,a.Z)(g.Z,{filter:r,query:n},void 0,(e=>{var s;let{data:i,loading:d,error:c,refetch:p}=e;return(0,a.Z)(v.D,{url:misago.get("NOTIFICATIONS_API")+"read-all/"},void 0,((e,v)=>{let{loading:g}=v;const Z={baseUrl:l,data:i,disabled:d||g||!i||0===i.results.length,markAllAsRead:async()=>{window.confirm(pgettext("notifications","Mark all notifications as read?"))&&e({onSuccess:async()=>{p(),t((0,h.yH)({unreadNotifications:null})),m.Z.success(pgettext("notifications","All notifications have been marked as read."))},onError:m.Z.apiError})}};return d||g?(0,a.Z)("div",{},void 0,o().createElement(O,Z),E||(E=(0,a.Z)(b.Pu,{})),o().createElement(O,(0,u.Z)({},Z,{bottom:!0}))):c?(0,a.Z)("div",{},void 0,o().createElement(O,Z),s||(s=(0,a.Z)(b.lb,{error:c})),o().createElement(O,(0,u.Z)({},Z,{bottom:!0}))):i?(!i.hasPrevious&&n&&window.history.replaceState({},"",l),(0,a.Z)("div",{},void 0,o().createElement(O,Z),(0,a.Z)(b.uE,{filter:r,items:i.results,hasNext:i.hasNext,hasPrevious:i.hasPrevious}),o().createElement(O,(0,u.Z)({},Z,{bottom:!0})))):null}))})))}));s(4517);var D,j=function(){const e=misago.get("NOTIFICATIONS_URL");return(0,a.Z)("div",{className:"page page-notifications"},void 0,A||(A=(0,a.Z)(p,{})),(0,a.Z)(d.F0,{history:d.mW,routes:[{path:e,component:R,props:{filter:"all"}},{path:e+"unread/",component:R,props:{filter:"unread"}},{path:e+"read/",component:R,props:{filter:"read"}}]}))},U=s(90287);misago.addInitializer({name:"component:notifications",initializer:function(e){const t=misago.get("NOTIFICATIONS_URL");if(document.location.pathname.startsWith(t)&&!document.location.pathname.startsWith(t+"disable-email/")&&e.get("isAuthenticated")){const e=document.getElementById("page-mount");r().render((0,a.Z)(l.zt,{store:U.Z.getStore()},void 0,D||(D=(0,a.Z)(j,{}))),e)}},after:"store"})},94795:function(e,t,s){"use strict";var a=s(22928),i=s(57588),o=s.n(i),n=s(37424),r=s(69987),l=s(94417);function d(e){return(0,a.Z)("div",{className:"list-group nav-side"},void 0,e.options.map((t=>(0,a.Z)(r.rU,{to:e.baseUrl+t.component+"/",className:"list-group-item",activeClassName:"active"},t.component,(0,a.Z)("span",{className:"material-icon"},void 0,t.icon),t.name))))}function c(e){return(0,a.Z)("ul",{className:e.className||"dropdown-menu",role:"menu"},void 0,e.options.map((t=>(0,a.Z)(l.Z,{path:e.baseUrl+t.component+"/"},t.component,(0,a.Z)(r.rU,{to:e.baseUrl+t.component+"/",onClick:e.hideNav},void 0,(0,a.Z)("span",{className:"material-icon hidden-sm"},void 0,t.icon),t.name)))))}var p=s(4942),u=s(82211),h=s(78657),m=s(53328),v=s(53904),g=s(32233),Z=class extends o().Component{constructor(e){super(e),(0,p.Z)(this,"onPasswordChange",(e=>{this.setState({password:e.target.value})})),(0,p.Z)(this,"handleSubmit",(e=>{e.preventDefault();const{isLoading:t,password:s}=this.state,{user:a}=this.props;return 0==s.length?(v.Z.error(pgettext("delete your account form","Complete the form.")),!1):!t&&(this.setState({isLoading:!0}),void h.Z.post(a.api.delete,{password:s}).then((e=>{window.location.href=g.Z.get("MISAGO_PATH")}),(e=>{this.setState({isLoading:!1}),e.password?v.Z.error(e.password[0]):v.Z.apiError(e)})))})),this.state={isLoading:!1,password:""}}componentDidMount(){m.Z.set({title:pgettext("delete your account title","Delete account"),parent:pgettext("forum options","Change your options")})}render(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-danger panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("delete your account title","Delete account"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{},void 0,pgettext("delete your account form","This form lets you delete your account. This action is not reversible.")),(0,a.Z)("p",{},void 0,pgettext("delete your account form","Your account will be deleted together with its profile details, IP addresses and notifications.")),(0,a.Z)("p",{},void 0,pgettext("delete your account form","Other content will NOT be deleted, but username displayed next to it will be changed to one shared by all deleted accounts.")),(0,a.Z)("p",{},void 0,pgettext("delete your account form","Your username and e-maill address will become available again for use during registration or for other accounts to change to."))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)("div",{className:"input-group"},void 0,(0,a.Z)("input",{className:"form-control",disabled:this.state.isLoading,name:"password-confirmation",type:"password",placeholder:pgettext("delete your account form field","Enter your password to confirm"),value:this.state.password,required:!0,onChange:this.onPasswordChange}),(0,a.Z)("span",{className:"input-group-btn"},void 0,(0,a.Z)(u.Z,{className:"btn-danger",loading:this.state.isLoading},void 0,pgettext("delete your account form btn","Delete my account")))))))}},f=s(21688),b=class extends o().Component{constructor(){super(...arguments),(0,p.Z)(this,"onSuccess",(()=>{v.Z.info(pgettext("profile details form","Your details have been changed."))}))}componentDidMount(){m.Z.set({title:pgettext("edit details","Edit details"),parent:pgettext("forum options","Change your options")})}render(){return(0,a.Z)(f.Z,{api:this.props.user.api.edit_details,onSuccess:this.onSuccess})}},_=s(30381),N=s.n(_);class x extends o().Component{constructor(e){super(e),(0,p.Z)(this,"handleLoadDownloads",(()=>{h.Z.get(this.props.user.api.data_downloads).then((e=>{this.setState({isLoading:!1,downloads:e})}),(e=>{v.Z.apiError(e)}))})),(0,p.Z)(this,"handleRequestDataDownload",(()=>{this.setState({isSubmiting:!0}),h.Z.post(this.props.user.api.request_data_download).then((()=>{this.handleLoadDownloads(),v.Z.success(pgettext("download your data","Your request for data download has been registered.")),this.setState({isSubmiting:!1})}),(e=>{v.Z.apiError(e),this.setState({isSubmiting:!1})}))})),this.state={isLoading:!1,isSubmiting:!1,downloads:[]}}componentDidMount(){m.Z.set({title:pgettext("download your data title","Download your data"),parent:pgettext("forum options","Change your options")}),this.handleLoadDownloads()}render(){return(0,a.Z)("div",{},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("download your data title","Download your data"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("p",{},void 0,pgettext("download your data",'To download your data from the site, click the "Request data download" button. Depending on amount of data to be archived and number of users wanting to download their data at same time it may take up to few days for your download to be prepared. An e-mail with notification will be sent to you when your data is ready to be downloaded.')),(0,a.Z)("p",{},void 0,pgettext("download your data","The download will only be available for limited amount of time, after which it will be deleted from the site and marked as expired."))),(0,a.Z)("table",{className:"table"},void 0,(0,a.Z)("thead",{},void 0,(0,a.Z)("tr",{},void 0,(0,a.Z)("th",{},void 0,pgettext("download your data table","Requested on")),(0,a.Z)("th",{className:"col-md-4"},void 0,pgettext("download your data table","Download")))),(0,a.Z)("tbody",{},void 0,this.state.downloads.map((e=>(0,a.Z)("tr",{},e.id,(0,a.Z)("td",{style:y},void 0,N()(e.requested_on).fromNow()),(0,a.Z)("td",{},void 0,(0,a.Z)(w,{exportFile:e.file,status:e.status}))))),0==this.state.downloads.length?(0,a.Z)("tr",{},void 0,(0,a.Z)("td",{colSpan:"2"},void 0,pgettext("download your data table","You have no data downloads."))):null)),(0,a.Z)("div",{className:"panel-footer text-right"},void 0,(0,a.Z)(u.Z,{className:"btn-primary",loading:this.state.isSubmiting,type:"button",onClick:this.handleRequestDataDownload},void 0,pgettext("download your data btn","Request data download")))))}}const y={verticalAlign:"middle"},w=e=>{let{exportFile:t,status:s}=e;return 0===s||1===s?(0,a.Z)(u.Z,{className:"btn-info btn-sm btn-block",disabled:!0,type:"button"},void 0,pgettext("download your data table btn","Download is being prepared")):t?(0,a.Z)("a",{className:"btn btn-success btn-sm btn-block",href:t},void 0,pgettext("download your data table btn","Download your data")):(0,a.Z)(u.Z,{className:"btn-default btn-sm btn-block",disabled:!0,type:"button"},void 0,pgettext("download your data table btn","Download is expired"))};var k=s(43345),C=s(96359),S=s(60471),E=s(7227),T=s(35486),L=s(90287);const P=[{value:0,icon:"notifications_none",label:pgettext("watch thread choice","No")},{value:1,icon:"notifications",label:pgettext("watch thread choice","Yes, with on site notifications")},{value:2,icon:"mail",label:pgettext("watch thread choice","Yes, with on site and e-mail notifications")}],O=[{value:0,icon:"notifications_none",label:pgettext("notification preference","Don't notify")},{value:1,icon:"notifications",label:pgettext("notification preference","Notify on site")},{value:2,icon:"mail",label:pgettext("notification preference","Notify on site and with e-mail")}];class I extends k.Z{constructor(e){super(e),this.state={isLoading:!1,is_hiding_presence:e.user.is_hiding_presence,limits_private_thread_invites_to:e.user.limits_private_thread_invites_to,watch_started_threads:e.user.watch_started_threads,watch_replied_threads:e.user.watch_replied_threads,watch_new_private_threads_by_followed:e.user.watch_new_private_threads_by_followed,watch_new_private_threads_by_other_users:e.user.watch_new_private_threads_by_other_users,notify_new_private_threads_by_followed:e.user.notify_new_private_threads_by_followed,notify_new_private_threads_by_other_users:e.user.notify_new_private_threads_by_other_users,errors:{}},this.privateThreadInvitesChoices=[{value:0,icon:"help_outline",label:pgettext("private threads preference","Anybody can invite me to their private threads")},{value:1,icon:"done_all",label:pgettext("private threads preference","Only those I follow can invite me to their private threads")},{value:2,icon:"highlight_off",label:pgettext("private threads preference","Nobody can invite me to their private threads")}]}send(){return h.Z.post(this.props.user.api.options,{is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,watch_started_threads:this.state.watch_started_threads,watch_replied_threads:this.state.watch_replied_threads,watch_new_private_threads_by_followed:this.state.watch_new_private_threads_by_followed,watch_new_private_threads_by_other_users:this.state.watch_new_private_threads_by_other_users,notify_new_private_threads_by_followed:this.state.notify_new_private_threads_by_followed,notify_new_private_threads_by_other_users:this.state.notify_new_private_threads_by_other_users})}handleSuccess(){L.Z.dispatch((0,T.r$)({is_hiding_presence:this.state.is_hiding_presence,limits_private_thread_invites_to:this.state.limits_private_thread_invites_to,watch_started_threads:this.state.watch_started_threads,watch_replied_threads:this.state.watch_replied_threads,watch_new_private_threads_by_followed:this.state.watch_new_private_threads_by_followed,watch_new_private_threads_by_other_users:this.state.watch_new_private_threads_by_other_users,notify_new_private_threads_by_followed:this.state.notify_new_private_threads_by_followed,notify_new_private_threads_by_other_users:this.state.notify_new_private_threads_by_other_users})),v.Z.success(pgettext("forum options form","Your forum options have been changed."))}handleError(e){400===e.status?v.Z.error(pgettext("forum options form","Please reload the page and try again.")):v.Z.apiError(e)}componentDidMount(){m.Z.set({title:pgettext("forum options title","Forum options"),parent:pgettext("forum options","Change your options")})}render(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("forum options form title","Change forum options"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,pgettext("forum options form","Privacy settings")),(0,a.Z)(C.Z,{label:pgettext("forum options form","Hide my presence"),helpText:pgettext("forum options form","If you hide your presence, only members with permission to see hidden presence will see when you are online."),for:"id_is_hiding_presence"},void 0,(0,a.Z)(E.Z,{id:"id_is_hiding_presence",disabled:this.state.isLoading,iconOn:"visibility_off",iconOff:"visibility",labelOn:pgettext("forum options form","Hide my presence from other users"),labelOff:pgettext("forum options form","Show my presence to other users"),onChange:this.bindInput("is_hiding_presence"),value:this.state.is_hiding_presence})),(0,a.Z)(C.Z,{label:pgettext("forum options form","Limit private thread invitations from other users"),for:"id_limits_private_thread_invites_to"},void 0,(0,a.Z)(S.Z,{id:"id_limits_private_thread_invites_to",disabled:this.state.isLoading,onChange:this.bindInput("limits_private_thread_invites_to"),value:this.state.limits_private_thread_invites_to,choices:this.privateThreadInvitesChoices}))),(0,a.Z)("fieldset",{},void 0,(0,a.Z)("legend",{},void 0,pgettext("notifications options","Notifications preferences")),(0,a.Z)(C.Z,{label:pgettext("notifications options","Automatically watch threads I start"),for:"id_watch_started_threads"},void 0,(0,a.Z)(S.Z,{id:"id_watch_started_threads",disabled:this.state.isLoading,onChange:this.bindInput("watch_started_threads"),value:this.state.watch_started_threads,choices:P})),(0,a.Z)(C.Z,{label:pgettext("notifications options","Automatically watch threads I reply to"),for:"id_watch_replied_threads"},void 0,(0,a.Z)(S.Z,{id:"id_watch_replied_threads",disabled:this.state.isLoading,onChange:this.bindInput("watch_replied_threads"),value:this.state.watch_replied_threads,choices:P})),(0,a.Z)(C.Z,{label:pgettext("notifications options","Automatically watch new private threads I'm invited to by the members I am following"),for:"id_watch_new_private_threads_by_followed"},void 0,(0,a.Z)(S.Z,{id:"id_watch_new_private_threads_by_followed",disabled:this.state.isLoading,onChange:this.bindInput("watch_new_private_threads_by_followed"),value:this.state.watch_new_private_threads_by_followed,choices:P})),(0,a.Z)(C.Z,{label:pgettext("notifications options","Automatically watch new private threads I'm invited to by other members"),for:"id_watch_new_private_threads_by_other_users"},void 0,(0,a.Z)(S.Z,{id:"id_watch_new_private_threads_by_other_users",disabled:this.state.isLoading,onChange:this.bindInput("watch_new_private_threads_by_other_users"),value:this.state.watch_new_private_threads_by_other_users,choices:P})),(0,a.Z)(C.Z,{label:pgettext("notifications options","Notify me about new private thread invitations from the members I am following"),for:"id_notify_new_private_threads_by_followed"},void 0,(0,a.Z)(S.Z,{id:"id_notify_new_private_threads_by_followed",disabled:this.state.isLoading,onChange:this.bindInput("notify_new_private_threads_by_followed"),value:this.state.notify_new_private_threads_by_followed,choices:O})),(0,a.Z)(C.Z,{label:pgettext("notifications options","Notify me about new private thread invitations from other members"),for:"id_notify_new_private_threads_by_other_users"},void 0,(0,a.Z)(S.Z,{id:"id_notify_new_private_threads_by_other_users",disabled:this.state.isLoading,onChange:this.bindInput("notify_new_private_threads_by_other_users"),value:this.state.notify_new_private_threads_by_other_users,choices:O})))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(u.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("forum options form btn","Save changes")))))}}var A,R=s(95187);function D(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change username title","Change username"))),A||(A=(0,a.Z)(R.Z,{})))}var j,U,z,M,B,q,F,H=s(33556),Y=class extends o().Component{getHelpText(){return this.props.options.next_on?interpolate(pgettext("change username","You will be able to change your username %(next_change)s."),{next_change:this.props.options.next_on.fromNow()},!0):pgettext("change username","You have changed your name allowed number of times.")}render(){return(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change username title","Change username"))),(0,a.Z)(H.Z,{helpText:this.getHelpText(),message:pgettext("change username","You can't change your username at the moment.")}))}},V=s(55210),G=class extends k.Z{constructor(e){super(e),this.state={username:"",validators:{username:[V.lG(),V.HR(e.options.length_min),V.gS(e.options.length_max)]},isLoading:!1}}getHelpText(){let e=[];if(this.props.options.changes_left>0){let t=npgettext("change username form","You can change your username %(changes_left)s more time.","You can change your username %(changes_left)s more times.",this.props.options.changes_left);e.push(interpolate(t,{changes_left:this.props.options.changes_left},!0))}if(this.props.user.acl.name_changes_expire>0){let t=npgettext("change username form","Used changes become available again after %(name_changes_expire)s day.","Used changes become available again after %(name_changes_expire)s days.",this.props.user.acl.name_changes_expire);e.push(interpolate(t,{name_changes_expire:this.props.user.acl.name_changes_expire},!0))}return e.length?e.join(" "):null}clean(){let e=this.validate();return e.username?(v.Z.error(e.username[0]),!1):this.state.username.trim()!==this.props.user.username||(v.Z.info(pgettext("change username form","New username is same as current one.")),!1)}send(){return h.Z.post(this.props.user.api.username,{username:this.state.username})}handleSuccess(e){this.setState({username:""}),this.props.complete(e.username,e.slug,e.options)}handleError(e){v.Z.apiError(e)}render(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change username title","Change username"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(C.Z,{label:pgettext("change username form field","New username"),for:"id_username",helpText:this.getHelpText()},void 0,(0,a.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(u.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("change username form btn","Change username")))))}},$=s(7850),W=s(48927),Q=s(6935),X=class extends o().Component{constructor(e){super(e),(0,p.Z)(this,"onComplete",((e,t,s)=>{this.setState({options:s}),L.Z.dispatch((0,W.KP)({username:e,slug:t},this.props.user,this.props.user)),L.Z.dispatch((0,Q._S)(this.props.user,e,t)),v.Z.success(pgettext("change username","Your username has been changed."))})),this.state={isLoaded:!1,options:null}}componentDidMount(){m.Z.set({title:pgettext("change username title","Change username"),parent:pgettext("forum options","Change your options")}),Promise.all([h.Z.get(this.props.user.api.username),h.Z.get(g.Z.get("USERNAME_CHANGES_API"),{user:this.props.user.id})]).then((e=>{L.Z.dispatch((0,W.ZB)(e[1].results)),this.setState({isLoaded:!0,options:{changes_left:e[0].changes_left,length_min:e[0].length_min,length_max:e[0].length_max,next_on:e[0].next_on?N()(e[0].next_on):null}})}))}getChangeForm(){return this.state.isLoaded?0===this.state.options.changes_left?(0,a.Z)(Y,{options:this.state.options}):(0,a.Z)(G,{complete:this.onComplete,options:this.state.options,user:this.props.user}):j||(j=(0,a.Z)(D,{}))}render(){return(0,a.Z)("div",{},void 0,this.getChangeForm(),(0,a.Z)($.Z,{changes:this.props["username-history"],isLoaded:this.state.isLoaded}))}},K=class extends k.Z{constructor(e){super(e),this.state={new_email:"",password:"",validators:{new_email:[V.Do()],password:[]},isLoading:!1}}clean(){let e=this.validate();return-1!==[this.state.new_email.trim().length,this.state.password.trim().length].indexOf(0)?(v.Z.error(pgettext("change email form","Fill out all fields.")),!1):!e.new_email||(v.Z.error(e.new_email[0]),!1)}send(){return h.Z.post(this.props.user.api.change_email,{new_email:this.state.new_email,password:this.state.password})}handleSuccess(e){this.setState({new_email:"",password:""}),v.Z.success(e.detail)}handleError(e){400===e.status?e.new_email?v.Z.error(e.new_email):v.Z.error(e.password):v.Z.apiError(e)}render(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change email title","Change e-mail address"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(C.Z,{label:pgettext("change email form field","New e-mail"),for:"id_new_email"},void 0,(0,a.Z)("input",{type:"text",id:"id_new_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_email"),value:this.state.new_email})),U||(U=(0,a.Z)("hr",{})),(0,a.Z)(C.Z,{label:pgettext("change email form field","Your current password"),for:"id_confirm_email"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_email",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(u.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("change email form btn","Change e-mail")))))}},J=class extends k.Z{constructor(e){super(e),this.state={new_password:"",repeat_password:"",password:"",validators:{new_password:[],repeat_password:[],password:[]},isLoading:!1}}clean(){let e=this.validate();return-1!==[this.state.new_password.trim().length,this.state.repeat_password.trim().length,this.state.password.trim().length].indexOf(0)?(v.Z.error(pgettext("change password form","Fill out all fields.")),!1):e.new_password?(v.Z.error(e.new_password[0]),!1):this.state.new_password===this.state.repeat_password||(v.Z.error(pgettext("change password form","New passwords are different.")),!1)}send(){return h.Z.post(this.props.user.api.change_password,{new_password:this.state.new_password,password:this.state.password})}handleSuccess(e){this.setState({new_password:"",repeat_password:"",password:""}),v.Z.success(e.detail)}handleError(e){400===e.status?e.new_password?v.Z.error(e.new_password):v.Z.error(e.password):v.Z.apiError(e)}render(){return(0,a.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,a.Z)("input",{type:"type",style:{display:"none"}}),(0,a.Z)("input",{type:"password",style:{display:"none"}}),(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change password title","Change password"))),(0,a.Z)("div",{className:"panel-body"},void 0,(0,a.Z)(C.Z,{label:pgettext("change password form field","New password"),for:"id_new_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_new_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("new_password"),value:this.state.new_password})),(0,a.Z)(C.Z,{label:pgettext("change password form field","Repeat password"),for:"id_repeat_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_repeat_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("repeat_password"),value:this.state.repeat_password})),z||(z=(0,a.Z)("hr",{})),(0,a.Z)(C.Z,{label:pgettext("change password form field","Your current password"),for:"id_confirm_password"},void 0,(0,a.Z)("input",{type:"password",id:"id_confirm_password",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,a.Z)("div",{className:"panel-footer"},void 0,(0,a.Z)(u.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("change password form btn","Change password")))))}},ee=()=>(0,a.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,a.Z)("div",{className:"panel-heading"},void 0,(0,a.Z)("h3",{className:"panel-title"},void 0,pgettext("change sign in credentials title","Change e-mail or password"))),(0,a.Z)("div",{className:"panel-body panel-message-body"},void 0,M||(M=(0,a.Z)("div",{className:"message-icon"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,a.Z)("div",{className:"message-body"},void 0,(0,a.Z)("p",{className:"lead"},void 0,pgettext("change sign in credentials","You need to set a password for your account to be able to change your e-mail or password.")),(0,a.Z)("p",{className:"help-block"},void 0,(0,a.Z)("a",{className:"btn btn-primary",href:g.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,pgettext("change sign in credentials link","Set password")))))),te=class extends o().Component{componentDidMount(){m.Z.set({title:pgettext("change sign in credentials title","Change e-mail or password"),parent:pgettext("forum options","Change your options")})}render(){return this.props.user.has_usable_password?(0,a.Z)("div",{},void 0,(0,a.Z)(K,{user:this.props.user}),(0,a.Z)(J,{user:this.props.user}),(0,a.Z)("p",{className:"message-line"},void 0,q||(q=(0,a.Z)("span",{className:"material-icon"},void 0,"warning")),(0,a.Z)("a",{href:g.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,pgettext("change sign in credentials link","Change forgotten password")))):B||(B=(0,a.Z)(ee,{}))}},se=s(82125),ae=s(98936),ie=s(59131),oe=s(99755),ne=class extends se.Z{render(){const e=g.Z.get("USER_OPTIONS").filter((e=>{const t=g.Z.get("USERCP_URL")+e.component+"/";return this.props.location.pathname.substr(0,t.length)===t}))[0];return(0,a.Z)("div",{className:"page page-options"},void 0,(0,a.Z)(oe.sP,{},void 0,(0,a.Z)(oe.mr,{styleName:"options"},void 0,(0,a.Z)(oe.gC,{styleName:"options"},void 0,(0,a.Z)(ae.gq,{},void 0,(0,a.Z)(ae.kw,{auto:!0},void 0,(0,a.Z)(ae.Z6,{auto:!0},void 0,(0,a.Z)("h1",{},void 0,pgettext("forum options","Change your options"))),(0,a.Z)(ae.Z6,{className:"hidden-xs hidden-md hidden-lg",shrink:!0},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-icon dropdown-toggle",title:pgettext("forum options nav btn","Menu"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,F||(F=(0,a.Z)("span",{className:"material-icon"},void 0,"menu"))),(0,a.Z)(c,{className:"dropdown-menu dropdown-menu-right",baseUrl:g.Z.get("USERCP_URL"),options:g.Z.get("USER_OPTIONS")})))),(0,a.Z)(ae.kw,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,a.Z)(ae.Z6,{},void 0,(0,a.Z)("div",{className:"dropdown"},void 0,(0,a.Z)("button",{type:"button",className:"btn btn-default btn-outline btn-block dropdown-toggle","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,a.Z)("span",{className:"material-icon"},void 0,e.icon),e.name),(0,a.Z)(c,{className:"dropdown-menu",baseUrl:g.Z.get("USERCP_URL"),options:g.Z.get("USER_OPTIONS")})))))))),(0,a.Z)(ie.Z,{},void 0,(0,a.Z)("div",{className:"row"},void 0,(0,a.Z)("div",{className:"col-md-3 hidden-xs hidden-sm"},void 0,(0,a.Z)(d,{baseUrl:g.Z.get("USERCP_URL"),options:g.Z.get("USER_OPTIONS")})),(0,a.Z)("div",{className:"col-md-9"},void 0,this.props.children))))}};function re(e){return{tick:e.tick.tick,user:e.auth.user,"username-history":e["username-history"]}}function le(){const e=[{path:g.Z.get("USERCP_URL")+"forum-options/",component:(0,n.$j)(re)(I)},{path:g.Z.get("USERCP_URL")+"edit-details/",component:(0,n.$j)(re)(b)}],t=g.Z.get("SETTINGS").DELEGATE_AUTH;return t||(e.push({path:g.Z.get("USERCP_URL")+"change-username/",component:(0,n.$j)(re)(X)}),e.push({path:g.Z.get("USERCP_URL")+"sign-in-credentials/",component:(0,n.$j)(re)(te)})),g.Z.get("ENABLE_DOWNLOAD_OWN_DATA")&&e.push({path:g.Z.get("USERCP_URL")+"download-data/",component:(0,n.$j)(re)(x)}),!t&&g.Z.get("ENABLE_DELETE_OWN_ACCOUNT")&&e.push({path:g.Z.get("USERCP_URL")+"delete-account/",component:(0,n.$j)(re)(Z)}),e}var de=s(39633);g.Z.addInitializer({name:"component:options",initializer:function(e){e.has("USER_OPTIONS")&&(0,de.Z)({root:g.Z.get("USERCP_URL"),component:ne,paths:le()})},after:"store"})},95563:function(e,t,s){"use strict";var a,i=s(37424),o=s(22928),n=s(4942),r=s(57588),l=s.n(r),d=s(30381),c=s.n(d),p=s(95187),u=s(33556),h=s(32233),m=s(55547),v=s(53328),g=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"update",(e=>{e.expires_on&&(e.expires_on=c()(e.expires_on)),this.setState({isLoaded:!0,error:null,ban:e})})),(0,n.Z)(this,"error",(e=>{this.setState({isLoaded:!0,error:e.detail,ban:null})})),h.Z.has("PROFILE_BAN")?this.initWithPreloadedData(h.Z.pop("PROFILE_BAN")):this.initWithoutPreloadedData(),this.startPolling(e.profile.api.ban)}initWithPreloadedData(e){e.expires_on&&(e.expires_on=c()(e.expires_on)),this.state={isLoaded:!0,ban:e}}initWithoutPreloadedData(){this.state={isLoaded:!1}}startPolling(e){m.Z.start({poll:"ban-details",url:e,frequency:9e4,update:this.update,error:this.error})}componentDidMount(){v.Z.set({title:pgettext("profile ban details title","Ban details"),parent:this.props.profile.username})}componentWillUnmount(){m.Z.stop("ban-details")}getUserMessage(){return this.state.ban.user_message?(0,o.Z)("div",{className:"panel-body ban-message ban-user-message"},void 0,(0,o.Z)("h4",{},void 0,pgettext("profile ban details","User-shown ban message")),(0,o.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.user_message.html}})):null}getStaffMessage(){return this.state.ban.staff_message?(0,o.Z)("div",{className:"panel-body ban-message ban-staff-message"},void 0,(0,o.Z)("h4",{},void 0,pgettext("profile ban details","Team-shown ban message")),(0,o.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.staff_message.html}})):null}getExpirationMessage(){if(this.state.ban.expires_on){if(this.state.ban.expires_on.isAfter(c()())){let e=interpolate(pgettext("profile ban details","This ban expires on %(expires_on)s."),{expires_on:this.state.ban.expires_on.format("LL, LT")},!0),t=interpolate(pgettext("profile ban details","This ban expires %(expires_on)s."),{expires_on:this.state.ban.expires_on.fromNow()},!0);return(0,o.Z)("abbr",{title:e},void 0,t)}return pgettext("profile ban details","This ban has expired.")}return interpolate(pgettext("profile ban details","%(username)s's ban is permanent."),{username:this.props.profile.username},!0)}getPanelBody(){return this.state.ban?Object.keys(this.state.ban).length?(0,o.Z)("div",{},void 0,this.getUserMessage(),this.getStaffMessage(),(0,o.Z)("div",{className:"panel-body ban-expires"},void 0,(0,o.Z)("h4",{},void 0,pgettext("profile ban details","Ban expiration")),(0,o.Z)("p",{className:"lead"},void 0,this.getExpirationMessage()))):(0,o.Z)("div",{},void 0,(0,o.Z)(u.Z,{message:pgettext("profile ban details","No ban is active at the moment.")})):this.state.error?(0,o.Z)("div",{},void 0,(0,o.Z)(u.Z,{icon:"error_outline",message:this.state.error})):a||(a=(0,o.Z)("div",{},void 0,(0,o.Z)(p.Z,{})))}render(){return(0,o.Z)("div",{className:"profile-ban-details"},void 0,(0,o.Z)("div",{className:"panel panel-default"},void 0,(0,o.Z)("div",{className:"panel-heading"},void 0,(0,o.Z)("h3",{className:"panel-title"},void 0,pgettext("profile ban details title","Ban details"))),this.getPanelBody()))}},Z=s(21688);function f(e){let{api:t,display:s,onCancel:a,onSuccess:i}=e;return s?(0,o.Z)(Z.Z,{api:t,onCancel:a,onSuccess:i}):null}function b(e){let{isAuthenticated:t,profile:s}=e,a=null;return a=t?pgettext("profile details empty","You are not sharing any details with others."):interpolate(pgettext("profile details empty","%(username)s is not sharing any details with others."),{username:s.username},!0),(0,o.Z)("div",{className:"panel panel-default"},void 0,(0,o.Z)("div",{className:"panel-body text-center lead"},void 0,a))}function _(e){let{html:t,text:s,url:a}=e;return t?(0,o.Z)("div",{className:"form-control-static col-md-9",dangerouslySetInnerHTML:{__html:t}}):(0,o.Z)("div",{className:"form-control-static col-md-9"},void 0,(0,o.Z)(N,{text:s,url:a}))}function N(e){let{text:t,url:s}=e;return s?(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:s,target:"_blank",rel:"nofollow"},void 0,t||s)):t?(0,o.Z)("p",{},void 0,t):null}function x(e){return(0,o.Z)("div",{className:"form-group"},void 0,(0,o.Z)("strong",{className:"control-label col-md-3"},void 0,e.name,":"),l().createElement(_,e))}function y(e){let{fields:t,name:s}=e;return(0,o.Z)("div",{className:"panel panel-default panel-profile-details-group"},void 0,(0,o.Z)("div",{className:"panel-heading"},void 0,(0,o.Z)("h3",{className:"panel-title"},void 0,s)),(0,o.Z)("div",{className:"panel-body"},void 0,(0,o.Z)("div",{className:"form-horizontal"},void 0,t.map((e=>{let{fieldname:t,html:s,name:a,text:i,url:n}=e;return(0,o.Z)(x,{name:a,html:s,text:i,url:n},t)})))))}var w,k=s(37848);function C(e){let{display:t,groups:s,isAuthenticated:a,loading:i,profile:n}=e;return t?i?w||(w=(0,o.Z)(k.Z,{})):s.length?(0,o.Z)("div",{},void 0,s.map(((e,t)=>(0,o.Z)(y,{fields:e.fields,name:e.name},t)))):(0,o.Z)(b,{isAuthenticated:a,profile:n}):null}var S,E=s(92490),T=e=>{let{onEdit:t,showEditButton:s}=e;return(0,o.Z)(E.o8,{},void 0,(0,o.Z)(E.Z2,{auto:!0},void 0,(0,o.Z)(E.Eg,{auto:!0},void 0,(0,o.Z)("h3",{},void 0,pgettext("profile details title","Details")))),s&&(0,o.Z)(E.Z2,{},void 0,(0,o.Z)(E.Eg,{},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-block",onClick:t,type:"button"},void 0,pgettext("profile details edit btn","Edit")))))},L=s(58598),P=s(78657),O=s(53904),I=class extends l().Component{componentDidMount(){const{data:e,dispatch:t,user:s}=this.props;e&&e.id===s.id||P.Z.get(this.props.user.api.details).then((e=>{t((0,L.zD)(e))}),(e=>{O.Z.apiError(e)}))}render(){return this.props.children}},A=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"onCancel",(()=>{this.setState({editing:!1})})),(0,n.Z)(this,"onEdit",(()=>{this.setState({editing:!0})})),(0,n.Z)(this,"onSuccess",(e=>{const{dispatch:t,isAuthenticated:s,profile:a}=this.props;let i=null;i=s?pgettext("profile details form","Your details have been changed."):interpolate(pgettext("profile details form","%(username)s's details have been changed."),{username:a.username},!0),O.Z.info(i),t((0,L.zD)(e)),this.setState({editing:!1})})),this.state={editing:!1}}componentDidMount(){v.Z.set({title:pgettext("profile details title","Details"),parent:this.props.profile.username})}render(){const{dispatch:e,isAuthenticated:t,profile:s,profileDetails:a}=this.props,i=a.id!==s.id;return(0,o.Z)(I,{data:a,dispatch:e,user:s},void 0,(0,o.Z)("div",{className:"profile-details"},void 0,(0,o.Z)(T,{onEdit:this.onEdit,showEditButton:!!a.edit&&!this.state.editing}),(0,o.Z)(C,{display:!this.state.editing,groups:a.groups,isAuthenticated:t,loading:i,profile:s}),(0,o.Z)(f,{api:s.api.edit_details,dispatch:e,display:this.state.editing,onCancel:this.onCancel,onSuccess:this.onSuccess})))}},R=s(87462),D=s(11005),j=s(82211),U=s(21981),z=s(90287),M=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"loadMore",(()=>{this.setState({isLoading:!0}),this.loadItems(this.props.posts.next)})),this.state={isLoading:!1}}loadItems(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;P.Z.get(this.props.api,{start:e||0}).then((t=>{0===e?z.Z.dispatch(U.zD(t)):z.Z.dispatch(U.R3(t)),this.setState({isLoading:!1})}),(e=>{this.setState({isLoading:!1}),O.Z.apiError(e)}))}componentDidMount(){v.Z.set({title:this.props.title,parent:this.props.profile.username}),this.loadItems()}render(){return(0,o.Z)("div",{className:"profile-feed"},void 0,(0,o.Z)(E.o8,{},void 0,(0,o.Z)(E.Z2,{auto:!0},void 0,(0,o.Z)(E.Eg,{auto:!0},void 0,(0,o.Z)("h3",{},void 0,this.props.header)))),l().createElement(B,(0,R.Z)({isLoading:this.state.isLoading,loadMore:this.loadMore},this.props)))}};function B(e){return e.posts.isLoaded&&!e.posts.results.length?(0,o.Z)("p",{className:"lead"},void 0,e.emptyMessage):(0,o.Z)("div",{},void 0,(0,o.Z)(D.Z,{isReady:e.posts.isLoaded,posts:e.posts.results,poster:e.profile}),(0,o.Z)(q,{isLoading:e.isLoading,loadMore:e.loadMore,next:e.posts.next}))}function q(e){return e.next?(0,o.Z)("div",{className:"pager-more"},void 0,(0,o.Z)(j.Z,{className:"btn btn-default btn-outline",loading:e.isLoading,onClick:e.loadMore},void 0,pgettext("profile load more btn","Show older activity"))):null}var F,H,Y,V,G,$,W,Q,X,K,J,ee=class extends l().Component{getClassName(){return this.props.className?"form-search "+this.props.className:"form-search"}render(){return(0,o.Z)("div",{className:this.getClassName()},void 0,(0,o.Z)("input",{type:"text",className:"form-control",value:this.props.value,onChange:this.props.onChange,placeholder:this.props.placeholder||pgettext("quick search placeholder","Search...")}),S||(S=(0,o.Z)("span",{className:"material-icon"},void 0,"search")))}},te=s(40429),se=s(6935),ae=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"loadMore",(()=>{this.setState({isBusy:!0}),this.loadUsers(this.state.page+1,this.state.search)})),(0,n.Z)(this,"search",(e=>{this.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),this.loadUsers(1,e.target.value)})),this.setSpecialProps(),h.Z.has(this.PRELOADED_DATA_KEY)?this.initWithPreloadedData(h.Z.pop(this.PRELOADED_DATA_KEY)):this.initWithoutPreloadedData()}setSpecialProps(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWERS",this.TITLE=pgettext("profile followers title","Followers"),this.API_FILTER="followers"}initWithPreloadedData(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},z.Z.dispatch((0,se.ZB)(e.results))}initWithoutPreloadedData(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadUsers()}loadUsers(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const s=this.props.profile.api[this.API_FILTER];P.Z.get(s,{search:t,page:e||1},"user-"+this.API_FILTER).then((t=>{1===e?z.Z.dispatch((0,se.ZB)(t.results)):z.Z.dispatch((0,se.R3)(t.results)),this.setState({isLoaded:!0,isBusy:!1,count:t.count,more:t.more,page:t.page,pages:t.pages})}),(e=>{O.Z.apiError(e)}))}componentDidMount(){v.Z.set({title:this.TITLE,parent:this.props.profile.username})}getLabel(){if(this.state.isLoaded){if(this.state.search){let e=npgettext("profile followers","Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){let e=npgettext("profile followers","You have %(users)s follower.","You have %(users)s followers.",this.state.count);return interpolate(e,{users:this.state.count},!0)}{let e=npgettext("profile followers","%(username)s has %(users)s follower.","%(username)s has %(users)s followers.",this.state.count);return interpolate(e,{username:this.props.profile.username,users:this.state.count},!0)}}return pgettext("Loading...")}getEmptyMessage(){return this.state.search?pgettext("profile followers","Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("profile followers","You have no followers."):interpolate(pgettext("profile followers","%(username)s has no followers."),{username:this.props.profile.username},!0)}getMoreButton(){return this.state.more?(0,o.Z)("div",{className:"pager-more"},void 0,(0,o.Z)(j.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(pgettext("profile followers","Show more (%(more)s)"),{more:this.state.more},!0))):null}getListBody(){return this.state.isLoaded&&0===this.state.count?(0,o.Z)("p",{className:"lead"},void 0,this.getEmptyMessage()):(0,o.Z)("div",{},void 0,(0,o.Z)(te.Z,{cols:3,isReady:this.state.isLoaded,users:this.props.users}),this.getMoreButton())}getClassName(){return"profile-"+this.API_FILTER}render(){return(0,o.Z)("div",{className:this.getClassName()},void 0,(0,o.Z)(E.o8,{},void 0,(0,o.Z)(E.Z2,{auto:!0},void 0,(0,o.Z)(E.Eg,{auto:!0},void 0,(0,o.Z)("h3",{},void 0,this.getLabel()))),(0,o.Z)(E.Z2,{},void 0,(0,o.Z)(E.Eg,{},void 0,(0,o.Z)(ee,{value:this.state.search,onChange:this.search,placeholder:pgettext("profile followers search","Search users...")})))),this.getListBody())}},ie=s(7850),oe=s(48927),ne=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"loadMore",(()=>{this.setState({isBusy:!0}),this.loadChanges(this.state.page+1,this.state.search)})),(0,n.Z)(this,"search",(e=>{this.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),this.loadChanges(1,e.target.value)})),h.Z.has("PROFILE_NAME_HISTORY")?this.initWithPreloadedData(h.Z.pop("PROFILE_NAME_HISTORY")):this.initWithoutPreloadedData()}initWithPreloadedData(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},z.Z.dispatch((0,oe.ZB)(e.results))}initWithoutPreloadedData(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadChanges()}loadChanges(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;P.Z.get(h.Z.get("USERNAME_CHANGES_API"),{user:this.props.profile.id,search:t,page:e||1},"search-username-history").then((t=>{1===e?z.Z.dispatch((0,oe.ZB)(t.results)):z.Z.dispatch((0,oe.R3)(t.results)),this.setState({isLoaded:!0,isBusy:!1,count:t.count,more:t.more,page:t.page,pages:t.pages})}),(e=>{O.Z.apiError(e)}))}componentDidMount(){v.Z.set({title:pgettext("profile username history title","Username history"),parent:this.props.profile.username})}getLabel(){if(this.state.isLoaded){if(this.state.search){let e=npgettext("profile username history","Found %(changes)s username change.","Found %(changes)s username changes.",this.state.count);return interpolate(e,{changes:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){let e=npgettext("profile username history","Your username was changed %(changes)s time.","Your username was changed %(changes)s times.",this.state.count);return interpolate(e,{changes:this.state.count},!0)}{let e=npgettext("profile username history","%(username)s's username was changed %(changes)s time.","%(username)s's username was changed %(changes)s times.",this.state.count);return interpolate(e,{username:this.props.profile.username,changes:this.state.count},!0)}}return pgettext("profile username history","Loading...")}getEmptyMessage(){return this.state.search?pgettext("profile username history","Search returned no username changes matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("username history empty","Your account has no history of name changes."):interpolate(pgettext("profile username history","%(username)s's username was never changed."),{username:this.props.profile.username},!0)}getMoreButton(){return this.state.more?(0,o.Z)("div",{className:"pager-more"},void 0,(0,o.Z)(j.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(pgettext("profile username history","Show older (%(more)s)"),{more:this.state.more},!0))):null}render(){return(0,o.Z)("div",{className:"profile-username-history"},void 0,(0,o.Z)(E.o8,{},void 0,(0,o.Z)(E.Z2,{auto:!0},void 0,(0,o.Z)(E.Eg,{auto:!0},void 0,(0,o.Z)("h3",{},void 0,this.getLabel()))),(0,o.Z)(E.Z2,{},void 0,(0,o.Z)(E.Eg,{},void 0,(0,o.Z)(ee,{value:this.state.search,onChange:this.search,placeholder:pgettext("profile username history search input","Search history...")})))),(0,o.Z)(ie.Z,{isLoaded:this.state.isLoaded,emptyMessage:this.getEmptyMessage(),changes:this.props["username-history"]}),this.getMoreButton())}},re=s(82125),le=s(27519),de=s(59131),ce=s(19605),pe=s(98936),ue=s(99755),he=class extends l().Component{constructor(e){super(e),(0,n.Z)(this,"action",(()=>{this.setState({isLoading:!0}),this.props.profile.is_followed?z.Z.dispatch((0,le.r$)({is_followed:!1,followers:this.props.profile.followers-1})):z.Z.dispatch((0,le.r$)({is_followed:!0,followers:this.props.profile.followers+1})),P.Z.post(this.props.profile.api.follow).then((e=>{this.setState({isLoading:!1}),z.Z.dispatch((0,le.r$)(e))}),(e=>{this.setState({isLoading:!1}),O.Z.apiError(e)}))})),this.state={isLoading:!1}}getClassName(){return this.props.profile.is_followed?this.props.className+" btn-default btn-following":this.props.className+" btn-default btn-follow"}getIcon(){return this.props.profile.is_followed?"favorite":"favorite_border"}getLabel(){return this.props.profile.is_followed?pgettext("user profile follow btn","Following"):pgettext("user profile follow btn","Follow")}render(){return(0,o.Z)(j.Z,{className:this.getClassName(),disabled:this.state.isLoading,onClick:this.action},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,this.getIcon()),this.getLabel())}},me=s(64646),ve=class extends l().Component{constructor(){super(...arguments),(0,n.Z)(this,"onClick",(()=>{me.Z.open({mode:"START_PRIVATE",submit:h.Z.get("PRIVATE_THREADS_API"),to:[this.props.profile]})}))}render(){const e=this.props.user.acl.can_start_private_threads,t=this.props.user.id===this.props.profile.id;return!e||t?null:(0,o.Z)("button",{className:this.props.className,onClick:this.onClick,type:"button"},void 0,F||(F=(0,o.Z)("span",{className:"material-icon"},void 0,"comment")),pgettext("profile message btn","Message"))}},ge=s(43345),Ze=s(96359),fe=s(3784),be=s(7227),_e=s(30337),Ne=class extends ge.Z{constructor(e){super(e),this.state={isLoaded:!1,isLoading:!1,error:null,is_avatar_locked:"",avatar_lock_user_message:"",avatar_lock_staff_message:""}}componentDidMount(){P.Z.get(this.props.profile.api.moderate_avatar).then((e=>{this.setState({isLoaded:!0,is_avatar_locked:e.is_avatar_locked,avatar_lock_user_message:e.avatar_lock_user_message||"",avatar_lock_staff_message:e.avatar_lock_staff_message||""})}),(e=>{this.setState({isLoaded:!0,error:e.detail})}))}clean(){return!!this.isValid()||(O.Z.error(this.validate().username[0]),!1)}send(){return P.Z.post(this.props.profile.api.moderate_avatar,{is_avatar_locked:this.state.is_avatar_locked,avatar_lock_user_message:this.state.avatar_lock_user_message,avatar_lock_staff_message:this.state.avatar_lock_staff_message})}handleSuccess(e){z.Z.dispatch((0,se.n1)(this.props.profile,e.avatar_hash)),O.Z.success(pgettext("profile avatar moderation","Avatar controls have been changed."))}getFormBody(){return(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(Ze.Z,{label:pgettext("profile avatar moderation field","Lock avatar"),helpText:pgettext("profile avatar moderation field","Locking user avatar will prohibit user from changing his avatar and will reset his/her avatar to default one."),for:"id_is_avatar_locked"},void 0,(0,o.Z)(be.Z,{id:"id_is_avatar_locked",disabled:this.state.isLoading,iconOn:"lock_outline",iconOff:"lock_open",labelOn:pgettext("profile avatar moderation field","Disallow user from changing avatar"),labelOff:pgettext("profile avatar moderation field","Allow user to change avatar"),onChange:this.bindInput("is_avatar_locked"),value:this.state.is_avatar_locked})),(0,o.Z)(Ze.Z,{label:pgettext("profile avatar moderation field","User message"),helpText:pgettext("profile avatar moderation field","Optional message for user explaining why they are prohibited from changing their avatar."),for:"id_avatar_lock_user_message"},void 0,(0,o.Z)("textarea",{id:"id_avatar_lock_user_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_user_message"),value:this.state.avatar_lock_user_message})),(0,o.Z)(Ze.Z,{label:pgettext("profile avatar moderation field","Staff message"),helpText:pgettext("profile avatar moderation field","Optional message for forum team members explaining why the user is prohibited form changing their avatar."),for:"id_avatar_lock_staff_message"},void 0,(0,o.Z)("textarea",{id:"id_avatar_lock_staff_message",className:"form-control",rows:"4",disabled:this.state.isLoading,onChange:this.bindInput("avatar_lock_staff_message"),value:this.state.avatar_lock_staff_message}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,pgettext("profile avatar moderation btn","Close")),(0,o.Z)(j.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("profile avatar moderation btn","Save changes"))))}getModalBody(){return this.state.error?(0,o.Z)(_e.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():H||(H=(0,o.Z)(fe.Z,{}))}getClassName(){return this.state.error?"modal-dialog modal-message modal-avatar-controls":"modal-dialog modal-avatar-controls"}render(){return(0,o.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,Y||(Y=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("profile avatar moderation title","Avatar controls"))),this.getModalBody()))}},xe=s(55210),ye=class extends ge.Z{constructor(e){super(e),this.state={isLoaded:!1,isLoading:!1,error:null,username:"",validators:{username:[xe.lG()]}}}componentDidMount(){P.Z.get(this.props.profile.api.moderate_username).then((()=>{this.setState({isLoaded:!0})}),(e=>{this.setState({isLoaded:!0,error:e.detail})}))}clean(){return!!this.isValid()||(O.Z.error(this.validate().username[0]),!1)}send(){return P.Z.post(this.props.profile.api.moderate_username,{username:this.state.username})}handleSuccess(e){this.setState({username:""}),z.Z.dispatch((0,oe.KP)(e,this.props.profile,this.props.user)),z.Z.dispatch((0,se._S)(this.props.profile,e.username,e.slug)),O.Z.success(pgettext("profile username moderation","Username has been changed."))}getFormBody(){return(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(Ze.Z,{label:pgettext("profile username moderation field","New username"),for:"id_username"},void 0,(0,o.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("profile username moderation btn","Cancel")),(0,o.Z)(j.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("profile username moderation btn","Change username"))))}getModalBody(){return this.state.error?(0,o.Z)(_e.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.getFormBody():V||(V=(0,o.Z)(fe.Z,{}))}getClassName(){return this.state.error?"modal-dialog modal-message modal-rename-user":"modal-dialog modal-rename-user"}render(){return(0,o.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,G||(G=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("profile username moderation title","Change username"))),this.getModalBody()))}},we=class extends ge.Z{constructor(e){super(e),(0,n.Z)(this,"countdown",(()=>{window.setTimeout((()=>{this.state.countdown>1?(this.setState({countdown:this.state.countdown-1}),this.countdown()):this.state.confirm||this.setState({confirm:!0})}),1e3)})),this.state={isLoaded:!1,isLoading:!1,isDeleted:!1,error:null,countdown:5,confirm:!1,with_content:!1}}componentDidMount(){P.Z.get(this.props.profile.api.delete).then((()=>{this.setState({isLoaded:!0}),this.countdown()}),(e=>{this.setState({isLoaded:!0,error:e.detail})}))}send(){return P.Z.post(this.props.profile.api.delete,{with_content:this.state.with_content})}handleSuccess(){m.Z.stop("user-profile"),this.state.with_content?this.setState({isDeleted:interpolate(pgettext("profile delete","%(username)s's account, threads, posts and other content has been deleted."),{username:this.props.profile.username},!0)}):this.setState({isDeleted:interpolate(pgettext("profile delete","%(username)s's account has been deleted and other content has been hidden."),{username:this.props.profile.username},!0)})}getButtonLabel(){return this.state.confirm?interpolate(pgettext("profile delete btn","Delete %(username)s"),{username:this.props.profile.username},!0):interpolate(pgettext("profile delete btn","Please wait... (%(countdown)ss)"),{countdown:this.state.countdown},!0)}getForm(){return(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(Ze.Z,{label:pgettext("profile delete","User content"),for:"id_with_content"},void 0,(0,o.Z)(be.Z,{id:"id_with_content",disabled:this.state.isLoading,labelOn:pgettext("profile delete content","Delete together with user's account"),labelOff:pgettext("profile delete content","Hide after deleting user's account"),onChange:this.bindInput("with_content"),value:this.state.with_content}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,pgettext("profile delete btn","Cancel")),(0,o.Z)(j.Z,{className:"btn-danger",loading:this.state.isLoading,disabled:!this.state.confirm},void 0,this.getButtonLabel())))}getDeletedBody(){return(0,o.Z)("div",{className:"modal-body"},void 0,$||($=(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,this.state.isDeleted),(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:h.Z.get("USERS_LIST_URL")},void 0,pgettext("profile delete link","Return to users list")))))}getModalBody(){return this.state.error?(0,o.Z)(_e.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.state.isDeleted?this.getDeletedBody():this.getForm():W||(W=(0,o.Z)(fe.Z,{}))}getClassName(){return this.state.error||this.state.isDeleted?"modal-dialog modal-message modal-delete-account":"modal-dialog modal-delete-account"}render(){return(0,o.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,Q||(Q=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("profile delete title","Delete user account"))),this.getModalBody()))}},ke=s(59801);let Ce=function(e){return{tick:e.tick,user:e.auth,profile:e.profile}};var Se,Ee,Te,Le,Pe,Oe=class extends l().Component{constructor(){super(...arguments),(0,n.Z)(this,"showAvatarDialog",(()=>{ke.Z.show((0,i.$j)(Ce)(Ne))})),(0,n.Z)(this,"showRenameDialog",(()=>{ke.Z.show((0,i.$j)(Ce)(ye))})),(0,n.Z)(this,"showDeleteDialog",(()=>{ke.Z.show((0,i.$j)(Ce)(we))}))}render(){const{moderation:e}=this.props;return(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right",role:"menu"},void 0,!!e.avatar&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showAvatarDialog},void 0,X||(X=(0,o.Z)("span",{className:"material-icon"},void 0,"portrait")),pgettext("profile moderation menu","Avatar controls"))),!!e.rename&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showRenameDialog},void 0,K||(K=(0,o.Z)("span",{className:"material-icon"},void 0,"credit_card")),pgettext("profile moderation menu","Change username"))),!!e.delete&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{type:"button",className:"btn btn-link",onClick:this.showDeleteDialog},void 0,J||(J=(0,o.Z)("span",{className:"material-icon"},void 0,"clear")),pgettext("profile moderation menu","Delete account"))))}},Ie=s(24678),Ae=e=>{let{profile:t}=e;return(0,o.Z)("ul",{className:"profile-data-list"},void 0,!1===t.is_active&&(0,o.Z)("li",{className:"user-account-disabled"},void 0,(0,o.Z)("abbr",{title:pgettext("profile data list","This user's account has been disabled by administrator.")},void 0,pgettext("profile data list","Account disabled"))),(0,o.Z)("li",{className:"user-status-display"},void 0,(0,o.Z)(Ie.ZP,{user:t,status:t.status},void 0,(0,o.Z)(Ie.Jj,{user:t,status:t.status}),(0,o.Z)(Ie.pg,{user:t,status:t.status,className:"status-label"}))),t.rank.is_tab?(0,o.Z)("li",{className:"user-rank"},void 0,(0,o.Z)("a",{href:t.rank.url,className:"item-title"},void 0,t.rank.name)):(0,o.Z)("li",{className:"user-rank"},void 0,(0,o.Z)("span",{className:"item-title"},void 0,t.rank.name)),(t.title||t.rank.title)&&(0,o.Z)("li",{className:"user-title"},void 0,t.title||t.rank.title),(0,o.Z)("li",{className:"user-joined-on"},void 0,(0,o.Z)("abbr",{title:interpolate(pgettext("profile data list","Joined on %(joined_on)s"),{joined_on:t.joined_on.format("LL, LT")},!0)},void 0,interpolate(pgettext("profile data list","Joined %(joined_on)s"),{joined_on:t.joined_on.fromNow()},!0))),t.email&&(0,o.Z)("li",{className:"user-email"},void 0,(0,o.Z)("a",{href:"mailto:"+t.email,className:"item-title"},void 0,t.email)))};const Re=()=>(0,o.Z)("button",{className:"btn btn-default btn-icon btn-outline dropdown-toggle",type:"button",title:pgettext("profile options btn","Options"),"data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,Pe||(Pe=(0,o.Z)("span",{className:"material-icon"},void 0,"settings")));var De=e=>{let{profile:t,user:s,moderation:a,message:i,follow:n}=e;return(0,o.Z)(ue.sP,{},void 0,(0,o.Z)(ue.mr,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,o.Z)(ue.gC,{styleName:t.rank.css_class?"rank-"+t.rank.css_class:"profile"},void 0,(0,o.Z)("div",{className:"profile-page-header"},void 0,(0,o.Z)("div",{className:"profile-page-header-avatar"},void 0,(0,o.Z)(ce.ZP,{className:"user-avatar hidden-sm hidden-md hidden-lg",user:t,size:200,size2x:400}),(0,o.Z)(ce.ZP,{className:"user-avatar hidden-xs hidden-md hidden-lg",user:t,size:64,size2x:128}),(0,o.Z)(ce.ZP,{className:"user-avatar hidden-xs hidden-sm",user:t,size:128,size2x:256})),(0,o.Z)("h1",{},void 0,t.username))),(0,o.Z)(ue.eA,{className:"profile-page-header-details"},void 0,(0,o.Z)(pe.gq,{},void 0,(0,o.Z)(pe.kw,{auto:!0},void 0,(0,o.Z)(pe.Z6,{},void 0,(0,o.Z)(Ae,{profile:t}))),i&&(0,o.Z)(pe.kw,{},void 0,(0,o.Z)(pe.Z6,{},void 0,(0,o.Z)(ve,{className:"btn btn-default btn-block btn-outline",profile:t,user:s})),a.available&&!n&&(0,o.Z)(pe.Z6,{shrink:!0},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,Se||(Se=(0,o.Z)(Re,{})),(0,o.Z)(Oe,{profile:t,moderation:a})))),n&&(0,o.Z)(pe.kw,{},void 0,(0,o.Z)(pe.Z6,{},void 0,(0,o.Z)(he,{className:"btn btn-block btn-outline",profile:t})),a.available&&(0,o.Z)(pe.Z6,{shrink:!0},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,Ee||(Ee=(0,o.Z)(Re,{})),(0,o.Z)(Oe,{profile:t,moderation:a})))),a.available&&!n&&!i&&(0,o.Z)(pe.kw,{},void 0,(0,o.Z)(pe.Z6,{className:"hidden-xs",shrink:!0},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,Te||(Te=(0,o.Z)(Re,{})),(0,o.Z)(Oe,{profile:t,moderation:a}))),(0,o.Z)(pe.Z6,{className:"hidden-sm hidden-md hidden-lg"},void 0,(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,Le||(Le=(0,o.Z)("span",{className:"material-icon"},void 0,"settings")),pgettext("profile options btn","Options")),(0,o.Z)(Oe,{profile:t,moderation:a}))))))))},je=s(69987),Ue=s(94417),ze=e=>{let{baseUrl:t,page:s,pages:a}=e;return(0,o.Z)("div",{className:"nav-container"},void 0,(0,o.Z)("div",{className:"dropdown hidden-sm hidden-md hidden-lg"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-block btn-outline dropdown-toggle",type:"button","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,s.icon),s.name),(0,o.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,a.map((e=>(0,o.Z)("li",{},e.component,(0,o.Z)(je.rU,{to:t+e.component+"/"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,e.icon),e.name)))))),(0,o.Z)("ul",{className:"nav nav-pills hidden-xs",role:"menu"},void 0,a.map((e=>(0,o.Z)(Ue.Z,{path:t+e.component+"/"},e.component,(0,o.Z)(je.rU,{to:t+e.component+"/"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))))))},Me=class extends re.Z{constructor(e){super(e),(0,n.Z)(this,"update",(e=>{z.Z.dispatch((0,le.ZB)(e))})),this.startPolling(e.profile.api.index)}startPolling(e){m.Z.start({poll:"user-profile",url:e,frequency:9e4,update:this.update})}render(){const e=h.Z.get("PROFILE").url,t=h.Z.get("PROFILE_PAGES"),s=t.filter((t=>{const s=e+t.component+"/";return this.props.location.pathname===s}))[0],{profile:a,user:i}=this.props,n=Be(a,i),r=!!i.acl.can_start_private_threads&&a.id!==i.id,l=!!a.acl.can_follow&&a.id!==i.id;return(0,o.Z)("div",{className:"page page-user-profile"},void 0,(0,o.Z)(De,{profile:this.props.profile,user:this.props.user,moderation:n,message:r,follow:l}),(0,o.Z)(de.Z,{},void 0,(0,o.Z)(ze,{baseUrl:e,page:s,pages:t}),this.props.children))}};const Be=(e,t)=>{const s={available:!1,rename:!1,avatar:!1,delete:!1};return t.is_anonymous||(s.rename=e.acl.can_rename,s.avatar=e.acl.can_moderate_avatar,s.delete=e.acl.can_delete,s.available=!!(s.rename||s.avatar||s.delete)),s};function qe(e){return{isAuthenticated:e.auth.user.id===e.profile.id,tick:e.tick.tick,user:e.auth.user,users:e.users,posts:e.posts,profile:e.profile,profileDetails:e["profile-details"],"username-history":e["username-history"]}}const Fe={posts:function(e){let t=null;t=e.user.id===e.profile.id?pgettext("profile posts","You have posted no messages."):interpolate(pgettext("profile posts","%(username)s posted no messages."),{username:e.profile.username},!0);let s=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){const t=npgettext("profile posts","You have posted %(posts)s message.","You have posted %(posts)s messages.",e.profile.posts);s=interpolate(t,{posts:e.profile.posts},!0)}else{const t=npgettext("profile posts","%(username)s has posted %(posts)s message.","%(username)s has posted %(posts)s messages.",e.profile.posts);s=interpolate(t,{username:e.profile.username,posts:e.profile.posts},!0)}else s=pgettext("profile posts","Loading...");return l().createElement(M,(0,R.Z)({api:e.profile.api.posts,emptyMessage:t,header:s,title:pgettext("profile posts title","Posts")},e))},threads:function(e){let t=null;t=e.user.id===e.profile.id?pgettext("profile threads","You haven't started any threads."):interpolate(pgettext("profile threads","%(username)s hasn't started any threads"),{username:e.profile.username},!0);let s=null;if(e.posts.isLoaded)if(e.profile.id===e.user.id){const t=npgettext("profile threads","You have started %(threads)s thread.","You have started %(threads)s threads.",e.profile.threads);s=interpolate(t,{threads:e.profile.threads},!0)}else{const t=npgettext("profile threads","%(username)s has started %(threads)s thread.","%(username)s has started %(threads)s threads.",e.profile.threads);s=interpolate(t,{username:e.profile.username,threads:e.profile.threads},!0)}else s=pgettext("profile threads","Loading...");return l().createElement(M,(0,R.Z)({api:e.profile.api.threads,emptyMessage:t,header:s,title:pgettext("profile threads title","Threads")},e))},followers:ae,follows:class extends ae{setSpecialProps(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWS",this.TITLE=pgettext("profile follows title","Follows"),this.API_FILTER="follows"}getLabel(){if(this.state.isLoaded){if(this.state.search){let e=npgettext("profile follows","Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){let e=npgettext("profile follows","You are following %(users)s user.","You are following %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}{let e=npgettext("profile follows","%(username)s is following %(users)s user.","%(username)s is following %(users)s users.",this.state.count);return interpolate(e,{username:this.props.profile.username,users:this.state.count},!0)}}return pgettext("profile follows","Loading...")}getEmptyMessage(){return this.state.search?pgettext("profile follows","Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("profile follows","You are not following any users."):interpolate(pgettext("profile follows","%(username)s is not following any users."),{username:this.props.profile.username},!0)}},details:A,"username-history":ne,"ban-details":g};function He(){let e=[];return h.Z.get("PROFILE_PAGES").forEach((function(t){e.push(Object.assign({},t,{path:h.Z.get("PROFILE").url+t.component+"/",component:(0,i.$j)(qe)(Fe[t.component])}))})),e}var Ye=s(39633);h.Z.addInitializer({name:"component:profile",initializer:function(e){e.has("PROFILE")&&e.has("PROFILE_PAGES")&&(0,Ye.Z)({root:h.Z.get("PROFILE").url,component:(0,i.$j)(qe)(Me),paths:He()})},after:"reducer:profile-hydrate"})},32488:function(e,t,s){"use strict";var a,i=s(32233),o=s(4942),n=s(22928),r=s(57588),l=s.n(r),d=s(82211),c=s(43345),p=s(78657),u=s(53904),h=s(55210),m=s(93051);class v extends c.Z{constructor(e){super(e),this.state={isLoading:!1,email:"",validators:{email:[h.Do()]}}}clean(){return!!this.isValid()||(u.Z.error(pgettext("request activation link form","Enter a valid e-mail address.")),!1)}send(){return p.Z.post(i.Z.get("SEND_ACTIVATION_API"),{email:this.state.email})}handleSuccess(e){this.props.callback(e)}handleError(e){["already_active","inactive_admin"].indexOf(e.code)>-1?u.Z.info(e.detail):403===e.status&&e.ban?(0,m.Z)(e.ban):u.Z.apiError(e)}render(){return(0,n.Z)("div",{className:"well well-form well-form-request-activation-link"},void 0,(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"form-group"},void 0,(0,n.Z)("div",{className:"control-input"},void 0,(0,n.Z)("input",{type:"text",className:"form-control",placeholder:pgettext("request activation link form field","Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,n.Z)(d.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("request activation link form btn","Send link"))))}}class g extends l().Component{getMessage(){return interpolate(pgettext("request activation link form","Activation link was sent to %(email)s"),{email:this.props.user.email},!0)}render(){return(0,n.Z)("div",{className:"well well-form well-form-request-activation-link well-done"},void 0,(0,n.Z)("div",{className:"done-message"},void 0,a||(a=(0,n.Z)("div",{className:"message-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,"check"))),(0,n.Z)("div",{className:"message-body"},void 0,(0,n.Z)("p",{},void 0,this.getMessage())),(0,n.Z)("button",{className:"btn btn-primary btn-block",type:"button",onClick:this.props.callback},void 0,pgettext("request activation link form btn","Request another link"))))}}var Z=class extends l().Component{constructor(e){super(e),(0,o.Z)(this,"complete",(e=>{this.setState({complete:e})})),(0,o.Z)(this,"reset",(()=>{this.setState({complete:!1})})),this.state={complete:!1}}render(){return this.state.complete?(0,n.Z)(g,{user:this.state.complete,callback:this.reset}):(0,n.Z)(v,{callback:this.complete})}},f=s(4869);i.Z.addInitializer({name:"component:request-activation-link",initializer:function(){document.getElementById("request-activation-link-mount")&&(0,f.Z)(Z,"request-activation-link-mount",!1)},after:"store"})},11768:function(e,t,s){"use strict";var a,i,o=s(32233),n=s(4942),r=s(22928),l=s(57588),d=s.n(l),c=s(73935),p=s.n(c),u=s(82211),h=s(43345),m=s(78657),v=s(53904),g=s(55210),Z=s(93051);class f extends h.Z{constructor(e){super(e),this.state={isLoading:!1,email:"",validators:{email:[g.Do()]}}}clean(){return!!this.isValid()||(v.Z.error(pgettext("request password reset form","Enter a valid e-mail address.")),!1)}send(){return m.Z.post(o.Z.get("SEND_PASSWORD_RESET_API"),{email:this.state.email})}handleSuccess(e){this.props.callback(e)}handleError(e){["inactive_user","inactive_admin"].indexOf(e.code)>-1?this.props.showInactivePage(e):403===e.status&&e.ban?(0,Z.Z)(e.ban):v.Z.apiError(e)}render(){return(0,r.Z)("div",{className:"well well-form well-form-request-password-reset"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"text",className:"form-control",placeholder:pgettext("request password reset form field","Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,r.Z)(u.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("request password reset form btn","Send link"))))}}class b extends d().Component{getMessage(){return interpolate(pgettext("request password reset form","Reset password link was sent to %(email)s"),{email:this.props.user.email},!0)}render(){return(0,r.Z)("div",{className:"well well-form well-form-request-password-reset well-done"},void 0,(0,r.Z)("div",{className:"done-message"},void 0,a||(a=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{},void 0,this.getMessage())),(0,r.Z)("button",{type:"button",className:"btn btn-primary btn-block",onClick:this.props.callback},void 0,pgettext("request password reset form btn","Request another link"))))}}class _ extends d().Component{getActivateButton(){return"inactive_user"===this.props.activation?(0,r.Z)("p",{},void 0,(0,r.Z)("a",{href:o.Z.get("REQUEST_ACTIVATION_URL")},void 0,pgettext("request password reset form error","Activate your account."))):null}render(){return(0,r.Z)("div",{className:"page page-message page-message-info page-forgotten-password-inactive"},void 0,(0,r.Z)("div",{className:"container"},void 0,(0,r.Z)("div",{className:"message-panel"},void 0,i||(i=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{className:"lead"},void 0,pgettext("request password reset form error","Your account is inactive.")),(0,r.Z)("p",{},void 0,this.props.message),this.getActivateButton()))))}}var N=class extends d().Component{constructor(e){super(e),(0,n.Z)(this,"complete",(e=>{this.setState({complete:e})})),(0,n.Z)(this,"reset",(()=>{this.setState({complete:!1})})),this.state={complete:!1}}showInactivePage(e){p().render((0,r.Z)(_,{activation:e.code,message:e.detail}),document.getElementById("page-mount"))}render(){return this.state.complete?(0,r.Z)(b,{callback:this.reset,user:this.state.complete}):(0,r.Z)(f,{callback:this.complete,showInactivePage:this.showInactivePage})}},x=s(4869);o.Z.addInitializer({name:"component:request-password-reset",initializer:function(){document.getElementById("request-password-reset-mount")&&(0,x.Z)(N,"request-password-reset-mount",!1)},after:"store"})},61323:function(e,t,s){"use strict";var a,i=s(32233),o=s(4942),n=s(22928),r=s(57588),l=s.n(r),d=s(73935),c=s.n(d),p=s(82211),u=s(43345),h=s(14467),m=s(78657),v=s(98274),g=s(59801),Z=s(53904),f=s(93051),b=s(19755);class _ extends u.Z{constructor(e){super(e),this.state={isLoading:!1,password:""}}clean(){return!!this.state.password.trim().length||(Z.Z.error(pgettext("password reset form","Enter new password.")),!1)}send(){return m.Z.post(i.Z.get("CHANGE_PASSWORD_API"),{password:this.state.password})}handleSuccess(e){this.props.callback(e)}handleError(e){403===e.status&&e.ban?(0,f.Z)(e.ban):Z.Z.apiError(e)}render(){return(0,n.Z)("div",{className:"well well-form well-form-reset-password"},void 0,(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("div",{className:"form-group"},void 0,(0,n.Z)("div",{className:"control-input"},void 0,(0,n.Z)("input",{type:"password",className:"form-control",placeholder:pgettext("password reset form field","Enter new password"),disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,n.Z)(p.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("password reset form btn","Change password"))))}}class N extends l().Component{getMessage(){return interpolate(pgettext("password reset form","%(username)s, your password has been changed."),{username:this.props.user.username},!0)}showSignIn(){g.Z.show(h.Z)}render(){return(0,n.Z)("div",{className:"page page-message page-message-success page-forgotten-password-changed"},void 0,(0,n.Z)("div",{className:"container"},void 0,(0,n.Z)("div",{className:"message-panel"},void 0,a||(a=(0,n.Z)("div",{className:"message-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,"check"))),(0,n.Z)("div",{className:"message-body"},void 0,(0,n.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,n.Z)("p",{},void 0,pgettext("password reset form","Sign in using new password to continue.")),(0,n.Z)("p",{},void 0,(0,n.Z)("button",{type:"button",className:"btn btn-primary",onClick:this.showSignIn},void 0,pgettext("password reset form btn","Sign in")))))))}}var x=class extends l().Component{constructor(){super(...arguments),(0,o.Z)(this,"complete",(e=>{v.Z.softSignOut(),b('#hidden-login-form input[name="redirect_to"]').remove(),c().render((0,n.Z)(N,{user:e}),document.getElementById("page-mount"))}))}render(){return(0,n.Z)(_,{callback:this.complete})}},y=s(4869);i.Z.addInitializer({name:"component:reset-password-form",initializer:function(){document.getElementById("reset-password-form-mount")&&(0,y.Z)(x,"reset-password-form-mount",!1)},after:"store"})},64752:function(e,t,s){"use strict";var a,i=s(22928),o=(s(57588),s(73935)),n=s.n(o),r=s(37424),l=s(62989),d=s(90287);misago.addInitializer({name:"component:search-overlay",initializer:function(e){const t=document.getElementById("search-mount");n().render((0,i.Z)(r.zt,{store:d.Z.getStore()},void 0,a||(a=(0,i.Z)(l.F,{}))),t)},after:"store"})},40949:function(e,t,s){"use strict";var a,i=s(37424),o=s(22928),n=s(87462),r=s(57588),l=s.n(r),d=s(59131),c=s(4942),p=s(32233),u=s(43345),h=s(21981),m=s(16427),v=s(6935),g=s(78657),Z=s(53904),f=s(90287),b=s(98936),_=s(99755),N=class extends u.Z{constructor(e){super(e),(0,c.Z)(this,"onQueryChange",(e=>{this.changeValue("query",e.target.value)})),this.state={isLoading:!1,query:e.search.query}}componentDidMount(){this.state.query.length&&this.handleSubmit()}clean(){return!!this.state.query.trim().length||(Z.Z.error(pgettext("search form","You have to enter search query.")),!1)}send(){f.Z.dispatch((0,m.Vx)({isLoading:!0}));const e=this.state.query.trim();let t=window.location.href;const s=t.indexOf("?q=");return s>0&&(t=t.substring(0,s+3)),window.history.pushState({},"",t+encodeURIComponent(e)),g.Z.get(p.Z.get("SEARCH_API"),{q:e})}handleSuccess(e){f.Z.dispatch((0,m.Vx)({query:this.state.query.trim(),isLoading:!1,providers:e})),e.forEach((e=>{"users"===e.id?f.Z.dispatch((0,v.ZB)(e.results.results)):"threads"===e.id&&f.Z.dispatch((0,h.zD)(e.results))}))}handleError(e){Z.Z.apiError(e),f.Z.dispatch((0,m.Vx)({isLoading:!1}))}render(){return(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)(_.sP,{},void 0,(0,o.Z)(_.mr,{styleName:"site-search"},void 0,(0,o.Z)(_.gC,{styleName:"site-search"},void 0,(0,o.Z)("h1",{},void 0,pgettext("search form title","Search"))),(0,o.Z)(_.eA,{className:"page-header-search-form"},void 0,(0,o.Z)(b.gq,{},void 0,(0,o.Z)(b.kw,{auto:!0},void 0,(0,o.Z)(b.Z6,{},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,type:"text",value:this.state.query,placeholder:pgettext("search form input","Search"),onChange:this.onQueryChange})),(0,o.Z)(b.Z6,{shrink:!0},void 0,(0,o.Z)("button",{className:"btn btn-secondary btn-icon btn-outline",title:pgettext("search form btn","Search"),disabled:this.state.isLoading},void 0,a||(a=(0,o.Z)("span",{className:"material-icon"},void 0,"search"))))))))))}},x=s(69987);function y(e){return(0,o.Z)("div",{className:"list-group nav-side"},void 0,e.providers.map((e=>(0,o.Z)(x.rU,{activeClassName:"active",className:"list-group-item",to:e.url},e.id,(0,o.Z)("span",{className:"material-icon"},void 0,e.icon),e.name,(0,o.Z)(w,{results:e.results})))))}function w(e){if(!e.results)return null;let t=e.results.count;return t>1e6?t=Math.ceil(t/1e6)+"KK":t>1e3&&(t=Math.ceil(t/1e3)+"K"),(0,o.Z)("span",{className:"badge"},void 0,t)}function k(e){return(0,o.Z)("div",{className:"page page-search"},void 0,(0,o.Z)(N,{provider:e.provider,search:e.search}),(0,o.Z)(d.Z,{},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-md-3"},void 0,(0,o.Z)(y,{providers:e.search.providers})),(0,o.Z)("div",{className:"col-md-9"},void 0,e.children,(0,o.Z)(C,{provider:e.provider,search:e.search})))))}function C(e){let t=null;if(e.search.providers.forEach((s=>{s.id===e.provider.id&&(t=s.time)})),null===t)return null;const s=pgettext("search time","Search took %(time)s s");return(0,o.Z)("footer",{className:"search-footer"},void 0,(0,o.Z)("p",{},void 0,interpolate(s,{time:t},!0)))}var S=s(11005),E=s(82211);function T(e){return(0,o.Z)("div",{},void 0,(0,o.Z)(S.Z,{isReady:!0,posts:e.results}),l().createElement(L,e))}s(69092);class L extends l().Component{constructor(){super(...arguments),(0,c.Z)(this,"onClick",(()=>{f.Z.dispatch((0,h.Vx)({isBusy:!0})),g.Z.get(this.props.provider.api,{q:this.props.query,page:this.props.next}).then((e=>{e.forEach((e=>{"threads"===e.id&&(f.Z.dispatch((0,h.R3)(e.results)),f.Z.dispatch((0,m.P0)(e)))})),f.Z.dispatch((0,h.Vx)({isBusy:!1}))}),(e=>{Z.Z.apiError(e),f.Z.dispatch((0,h.Vx)({isBusy:!1}))}))}))}render(){return this.props.more?(0,o.Z)("div",{className:"pager-more"},void 0,(0,o.Z)(E.Z,{className:"btn btn-default btn-outline",loading:this.props.isBusy,onClick:this.onClick},void 0,pgettext("search threads btn","Show more"))):null}}function P(e){let{children:t,loading:s,posts:a,query:i}=e;return a&&a.count?t:i.length?(0,o.Z)("p",{className:"lead"},void 0,s?pgettext("search threads","Loading results..."):pgettext("search threads","No threads matching search query have been found.")):(0,o.Z)("p",{className:"lead"},void 0,pgettext("search threads","Enter at least two characters to search threads."))}var O=s(40429);function I(e){let{children:t,loading:s,query:a,users:i}=e;return i.length?t:a.length?(0,o.Z)("p",{className:"lead"},void 0,s?pgettext("search users","Loading results..."):pgettext("search users","No users matching search query have been found.")):(0,o.Z)("p",{className:"lead"},void 0,pgettext("search users","Enter at least two characters to search users."))}const A={threads:function(e){return(0,o.Z)(k,{provider:e.route.provider,search:e.search},void 0,(0,o.Z)(P,{loading:e.search.isLoading,query:e.search.query,posts:e.posts},void 0,l().createElement(T,(0,n.Z)({provider:e.route.provider,query:e.search.query},e.posts))))},users:function(e){return(0,o.Z)(k,{provider:e.route.provider,search:e.search},void 0,(0,o.Z)(I,{loading:e.search.isLoading,query:e.search.query,users:e.users},void 0,(0,o.Z)(O.Z,{cols:3,isReady:!e.search.isLoading,users:e.users})))}};function R(e){return{posts:e.posts,search:e.search,tick:e.tick.tick,user:e.auth.user,users:e.users}}var D=s(39633);p.Z.addInitializer({name:"component:search",initializer:function(e){var t;"misago:search"===e.get("CURRENT_LINK")&&(0,D.Z)({paths:(t=p.Z.get("SEARCH_PROVIDERS"),t.map((e=>({path:e.url,component:(0,i.$j)(R)(A[e.id]),provider:e}))))})},after:"store"})},78679:function(e,t,s){"use strict";var a,i=s(22928),o=(s(57588),s(73935)),n=s.n(o),r=s(37424),l=s(6333),d=s(90287);misago.addInitializer({name:"component:site-nav-overlay",initializer:function(e){const t=document.getElementById("site-nav-mount");n().render((0,i.Z)(r.zt,{store:d.Z.getStore()},void 0,a||(a=(0,i.Z)(l.Or,{}))),t)},after:"store"})},61814:function(e,t,s){"use strict";var a=s(37424),i=s(32233),o=s(22928),n=s(57588),r=s.n(n);const l={info:"alert-info",success:"alert-success",warning:"alert-warning",error:"alert-danger"};class d extends r().Component{getSnackbarClass(){let e="alerts-snackbar";return this.props.isVisible?e+=" in":e+=" out",e}render(){return(0,o.Z)("div",{className:this.getSnackbarClass()},void 0,(0,o.Z)("p",{className:"alert "+l[this.props.type]},void 0,this.props.message))}}function c(e){return e.snackbar}var p=s(4869);i.Z.addInitializer({name:"component:snackbar",initializer:function(){(0,p.Z)((0,a.$j)(c)(d),"snackbar-mount")},after:"snackbar"})},95920:function(e,t,s){"use strict";var a=s(57588),i=s.n(a),o=s(22928),n=s(4942),r=s(32233),l=s(26106),d=s(82211),c=s(43345),p=s(96359),u=s(78657),h=s(53904),m=s(55210),v=s(59131),g=s(99755),Z=e=>{let{backendName:t}=e;const s=pgettext("social auth title","Sign in with %(backend)s"),a=interpolate(s,{backend:t},!0);return(0,o.Z)(g.sP,{},void 0,(0,o.Z)(g.mr,{styleName:"social-auth"},void 0,(0,o.Z)(g.gC,{styleName:"social-auth"},void 0,(0,o.Z)("h1",{},void 0,a))))};class f extends c.Z{constructor(e){super(e),(0,n.Z)(this,"handlePrivacyPolicyChange",(e=>{const t=e.target.value;this.handleToggleAgreement("privacyPolicy",t)})),(0,n.Z)(this,"handleTermsOfServiceChange",(e=>{const t=e.target.value;this.handleToggleAgreement("termsOfService",t)})),(0,n.Z)(this,"handleToggleAgreement",((e,t)=>{this.setState(((s,a)=>{if(null===s[e])return{errors:{...s.errors,[e]:null},[e]:t};const i=this.state.validators[e][0];return{errors:{...s.errors,[e]:[i(null)]},[e]:null}}))}));const t={email:[m.Do()],username:[m.lG()]};r.Z.get("TERMS_OF_SERVICE_ID")&&(t.termsOfService=[m.fT()]),r.Z.get("PRIVACY_POLICY_ID")&&(t.privacyPolicy=[m.jA()]),this.state={email:e.email||"",emailProtected:!!e.email,username:e.username||"",termsOfService:null,privacyPolicy:null,validators:t,errors:{},isLoading:!1}}clean(){if(this.validate(),-1!==[this.state.email.trim().length,this.state.username.trim().length].indexOf(0))return h.Z.error(pgettext("social auth form","Fill out all fields.")),!1;const{validators:e}=this.state;return r.Z.get("TERMS_OF_SERVICE_ID")&&null===this.state.termsOfService?(h.Z.error(e.termsOfService[0](null)),!1):!r.Z.get("PRIVACY_POLICY_ID")||null!==this.state.privacyPolicy||(h.Z.error(e.privacyPolicy[0](null)),!1)}send(){return u.Z.post(this.props.url,{email:this.state.email,username:this.state.username,terms_of_service:this.state.termsOfService,privacy_policy:this.state.privacyPolicy})}handleSuccess(e){const{onRegistrationComplete:t}=this.props;t(e)}handleError(e){if(200===e.status){const{onRegistrationComplete:e}=this.props,{username:t}=this.state;e({activation:"active",step:"done",username:t})}else if(400===e.status){const t={errors:e};e.email&&(t.emailProtected=!1),this.setState(t)}else h.Z.apiError(e)}render(){const{backend_name:e}=this.props,{email:t,emailProtected:s,username:a,isLoading:i}=this.state;let n=null;if(s){const t=pgettext("social auth form","Your e-mail address has been verified by %(backend)s.");n=interpolate(t,{backend:e},!0)}return(0,o.Z)("div",{className:"page page-social-auth page-social-auth-register"},void 0,(0,o.Z)(Z,{backendName:e}),(0,o.Z)(v.Z,{},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,o.Z)("div",{className:"panel-heading"},void 0,(0,o.Z)("h3",{className:"panel-title"},void 0,pgettext("social auth form title","Complete your account"))),(0,o.Z)("div",{className:"panel-body"},void 0,(0,o.Z)(p.Z,{for:"id_username",label:pgettext("social auth form field","Username"),validation:this.state.errors.username},void 0,(0,o.Z)("input",{type:"text",id:"id_username",className:"form-control",disabled:i,onChange:this.bindInput("username"),value:a})),(0,o.Z)(p.Z,{for:"id_email",label:pgettext("social auth form field","E-mail address"),helpText:n,validation:s?null:this.state.errors.email},void 0,(0,o.Z)("input",{type:"email",id:"id_email",className:"form-control",disabled:i||s,onChange:this.bindInput("email"),value:t})),(0,o.Z)(l.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,o.Z)("div",{className:"panel-footer"},void 0,(0,o.Z)(d.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("social auth form btn","Sign in")))))))))}}var b=e=>{let{activation:t,backend_name:s,username:a}=e,i="",n="";return n="user"===t?pgettext("account activation required","%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===t?pgettext("account activation required","%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in."):pgettext("social auth complete","%(username)s, your account has been created and you have been signed in to it."),i="active"===t?"check":"info_outline",(0,o.Z)("div",{className:"page page-social-auth page-social-auth-register"},void 0,(0,o.Z)(Z,{backendName:s}),(0,o.Z)(v.Z,{},void 0,(0,o.Z)("div",{className:"row"},void 0,(0,o.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,o.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,o.Z)("div",{className:"panel-heading"},void 0,(0,o.Z)("h3",{className:"panel-title"},void 0,pgettext("social auth complete title","Registration completed!"))),(0,o.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,o.Z)("div",{className:"message-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,i)),(0,o.Z)("div",{className:"message-body"},void 0,(0,o.Z)("p",{className:"lead"},void 0,interpolate(n,{username:a},!0)),(0,o.Z)("p",{className:"help-block"},void 0,(0,o.Z)("a",{className:"btn btn-default",href:r.Z.get("MISAGO_PATH")},void 0,pgettext("social auth complete link","Return to forum index"))))))))))};class _ extends i().Component{constructor(e){super(e),(0,n.Z)(this,"handleRegistrationComplete",(e=>{let{activation:t,email:s,step:a,username:i}=e;this.setState({activation:t,email:s,step:a,username:i})})),this.state={step:e.step,activation:e.activation||"",email:e.email||"",username:e.username||""}}render(){const{backend_name:e,url:t}=this.props,{activation:s,email:a,step:i,username:n}=this.state;return"register"===i?(0,o.Z)(f,{backend_name:e,email:a,url:t,username:n,onRegistrationComplete:this.handleRegistrationComplete}):(0,o.Z)(b,{activation:s,backend_name:e,email:a,url:t,username:n})}}var N=s(4869);r.Z.addInitializer({name:"component:social-auth",initializer:function(e){if("misago:social-complete"===e.get("CURRENT_LINK")){const t=e.get("SOCIAL_AUTH_FORM");(0,N.Z)(i().createElement(_,t),"page-mount")}},after:"store"})},84333:function(e,t,s){"use strict";var a,i,o,n=s(37424),r=s(22928),l=s(4942),d=s(57588),c=s.n(d),p=s(87462),u=s(43345),h=s(96359),m=s(8154),v=s(7738),g=s(78657),Z=s(59801),f=s(53904),b=s(90287),_=class extends u.Z{constructor(e){super(e),(0,l.Z)(this,"onUsernameChange",(e=>{this.changeValue("username",e.target.value)})),this.state={isLoading:!1,username:""}}clean(){return!!this.state.username.trim().length||(f.Z.error(pgettext("add private thread participant","You have to enter user name.")),!1)}send(){return g.Z.patch(this.props.thread.api.index,[{op:"add",path:"participants",value:this.state.username},{op:"add",path:"acl",value:1}])}handleSuccess(e){b.Z.dispatch((0,v.y8)(e)),b.Z.dispatch(m.gx(e.participants)),f.Z.success(pgettext("add private thread participant","New participant has been added to thread.")),Z.Z.hide()}render(){return(0,r.Z)("div",{className:"modal-dialog modal-sm",role:"document"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,a||(a=(0,r.Z)(N,{})),(0,r.Z)("div",{className:"modal-body"},void 0,(0,r.Z)(h.Z,{for:"id_username",label:pgettext("add private thread participant field","User to add")},void 0,(0,r.Z)("input",{id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.onUsernameChange,type:"text",value:this.state.username}))),(0,r.Z)("div",{className:"modal-footer"},void 0,(0,r.Z)("button",{className:"btn btn-block btn-primary",disabled:this.state.isLoading},void 0,pgettext("add private thread participant btn","Add participant")),(0,r.Z)("button",{className:"btn btn-block btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("add private thread participant btn","Cancel"))))))}};function N(e){return(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,i||(i=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,pgettext("add private thread participant modal title","Add participant")))}var x,y,w,k=class extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{Z.Z.show((0,r.Z)(_,{thread:this.props.thread}))}))}render(){return this.props.thread.acl.can_add_participants?(0,r.Z)("div",{className:"col-xs-12 col-sm-3"},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block",onClick:this.onClick,type:"button"},void 0,o||(o=(0,r.Z)("span",{className:"material-icon"},void 0,"person_add")),pgettext("add participant btn","Add participant"))):null}},C=s(32233),S=class extends c().Component{constructor(e){super(e),(0,l.Z)(this,"onClick",(()=>{let e=!1;if(this.isUser)e=window.confirm(pgettext("private thread owner change","Are you sure you want to take over this thread?"));else{const t=pgettext("private thread owner change","Are you sure you want to change thread owner to %(user)s?");e=window.confirm(interpolate(t,{user:this.props.participant.username},!0))}var t,s;e&&(t=this.props.thread,s=this.props.participant,g.Z.patch(t.api.index,[{op:"replace",path:"owner",value:s.id},{op:"add",path:"acl",value:1}]).then((e=>{b.Z.dispatch((0,v.y8)(e)),b.Z.dispatch(m.gx(e.participants));const t=pgettext("thread participants actions","%(user)s has been made new thread owner.");f.Z.success(interpolate(t,{user:s.username},!0))}),(e=>{f.Z.apiError(e)})))})),this.isUser=e.participant.id===e.user.id}render(){return this.props.participant.is_owner?null:this.props.thread.acl.can_change_owner?(0,r.Z)("li",{},void 0,(0,r.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,pgettext("private thread owner change btn","Make owner"))):null}},E=class extends c().Component{constructor(e){super(e),(0,l.Z)(this,"onClick",(()=>{let e=!1;if(this.isUser)e=window.confirm(pgettext("private thread leave","Are you sure you want to leave this thread?"));else{const t=pgettext("private thread leave","Are you sure you want to remove %(user)s from this thread?");e=window.confirm(interpolate(t,{user:this.props.participant.username},!0))}var t,s;e&&(this.isUser?(t=this.props.thread,s=this.props.participant,g.Z.patch(t.api.index,[{op:"remove",path:"participants",value:s.id}]).then((()=>{f.Z.success(pgettext("thread participants actions","You have left this thread.")),window.setTimeout((()=>{window.location=C.Z.get("PRIVATE_THREADS_URL")}),3e3)}),(e=>{f.Z.apiError(e)}))):function(e,t){g.Z.patch(e.api.index,[{op:"remove",path:"participants",value:t.id},{op:"add",path:"acl",value:1}]).then((e=>{b.Z.dispatch((0,v.y8)(e)),b.Z.dispatch(m.gx(e.participants));const s=pgettext("thread participants actions","%(user)s has been removed from this thread.");f.Z.success(interpolate(s,{user:t.username},!0))}),(e=>{f.Z.apiError(e)}))}(this.props.thread,this.props.participant))})),this.isUser=e.participant.id===e.user.id}render(){const e=this.props.user.acl.can_moderate_private_threads;return this.props.userIsOwner||this.isUser||e?(0,r.Z)("li",{},void 0,(0,r.Z)("button",{className:"btn btn-link",onClick:this.onClick,type:"button"},void 0,this.isUser?pgettext("private thread leave btn","Leave thread"):pgettext("private thread leave btn","Remove"))):null}},T=s(19605);function L(e){const t=e.participant;let s="btn btn-default";return t.is_owner&&(s="btn btn-primary"),s+=" btn-user btn-block",(0,r.Z)("div",{className:"col-xs-12 col-sm-3 col-md-2 participant-card"},void 0,(0,r.Z)("div",{className:"dropdown"},void 0,(0,r.Z)("button",{"aria-haspopup":"true","aria-expanded":"false",className:s,"data-toggle":"dropdown",type:"button"},void 0,(0,r.Z)(T.ZP,{size:"34",user:t}),(0,r.Z)("span",{className:"btn-text"},void 0,t.username)),(0,r.Z)("ul",{className:"dropdown-menu stick-to-bottom"},void 0,(0,r.Z)(P,{isOwner:t.is_owner}),x||(x=(0,r.Z)("li",{className:"dropdown-header"})),(0,r.Z)("li",{},void 0,(0,r.Z)("a",{href:t.url},void 0,pgettext("thread participants profile link","See profile"))),y||(y=(0,r.Z)("li",{role:"separator",className:"divider"})),c().createElement(S,e),c().createElement(E,e))))}function P(e){let{isOwner:t}=e;return t?(0,r.Z)("li",{className:"dropdown-header dropdown-header-owner"},void 0,w||(w=(0,r.Z)("span",{className:"material-icon"},void 0,"start")),(0,r.Z)("span",{className:"icon-text"},void 0,pgettext("thread participants owner status","Thread owner"))):null}function O(e){let{participants:t,thread:s,user:a,userIsOwner:i}=e;return(0,r.Z)("div",{className:"participants-cards"},void 0,(0,r.Z)("div",{className:"row"},void 0,t.map((e=>(0,r.Z)(L,{participant:e,thread:s,user:a,userIsOwner:i},e.id)))))}function I(e){return e.participants.length?(0,r.Z)("div",{className:"panel panel-default panel-participants"},void 0,(0,r.Z)("div",{className:"panel-body"},void 0,c().createElement(O,(0,p.Z)({userIsOwner:A(e.user,e.participants)},e)),(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)(k,{thread:e.thread}),(0,r.Z)("div",{className:"col-xs-12 col-sm-9"},void 0,(0,r.Z)("p",{},void 0,function(e){const t=e.length,s=npgettext("thread participants stat","This thread has %(users)s participant.","This thread has %(users)s participants.",t);return interpolate(s,{users:t},!0)}(e.participants)))))):null}function A(e,t){return t[0].id===e.id}var R,D=s(30381),j=s.n(D);function U(e){return(0,r.Z)("div",{className:"poll-choices-bars"},void 0,e.poll.choices.map((t=>(0,r.Z)(z,{choice:t,poll:e.poll},t.hash))))}function z(e){let t=0;return e.choice.votes&&e.poll.votes&&(t=Math.ceil(100*e.choice.votes/e.poll.votes)),(0,r.Z)("dl",{className:"dl-horizontal"},void 0,(0,r.Z)("dt",{},void 0,e.choice.label),(0,r.Z)("dd",{},void 0,(0,r.Z)("div",{className:"progress"},void 0,(0,r.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100",style:{width:t+"%"}},void 0,(0,r.Z)("span",{className:"sr-only"},void 0,B(e.votes,e.proc)))),(0,r.Z)("ul",{className:"list-unstyled list-inline poll-chart"},void 0,(0,r.Z)(M,{proc:t,votes:e.choice.votes}),(0,r.Z)(q,{selected:e.choice.selected}))))}function M(e){return(0,r.Z)("li",{className:"poll-chart-votes"},void 0,B(e.votes,e.proc))}function B(e,t){const s=npgettext("thread poll","%(votes)s vote, %(proc)s% of total.","%(votes)s votes, %(proc)s% of total.",e);return interpolate(s,{votes:e,proc:t},!0)}function q(e){return e.selected?(0,r.Z)("li",{className:"poll-chart-selected"},void 0,R||(R=(0,r.Z)("span",{className:"material-icon"},void 0,"check_box")),pgettext("thread poll","You've voted on this choice.")):null}var F,H,Y,V=s(30337),G=s(3784),$=class extends c().Component{constructor(e){super(e),this.state={isLoading:!0,error:null,data:[]}}componentDidMount(){g.Z.get(this.props.poll.api.votes).then((e=>{const t=e.map((e=>Object.assign({},e,{voters:e.voters.map((e=>Object.assign({},e,{voted_on:j()(e.voted_on)})))})));this.setState({isLoading:!1,data:t})}),(e=>{this.setState({isLoading:!1,error:e.detail})}))}render(){return(0,r.Z)("div",{className:"modal-dialog"+(this.state.error?" modal-message":" modal-sm"),role:"document"},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,F||(F=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,pgettext("thread poll","Poll votes"))),(0,r.Z)(W,{data:this.state.data,error:this.state.error,isLoading:this.state.isLoading})))}};function W(e){return e.isLoading?H||(H=(0,r.Z)(G.Z,{})):e.error?(0,r.Z)(V.Z,{icon:"error_outline",message:e.error}):(0,r.Z)(Q,{data:e.data})}function Q(e){return(0,r.Z)("div",{className:"modal-body modal-poll-votes"},void 0,(0,r.Z)("ul",{className:"list-unstyled votes-details"},void 0,e.data.map((e=>c().createElement(X,(0,p.Z)({key:e.hash},e))))))}function X(e){return(0,r.Z)("li",{},void 0,(0,r.Z)("h4",{},void 0,e.label),(0,r.Z)(K,{votes:e.votes}),(0,r.Z)(J,{voters:e.voters}),Y||(Y=(0,r.Z)("hr",{})))}function K(e){const t=npgettext("thread poll","%(votes)s user has voted for this choice.","%(votes)s users have voted for this choice.",e.votes),s=interpolate(t,{votes:e.votes},!0);return(0,r.Z)("p",{},void 0,s)}function J(e){return e.voters.length?(0,r.Z)("ul",{className:"list-unstyled"},void 0,e.voters.map((e=>c().createElement(ee,(0,p.Z)({key:e.username},e))))):null}function ee(e){return e.url?(0,r.Z)("li",{},void 0,(0,r.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,r.Z)(te,{voted_on:e.voted_on})):(0,r.Z)("li",{},void 0,(0,r.Z)("strong",{},void 0,e.username)," ",(0,r.Z)(te,{voted_on:e.voted_on}))}function te(e){return(0,r.Z)("abbr",{className:"text-muted",title:e.voted_on.format("LLL")},void 0,e.voted_on.fromNow())}var se=s(59752),ae=s(64646);function ie(e){const{isPollOver:t,poll:s,showVoting:a,thread:i}=e;if(!function(e,t,s){return s.is_public||t.can_delete||t.can_edit||t.can_see_votes||t.can_vote&&!e&&(!s.hasSelectedChoices||s.allow_revotes)}(t,s.acl,s))return null;const o=[],n=s.acl.can_vote,l=!s.hasSelectedChoices||s.allow_revotes;return n&&l&&o.push(0),(s.is_public||s.acl.can_see_votes)&&o.push(1),s.acl.can_edit&&o.push(2),s.acl.can_delete&&o.push(3),(0,r.Z)("div",{className:"row poll-options"},void 0,(0,r.Z)(ne,{controls:o,isPollOver:t,poll:s,showVoting:a}),(0,r.Z)(re,{controls:o,poll:s}),(0,r.Z)(le,{controls:o,poll:s,thread:i,onClick:e.edit}),(0,r.Z)(de,{controls:o,poll:s}))}function oe(e,t){let s="col-xs-6";return 1===e.length&&(s="col-xs-12"),3===e.length&&e[0]===t&&(s="col-xs-12"),s+" col-sm-3 col-md-2"}function ne(e){const t=e.poll.acl.can_vote,s=!e.poll.hasSelectedChoices||e.poll.allow_revotes;return t&&s?(0,r.Z)("div",{className:oe(e.controls,0)},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:e.poll.isBusy,onClick:e.showVoting,type:"button"},void 0,pgettext("thread poll","Vote"))):null}class re extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{Z.Z.show((0,r.Z)($,{poll:this.props.poll}))}))}render(){return this.props.poll.is_public||this.props.poll.acl.can_see_votes?(0,r.Z)("div",{className:oe(this.props.controls,1)},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,pgettext("thread poll","See votes"))):null}}function le(e){return e.poll.acl.can_edit?(0,r.Z)("div",{className:oe(e.controls,2)},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:e.poll.isBusy,onClick:e.onClick,type:"button"},void 0,pgettext("thread poll","Edit"))):null}class de extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{if(!window.confirm(pgettext("thread poll","Are you sure you want to delete this poll? This action is not reversible.")))return!1;b.Z.dispatch(se.n6()),g.Z.delete(this.props.poll.api.index).then(this.handleSuccess,this.handleError)})),(0,l.Z)(this,"handleSuccess",(e=>{f.Z.success(pgettext("thread poll","Poll has been deleted")),b.Z.dispatch(se.Od()),b.Z.dispatch(v.y8(e))})),(0,l.Z)(this,"handleError",(e=>{f.Z.apiError(e),b.Z.dispatch(se.Ar())}))}render(){return this.props.poll.acl.can_delete?(0,r.Z)("div",{className:oe(this.props.controls,3)},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.props.poll.isBusy,onClick:this.onClick,type:"button"},void 0,pgettext("thread poll","Delete"))):null}}var ce=s(89627);const pe='%(relative)s';function ue(e){return(0,r.Z)("ul",{className:"list-unstyled list-inline poll-details"},void 0,(0,r.Z)(fe,{votes:e.poll.votes}),(0,r.Z)(ge,{poll:e.poll}),(0,r.Z)(be,{poll:e.poll}),(0,r.Z)(he,{poll:e.poll}))}function he(e){const t=interpolate((0,ce.Z)(pgettext("thread poll","Started by %(poster)s %(posted_on)s.")),{poster:me(e.poll),posted_on:ve(e.poll)},!0);return(0,r.Z)("li",{className:"poll-info-creation",dangerouslySetInnerHTML:{__html:t}})}function me(e){return e.url.poster?interpolate('%(user)s',{url:(0,ce.Z)(e.url.poster),user:(0,ce.Z)(e.poster_name)},!0):interpolate('%(user)s',{user:(0,ce.Z)(e.poster_name)},!0)}function ve(e){return interpolate(pe,{absolute:(0,ce.Z)(e.posted_on.format("LLL")),relative:(0,ce.Z)(e.posted_on.fromNow())},!0)}function ge(e){if(!e.poll.length)return null;const t=interpolate((0,ce.Z)(pgettext("thread poll","Voting ends %(ends_on)s.")),{ends_on:Ze(e.poll)},!0);return(0,r.Z)("li",{className:"poll-info-ends-on",dangerouslySetInnerHTML:{__html:t}})}function Ze(e){return interpolate(pe,{absolute:(0,ce.Z)(e.endsOn.format("LLL")),relative:(0,ce.Z)(e.endsOn.fromNow())},!0)}function fe(e){const t=npgettext("thread poll","%(votes)s vote.","%(votes)s votes.",e.votes),s=interpolate(t,{votes:e.votes},!0);return(0,r.Z)("li",{className:"poll-info-votes"},void 0,s)}function be(e){return e.poll.is_public?(0,r.Z)("li",{className:"poll-info-public"},void 0,pgettext("thread poll","Voting is public.")):null}function _e(e){return(0,r.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,r.Z)("div",{className:"panel-body"},void 0,(0,r.Z)("h2",{},void 0,e.poll.question),(0,r.Z)(ue,{poll:e.poll}),(0,r.Z)(U,{poll:e.poll}),(0,r.Z)(ie,{isPollOver:e.isPollOver,poll:e.poll,edit:e.edit,showVoting:e.showVoting,thread:e.thread})))}function Ne(e){return(0,r.Z)("ul",{className:"list-unstyled list-inline poll-help"},void 0,(0,r.Z)(xe,{choicesLeft:e.choicesLeft}),(0,r.Z)(ye,{poll:e.poll}))}function xe(e){let{choicesLeft:t}=e;if(0===t)return(0,r.Z)("li",{className:"poll-help-choices-left"},void 0,pgettext("thread poll","You can't select any more choices."));const s=npgettext("thread poll","You can select %(choices)s more choice.","You can select %(choices)s more choices.",t),a=interpolate(s,{choices:t},!0);return(0,r.Z)("li",{className:"poll-help-choices-left"},void 0,a)}function ye(e){return e.poll.allow_revotes?(0,r.Z)("li",{className:"poll-help-allow-revotes"},void 0,pgettext("thread poll","You can change your vote later.")):(0,r.Z)("li",{className:"poll-help-no-revotes"},void 0,pgettext("thread poll","Votes are final."))}function we(e){return(0,r.Z)("ul",{className:"list-unstyled poll-select-choices"},void 0,e.choices.map((t=>(0,r.Z)(ke,{choice:t,toggleChoice:e.toggleChoice},t.hash))))}class ke extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{this.props.toggleChoice(this.props.choice.hash)}))}render(){return(0,r.Z)("li",{className:"poll-select-choice"},void 0,(0,r.Z)("button",{className:this.props.choice.selected?"btn btn-selected":"btn",onClick:this.onClick,type:"button"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,this.props.choice.selected?"check_box":"check_box_outline_blank"),(0,r.Z)("strong",{},void 0,this.props.choice.label)))}}function Ce(e,t){let s=[];for(const e in t){const a=t[e];a.selected&&s.push(a)}return e.allowed_choices-s.length}var Se,Ee=s(82211),Te=class extends u.Z{constructor(e){super(e),(0,l.Z)(this,"toggleChoice",(e=>{const t=function(e,t){for(const s in e){const a=e[s];if(a.hash===t)return a}return null}(this.state.choices,e);let s=null;s=t.selected?this.deselectChoice(t,e):this.selectChoice(t,e),this.setState({choices:s,choicesLeft:Ce(this.props.poll,s)})})),(0,l.Z)(this,"selectChoice",((e,t)=>{if(!Ce(this.props.poll,this.state.choices))for(const e in this.state.choices.slice()){const s=this.state.choices[e];if(s.selected&&s.hash!=t){s.selected=!1;break}}return this.state.choices.map((e=>Object.assign({},e,{selected:e.hash==t||e.selected})))})),(0,l.Z)(this,"deselectChoice",((e,t)=>this.state.choices.map((e=>Object.assign({},e,{selected:e.hash!=t&&e.selected}))))),this.state={isLoading:!1,choices:e.poll.choices,choicesLeft:Ce(e.poll,e.poll.choices)}}clean(){return this.state.choicesLeft!==this.props.poll.allowed_choices||(f.Z.error(pgettext("thread poll vote","You need to select at least one choice.")),!1)}send(){let e=[];for(const t in this.state.choices.slice()){const s=this.state.choices[t];s.selected&&e.push(s.hash)}return g.Z.post(this.props.poll.api.votes,e)}handleSuccess(e){b.Z.dispatch(se.gx(e)),f.Z.success(pgettext("thread poll vote","Your vote has been saved.")),this.props.showResults()}handleError(e){400===e.status?f.Z.error(e.detail):f.Z.apiError(e)}render(){const e=[];return this.props.poll.acl.can_vote&&e.push(0),(this.props.poll.is_public||this.props.poll.acl.can_see_votes)&&e.push(1),this.props.poll.acl.can_edit&&e.push(2),this.props.poll.acl.can_delete&&e.push(3),(0,r.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"panel-body"},void 0,(0,r.Z)("h2",{},void 0,this.props.poll.question),(0,r.Z)(ue,{poll:this.props.poll}),(0,r.Z)(we,{choices:this.state.choices,toggleChoice:this.toggleChoice}),(0,r.Z)(Ne,{choicesLeft:this.state.choicesLeft,poll:this.props.poll})),(0,r.Z)("div",{className:"panel-footer"},void 0,(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:oe(e,0)},void 0,(0,r.Z)(Ee.Z,{className:"btn-primary btn-block btn-sm",loading:this.state.isLoading},void 0,pgettext("thread poll vote btn","Save your vote"))),(0,r.Z)("div",{className:oe(e,1)},void 0,(0,r.Z)("button",{className:"btn btn-default btn-block btn-sm",disabled:this.state.isLoading,onClick:this.props.showResults,type:"button"},void 0,pgettext("thread poll vote btn","See results"))),(0,r.Z)(le,{controls:e,poll:this.props.poll,thread:this.props.thread,onClick:this.props.edit}),(0,r.Z)(de,{controls:e,poll:this.props.poll})))))}},Le=class extends c().Component{constructor(e){super(e),(0,l.Z)(this,"showResults",(()=>{this.setState({showResults:!0})})),(0,l.Z)(this,"showVoting",(()=>{this.setState({showResults:!1})}));let t=!0;e.user.id&&!e.poll.hasSelectedChoices&&(t=!1),this.state={showResults:t}}render(){if(!this.props.thread.poll)return null;const e=function(e){return!!e.length&&j()().isAfter(e.endsOn)}(this.props.poll);return e||!this.props.poll.acl.can_vote||this.state.showResults?c().createElement(_e,(0,p.Z)({isPollOver:e,showVoting:this.showVoting},this.props)):c().createElement(Te,(0,p.Z)({showResults:this.showResults},this.props))}},Pe=s(54031),Oe=class extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onAdd",(()=>{let e=this.props.choices.slice();e.push({hash:(0,Pe.ZP)(12),label:""}),this.props.setChoices(e)})),(0,l.Z)(this,"onChange",((e,t)=>{const s=this.props.choices.map((s=>(s.hash===e&&(s.label=t),s)));this.props.setChoices(s)})),(0,l.Z)(this,"onDelete",(e=>{const t=this.props.choices.filter((t=>t.hash!==e));this.props.setChoices(t)}))}render(){return(0,r.Z)("div",{className:"poll-choices-control"},void 0,(0,r.Z)("ul",{className:"list-group"},void 0,this.props.choices.map((e=>(0,r.Z)(Ie,{canDelete:this.props.choices.length>2,choice:e,disabled:this.props.disabled,onChange:this.onChange,onDelete:this.onDelete},e.hash)))),(0,r.Z)("button",{className:"btn btn-default btn-sm",disabled:this.props.disabled,onClick:this.onAdd,type:"button"},void 0,pgettext("thread poll","Add choice")))}};class Ie extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onChange",(e=>{this.props.onChange(this.props.choice.hash,e.target.value)})),(0,l.Z)(this,"onDelete",(()=>{(0===this.props.choice.label.length||window.confirm(pgettext("thread poll","Are you sure you want to remove this choice?")))&&this.props.onDelete(this.props.choice.hash)}))}render(){return(0,r.Z)("li",{className:"list-group-item"},void 0,(0,r.Z)("button",{className:"btn",disabled:!this.props.canDelete||this.props.disabled,onClick:this.onDelete,title:pgettext("thread poll","Remove this choice"),type:"button"},void 0,Se||(Se=(0,r.Z)("span",{className:"material-icon"},void 0,"close"))),(0,r.Z)("input",{disabled:this.props.disabled,maxLength:"255",placeholder:pgettext("thread poll","Poll choice"),type:"text",onChange:this.onChange,value:this.props.choice.label}))}}var Ae=s(7227),Re=class extends u.Z{constructor(e){super(e),(0,l.Z)(this,"setChoices",(e=>{this.setState((t=>({choices:e,errors:Object.assign({},t.errors,{choices:null})})))})),(0,l.Z)(this,"onCancel",(()=>{let e=!1;if(""===this.state.question&&this.state.choices&&this.state.choices.every((e=>""===e.label))&&0===this.state.length&&1===this.state.allowed_choices)return this.props.close();e=this.props.poll?window.confirm(pgettext("thread poll","Are you sure you want to discard changes?")):window.confirm(pgettext("thread poll","Are you sure you want to discard new poll?")),e&&this.props.close()}));const t=e.poll.id?e.poll:{question:"",choices:[{hash:"choice-10000",label:""},{hash:"choice-20000",label:""}],length:0,allowed_choices:1,allow_revotes:0,is_public:0};this.state={isLoading:!1,isEdit:!!t.id,question:t.question,choices:t.choices,length:t.length,allowed_choices:t.allowed_choices,allow_revotes:t.allow_revotes,is_public:t.is_public,validators:{question:[],choices:[],length:[],allowed_choices:[]},errors:{}}}send(){const e={question:this.state.question,choices:this.state.choices,length:this.state.length,allowed_choices:this.state.allowed_choices,allow_revotes:this.state.allow_revotes,is_public:this.state.is_public};return this.state.isEdit?g.Z.put(this.props.poll.api.index,e):g.Z.post(this.props.thread.api.poll,e)}handleSuccess(e){b.Z.dispatch(se.gx(e)),this.state.isEdit?f.Z.success(pgettext("thread poll","Poll has been edited.")):f.Z.success(pgettext("thread poll","Poll has been posted.")),this.props.close()}handleError(e){400===e.status?(e.non_field_errors&&(e.allowed_choices=e.non_field_errors),this.setState({errors:Object.assign({},e)}),f.Z.error(gettext("Form contains errors."))):f.Z.apiError(e)}render(){return(0,r.Z)("div",{className:"poll-form"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"panel panel-default panel-form"},void 0,(0,r.Z)("div",{className:"panel-heading"},void 0,(0,r.Z)("h3",{className:"panel-title"},void 0,this.state.isEdit?pgettext("thread poll","Edit poll"):pgettext("thread poll","Add poll"))),(0,r.Z)("div",{className:"panel-body"},void 0,(0,r.Z)("fieldset",{},void 0,(0,r.Z)("legend",{},void 0,pgettext("thread poll","Question and choices")),(0,r.Z)(h.Z,{label:pgettext("thread poll","Poll question"),for:"id_questions",validation:this.state.errors.question},void 0,(0,r.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_questions",onChange:this.bindInput("question"),type:"text",maxLength:"255",value:this.state.question})),(0,r.Z)(h.Z,{label:pgettext("thread poll","Available choices"),validation:this.state.errors.choices},void 0,(0,r.Z)(Oe,{choices:this.state.choices,disabled:this.state.isLoading,setChoices:this.setChoices}))),(0,r.Z)("fieldset",{},void 0,(0,r.Z)("legend",{},void 0,pgettext("thread poll","Voting")),(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,r.Z)(h.Z,{label:pgettext("thread poll","Poll length"),helpText:pgettext("thread poll","Enter number of days for which voting in this poll should be possible or zero to run this poll indefinitely."),for:"id_length",validation:this.state.errors.length},void 0,(0,r.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_length",onChange:this.bindInput("length"),type:"text",value:this.state.length}))),(0,r.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,r.Z)(h.Z,{label:pgettext("thread poll","Allowed choices"),for:"id_allowed_choices",validation:this.state.errors.allowed_choices},void 0,(0,r.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_allowed_choices",onChange:this.bindInput("allowed_choices"),type:"text",maxLength:"255",value:this.state.allowed_choices})))),(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)(De,{bindInput:this.bindInput,disabled:this.state.isLoading,isEdit:this.state.isEdit,value:this.state.is_public}),(0,r.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,r.Z)(h.Z,{label:pgettext("thread poll","Allow vote changes"),for:"id_allow_revotes"},void 0,(0,r.Z)(Ae.Z,{id:"id_allow_revotes",disabled:this.state.isLoading,iconOn:"check",iconOff:"close",labelOn:pgettext("thread poll","Allow participants to change their vote"),labelOff:pgettext("thread poll","Don't allow participants to change their vote"),onChange:this.bindInput("allow_revotes"),value:this.state.allow_revotes})))))),(0,r.Z)("div",{className:"panel-footer text-right"},void 0,(0,r.Z)("button",{className:"btn btn-default",disabled:this.state.isLoading,onClick:this.onCancel,type:"button"},void 0,pgettext("thread poll","Cancel"))," ",(0,r.Z)(Ee.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,this.state.isEdit?pgettext("thread poll","Save changes"):pgettext("thread poll","Post poll"))))))}};function De(e){return e.isEdit?null:(0,r.Z)("div",{className:"col-xs-12 col-sm-6"},void 0,(0,r.Z)(h.Z,{label:pgettext("thread poll","Make voting public"),helpText:pgettext("thread poll","Making voting public will allow everyone to access detailed list of votes, showing which users voted for which choices and at which times. This option can't be changed after poll's creation. Moderators may see voting details for all polls."),for:"id_is_public"},void 0,(0,r.Z)(Ae.Z,{id:"id_is_public",disabled:e.disabled,iconOn:"visibility",iconOff:"visibility_off",labelOn:pgettext("thread poll","Votes are public"),labelOff:pgettext("thread poll","Votes are hidden"),onChange:e.bindInput("is_public"),value:e.value})))}const je={changed_title:"edit",pinned_globally:"bookmark",pinned_locally:"bookmark_border",unpinned:"panorama_fish_eye",moved:"arrow_forward",merged:"call_merge",approved:"done",opened:"lock_open",closed:"lock_outline",unhid:"visibility",hid:"visibility_off",changed_owner:"grade",tookover:"grade",added_participant:"person_add",owner_left:"person_outline",participant_left:"person_outline",removed_participant:"remove_circle_outline"};var Ue=e=>(0,r.Z)("span",{className:"event-icon-bg"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,je[e.post.event_type])),ze=s(92747);function Me(e){return e.post.acl.can_hide?(0,r.Z)("li",{className:"event-controls"},void 0,c().createElement(Be,e),c().createElement(qe,e),c().createElement(Fe,e)):null}class Be extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{b.Z.dispatch(ze.r$(this.props.post,{is_hidden:!0,hidden_on:j()(),hidden_by_name:this.props.user.username,url:Object.assign(this.props.post.url,{hidden_by:this.props.user.url})})),g.Z.patch(this.props.post.api.index,[{op:"replace",path:"is-hidden",value:!0}]).then((e=>{b.Z.dispatch(ze.r$(this.props.post,e))}),(e=>{400===e.status?f.Z.error(e.detail[0]):f.Z.apiError(e),b.Z.dispatch(ze.r$(this.props.post,{is_hidden:!1}))}))}))}render(){return this.props.post.is_hidden?null:(0,r.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,pgettext("event hide btn","Hide"))}}class qe extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{b.Z.dispatch(ze.r$(this.props.post,{is_hidden:!1})),g.Z.patch(this.props.post.api.index,[{op:"replace",path:"is-hidden",value:!1}]).then((e=>{b.Z.dispatch(ze.r$(this.props.post,e))}),(e=>{400===e.status?f.Z.error(e.detail[0]):f.Z.apiError(e),b.Z.dispatch(ze.r$(this.props.post,{is_hidden:!0}))}))}))}render(){return this.props.post.is_hidden?(0,r.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,pgettext("event reveal btn","Unhide")):null}}class Fe extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{window.confirm(pgettext("event delete","Are you sure you wish to delete this event? This action is not reversible!"))&&this.delete()})),(0,l.Z)(this,"delete",(()=>{b.Z.dispatch(ze.r$(this.props.post,{isDeleted:!0})),g.Z.delete(this.props.post.api.index).then((()=>{f.Z.success(pgettext("event delete","Event has been deleted."))}),(e=>{400===e.status?f.Z.error(e.detail[0]):f.Z.apiError(e),b.Z.dispatch(ze.r$(this.props.post,{isDeleted:!1}))}))}))}render(){return(0,r.Z)("button",{type:"button",className:"btn btn-link",onClick:this.onClick},void 0,pgettext("event delete btn","Delete"))}}const He='%(user)s',Ye='%(user)s';function Ve(e){return(0,r.Z)("ul",{className:"list-inline event-info"},void 0,c().createElement(Ge,e),c().createElement($e,e),c().createElement(Me,e))}function Ge(e){if(e.post.is_hidden){let t=null;t=e.post.url.hidden_by?interpolate(Ye,{url:(0,ce.Z)(e.post.url.hidden_by),user:(0,ce.Z)(e.post.hidden_by_name)},!0):interpolate(He,{user:(0,ce.Z)(e.post.hidden_by_name)},!0);const s=interpolate('%(relative)s',{absolute:(0,ce.Z)(e.post.hidden_on.format("LLL")),relative:(0,ce.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,ce.Z)(pgettext("event info","Hidden by %(event_by)s %(event_on)s.")),{event_by:t,event_on:s},!0);return(0,r.Z)("li",{className:"event-hidden-message",dangerouslySetInnerHTML:{__html:a}})}return null}function $e(e){let t=null;t=e.post.poster?interpolate(Ye,{url:(0,ce.Z)(e.post.poster.url),user:(0,ce.Z)(e.post.poster_name)},!0):interpolate(He,{user:(0,ce.Z)(e.post.poster_name)},!0);const s=interpolate('%(relative)s',{url:(0,ce.Z)(e.post.url.index),absolute:(0,ce.Z)(e.post.posted_on.format("LLL")),relative:(0,ce.Z)(e.post.posted_on.fromNow())},!0),a=interpolate((0,ce.Z)(pgettext("event info","By %(event_by)s %(event_on)s.")),{event_by:t,event_on:s},!0);return(0,r.Z)("li",{className:"event-posters",dangerouslySetInnerHTML:{__html:a}})}const We={pinned_globally:pgettext("event message","Thread has been pinned globally."),pinned_locally:pgettext("event message","Thread has been pinned in category."),unpinned:pgettext("event message","Thread has been unpinned."),approved:pgettext("event message","Thread has been approved."),opened:pgettext("event message","Thread has been opened."),closed:pgettext("event message","Thread has been closed."),unhid:pgettext("event message","Thread has been revealed."),hid:pgettext("event message","Thread has been made hidden."),tookover:pgettext("event message","Took thread over."),owner_left:pgettext("event message","Owner has left thread. This thread is now closed."),participant_left:pgettext("event message","Participant has left thread.")},Qe='%(name)s',Xe='%(name)s';function Ke(e){return We[e.post.event_type]?(0,r.Z)("p",{className:"event-message"},void 0,We[e.post.event_type]):"changed_title"===e.post.event_type?c().createElement(Je,e):"moved"===e.post.event_type?c().createElement(et,e):"merged"===e.post.event_type?c().createElement(tt,e):"changed_owner"===e.post.event_type?c().createElement(st,e):"added_participant"===e.post.event_type?c().createElement(at,e):"removed_participant"===e.post.event_type?c().createElement(it,e):null}function Je(e){const t=(0,ce.Z)(pgettext("event message","Thread title has been changed from %(old_title)s.")),s=interpolate(Xe,{name:(0,ce.Z)(e.post.event_context.old_title)},!0),a=interpolate(t,{old_title:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function et(e){const t=(0,ce.Z)(pgettext("event message","Thread has been moved from %(from_category)s.")),s=interpolate(Qe,{url:(0,ce.Z)(e.post.event_context.from_category.url),name:(0,ce.Z)(e.post.event_context.from_category.name)},!0),a=interpolate(t,{from_category:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function tt(e){const t=(0,ce.Z)(pgettext("event message","The %(merged_thread)s thread has been merged into this thread.")),s=interpolate(Xe,{name:(0,ce.Z)(e.post.event_context.merged_thread)},!0),a=interpolate(t,{merged_thread:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function st(e){const t=(0,ce.Z)(pgettext("event message","Changed thread owner to %(user)s.")),s=interpolate(Qe,{url:(0,ce.Z)(e.post.event_context.user.url),name:(0,ce.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function at(e){const t=(0,ce.Z)(pgettext("event message","Added %(user)s to thread.")),s=interpolate(Qe,{url:(0,ce.Z)(e.post.event_context.user.url),name:(0,ce.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function it(e){const t=(0,ce.Z)(pgettext("event message","Removed %(user)s from thread.")),s=interpolate(Qe,{url:(0,ce.Z)(e.post.event_context.user.url),name:(0,ce.Z)(e.post.event_context.user.username)},!0),a=interpolate(t,{user:s},!0);return(0,r.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:a}})}function ot(e){let{post:t}=e;return t.is_read?null:(0,r.Z)("div",{className:"event-label"},void 0,(0,r.Z)("span",{className:"label label-unread"},void 0,pgettext("event unread label","New event")))}var nt=class extends c().Component{constructor(e){super(e),(0,l.Z)(this,"initialize",(e=>{this.initialized=!0,this.observer=new IntersectionObserver((e=>e.forEach(this.callback))),this.observer.observe(e)})),(0,l.Z)(this,"callback",(e=>{!e.isIntersecting||this.props.post.is_read||this.primed||(window.setTimeout((()=>{g.Z.post(this.props.post.api.read)}),0),this.primed=!0,this.destroy())})),this.initialized=!1,this.primed=!1,this.observer=null}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null)}componentWillUnmount(){this.destroy()}render(){const e=!this.initialized&&!this.primed&&!this.props.post.is_read;return c().createElement("div",{className:this.props.className,ref:t=>{t&&e&&this.initialize(t)}},this.props.children)}};function rt(e){let t="event";return e.post.isDeleted?t="hide":e.post.is_hidden&&(t="event post-hidden"),(0,r.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,r.Z)(ot,{post:e.post}),(0,r.Z)("div",{className:"event-body"},void 0,(0,r.Z)("div",{className:"event-icon"},void 0,c().createElement(Ue,e)),(0,r.Z)(nt,{className:"event-content",post:e.post},void 0,c().createElement(Ke,e),c().createElement(Ve,e))))}var lt=s(69130),dt=s(48772);function ct(e){return(0,r.Z)("div",{className:"col-xs-12 col-md-6"},void 0,c().createElement(pt,e),(0,r.Z)("div",{className:"post-attachment"},void 0,(0,r.Z)("a",{href:e.attachment.url.index,className:"attachment-name item-title",target:"_blank"},void 0,e.attachment.filename),c().createElement(mt,e)))}function pt(e){return e.attachment.is_image?(0,r.Z)("div",{className:"post-attachment-preview"},void 0,c().createElement(ht,e)):(0,r.Z)("div",{className:"post-attachment-preview"},void 0,c().createElement(ut,e))}function ut(e){return(0,r.Z)("a",{href:e.attachment.url.index,className:"material-icon"},void 0,"insert_drive_file")}function ht(e){const t=e.attachment.url.thumb||e.attachment.url.index;return(0,r.Z)("a",{className:"post-thumbnail",href:e.attachment.url.index,target:"_blank",style:{backgroundImage:'url("'+(0,ce.Z)(t)+'")'}})}function mt(e){let t=null;t=e.attachment.url.uploader?interpolate('%(user)s',{url:(0,ce.Z)(e.attachment.url.uploader),user:(0,ce.Z)(e.attachment.uploader_name)},!0):interpolate('%(user)s',{user:(0,ce.Z)(e.attachment.uploader_name)},!0);const s=interpolate('%(relative)s',{absolute:(0,ce.Z)(e.attachment.uploaded_on.format("LLL")),relative:(0,ce.Z)(e.attachment.uploaded_on.fromNow())},!0),a=interpolate((0,ce.Z)(pgettext("post attachment","%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.attachment.filetype,size:(0,dt.Z)(e.attachment.size),uploader:t,uploaded_on:s},!0);return(0,r.Z)("p",{className:"post-attachment-description",dangerouslySetInnerHTML:{__html:a}})}function vt(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&e.attachments}(e.post)?(0,r.Z)("div",{className:"post-attachments"},void 0,(0,lt.Z)(e.post.attachments,2).map((e=>{const t=e.map((e=>e?e.id:0)).join("_");return(0,r.Z)(gt,{row:e},t)}))):null}function gt(e){return(0,r.Z)("div",{className:"row"},void 0,e.row.map((e=>(0,r.Z)(ct,{attachment:e},e?e.id:0))))}var Zt,ft,bt,_t,Nt,xt,yt,wt=s(69092);function kt(e){return e.post.is_hidden&&!e.post.acl.can_see_hidden?c().createElement(St,e):e.post.content?c().createElement(Ct,e):c().createElement(Et,e)}function Ct(e){let{post:t}=e;const s="@"+(t.poster?t.poster.username:t.poster_name);return(0,r.Z)(nt,{className:"post-body",post:t},void 0,(0,r.Z)(wt.Z,{author:s,markup:t.content}))}function St(e){let t=null;t=e.post.hidden_by?interpolate('%(user)s',{url:(0,ce.Z)(e.post.url.hidden_by),user:(0,ce.Z)(e.post.hidden_by_name)},!0):interpolate('%(user)s',{user:(0,ce.Z)(e.post.hidden_by_name)},!0);const s=interpolate('%(relative)s',{absolute:(0,ce.Z)(e.post.hidden_on.format("LLL")),relative:(0,ce.Z)(e.post.hidden_on.fromNow())},!0),a=interpolate((0,ce.Z)(pgettext("post body hidden","Hidden by %(hidden_by)s %(hidden_on)s.")),{hidden_by:t,hidden_on:s},!0);return(0,r.Z)(nt,{className:"post-body post-body-hidden",post:e.post},void 0,(0,r.Z)("p",{className:"lead"},void 0,pgettext("post body hidden","This post is hidden. You cannot see its contents.")),(0,r.Z)("p",{className:"text-muted",dangerouslySetInnerHTML:{__html:a}}))}function Et(e){return(0,r.Z)(nt,{className:"post-body post-body-invalid",post:e.post},void 0,(0,r.Z)("p",{className:"lead"},void 0,pgettext("post body invalid","This post's contents cannot be displayed.")),(0,r.Z)("p",{className:"text-muted"},void 0,pgettext("post body invalid","This error is caused by invalid post content manipulation.")))}function Tt(e){let{post:t,thread:s,user:a}=e;if(!It(t)||t.id!==s.best_answer)return null;let i=null;return i=a.id&&s.best_answer_marked_by===a.id?interpolate(pgettext("post best answer flag","Marked as best answer by you %(marked_on)s."),{marked_on:s.best_answer_marked_on.fromNow()},!0):interpolate(pgettext("post best answer flag","Marked as best answer by %(marked_by)s %(marked_on)s."),{marked_by:s.best_answer_marked_by_name,marked_on:s.best_answer_marked_on.fromNow()},!0),(0,r.Z)("div",{className:"post-status-message post-status-best-answer"},void 0,Zt||(Zt=(0,r.Z)("span",{className:"material-icon"},void 0,"check_box")),(0,r.Z)("p",{},void 0,i))}function Lt(e){return It(e.post)&&e.post.is_hidden?(0,r.Z)("div",{className:"post-status-message post-status-hidden"},void 0,ft||(ft=(0,r.Z)("span",{className:"material-icon"},void 0,"visibility_off")),(0,r.Z)("p",{},void 0,pgettext("post hidden flag","This post is hidden. Only users with permission may see its contents."))):null}function Pt(e){return It(e.post)&&e.post.is_unapproved?(0,r.Z)("div",{className:"post-status-message post-status-unapproved"},void 0,bt||(bt=(0,r.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline")),(0,r.Z)("p",{},void 0,pgettext("post unapproved flag","This post is unapproved. Only users with permission to approve posts and its author may see its contents."))):null}function Ot(e){return It(e.post)&&e.post.is_protected?(0,r.Z)("div",{className:"post-status-message post-status-protected visible-xs-block"},void 0,_t||(_t=(0,r.Z)("span",{className:"material-icon"},void 0,"lock_outline")),(0,r.Z)("p",{},void 0,pgettext("post protected flag","This post is protected. Only moderators may change it."))):null}function It(e){return!e.is_hidden||e.acl.can_see_hidden}function At(e,t,s){g.Z.patch(e.post.api.index,t).then((t=>{b.Z.dispatch(ze.r$(e.post,t))}),(t=>{400===t.status?f.Z.error(t.detail[0]):f.Z.apiError(t),b.Z.dispatch(ze.r$(e.post,s))}))}function Rt(e){const{post:t,user:s}=e;b.Z.dispatch(v.Vx({best_answer:t.id,best_answer_is_protected:t.is_protected,best_answer_marked_on:j()(),best_answer_marked_by:s.id,best_answer_marked_by_name:s.username,best_answer_marked_by_slug:s.slug})),Dt(e,[{op:"replace",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Dt(e,t,s){g.Z.patch(e.thread.api.index,t).then((e=>{e.best_answer_marked_on&&(e.best_answer_marked_on=j()(e.best_answer_marked_on)),b.Z.dispatch(v.Vx(e))}),(e=>{400===e.status?f.Z.error(e.detail[0]):f.Z.apiError(e),b.Z.dispatch(v.Vx(s))}))}var jt,Ut,zt,Mt,Bt,qt,Ft=class extends c().Component{constructor(e){super(e),this.state={isReady:!1,error:null,likes:[]}}componentDidMount(){g.Z.get(this.props.post.api.likes).then((e=>{this.setState({isReady:!0,likes:e.map(Ht)})}),(e=>{this.setState({isReady:!0,error:e.detail})}))}render(){return this.state.error?(0,r.Z)(Yt,{className:"modal-message"},void 0,(0,r.Z)(V.Z,{message:this.state.error})):this.state.isReady?this.state.likes.length?(0,r.Z)(Yt,{className:"modal-sm",likes:this.state.likes},void 0,(0,r.Z)(Vt,{likes:this.state.likes})):(0,r.Z)(Yt,{className:"modal-message"},void 0,(0,r.Z)(V.Z,{message:pgettext("post likes modal","No users have liked this post.")})):Nt||(Nt=(0,r.Z)(Yt,{className:"modal-sm"},void 0,(0,r.Z)(G.Z,{})))}};function Ht(e){return Object.assign({},e,{liked_on:j()(e.liked_on)})}function Yt(e){let{className:t,children:s,likes:a}=e,i=pgettext("post likes modal title","Post Likes");if(a){const e=a.length,t=npgettext("post likes modal","%(likes)s like","%(likes)s likes",e);i=interpolate(t,{likes:e},!0)}return(0,r.Z)("div",{className:"modal-dialog "+(t||""),role:"document"},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,xt||(xt=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,i)),s))}function Vt(e){return(0,r.Z)("div",{className:"modal-body modal-post-likers"},void 0,(0,r.Z)("ul",{className:"media-list"},void 0,e.likes.map((e=>c().createElement(Gt,(0,p.Z)({key:e.id},e))))))}function Gt(e){if(e.url){const t={id:e.liker_id,avatars:e.avatars};return(0,r.Z)("li",{className:"media"},void 0,(0,r.Z)("div",{className:"media-left"},void 0,(0,r.Z)("a",{className:"user-avatar",href:e.url},void 0,(0,r.Z)(T.ZP,{size:"50",user:t}))),(0,r.Z)("div",{className:"media-body"},void 0,(0,r.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,r.Z)($t,{likedOn:e.liked_on})))}return(0,r.Z)("li",{className:"media"},void 0,yt||(yt=(0,r.Z)("div",{className:"media-left"},void 0,(0,r.Z)("span",{className:"user-avatar"},void 0,(0,r.Z)(T.ZP,{size:"50"})))),(0,r.Z)("div",{className:"media-body"},void 0,(0,r.Z)("strong",{},void 0,e.username)," ",(0,r.Z)($t,{likedOn:e.liked_on})))}function $t(e){return(0,r.Z)("span",{className:"text-muted",title:e.likedOn.format("LLL")},void 0,e.likedOn.fromNow())}function Wt(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&(e.acl.can_reply||e.acl.can_edit||e.acl.can_see_likes&&(e.last_likes||[]).length||e.acl.can_like)}(e.post)?(0,r.Z)("div",{className:"post-footer"},void 0,c().createElement(Qt,e),c().createElement(Xt,e),c().createElement(Kt,e),c().createElement(Jt,(0,p.Z)({lastLikes:e.post.last_likes,likes:e.post.likes},e)),c().createElement(es,(0,p.Z)({likes:e.post.likes},e)),c().createElement(ss,e),c().createElement(as,e),c().createElement(is,e)):null}class Qt extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{Rt(this.props)}))}render(){const{post:e,thread:t}=this.props;return t.acl.can_mark_best_answer&&e.acl.can_mark_as_best_answer?t.best_answer&&!t.acl.can_change_best_answer?null:(0,r.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||e.id===t.best_answer,onClick:this.onClick,type:"button"},void 0,jt||(jt=(0,r.Z)("span",{className:"material-icon"},void 0,"check_box")),pgettext("post footer btn","Best answer")):null}}class Xt extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{Rt(this.props)}))}render(){const{post:e,thread:t}=this.props;return t.acl.can_mark_best_answer&&e.acl.can_mark_as_best_answer?t.best_answer&&!t.acl.can_change_best_answer?null:(0,r.Z)("button",{className:"visible-xs-inline-block btn btn-default btn-sm pull-left",disabled:this.props.post.isBusy||e.id===t.best_answer,onClick:this.onClick,type:"button"},void 0,Ut||(Ut=(0,r.Z)("span",{className:"material-icon"},void 0,"check_box"))):null}}class Kt extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{this.props.post.is_liked?function(e){b.Z.dispatch(ze.r$(e.post,{is_liked:!1,likes:e.post.likes-1,last_likes:e.post.last_likes.filter((t=>!t.id||t.id!==e.user.id))}));const t={is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes};At(e,[{op:"replace",path:"is-liked",value:!1}],t)}(this.props):function(e){const t=e.post.last_likes||[],s=[e.user].concat(t),a=s.length>3?s.slice(0,-1):s;b.Z.dispatch(ze.r$(e.post,{is_liked:!0,likes:e.post.likes+1,last_likes:a})),At(e,[{op:"replace",path:"is-liked",value:!0}],{is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes})}(this.props)}))}render(){if(!this.props.post.acl.can_like)return null;let e="btn btn-default btn-sm pull-left";return this.props.post.is_liked&&(e="btn btn-success btn-sm pull-left"),(0,r.Z)("button",{className:e,disabled:this.props.post.isBusy,onClick:this.onClick,type:"button"},void 0,this.props.post.is_liked?pgettext("post footer btn","Liked"):pgettext("post footer btn","Like"))}}class Jt extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{Z.Z.show((0,r.Z)(Ft,{post:this.props.post}))}))}render(){const e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,r.Z)("button",{className:"btn btn-link btn-sm pull-left hidden-xs",onClick:this.onClick,type:"button"},void 0,ts(this.props.likes,this.props.lastLikes)):(0,r.Z)("p",{className:"pull-left hidden-xs"},void 0,ts(this.props.likes,this.props.lastLikes)):null}}class es extends Jt{render(){const e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,r.Z)("button",{className:"btn btn-link btn-sm likes-compact pull-left visible-xs-block",onClick:this.onClick,type:"button"},void 0,zt||(zt=(0,r.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):(0,r.Z)("p",{className:"likes-compact pull-left visible-xs-block"},void 0,Mt||(Mt=(0,r.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):null}}function ts(e,t){const s=t.slice(0,3).map((e=>e.username));if(1==s.length)return interpolate(pgettext("post likes","%(user)s likes this."),{user:s[0]},!0);const a=e-s.length,i=s.slice(0,-1).join(", "),o=s.slice(-1)[0],n=interpolate(pgettext("post likes","%(users)s and %(last_user)s"),{users:i,last_user:o},!0);if(0===a)return interpolate(pgettext("post likes","%(users)s like this."),{users:n},!0);const r=npgettext("post likes","%(users)s and %(likes)s other user like this.","%(users)s and %(likes)s other users like this.",a);return interpolate(r,{users:s.join(", "),likes:a},!0)}class ss extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{ae.Z.open({mode:"REPLY",thread:this.props.thread,config:this.props.thread.api.editor,submit:this.props.thread.api.posts.index})}))}render(){return this.props.post.acl.can_reply?(0,r.Z)("button",{className:"btn btn-default btn-sm pull-right",type:"button",onClick:this.onClick},void 0,pgettext("post footer btn","Reply")):null}}class as extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{ae.Z.open({mode:"QUOTE",thread:this.props.thread,config:this.props.thread.api.editor,submit:this.props.thread.api.posts.index,context:{reply:this.props.post.id}})}))}render(){return this.props.post.acl.can_reply?(0,r.Z)("button",{className:"btn btn-default btn-sm pull-right",type:"button",onClick:this.onClick},void 0,pgettext("post footer btn","Quote")):null}}class is extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{ae.Z.open({mode:"EDIT",thread:this.props.thread,post:this.props.post,config:this.props.post.api.editor,submit:this.props.post.api.index})}))}render(){return this.props.post.acl.can_edit?(0,r.Z)("button",{className:"hidden-xs btn btn-default btn-sm pull-right",type:"button",onClick:this.onClick},void 0,pgettext("post footer btn","Edit")):null}}var os=class extends u.Z{constructor(e){super(e),(0,l.Z)(this,"onUrlChange",(e=>{this.changeValue("url",e.target.value)})),this.state={isLoading:!1,url:"",validators:{url:[]},errors:{}}}clean(){return!!this.state.url.trim().length||(f.Z.error(pgettext("post move modal","You have to enter link to the other thread.")),!1)}send(){return g.Z.post(this.props.thread.api.posts.move,{new_thread:this.state.url,posts:[this.props.post.id]})}handleSuccess(e){b.Z.dispatch(ze.r$(this.props.post,{isDeleted:!0})),Z.Z.hide(),f.Z.success(pgettext("post move modal","Selected post was moved to the other thread."))}handleError(e){400===e.status?f.Z.error(e.detail):f.Z.apiError(e)}render(){return(0,r.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,Bt||(Bt=(0,r.Z)(ns,{})),(0,r.Z)("div",{className:"modal-body"},void 0,(0,r.Z)(h.Z,{for:"id_url",label:pgettext("post move modal field","Link to thread you want to move post to")},void 0,(0,r.Z)("input",{className:"form-control",disabled:this.state.isLoading,id:"id_url",onChange:this.onUrlChange,value:this.state.url}))),(0,r.Z)("div",{className:"modal-footer"},void 0,(0,r.Z)("button",{className:"btn btn-primary",disabled:this.state.isLoading},void 0,pgettext("post move modal btn","Move post"))))))}};function ns(e){return(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,qt||(qt=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,pgettext("post move modal title","Move post")))}function rs(e){return(0,r.Z)("div",{className:"modal-body post-changelog-diff"},void 0,(0,r.Z)("ul",{className:"list-unstyled"},void 0,e.diff.map(((e,t)=>(0,r.Z)(ls,{item:e},t)))))}function ls(e){return"?"===e.item[0]?null:(0,r.Z)("li",{className:ds(e.item)},void 0,e.item.substr(2))}function ds(e){let t="diff-item";return"-"===e[0]?t+=" diff-item-sub":"+"===e[0]&&(t+=" diff-item-add"),t}var cs,ps,us,hs,ms,vs=class extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"onClick",(()=>{this.props.revertEdit(this.props.edit.id)}))}render(){return this.props.canRevert?(0,r.Z)("div",{className:"modal-footer visible-xs-block"},void 0,(0,r.Z)(Ee.Z,{className:"btn-default btn-sm btn-block",disabled:this.props.disabled,onClick:this.onClick,title:pgettext("post revert btn","Revert post to state from before this edit.")},void 0,pgettext("post revert btn","Revert"))):null}},gs=class extends c().Component{constructor(){super(...arguments),(0,l.Z)(this,"goLast",(()=>{this.props.goToEdit()})),(0,l.Z)(this,"goForward",(()=>{this.props.goToEdit(this.props.edit.next)})),(0,l.Z)(this,"goBack",(()=>{this.props.goToEdit(this.props.edit.previous)})),(0,l.Z)(this,"revertEdit",(()=>{this.props.revertEdit(this.props.edit.id)}))}render(){return(0,r.Z)("div",{className:"modal-toolbar post-changelog-toolbar"},void 0,(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:"col-xs-12 col-sm-4"},void 0,(0,r.Z)("div",{className:"row"},void 0,(0,r.Z)("div",{className:"col-xs-4"},void 0,(0,r.Z)(Zs,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goBack})),(0,r.Z)("div",{className:"col-xs-4"},void 0,(0,r.Z)(fs,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goForward})),(0,r.Z)("div",{className:"col-xs-4"},void 0,(0,r.Z)(bs,{disabled:this.props.disabled,edit:this.props.edit,onClick:this.goLast})))),(0,r.Z)("div",{className:"col-xs-12 col-sm-5 xs-margin-top-half post-change-label"},void 0,(0,r.Z)(Ns,{edit:this.props.edit})),(0,r.Z)(_s,{canRevert:this.props.canRevert,disabled:this.props.disabled,onClick:this.revertEdit})))}};function Zs(e){return(0,r.Z)(Ee.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.previous,onClick:e.onClick,title:pgettext("post history modal btn","See previous change")},void 0,cs||(cs=(0,r.Z)("span",{className:"material-icon"},void 0,"chevron_left")))}function fs(e){return(0,r.Z)(Ee.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:pgettext("post history modal btn","See next change")},void 0,ps||(ps=(0,r.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function bs(e){return(0,r.Z)(Ee.Z,{className:"btn-default btn-block btn-icon btn-sm",disabled:e.disabled||!e.edit.next,onClick:e.onClick,title:pgettext("post history modal btn","See previous change")},void 0,us||(us=(0,r.Z)("span",{className:"material-icon"},void 0,"last_page")))}function _s(e){return e.canRevert?(0,r.Z)("div",{className:"col-sm-3 hidden-xs"},void 0,(0,r.Z)(Ee.Z,{className:"btn-default btn-sm btn-block",disabled:e.disabled,onClick:e.onClick,title:pgettext("post revert btn","Revert post to state from before this edit.")},void 0,pgettext("post revert btn","Revert"))):null}function Ns(e){let t=null;t=e.edit.url.editor?interpolate('%(user)s',{url:(0,ce.Z)(e.edit.url.editor),user:(0,ce.Z)(e.edit.editor_name)},!0):interpolate('%(user)s',{user:(0,ce.Z)(e.edit.editor_name)},!0);const s=interpolate('%(relative)s',{absolute:(0,ce.Z)(e.edit.edited_on.format("LLL")),relative:(0,ce.Z)(e.edit.edited_on.fromNow())},!0),a=interpolate((0,ce.Z)(pgettext("post history modal","By %(edited_by)s %(edited_on)s.")),{edited_by:t,edited_on:s},!0);return(0,r.Z)("p",{dangerouslySetInnerHTML:{__html:a}})}function xs(e){return Object.assign({},e,{edited_on:j()(e.edited_on)})}var ys=class extends c().Component{constructor(e){var t;super(e),t=this,(0,l.Z)(this,"goToEdit",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t.setState({isBusy:!0});let s=t.props.post.api.edits;null!==e&&(s+="?edit="+e),g.Z.get(s).then((e=>{t.setState({isReady:!0,isBusy:!1,edit:xs(e)})}),(e=>{t.setState({isReady:!0,isBusy:!1,error:e.detail})}))})),(0,l.Z)(this,"revertEdit",(e=>{if(this.state.isBusy)return;if(!window.confirm(pgettext("post revert","Are you sure you with to revert this post to the state from before this edit?")))return;this.setState({isBusy:!0});const t=this.props.post.api.edits+"?edit="+e;g.Z.post(t).then((e=>{const t=ze.ZB(e);b.Z.dispatch(ze.r$(e,t)),f.Z.success(pgettext("post revert","Post has been reverted to previous state.")),Z.Z.hide()}),(e=>{f.Z.apiError(e),this.setState({isBusy:!1})}))})),this.state={isReady:!1,isBusy:!0,canRevert:e.post.acl.can_edit,error:null,edit:null}}componentDidMount(){this.goToEdit()}render(){return this.state.error?(0,r.Z)(ws,{className:"modal-dialog modal-message"},void 0,(0,r.Z)(V.Z,{message:this.state.error})):this.state.isReady?(0,r.Z)(ws,{},void 0,(0,r.Z)(gs,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,goToEdit:this.goToEdit,revertEdit:this.revertEdit}),(0,r.Z)(rs,{diff:this.state.edit.diff}),(0,r.Z)(vs,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,revertEdit:this.revertEdit})):hs||(hs=(0,r.Z)(ws,{},void 0,(0,r.Z)(G.Z,{})))}};function ws(e){return(0,r.Z)("div",{className:e.className||"modal-dialog",role:"document"},void 0,(0,r.Z)("div",{className:"modal-content"},void 0,(0,r.Z)("div",{className:"modal-header"},void 0,(0,r.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,ms||(ms=(0,r.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,r.Z)("h4",{className:"modal-title"},void 0,pgettext("post history modal title","Post edits history"))),e.children))}var ks,Cs,Ss,Es,Ts,Ls,Ps,Os,Is,As,Rs,Ds,js,Us,zs,Ms,Bs,qs,Fs,Hs,Ys=s(57026),Vs=s(60471),Gs=s(55210);function $s(e){return c().createElement(Ws,(0,p.Z)({},e,{Form:Qs}))}class Ws extends c().Component{constructor(e){super(e),this.state={isLoaded:!1,isError:!1,categories:[]}}componentDidMount(){g.Z.get(misago.get("THREAD_EDITOR_API")).then((e=>{const t=e.map((e=>Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})));this.setState({isLoaded:!0,categories:t})}),(e=>{this.setState({isError:e.detail})}))}render(){return this.state.isError?(0,r.Z)(Ks,{message:this.state.isError}):this.state.isLoaded?c().createElement(Qs,(0,p.Z)({},this.props,{categories:this.state.categories})):ks||(ks=(0,r.Z)(Xs,{}))}}class Qs extends u.Z{constructor(e){super(e),(0,l.Z)(this,"onCategoryChange",(e=>{const t=e.target.value,s={category:t};this.acl[t].can_pin_threads