text: module.exports=function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=29)}([function(t,e){t.exports=flarum.core.compat["forum/app"]},,function(t,e){t.exports=flarum.core.compat["common/Model"]},function(t,e,o){"use strict";e.a=function(t,e){return void 0===e&&(e="sort"),t.sort((function(t,o){return t[e]()-o[e]()}))}},function(t,e){t.exports=flarum.core.compat["common/extend"]},function(t,e,o){"use strict";function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,r(t,e)}o.d(e,"a",(function(){return n}))},function(t,e){t.exports=flarum.core.compat["common/components/Button"]},function(t,e,o){"use strict";function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}o.d(e,"a",(function(){return f}));var n=o(5);function a(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var s=o(2),c=o.n(s),i=o(10),u=o.n(i),f=function(t){function e(){for(var e,o=arguments.length,n=new Array(o),s=0;s<o;s++)n[s]=arguments[s];return a(r(e=t.call.apply(t,[this].concat(n))||this),"sort",c.a.attribute("sort")),a(r(e),"name",c.a.attribute("name")),a(r(e),"url",c.a.attribute("url")),a(r(e),"update_message",c.a.attribute("update_message")),a(r(e),"terms_updated_at",c.a.attribute("terms_updated_at")),a(r(e),"form_key",u()("id",(function(t){return"fof_terms_policy_"+t}))),e}return Object(n.a)(e,t),e.prototype.apiEndpoint=function(){return"/fof/terms/policies"+(this.exists?"/"+this.data.id:"")},e}(c.a)},function(t,e,o){"use strict";o.d(e,"a",(function(){return r}));var r={Policy:o(7).a}},function(t,e,o){"use strict";o.d(e,"a",(function(){return r}));var r={sortByAttribute:o(3).a}},function(t,e){t.exports=flarum.core.compat["common/utils/computed"]},function(t,e){t.exports=flarum.core.compat["common/models/User"]},,function(t,e){t.exports=flarum.core.compat["common/components/Modal"]},function(t,e){t.exports=flarum.core.compat["forum/components/SignUpModal"]},function(t,e){t.exports=flarum.core.compat["common/components/Page"]},function(t,e){t.exports=flarum.core.compat["common/components/IndexPage"]},function(t,e){t.exports=flarum.core.compat["forum/components/IndexPage"]},function(t,e){t.exports=flarum.core.compat["forum/components/DiscussionPage"]},function(t,e){t.exports=flarum.core.compat["forum/components/UserPage"]},function(t,e){t.exports=flarum.core.compat["common/helpers/listItems"]},function(t,e){t.exports=flarum.core.compat["forum/utils/UserControls"]},function(t,e){t.exports=flarum.core.compat["forum/components/Button"]},function(t,e){t.exports=flarum.core.compat["common/helpers/humanTime"]},,,,,,function(t,e,o){"use strict";o.r(e),o.d(e,"components",(function(){return R})),o.d(e,"models",(function(){return G.a})),o.d(e,"helpers",(function(){return J.a}));var r=o(0),n=o.n(r),a=o(2),s=o.n(a),c=o(11),i=o.n(c),u=o(7),f=o(4),l=o(15),p=o.n(l),d=o(16),h=o.n(d),y=o(5),b=o(13),v=o.n(b),_=o(6),g=o.n(_),x=o(3),P=function(t){function e(){return t.apply(this,arguments)||this}Object(y.a)(e,t);var o=e.prototype;return o.oninit=function(e){var o=this;t.prototype.oninit.call(this,e),n.a.store.all("fof-terms-policies").forEach((function(t){o[t.form_key()]=!1}))},o.title=function(){return n.a.translator.trans("fof-terms.forum.accept-modal.title")},o.content=function(){return m(".Modal-body",this.body())},o.body=function(){var t=this,e=Object(x.a)(n.a.store.all("fof-terms-policies").filter((function(t){var e=n.a.session.user.fofTermsPoliciesState()[t.id()];return!e||e.has_update})));return 0===e.length?g.a.component({className:"Button",onclick:function(){n.a.modal.close()}},n.a.translator.trans("fof-terms.forum.accept-modal.close")):e.map((function(o){return m("div",[m("h2",o.name()),n.a.forum.attribute("fof-terms.hide-updated-at")?null:m("p",o.terms_updated_at()?n.a.translator.trans("fof-terms.forum.accept-modal.updated-at",{date:dayjs(o.terms_updated_at()).format(n.a.forum.attribute("fof-terms.date-format"))}):n.a.translator.trans("fof-terms.forum.accept-modal.updated-recently")),o.update_message()?m("p",o.update_message()):null,m(".Form-group",m(".FoF-Terms-Check.FoF-Terms-Check--login",m("label.checkbox",[m("input",{type:"checkbox",checked:t[o.form_key()],onchange:function(){t[o.form_key()]=!t[o.form_key()]}}),n.a.translator.trans("fof-terms.forum.accept-modal.i-accept",{policy:o.name(),a:o.url()?m("a",{href:o.url(),target:"_blank"}):m("span")})]))),g.a.component({className:"Button Button--primary",disabled:!t[o.form_key()],onclick:function(){var r=n.a.session.user.fofTermsPoliciesMustAccept();n.a.request({url:n.a.forum.attribute("apiUrl")+o.apiEndpoint()+"/accept",method:"POST",errorHandler:t.onerror.bind(t)}).then((function(t){n.a.store.pushPayload(t),1===e.length&&(r?window.location.reload():n.a.modal.close()),m.redraw()}))}},n.a.translator.trans("fof-terms.forum.accept-modal.accept"))])}))},e}(v.a),k=o(14),T=o.n(k),O=o(17),j=o.n(O),A=o(18),S=o.n(A),w=o(19),F=o.n(w),M=o(20),U=o.n(M),B=!1,E=function(){function t(){}var e=t.prototype;return e.shouldShowAlert=function(){if(B)return!1;var t=n.a.session.user;return t&&t.fofTermsPoliciesHasUpdate()},e.view=function(){if(!this.shouldShowAlert())return m("div");var t=[g.a.component({className:"Button Button--link",onclick:function(){n.a.modal.show(P)}},n.a.translator.trans("fof-terms.forum.update-alert.review"))],e=[];return n.a.session.user.fofTermsPoliciesMustAccept()||e.push(g.a.component({icon:"fas fa-times",className:"Button Button--link Button--icon Alert-dismiss",onclick:function(){B=!0}})),m(".Alert.Alert-info",m(".container",[m("span.Alert-body",n.a.session.user.fofTermsPoliciesMustAccept()?n.a.translator.trans("fof-terms.forum.update-alert.must-accept-message"):n.a.translator.trans("fof-terms.forum.update-alert.can-accept-message")),m("ul.Alert-controls",U()(t.concat(e)))]))},t}();function C(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),r=1;r<e;r++)o[r-1]=arguments[r];var n=t.apply(void 0,o),a=m(E);return Array.isArray(n)?(n.unshift(a),n):m("div",[a,n])}var H=o(21),N=o.n(H),I=o(22),D=o.n(I),q=o(23),z=o.n(q),L=function(t){function e(){return t.apply(this,arguments)||this}Object(y.a)(e,t);var o=e.prototype;return o.title=function(){return n.a.translator.trans("fof-terms.forum.state-modal.title",{username:this.attrs.user.username()})},o.content=function(){var t=this;return m(".Modal-body",m("ul",Object(x.a)(n.a.store.all("fof-terms-policies")).map((function(e){var o=t.attrs.user.fofTermsPoliciesState()[e.id()];return m("li",[e.name()+": ",o&&o.accepted_at?n.a.translator.trans("fof-terms.forum.state-modal.accepted-at",{date:z()(o.accepted_at)}):n.a.translator.trans("fof-terms.forum.state-modal.not-accepted")])}))))},e}(v.a),R={AcceptPoliciesModal:P,UpdateAlert:E,UserPoliciesStateModal:L},G=o(8),J=o(9);n.a.initializers.add("fof-terms",(function(){var t;n.a.store.models["fof-terms-policies"]=u.a,i.a.prototype.fofTermsPoliciesState=s.a.attribute("fofTermsPoliciesState"),i.a.prototype.fofTermsPoliciesHasUpdate=s.a.attribute("fofTermsPoliciesHasUpdate"),i.a.prototype.fofTermsPoliciesMustAccept=s.a.attribute("fofTermsPoliciesMustAccept"),i.a.prototype.seeFoFTermsPoliciesState=s.a.attribute("seeFoFTermsPoliciesState"),t=!1,Object(f.extend)(p.a.prototype,"oninit",(function(){if(!t){if(n.a.current.matches(h.a)){var e=n.a.session.user;e&&e.fofTermsPoliciesMustAccept()&&setTimeout((function(){n.a.modal.show(P)}),0)}t=!0}})),Object(f.extend)(T.a.prototype,"oninit",(function(){var t=this;this.fofTermsPolicies=Object(x.a)(n.a.store.all("fof-terms-policies")),this.fofTermsPolicies.forEach((function(e){t[e.form_key()]=!1}))})),Object(f.extend)(T.a.prototype,"fields",(function(t){var e=this,o=n.a.forum.attribute("fof-terms.signup-legal-text");o&&t.add("fof-terms-legal-text",m(".Form-group",m(".FoF-Terms-SignUp-Legal.Alert",o))),this.fofTermsPolicies.forEach((function(o){t.add("fof-terms-policy-"+o.id(),m(".Form-group",m(".FoF-Terms-Check.FoF-Terms-Check--signup",m("label.checkbox",[m("input",{type:"checkbox",checked:e[o.form_key()],onchange:function(){e[o.form_key()]=!e[o.form_key()]},disabled:e.loading}),n.a.translator.trans("fof-terms.forum.signup.i-accept",{policy:o.name(),a:o.url()?m("a",{href:o.url(),target:"_blank"}):m("span")})]))))}))})),Object(f.extend)(T.a.prototype,"submitData",(function(t){var e=this;this.fofTermsPolicies.forEach((function(o){t[o.form_key()]=e[o.form_key()]}))})),Object(f.override)(j.a.prototype,"hero",C),Object(f.override)(S.a.prototype,"view",C),Object(f.override)(F.a.prototype,"view",C),Object(f.extend)(N.a,"moderationControls",(function(t,e){n.a.forum.attribute("fof-terms.canSeeUserPoliciesState")&&t.add("fof-terms.state",D.a.component({icon:"fas fa-paperclip",onclick:function(){n.a.modal.show(L,{user:e})}},n.a.translator.trans("fof-terms.forum.user_controls.state_button")))}))}))}]);
  //# sourceMappingURL=forum.js.map