diff --git a/js/dist/forum.js b/js/dist/forum.js index 5cfc40d8..99afc8eb 100644 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -1,2 +1,2 @@ -(()=>{var t={n:o=>{var n=o&&o.__esModule?()=>o.default:()=>o;return t.d(n,{a:n}),n},d:(o,n)=>{for(var e in n)t.o(n,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:n[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{components:()=>lt,extend:()=>yt,models:()=>ut});const n=flarum.core.compat["forum/app"];var e=t.n(n);const a=flarum.core.compat["common/extend"],l=flarum.core.compat["common/components/Badge"];var s=t.n(l);const i=flarum.core.compat["forum/components/DiscussionList"];var r=t.n(i);const p=flarum.core.compat["common/models/Discussion"];var u=t.n(p);const c=flarum.core.compat["common/utils/classList"];var d=t.n(c);const f=flarum.core.compat["forum/components/DiscussionComposer"];var h=t.n(f);const v=flarum.core.compat["forum/components/ReplyComposer"];var b=t.n(v);function y(t,o){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},y(t,o)}function g(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,y(t,o)}const P=flarum.core.compat["common/components/Button"];var w=t.n(P);const V=flarum.core.compat["common/components/Modal"];var x=t.n(V);const M=flarum.core.compat["common/components/Switch"];var N=t.n(M);const D=flarum.core.compat["common/utils/ItemList"];var O=t.n(D);const _=flarum.core.compat["common/utils/Stream"];var C=t.n(_);const I=flarum.core.compat["common/utils/extractText"];var k=t.n(I),A=function(t){function o(){return t.apply(this,arguments)||this}g(o,t);var n=o.prototype;return n.oninit=function(o){var n=this;t.prototype.oninit.call(this,o),this.options=[C()(""),C()("")],this.optionImageUrls=[C()(""),C()("")],this.question=C()(""),this.endDate=C()(),this.publicPoll=C()(!1),this.hideVotes=C()(!1),this.allowMultipleVotes=C()(!1),this.maxVotes=C()(0),this.datepickerMinDate=this.formatDate(void 0);var e=this.attrs.poll;e&&Array.isArray(e.options)&&(this.options=[],this.optionImageUrls=[],e.options.forEach((function(t){n.options.push(C()(t.answer)),n.optionImageUrls.push(C()(t.imageUrl))})),this.question(e.question),this.publicPoll(e.publicPoll),this.hideVotes(e.hideVotes),this.allowMultipleVotes(e.allowMultipleVotes),this.maxVotes(e.maxVotes||0),this.endDate(this.formatDate(e.endDate)),this.endDate()&&dayjs(e.endDate).isAfter(dayjs())&&(this.datepickerMinDate=this.formatDate(e.endDate)))},n.title=function(){return e().translator.trans("fof-polls.forum.modal.add_title")},n.className=function(){return"PollDiscussionModal Modal--medium"},n.content=function(){return[m("div",{className:"Modal-body"},m("div",{className:"PollDiscussionModal-form"},this.fields().toArray()))]},n.fields=function(){var t=new(O());return t.add("question",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.question_placeholder")),m("input",{type:"text",name:"question",className:"FormControl",bidi:this.question})),100),t.add("answers",m("div",{className:"PollModal--answers Form-group"},m("label",{className:"label PollModal--answers-title"},m("span",null,e().translator.trans("fof-polls.forum.modal.options_label")),w().component({className:"Button PollModal--button small",icon:"fas fa-plus",onclick:this.addOption.bind(this)})),this.displayOptions()),80),t.add("date",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.date_placeholder")),m("div",{className:"PollModal--date"},m("input",{className:"FormControl",type:"datetime-local",name:"date",bidi:this.endDate,min:this.datepickerMinDate,max:this.formatDate("2038")}),w().component({className:"Button PollModal--button",icon:"fas fa-times",onclick:this.endDate.bind(this,null)})),this.endDate()&&m("p",{className:"helpText"},m("i",{class:"icon fas fa-clock"})," ",dayjs(this.endDate()).isBefore(dayjs())?e().translator.trans("fof-polls.forum.poll_ended"):e().translator.trans("fof-polls.forum.days_remaining",{time:dayjs(this.endDate()).fromNow()}))),40),t.add("public",m("div",{className:"Form-group"},N().component({state:this.publicPoll()||!1,onchange:this.publicPoll},e().translator.trans("fof-polls.forum.modal.public_poll_label"))),20),t.add("hide-votes",m("div",{className:"Form-group"},m(N(),{state:this.endDate()&&this.hideVotes(),onchange:this.hideVotes,disabled:!this.endDate()},e().translator.trans("fof-polls.forum.modal.hide_votes_label"))),20),t.add("allow-multiple-votes",m("div",{className:"Form-group"},N().component({state:this.allowMultipleVotes()||!1,onchange:this.allowMultipleVotes},e().translator.trans("fof-polls.forum.modal.allow_multiple_votes_label"))),15),this.allowMultipleVotes()&&t.add("max-votes",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.max_votes_label")),m("input",{type:"number",min:"0",max:this.options.length,name:"maxVotes",className:"FormControl",bidi:this.maxVotes}),m("p",{className:"helpText"},e().translator.trans("fof-polls.forum.modal.max_votes_help"))),15),t.add("submit",m("div",{className:"Form-group"},w().component({type:"submit",className:"Button Button--primary PollModal-SubmitButton",loading:this.loading},e().translator.trans("fof-polls.forum.modal.submit"))),-10),t},n.displayOptions=function(){var t=this;return Object.keys(this.options).map((function(o,n){return m("div",{className:"Form-group"},m("fieldset",{className:"Poll-answer-input"},m("input",{className:"FormControl",type:"text",name:"answer"+(n+1),bidi:t.options[n],placeholder:e().translator.trans("fof-polls.forum.modal.option_placeholder")+" #"+(n+1)}),e().forum.attribute("allowPollOptionImage")?m("input",{className:"FormControl",type:"text",name:"answerImage"+(n+1),bidi:t.optionImageUrls[n],placeholder:e().translator.trans("fof-polls.forum.modal.image_option_placeholder")+" #"+(n+1)}):null),n>=2?w().component({type:"button",className:"Button Button--warning PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length=2?w().component({type:"button",className:"Button PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length0,i=l.voteCount(),r=null==(n=l.myVotes())||null==n.some?void 0:n.some((function(o){return o.option()===t})),p=t.voteCount(),u=i>0?Math.round(p/i*100):0,c="number"==typeof p,f=this.loadingOptions||s&&!l.canChangeVote(),h=c?u:Number(r)/((null==(a=l.myVotes())?void 0:a.length)||1)*100,v=m("div",{className:"PollBar","data-selected":r},(!l.hasEnded()&&l.canVote()||!e().session.user)&&m("label",{className:"checkbox"},m("input",{onchange:this.changeVote.bind(this,t),type:"checkbox",checked:r,disabled:f}),m("span",{className:"checkmark"})),m("div",{style:"--width: "+h+"%",className:"PollOption-active"}),m("label",{className:"PollAnswer"},m("span",null,t.answer()),t.imageUrl()?m("img",{className:"PollAnswerImage",src:t.imageUrl(),alt:t.answer()}):null),c&&m("label",null,m("span",{className:d()("PollPercent",100!==u&&"PollPercent--option")},u,"%")));return m("div",{className:d()("PollOption",s&&"PollVoted",l.hasEnded()&&"PollEnded",t.imageUrl()&&"PollOption-hasImage"),"data-id":t.id()},c?m(Q(),{text:e().translator.trans("fof-polls.forum.tooltip.votes",{count:p}),onremove:this.hideOptionTooltip},v):v)},n.changeVote=function(t,o){var n,a,l=this;if(!e().session.user)return e().modal.show(F()),void(o.target.checked=!1);var s=new Set(null==(n=(a=this.attrs.poll.myVotes()).map)?void 0:n.call(a,(function(t){return t.option().id()}))),i=s.delete(t.id());return this.attrs.poll.allowMultipleVotes()||s.clear(),i||s.add(t.id()),this.loadingOptions=!0,m.redraw(),e().request({method:"PATCH",url:e().forum.attribute("apiUrl")+"/fof/polls/"+this.attrs.poll.id()+"/votes",body:{data:{optionIds:Array.from(s)}}}).then((function(t){e().store.pushPayload(t)})).catch((function(){o.target.checked=i})).finally((function(){l.loadingOptions=!1,m.redraw()}))},n.showVoters=function(){e().modal.show(G,{poll:this.attrs.poll,post:this.attrs.post})},n.deletePoll=function(){confirm(e().translator.trans("fof-polls.forum.moderation.delete_confirm"))&&this.attrs.poll.delete().then((function(){m.redraw.sync()}))},n.hideOptionTooltip=function(t){t.attrs.tooltipVisible=!1,t.state.updateVisibility()},o}(T());const Z=flarum.core.compat["forum/components/DiscussionPage"];var tt=t.n(Z);function ot(t,o){(null==o||o>t.length)&&(o=t.length);for(var n=0,e=new Array(o);n=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(o.polls());!(n=e()).done;){var a=n.value;a&&t.push(m(X,{post:o,poll:a}))}})),(0,a.extend)(U().prototype,"oninit",(function(){var t=this;this.subtree.check((function(){var o=t.attrs.post.polls(),n=null==o||null==o.map?void 0:o.map((function(t){var o,n,e,a,l;return t&&[null==(o=t.data)?void 0:o.attributes,null==(n=(e=t.options()).map)?void 0:n.call(e,(function(t){var o;return null==t||null==(o=t.data)?void 0:o.attributes})),null==(a=(l=t.myVotes()).map)?void 0:a.call(l,(function(t){var o;return null==(o=t.option())?void 0:o.id()}))]}));return JSON.stringify(n)}))})),(0,a.extend)(tt().prototype,"oncreate",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.bind("updatedPollOptions",(function(t){var o=e().store.getById("polls",t.pollId);o&&o.pushAttributes({voteCount:t.pollVoteCount});var n=t.options;for(var a in n){var l=e().store.getById("poll_options",a);l&&void 0!==l.voteCount()&&l.pushAttributes({voteCount:n[a]})}m.redraw()}))}))})),(0,a.extend)(tt().prototype,"onremove",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.unbind("updatedPollOptions")}))})),t=function(t){return e().modal.show(A,{onsubmit:function(o){return e().store.createRecord("polls").save(nt({},o,{relationships:{post:t}}),{data:{include:"options,myVotes,myVotes.option"}}).then((function(o){var n;return null==(n=t.rawRelationship("polls"))||null==n.push||n.push({type:"polls",id:o.id()}),o}))}})},(0,a.extend)(at(),"moderationControls",(function(o,n){!n.isHidden()&&n.canStartPoll()&&o.add("addPoll",m(w(),{icon:"fas fa-poll",onclick:t.bind(this,n)},e().translator.trans("fof-polls.forum.moderation.add")))}))}))})(),module.exports=o})(); +(()=>{var t={n:o=>{var n=o&&o.__esModule?()=>o.default:()=>o;return t.d(n,{a:n}),n},d:(o,n)=>{for(var e in n)t.o(n,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:n[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},o={};(()=>{"use strict";t.r(o),t.d(o,{components:()=>lt,extend:()=>gt,models:()=>ut});const n=flarum.core.compat["forum/app"];var e=t.n(n);const a=flarum.core.compat["common/extend"],l=flarum.core.compat["common/components/Badge"];var s=t.n(l);const i=flarum.core.compat["forum/components/DiscussionList"];var r=t.n(i);const p=flarum.core.compat["common/models/Discussion"];var u=t.n(p);const c=flarum.core.compat["common/utils/classList"];var d=t.n(c);const h=flarum.core.compat["forum/components/DiscussionComposer"];var f=t.n(h);const v=flarum.core.compat["forum/components/ReplyComposer"];var b=t.n(v);function g(t,o){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},g(t,o)}function y(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,g(t,o)}const w=flarum.core.compat["common/components/Button"];var V=t.n(w);const P=flarum.core.compat["common/components/Modal"];var N=t.n(P);const x=flarum.core.compat["common/components/Switch"];var M=t.n(x);const O=flarum.core.compat["common/utils/ItemList"];var C=t.n(O);const _=flarum.core.compat["common/utils/Stream"];var D=t.n(_);const I=flarum.core.compat["common/utils/extractText"];var S=t.n(I),k=function(t){function o(){return t.apply(this,arguments)||this}y(o,t);var n=o.prototype;return n.oninit=function(o){var n=this;t.prototype.oninit.call(this,o),this.options=[D()(""),D()("")],this.optionImageUrls=[D()(""),D()("")],this.question=D()(""),this.endDate=D()(),this.publicPoll=D()(!1),this.hideVotes=D()(!1),this.allowChangeVote=D()(!0),this.allowMultipleVotes=D()(!1),this.maxVotes=D()(0),this.datepickerMinDate=this.formatDate(void 0);var e=this.attrs.poll;e&&Array.isArray(e.options)&&(this.options=[],this.optionImageUrls=[],e.options.forEach((function(t){n.options.push(D()(t.answer)),n.optionImageUrls.push(D()(t.imageUrl))})),this.question(e.question),this.publicPoll(e.publicPoll),this.hideVotes(e.hideVotes),this.allowChangeVote(e.allowChangeVote),this.allowMultipleVotes(e.allowMultipleVotes),this.maxVotes(e.maxVotes||0),this.endDate(this.formatDate(e.endDate)),this.endDate()&&dayjs(e.endDate).isAfter(dayjs())&&(this.datepickerMinDate=this.formatDate(e.endDate)))},n.title=function(){return e().translator.trans("fof-polls.forum.modal.add_title")},n.className=function(){return"PollDiscussionModal Modal--medium"},n.content=function(){return[m("div",{className:"Modal-body"},m("div",{className:"PollDiscussionModal-form"},this.fields().toArray()))]},n.fields=function(){var t=new(C());return t.add("question",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.question_placeholder")),m("input",{type:"text",name:"question",className:"FormControl",bidi:this.question})),100),t.add("answers",m("div",{className:"PollModal--answers Form-group"},m("label",{className:"label PollModal--answers-title"},m("span",null,e().translator.trans("fof-polls.forum.modal.options_label")),V().component({className:"Button PollModal--button small",icon:"fas fa-plus",onclick:this.addOption.bind(this)})),this.displayOptions()),80),t.add("date",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.date_placeholder")),m("div",{className:"PollModal--date"},m("input",{className:"FormControl",type:"datetime-local",name:"date",bidi:this.endDate,min:this.datepickerMinDate,max:this.formatDate("2038")}),V().component({className:"Button PollModal--button",icon:"fas fa-times",onclick:this.endDate.bind(this,null)})),this.endDate()&&m("p",{className:"helpText"},m("i",{class:"icon fas fa-clock"})," ",dayjs(this.endDate()).isBefore(dayjs())?e().translator.trans("fof-polls.forum.poll_ended"):e().translator.trans("fof-polls.forum.days_remaining",{time:dayjs(this.endDate()).fromNow()}))),40),t.add("public",m("div",{className:"Form-group"},M().component({state:this.publicPoll()||!1,onchange:this.publicPoll},e().translator.trans("fof-polls.forum.modal.public_poll_label"))),20),t.add("hide-votes",m("div",{className:"Form-group"},m(M(),{state:this.endDate()&&this.hideVotes(),onchange:this.hideVotes,disabled:!this.endDate()},e().translator.trans("fof-polls.forum.modal.hide_votes_label"))),20),t.add("allow-change-vote",m("div",{className:"Form-group"},m(M(),{state:this.allowChangeVote(),onchange:this.allowChangeVote},e().translator.trans("fof-polls.forum.modal.allow_change_vote_label"))),20),t.add("allow-multiple-votes",m("div",{className:"Form-group"},M().component({state:this.allowMultipleVotes()||!1,onchange:this.allowMultipleVotes},e().translator.trans("fof-polls.forum.modal.allow_multiple_votes_label"))),15),this.allowMultipleVotes()&&t.add("max-votes",m("div",{className:"Form-group"},m("label",{className:"label"},e().translator.trans("fof-polls.forum.modal.max_votes_label")),m("input",{type:"number",min:"0",max:this.options.length,name:"maxVotes",className:"FormControl",bidi:this.maxVotes}),m("p",{className:"helpText"},e().translator.trans("fof-polls.forum.modal.max_votes_help"))),15),t.add("submit",m("div",{className:"Form-group"},V().component({type:"submit",className:"Button Button--primary PollModal-SubmitButton",loading:this.loading},e().translator.trans("fof-polls.forum.modal.submit"))),-10),t},n.displayOptions=function(){var t=this;return Object.keys(this.options).map((function(o,n){return m("div",{className:"Form-group"},m("fieldset",{className:"Poll-answer-input"},m("input",{className:"FormControl",type:"text",name:"answer"+(n+1),bidi:t.options[n],placeholder:e().translator.trans("fof-polls.forum.modal.option_placeholder")+" #"+(n+1)}),e().forum.attribute("allowPollOptionImage")?m("input",{className:"FormControl",type:"text",name:"answerImage"+(n+1),bidi:t.optionImageUrls[n],placeholder:e().translator.trans("fof-polls.forum.modal.image_option_placeholder")+" #"+(n+1)}):null),n>=2?V().component({type:"button",className:"Button Button--warning PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length=2?V().component({type:"button",className:"Button PollModal--button",icon:"fas fa-minus",onclick:n>=2?t.removeOption.bind(t,n):""}):"")}))},n.addOption=function(){var t=Math.max(e().forum.attribute("pollMaxOptions"),2);this.options.length0;return!e().session.user||a.canVote()||a.hasEnded()||n.add("no-permission",m("span",null,m("i",{className:"icon fas fa-times-circle fa-fw"}),e().translator.trans("fof-polls.forum.no_permission"))),a.endDate()&&n.add("end-date",m("span",null,m("i",{class:"icon fas fa-clock fa-fw"}),a.hasEnded()?e().translator.trans("fof-polls.forum.poll_ended"):e().translator.trans("fof-polls.forum.days_remaining",{time:dayjs(a.endDate()).fromNow()}))),a.canVote()&&(n.add("max-votes",m("span",null,m("i",{className:"icon fas fa-poll fa-fw"}),e().translator.trans("fof-polls.forum.max_votes_allowed",{max:t}))),a.canChangeVote()||n.add("cannot-change-vote",m("span",null,m("i",{className:"icon fas fa-"+(l?"times":"exclamation")+"-circle fa-fw"}),e().translator.trans("fof-polls.forum.poll.cannot_change_vote")))),n},n.viewOption=function(t){var o,n,a,l=this.attrs.poll,s=(null==(o=l.myVotes())?void 0:o.length)>0,i=l.voteCount(),r=this.pendingOptions?this.pendingOptions.has(t.id()):null==(n=l.myVotes())||null==n.some?void 0:n.some((function(o){return o.option()===t})),p=t.voteCount(),u=i>0?Math.round(p/i*100):0,c="number"==typeof p,h=this.loadingOptions||s&&!l.canChangeVote(),f=c?u:Number(r)/((null==(a=l.myVotes())?void 0:a.length)||1)*100,v=!e().session.user||!l.hasEnded()&&l.canVote()&&(!s||l.canChangeVote()),b=m("div",{className:"PollBar","data-selected":r},v&&m("label",{className:"checkbox"},m("input",{onchange:this.changeVote.bind(this,t),type:"checkbox",checked:r,disabled:h}),m("span",{className:"checkmark"})),m("div",{style:"--width: "+f+"%",className:"PollOption-active"}),m("label",{className:"PollAnswer"},m("span",null,t.answer()),t.imageUrl()?m("img",{className:"PollAnswerImage",src:t.imageUrl(),alt:t.answer()}):null),c&&m("label",null,m("span",{className:d()("PollPercent",100!==u&&"PollPercent--option")},u,"%")));return m("div",{className:d()("PollOption",s&&"PollVoted",l.hasEnded()&&"PollEnded",t.imageUrl()&&"PollOption-hasImage"),"data-id":t.id()},c?m(Q(),{text:e().translator.trans("fof-polls.forum.tooltip.votes",{count:p}),onremove:this.hideOptionTooltip},b):b)},n.changeVote=function(t,o){var n,a;if(!e().session.user)return e().modal.show(F()),void(o.target.checked=!1);var l=this.pendingOptions||new Set(null==(n=(a=this.attrs.poll.myVotes()).map)?void 0:n.call(a,(function(t){return t.option().id()}))),s=l.delete(t.id());return this.attrs.poll.allowMultipleVotes()||l.clear(),s||l.add(t.id()),this.useSubmitUI?(this.pendingOptions=l.size?l:null,void(this.pendingSubmit=!!this.pendingOptions)):this.submit(l,null,(function(){return o.target.checked=s}))},n.onsubmit=function(){var t=this;return this.submit(this.pendingOptions,(function(){t.pendingOptions=null,t.pendingSubmit=!1}))},n.submit=function(t,o,n){var a=this;return this.loadingOptions=!0,m.redraw(),e().request({method:"PATCH",url:e().forum.attribute("apiUrl")+"/fof/polls/"+this.attrs.poll.id()+"/votes",body:{data:{optionIds:Array.from(t)}}}).then((function(t){e().store.pushPayload(t),null==o||o()})).catch((function(t){null==n||n(t)})).finally((function(){a.loadingOptions=!1,m.redraw()}))},n.showVoters=function(){e().modal.show(G,{poll:this.attrs.poll,post:this.attrs.post})},n.deletePoll=function(){confirm(e().translator.trans("fof-polls.forum.moderation.delete_confirm"))&&this.attrs.poll.delete().then((function(){m.redraw.sync()}))},n.hideOptionTooltip=function(t){t.attrs.tooltipVisible=!1,t.state.updateVisibility()},n.preventClose=function(t){if(this.pendingOptions)return t.preventDefault(),!0},o}(B());const Z=flarum.core.compat["forum/components/DiscussionPage"];var tt=t.n(Z);function ot(t,o){(null==o||o>t.length)&&(o=t.length);for(var n=0,e=new Array(o);n=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(o.polls());!(n=e()).done;){var a=n.value;a&&t.push(m(X,{post:o,poll:a}))}})),(0,a.extend)(j().prototype,"oninit",(function(){var t=this;this.subtree.check((function(){var o=t.attrs.post.polls(),n=null==o||null==o.map?void 0:o.map((function(t){var o,n,e,a,l;return t&&[null==(o=t.data)?void 0:o.attributes,null==(n=(e=t.options()).map)?void 0:n.call(e,(function(t){var o;return null==t||null==(o=t.data)?void 0:o.attributes})),null==(a=(l=t.myVotes()).map)?void 0:a.call(l,(function(t){var o;return null==(o=t.option())?void 0:o.id()}))]}));return JSON.stringify(n)}))})),(0,a.extend)(tt().prototype,"oncreate",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.bind("updatedPollOptions",(function(t){var o=e().store.getById("polls",t.pollId);o&&o.pushAttributes({voteCount:t.pollVoteCount});var n=t.options;for(var a in n){var l=e().store.getById("poll_options",a);l&&void 0!==l.voteCount()&&l.pushAttributes({voteCount:n[a]})}m.redraw()}))}))})),(0,a.extend)(tt().prototype,"onremove",(function(){e().pusher&&e().pusher.then((function(t){t.channels.main.unbind("updatedPollOptions")}))})),t=function(t){return e().modal.show(k,{onsubmit:function(o){return e().store.createRecord("polls").save(nt({},o,{relationships:{post:t}}),{data:{include:"options,myVotes,myVotes.option"}}).then((function(o){var n;return null==(n=t.rawRelationship("polls"))||null==n.push||n.push({type:"polls",id:o.id()}),o}))}})},(0,a.extend)(at(),"moderationControls",(function(o,n){!n.isHidden()&&n.canStartPoll()&&o.add("addPoll",m(V(),{icon:"fas fa-poll",onclick:t.bind(this,n)},e().translator.trans("fof-polls.forum.moderation.add")))}))}))})(),module.exports=o})(); //# sourceMappingURL=forum.js.map \ No newline at end of file diff --git a/js/dist/forum.js.map b/js/dist/forum.js.map index 73cf4a6c..55b88a63 100644 --- a/js/dist/forum.js.map +++ b/js/dist/forum.js.map @@ -1 +1 @@ -{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,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C,QACJ,GACF,GAEJ,KAEAX,EAAAA,EAAAA,QAAOuH,KAAAA,UAA0B,YAAY,WACvCxL,IAAAA,QACFA,IAAAA,OAAWgD,MAAK,SAACyI,GACfA,EAAQC,SAASC,KAAKI,OAAO,qBAC/B,GAEJ,IDrEMzB,EAAa,SAAC1B,GAAI,OACtB5I,IAAAA,MAAUgE,KAAK5F,EAAiB,CAC9BuE,SAAU,SAACH,GAAI,OACbxC,IAAAA,MACG0F,aAAa,SACbE,KAAK,MAECpD,EAAI,CACPwJ,cAAe,CACbpD,KAAAA,KAGJ,CACEpG,KAAM,CACJkC,QAAS,oCAId1B,MAAK,SAAC5D,GAAS,MAGd,OAF6B,OAA7B,EAAAwJ,EAAKqD,gBAAgB,WAAc,MAAnC,EAA+BvM,MAA/B,EAA+BA,KAAO,CAAEe,KAAM,QAASgE,GAAIrF,EAAKqF,OAEzDrF,CACT,GAAE,GACN,GAEJ6E,EAAAA,EAAAA,QAAOiI,KAAc,sBAAsB,SAAU5L,EAAOsI,IACrDA,EAAKoC,YAAcpC,EAAKxE,gBAC3B9D,EAAME,IACJ,UACA,EAAC,IAAM,CAACK,KAAK,cAAcC,QAASwJ,EAAWzM,KAAKU,KAAMqK,IACvD5I,IAAAA,WAAeC,MAAM,mCAI9B,GD3BF,G","sources":["webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object","webpack://@fof/polls/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@fof/polls/./src/forum/addDiscussionBadge.js","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionComposer']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/polls/./src/forum/components/CreatePollModal.js","webpack://@fof/polls/./src/forum/addComposerItems.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/LogInModal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Link']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/polls/./src/forum/components/ListVotersModal.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/polls/./src/forum/components/EditPollModal.js","webpack://@fof/polls/./src/forum/components/PostPoll.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/polls/./src/forum/components/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/polls/./src/forum/models/Poll.js","webpack://@fof/polls/./src/forum/models/PollOption.js","webpack://@fof/polls/./src/forum/models/PollVote.js","webpack://@fof/polls/./src/forum/models/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/extenders']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Post']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Forum']\"","webpack://@fof/polls/./src/forum/extend.js","webpack://@fof/polls/./src/forum/index.js","webpack://@fof/polls/./src/forum/addPostControls.js","webpack://@fof/polls/./src/forum/addPollsToPost.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport Discussion from 'flarum/common/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.hasPoll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fas fa-signal',\n }),\n 5\n );\n }\n });\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/ReplyComposer'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Modal from 'flarum/common/components/Modal';\nimport Switch from 'flarum/common/components/Switch';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport default class CreatePollModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.options = [Stream(''), Stream('')];\n this.optionImageUrls = [Stream(''), Stream('')];\n\n this.question = Stream('');\n\n this.endDate = Stream();\n\n this.publicPoll = Stream(false);\n this.hideVotes = Stream(false);\n this.allowMultipleVotes = Stream(false);\n this.maxVotes = Stream(0);\n\n this.datepickerMinDate = this.formatDate(undefined);\n\n const { poll } = this.attrs;\n\n // When re-opening the modal for the same discussion composer where we already set poll attributes\n if (poll && Array.isArray(poll.options)) {\n this.options = [];\n this.optionImageUrls = [];\n poll.options.forEach((option) => {\n this.options.push(Stream(option.answer));\n this.optionImageUrls.push(Stream(option.imageUrl));\n });\n\n this.question(poll.question);\n this.publicPoll(poll.publicPoll);\n this.hideVotes(poll.hideVotes);\n this.allowMultipleVotes(poll.allowMultipleVotes);\n this.maxVotes(poll.maxVotes || 0);\n\n this.endDate(this.formatDate(poll.endDate));\n\n // Replace minimum of 'today' for poll end date only if the poll is not already closed\n if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(poll.endDate);\n }\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--medium';\n }\n\n content() {\n return [\n
\n
{this.fields().toArray()}
\n
,\n ];\n }\n\n fields() {\n const items = new ItemList();\n\n items.add(\n 'question',\n
\n \n\n \n
,\n 100\n );\n\n items.add(\n 'answers',\n
\n \n\n {this.displayOptions()}\n
,\n 80\n );\n\n items.add(\n 'date',\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n onclick: this.endDate.bind(this, null),\n })}\n
\n\n {this.endDate() && (\n

\n \n  \n {dayjs(this.endDate()).isBefore(dayjs())\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.endDate()).fromNow() })}\n

\n )}\n
,\n 40\n );\n\n items.add(\n 'public',\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
,\n 20\n );\n\n items.add(\n 'hide-votes',\n
\n \n {app.translator.trans('fof-polls.forum.modal.hide_votes_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-multiple-votes',\n
\n {Switch.component(\n {\n state: this.allowMultipleVotes() || false,\n onchange: this.allowMultipleVotes,\n },\n app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label')\n )}\n
,\n 15\n );\n\n if (this.allowMultipleVotes()) {\n items.add(\n 'max-votes',\n
\n \n\n \n\n

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

\n
,\n 15\n );\n }\n\n items.add(\n 'submit',\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary PollModal-SubmitButton',\n loading: this.loading,\n },\n app.translator.trans('fof-polls.forum.modal.submit')\n )}\n
,\n -10\n );\n\n return items;\n }\n\n displayOptions() {\n return Object.keys(this.options).map((el, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(option) {\n this.options.splice(option, 1);\n this.optionImageUrls.splice(option, 1);\n }\n\n data() {\n const poll = {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options: [],\n };\n\n this.options.forEach((answer, index) => {\n if (answer()) {\n poll.options.push({\n answer: answer(),\n imageUrl: this.optionImageUrls[index](),\n });\n }\n });\n\n if (this.question() === '') {\n alert(app.translator.trans('fof-polls.forum.modal.include_question'));\n\n return null;\n }\n\n if (poll.options.length < 2) {\n alert(app.translator.trans('fof-polls.forum.modal.min'));\n\n return null;\n }\n\n return poll;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n const data = this.data();\n\n if (data === null) {\n return;\n }\n\n const promise = this.attrs.onsubmit(data);\n\n if (promise instanceof Promise) {\n this.loading = true;\n\n promise.then(this.hide.bind(this), (err) => {\n console.error(err);\n this.loaded();\n });\n } else {\n app.modal.close();\n }\n }\n\n formatDate(date, def = false) {\n const dayjsDate = dayjs(date);\n\n if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null;\n\n return dayjsDate.format('YYYY-MM-DDTHH:mm');\n }\n\n dateToTimestamp(date) {\n const dayjsDate = dayjs(date);\n\n if (!date || !dayjsDate.isValid()) return false;\n\n return dayjsDate.format();\n }\n}\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\nimport DiscussionComposer from 'flarum/forum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport const addToComposer = (composer) => {\n composer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.composer.fields.poll,\n onsubmit: (poll) => (this.composer.fields.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(composer.prototype, 'headerItems', function (items) {\n const discussion = this.composer.body?.attrs?.discussion;\n const canStartPoll = discussion?.canStartPoll() ?? app.forum.canStartPolls();\n\n if (canStartPoll) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.composer.fields.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(composer.prototype, 'data', function (data) {\n if (this.composer.fields.poll) {\n data.poll = this.composer.fields.poll;\n }\n });\n};\n\nexport default () => {\n addToComposer(DiscussionComposer);\n addToComposer(ReplyComposer);\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/LogInModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","import app from 'flarum/forum/app';\n\nimport Modal from 'flarum/common/components/Modal';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport Stream from 'flarum/common/utils/Stream';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default class ListVotersModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = Stream(true);\n\n app.store\n .find('fof/polls', this.attrs.poll.id(), {\n include: 'votes,votes.user,votes.option',\n })\n .then(() => this.loading(false))\n .finally(() => m.redraw());\n }\n\n className() {\n return 'Modal--medium VotesModal';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return
{this.loading() ? : this.attrs.poll.options().map(this.optionContent.bind(this))}
;\n }\n\n optionContent(opt) {\n const votes = (this.attrs.poll.votes() || []).filter((v) => opt.id() === v.option().id());\n\n return (\n
\n

{opt.answer() + ':'}

\n\n {votes.length ? (\n
{votes.map(this.voteContent.bind(this))}
\n ) : (\n

{app.translator.trans('fof-polls.forum.modal.no_voters')}

\n )}\n
\n );\n }\n\n voteContent(vote) {\n const user = vote.user();\n const attrs = user && { href: app.route.user(user) };\n\n return (\n \n {avatar(user)} {username(user)}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.poll = this.attrs.poll;\n\n this.options = this.poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl()));\n this.question = Stream(this.poll.question());\n this.endDate = Stream(this.formatDate(this.poll.endDate()));\n this.publicPoll = Stream(this.poll.publicPoll());\n this.allowMultipleVotes = Stream(this.poll.allowMultipleVotes());\n this.hideVotes = Stream(this.poll.hideVotes());\n this.maxVotes = Stream(this.poll.maxVotes() || 0);\n\n if (this.endDate() && dayjs(this.poll.endDate()).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(this.endDate());\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n\n displayOptions() {\n return this.options.map((opt, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n this.optionImageUrls.splice(i, 1);\n }\n\n data() {\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n o.data.attributes.imageUrl = this.optionImageUrls[i]();\n\n return o.data;\n });\n\n return {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options,\n };\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (this.loading) return;\n\n this.loading = true;\n\n return this.poll\n .save(this.data())\n .then(() => {\n this.hide();\n m.redraw();\n })\n .catch((e) => {\n this.loaded();\n this.onerror(e);\n });\n }\n}\n","import app from 'flarum/forum/app';\n\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LogInModal from 'flarum/forum/components/LogInModal';\nimport ListVotersModal from './ListVotersModal';\nimport classList from 'flarum/common/utils/classList';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport EditPollModal from './EditPollModal';\n\nexport default class PostPoll extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadingOptions = false;\n }\n\n view() {\n const poll = this.attrs.poll;\n const options = poll.options() || [];\n let maxVotes = poll.allowMultipleVotes() ? poll.maxVotes() : 1;\n\n if (maxVotes === 0) maxVotes = options.length;\n\n return (\n
\n
\n

{poll.question()}

\n\n {poll.canSeeVoters() && (\n \n
\n\n
{options.map(this.viewOption.bind(this))}
\n\n
\n {app.session.user && !poll.canVote() && !poll.hasEnded() && (\n \n \n {app.translator.trans('fof-polls.forum.no_permission')}\n \n )}\n {poll.endDate() && (\n \n \n {poll.hasEnded()\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(poll.endDate()).fromNow() })}\n \n )}\n\n {poll.canVote() && (\n \n \n {app.translator.trans('fof-polls.forum.max_votes_allowed', { max: maxVotes })}\n \n )}\n
\n
\n );\n }\n\n viewOption(opt) {\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n const totalVotes = poll.voteCount();\n\n const voted = poll.myVotes()?.some?.((vote) => vote.option() === opt);\n const votes = opt.voteCount();\n const percent = totalVotes > 0 ? Math.round((votes / totalVotes) * 100) : 0;\n\n // isNaN(null) is false, so we have to check type directly now that API always returns the field\n const canSeeVoteCount = typeof votes === 'number';\n const isDisabled = this.loadingOptions || (hasVoted && !poll.canChangeVote());\n const width = canSeeVoteCount ? percent : (Number(voted) / (poll.myVotes()?.length || 1)) * 100;\n\n const bar = (\n
\n {((!poll.hasEnded() && poll.canVote()) || !app.session.user) && (\n \n )}\n\n
\n \n {canSeeVoteCount && (\n \n )}\n
\n );\n\n return (\n \n {canSeeVoteCount ? (\n \n {bar}\n \n ) : (\n bar\n )}\n
\n );\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n const optionIds = new Set(this.attrs.poll.myVotes().map?.((v) => v.option().id()));\n const isUnvoting = optionIds.delete(option.id());\n const allowsMultiple = this.attrs.poll.allowMultipleVotes();\n\n if (!allowsMultiple) {\n optionIds.clear();\n }\n\n if (!isUnvoting) {\n optionIds.add(option.id());\n }\n\n this.loadingOptions = true;\n m.redraw();\n\n return app\n .request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.attrs.poll.id()}/votes`,\n body: {\n data: {\n optionIds: Array.from(optionIds),\n },\n },\n })\n .then((res) => {\n app.store.pushPayload(res);\n\n // m.redraw();\n })\n .catch(() => {\n evt.target.checked = isUnvoting;\n })\n .finally(() => {\n this.loadingOptions = false;\n\n m.redraw();\n });\n }\n\n showVoters() {\n // Load all the votes only when opening the votes list\n app.modal.show(ListVotersModal, {\n poll: this.attrs.poll,\n post: this.attrs.post,\n });\n }\n\n deletePoll() {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n this.attrs.poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n }\n\n /**\n * Attempting to use the `tooltipVisible` attr on the Tooltip component set to 'false' when no vote count\n * caused the tooltip to break on click. This is a workaround to hide the tooltip when no vote count is available,\n * called on 'onremove' of the Tooltip component. It doesn't always work as intended either, but it does the job.\n */\n hideOptionTooltip(vnode) {\n vnode.attrs.tooltipVisible = false;\n vnode.state.updateVisibility();\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","import CreatePollModal from './CreatePollModal';\nimport PostPoll from './PostPoll';\nimport EditPollModal from './EditPollModal';\nimport ListVotersModal from './ListVotersModal';\n\nexport const components = {\n CreatePollModal,\n PostPoll,\n EditPollModal,\n ListVotersModal,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from 'flarum/common/Model';\n\nexport default class Poll extends Model {\n question = Model.attribute('question');\n hasEnded = Model.attribute('hasEnded');\n endDate = Model.attribute('endDate');\n\n publicPoll = Model.attribute('publicPoll');\n hideVotes = Model.attribute('hideVotes');\n allowMultipleVotes = Model.attribute('allowMultipleVotes');\n maxVotes = Model.attribute('maxVotes');\n\n voteCount = Model.attribute('voteCount');\n\n canVote = Model.attribute('canVote');\n canEdit = Model.attribute('canEdit');\n canDelete = Model.attribute('canDelete');\n canSeeVoters = Model.attribute('canSeeVoters');\n canChangeVote = Model.attribute('canChangeVote');\n\n options = Model.hasMany('options');\n votes = Model.hasMany('votes');\n myVotes = Model.hasMany('myVotes');\n\n apiEndpoint() {\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollOption extends Model {\n answer = Model.attribute('answer');\n imageUrl = Model.attribute('imageUrl');\n voteCount = Model.attribute('voteCount');\n\n poll = Model.hasOne('polls');\n votes = Model.hasMany('votes');\n\n apiEndpoint() {\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollVote extends Model {\n poll = Model.hasOne('poll');\n option = Model.hasOne('option');\n user = Model.hasOne('user');\n\n pollId = Model.attribute('pollId');\n optionId = Model.attribute('optionId');\n\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Poll from './Poll';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport const models = {\n Poll,\n PollOption,\n PollVote,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Forum'];","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport Forum from 'flarum/common/models/Forum';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\n\nexport default [\n new Extend.Store().add('polls', Poll).add('poll_options', PollOption).add('poll_votes', PollVote),\n\n new Extend.Model(Post).hasMany('polls').attribute('canStartPoll'),\n\n new Extend.Model(Forum).attribute('canStartPolls'),\n\n new Extend.Model(Discussion).attribute('hasPoll').attribute('canStartPoll'),\n];\n","import app from 'flarum/forum/app';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addComposerItems from './addComposerItems';\nimport addPollsToPost from './addPollsToPost';\nimport addPostControls from './addPostControls';\n\nexport * from './components';\nexport * from './models';\n\napp.initializers.add('fof/polls', () => {\n addDiscussionBadge();\n addComposerItems();\n addPollsToPost();\n addPostControls();\n});\n\nexport { default as extend } from './extend';\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CreatePollModal from './components/CreatePollModal';\nimport Button from 'flarum/common/components/Button';\n\nexport default () => {\n const createPoll = (post) =>\n app.modal.show(CreatePollModal, {\n onsubmit: (data) =>\n app.store\n .createRecord('polls')\n .save(\n {\n ...data,\n relationships: {\n post,\n },\n },\n {\n data: {\n include: 'options,myVotes,myVotes.option',\n },\n }\n )\n .then((poll) => {\n post.rawRelationship('polls')?.push?.({ type: 'polls', id: poll.id() });\n\n return poll;\n }),\n });\n\n extend(PostControls, 'moderationControls', function (items, post) {\n if (!post.isHidden() && post.canStartPoll()) {\n items.add(\n 'addPoll',\n \n );\n }\n });\n};\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPoll from './components/PostPoll';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const post = this.attrs.post;\n\n if ((!post.isHidden() || this.revealContent) && post.polls()) {\n for (const poll of post.polls()) {\n if (poll) {\n content.push();\n }\n }\n }\n });\n\n extend(CommentPost.prototype, 'oninit', function () {\n this.subtree.check(() => {\n const polls = this.attrs.post.polls();\n\n const checks = polls?.map?.(\n (poll) =>\n poll && [\n poll.data?.attributes,\n poll.options().map?.((option) => option?.data?.attributes),\n poll.myVotes().map?.((vote) => vote.option()?.id()),\n ]\n );\n\n return JSON.stringify(checks);\n });\n });\n\n extend(DiscussionPage.prototype, 'oncreate', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n // We will listen for updates to all polls and options\n // Even if that model is not in the current discussion, it doesn't really matter\n binding.channels.main.bind('updatedPollOptions', (data) => {\n const poll = app.store.getById('polls', data['pollId']);\n\n if (poll) {\n poll.pushAttributes({\n voteCount: data['pollVoteCount'],\n });\n\n // Not redrawing here, as the option below should trigger the redraw already\n }\n\n const changedOptions = data['options'];\n\n for (const optionId in changedOptions) {\n const option = app.store.getById('poll_options', optionId);\n\n if (option && option.voteCount() !== undefined) {\n option.pushAttributes({\n voteCount: changedOptions[optionId],\n });\n }\n }\n\n m.redraw();\n });\n });\n }\n });\n\n extend(DiscussionPage.prototype, 'onremove', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n binding.channels.main.unbind('updatedPollOptions');\n });\n }\n });\n};\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","CreatePollModal","oninit","vnode","this","options","Stream","optionImageUrls","question","endDate","publicPoll","hideVotes","allowMultipleVotes","maxVotes","datepickerMinDate","formatDate","undefined","poll","attrs","Array","isArray","forEach","option","push","answer","imageUrl","dayjs","isAfter","title","app","trans","className","content","fields","toArray","items","ItemList","add","type","name","bidi","Button","icon","onclick","addOption","displayOptions","min","max","class","isBefore","time","fromNow","Switch","state","onchange","disabled","length","loading","keys","map","el","i","placeholder","attribute","removeOption","Math","alert","extractText","splice","data","dateToTimestamp","index","onsubmit","e","preventDefault","promise","Promise","then","hide","err","console","error","loaded","close","date","def","dayjsDate","isValid","format","Modal","addToComposer","composer","addPoll","show","extend","discussion","body","canStartPoll","canStartPolls","classList","ListVotersModal","find","id","include","m","redraw","optionContent","opt","votes","filter","v","voteContent","vote","user","href","avatar","username","EditPollModal","optionAnswers","createRecord","attributes","save","onerror","PostPoll","loadingOptions","view","canSeeVoters","text","showVoters","canEdit","canDelete","deletePoll","viewOption","canVote","hasEnded","hasVoted","myVotes","totalVotes","voteCount","voted","some","percent","round","canSeeVoteCount","isDisabled","canChangeVote","width","Number","bar","changeVote","checked","style","src","alt","count","onremove","hideOptionTooltip","evt","LogInModal","target","optionIds","Set","isUnvoting","clear","method","url","from","res","pushPayload","post","confirm","sync","tooltipVisible","updateVisibility","Component","_extends","assign","arguments","source","apply","components","Poll","Model","apiEndpoint","exists","PollOption","PollVote","pollId","optionId","models","Extend","Post","hasMany","Forum","Discussion","createPoll","DiscussionList","params","badges","hasPoll","Badge","label","DiscussionComposer","ReplyComposer","CommentPost","isHidden","revealContent","polls","subtree","check","checks","JSON","stringify","DiscussionPage","binding","channels","main","getById","pushAttributes","changedOptions","unbind","relationships","rawRelationship","PostControls"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,sFCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,2B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,mC,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCOxD,MCPM,EAA+BF,OAAOC,KAAKC,OAAO,0B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,uC,aC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IAAAA,OAAWgD,MAAK,SAACwJ,GACfA,EAAQC,SAASC,KAAKI,OAAO,qBAC/B,GAEJ,IDrEMzB,EAAa,SAAC1B,GAAI,OACtB3J,IAAAA,MAAUiE,KAAK9F,EAAiB,CAC9BwE,SAAU,SAACH,GAAI,OACbxC,IAAAA,MACG2F,aAAa,SACbE,KAAK,MAECrD,EAAI,CACPuK,cAAe,CACbpD,KAAAA,KAGJ,CACEnH,KAAM,CACJmC,QAAS,oCAId3B,MAAK,SAAC5D,GAAS,MAGd,OAF6B,OAA7B,EAAAuK,EAAKqD,gBAAgB,WAAc,MAAnC,EAA+BtN,MAA/B,EAA+BA,KAAO,CAAEe,KAAM,QAASiE,GAAItF,EAAKsF,OAEzDtF,CACT,GAAE,GACN,GAEJ8E,EAAAA,EAAAA,QAAO+I,KAAc,sBAAsB,SAAU3M,EAAOqJ,IACrDA,EAAKoC,YAAcpC,EAAKtF,gBAC3B/D,EAAME,IACJ,UACA,EAAC,IAAM,CAACK,KAAK,cAAcC,QAASuK,EAAWzN,KAAKU,KAAMqL,IACvD3J,IAAAA,WAAeC,MAAM,mCAI9B,GD3BF,G","sources":["webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/webpack/runtime/compat get default export","webpack://@fof/polls/webpack/runtime/define property getters","webpack://@fof/polls/webpack/runtime/hasOwnProperty shorthand","webpack://@fof/polls/webpack/runtime/make namespace object","webpack://@fof/polls/external root \"flarum.core.compat['forum/app']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/extend']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Badge']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Discussion']\"","webpack://@fof/polls/./src/forum/addDiscussionBadge.js","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/classList']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionComposer']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/ReplyComposer']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Button']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Modal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Switch']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/ItemList']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/Stream']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@fof/polls/./src/forum/components/CreatePollModal.js","webpack://@fof/polls/./src/forum/addComposerItems.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/Component']\"","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/LogInModal']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/avatar']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/helpers/username']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Link']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/components/LoadingIndicator']\"","webpack://@fof/polls/./src/forum/components/ListVotersModal.js","webpack://@fof/polls/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@fof/polls/./src/forum/components/EditPollModal.js","webpack://@fof/polls/./src/forum/components/PostPoll.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/components/DiscussionPage']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/polls/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@fof/polls/./src/forum/components/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/Model']\"","webpack://@fof/polls/./src/forum/models/Poll.js","webpack://@fof/polls/./src/forum/models/PollOption.js","webpack://@fof/polls/./src/forum/models/PollVote.js","webpack://@fof/polls/./src/forum/models/index.js","webpack://@fof/polls/external root \"flarum.core.compat['common/extenders']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Post']\"","webpack://@fof/polls/external root \"flarum.core.compat['common/models/Forum']\"","webpack://@fof/polls/./src/forum/extend.js","webpack://@fof/polls/./src/forum/index.js","webpack://@fof/polls/./src/forum/addPostControls.js","webpack://@fof/polls/./src/forum/addPollsToPost.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Badge'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Discussion'];","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport Badge from 'flarum/common/components/Badge';\nimport DiscussionList from 'flarum/forum/components/DiscussionList';\nimport Discussion from 'flarum/common/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.hasPoll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fas fa-signal',\n }),\n 5\n );\n }\n });\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/classList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionComposer'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/ReplyComposer'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Modal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Switch'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/ItemList'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/Stream'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Modal from 'flarum/common/components/Modal';\nimport Switch from 'flarum/common/components/Switch';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\n\nexport default class CreatePollModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.options = [Stream(''), Stream('')];\n this.optionImageUrls = [Stream(''), Stream('')];\n\n this.question = Stream('');\n\n this.endDate = Stream();\n\n this.publicPoll = Stream(false);\n this.hideVotes = Stream(false);\n this.allowChangeVote = Stream(true);\n this.allowMultipleVotes = Stream(false);\n this.maxVotes = Stream(0);\n\n this.datepickerMinDate = this.formatDate(undefined);\n\n const { poll } = this.attrs;\n\n // When re-opening the modal for the same discussion composer where we already set poll attributes\n if (poll && Array.isArray(poll.options)) {\n this.options = [];\n this.optionImageUrls = [];\n poll.options.forEach((option) => {\n this.options.push(Stream(option.answer));\n this.optionImageUrls.push(Stream(option.imageUrl));\n });\n\n this.question(poll.question);\n this.publicPoll(poll.publicPoll);\n this.hideVotes(poll.hideVotes);\n this.allowChangeVote(poll.allowChangeVote);\n this.allowMultipleVotes(poll.allowMultipleVotes);\n this.maxVotes(poll.maxVotes || 0);\n\n this.endDate(this.formatDate(poll.endDate));\n\n // Replace minimum of 'today' for poll end date only if the poll is not already closed\n if (this.endDate() && dayjs(poll.endDate).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(poll.endDate);\n }\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--medium';\n }\n\n content() {\n return [\n
\n
{this.fields().toArray()}
\n
,\n ];\n }\n\n fields() {\n const items = new ItemList();\n\n items.add(\n 'question',\n
\n \n\n \n
,\n 100\n );\n\n items.add(\n 'answers',\n
\n \n\n {this.displayOptions()}\n
,\n 80\n );\n\n items.add(\n 'date',\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n onclick: this.endDate.bind(this, null),\n })}\n
\n\n {this.endDate() && (\n

\n \n  \n {dayjs(this.endDate()).isBefore(dayjs())\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.endDate()).fromNow() })}\n

\n )}\n
,\n 40\n );\n\n items.add(\n 'public',\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
,\n 20\n );\n\n items.add(\n 'hide-votes',\n
\n \n {app.translator.trans('fof-polls.forum.modal.hide_votes_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-change-vote',\n
\n \n {app.translator.trans('fof-polls.forum.modal.allow_change_vote_label')}\n \n
,\n 20\n );\n\n items.add(\n 'allow-multiple-votes',\n
\n {Switch.component(\n {\n state: this.allowMultipleVotes() || false,\n onchange: this.allowMultipleVotes,\n },\n app.translator.trans('fof-polls.forum.modal.allow_multiple_votes_label')\n )}\n
,\n 15\n );\n\n if (this.allowMultipleVotes()) {\n items.add(\n 'max-votes',\n
\n \n\n \n\n

{app.translator.trans('fof-polls.forum.modal.max_votes_help')}

\n
,\n 15\n );\n }\n\n items.add(\n 'submit',\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary PollModal-SubmitButton',\n loading: this.loading,\n },\n app.translator.trans('fof-polls.forum.modal.submit')\n )}\n
,\n -10\n );\n\n return items;\n }\n\n displayOptions() {\n return Object.keys(this.options).map((el, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(option) {\n this.options.splice(option, 1);\n this.optionImageUrls.splice(option, 1);\n }\n\n data() {\n const poll = {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowChangeVote: this.allowChangeVote(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options: [],\n };\n\n this.options.forEach((answer, index) => {\n if (answer()) {\n poll.options.push({\n answer: answer(),\n imageUrl: this.optionImageUrls[index](),\n });\n }\n });\n\n if (this.question() === '') {\n alert(app.translator.trans('fof-polls.forum.modal.include_question'));\n\n return null;\n }\n\n if (poll.options.length < 2) {\n alert(app.translator.trans('fof-polls.forum.modal.min'));\n\n return null;\n }\n\n return poll;\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n const data = this.data();\n\n if (data === null) {\n return;\n }\n\n const promise = this.attrs.onsubmit(data);\n\n if (promise instanceof Promise) {\n this.loading = true;\n\n promise.then(this.hide.bind(this), (err) => {\n console.error(err);\n this.onerror(err);\n this.loaded();\n });\n } else {\n app.modal.close();\n }\n }\n\n formatDate(date, def = false) {\n const dayjsDate = dayjs(date);\n\n if (date === false || !dayjsDate.isValid()) return def !== false ? this.formatDate(def) : null;\n\n return dayjsDate.format('YYYY-MM-DDTHH:mm');\n }\n\n dateToTimestamp(date) {\n const dayjsDate = dayjs(date);\n\n if (!date || !dayjsDate.isValid()) return false;\n\n return dayjsDate.format();\n }\n}\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport classList from 'flarum/common/utils/classList';\nimport DiscussionComposer from 'flarum/forum/components/DiscussionComposer';\nimport ReplyComposer from 'flarum/forum/components/ReplyComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport const addToComposer = (composer) => {\n composer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.composer.fields.poll,\n onsubmit: (poll) => (this.composer.fields.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(composer.prototype, 'headerItems', function (items) {\n const discussion = this.composer.body?.attrs?.discussion;\n const canStartPoll = discussion?.canStartPoll() ?? app.forum.canStartPolls();\n\n if (canStartPoll) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.composer.fields.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(composer.prototype, 'data', function (data) {\n if (this.composer.fields.poll) {\n data.poll = this.composer.fields.poll;\n }\n });\n};\n\nexport default () => {\n addToComposer(DiscussionComposer);\n addToComposer(ReplyComposer);\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Component'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/LogInModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/avatar'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/username'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Link'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LoadingIndicator'];","import app from 'flarum/forum/app';\n\nimport Modal from 'flarum/common/components/Modal';\nimport avatar from 'flarum/common/helpers/avatar';\nimport username from 'flarum/common/helpers/username';\nimport Link from 'flarum/common/components/Link';\nimport Stream from 'flarum/common/utils/Stream';\nimport LoadingIndicator from 'flarum/common/components/LoadingIndicator';\n\nexport default class ListVotersModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loading = Stream(true);\n\n app.store\n .find('fof/polls', this.attrs.poll.id(), {\n include: 'votes,votes.user,votes.option',\n })\n .then(() => this.loading(false))\n .finally(() => m.redraw());\n }\n\n className() {\n return 'Modal--medium VotesModal';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return
{this.loading() ? : this.attrs.poll.options().map(this.optionContent.bind(this))}
;\n }\n\n optionContent(opt) {\n const votes = (this.attrs.poll.votes() || []).filter((v) => opt.id() === v.option().id());\n\n return (\n
\n

{opt.answer() + ':'}

\n\n {votes.length ? (\n
{votes.map(this.voteContent.bind(this))}
\n ) : (\n

{app.translator.trans('fof-polls.forum.modal.no_voters')}

\n )}\n
\n );\n }\n\n voteContent(vote) {\n const user = vote.user();\n const attrs = user && { href: app.route.user(user) };\n\n return (\n \n {avatar(user)} {username(user)}\n \n );\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","import app from 'flarum/forum/app';\n\nimport Button from 'flarum/common/components/Button';\nimport Stream from 'flarum/common/utils/Stream';\nimport extractText from 'flarum/common/utils/extractText';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.poll = this.attrs.poll;\n\n this.options = this.poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.optionImageUrls = this.options.map((o) => Stream(o.imageUrl()));\n this.question = Stream(this.poll.question());\n this.endDate = Stream(this.formatDate(this.poll.endDate()));\n this.publicPoll = Stream(this.poll.publicPoll());\n this.allowMultipleVotes = Stream(this.poll.allowMultipleVotes());\n this.hideVotes = Stream(this.poll.hideVotes());\n this.allowChangeVote = Stream(this.poll.allowChangeVote());\n this.maxVotes = Stream(this.poll.maxVotes() || 0);\n\n if (this.endDate() && dayjs(this.poll.endDate()).isAfter(dayjs())) {\n this.datepickerMinDate = this.formatDate(this.endDate());\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n\n displayOptions() {\n return this.options.map((opt, i) => (\n
\n
\n \n {app.forum.attribute('allowPollOptionImage') ? (\n \n ) : null}\n
\n\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const max = Math.max(app.forum.attribute('pollMaxOptions'), 2);\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n this.optionImageUrls.push(Stream(''));\n } else {\n alert(extractText(app.translator.trans('fof-polls.forum.modal.max', { max })));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n this.optionImageUrls.splice(i, 1);\n }\n\n data() {\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n o.data.attributes.imageUrl = this.optionImageUrls[i]();\n\n return o.data;\n });\n\n return {\n question: this.question(),\n endDate: this.dateToTimestamp(this.endDate()),\n publicPoll: this.publicPoll(),\n hideVotes: this.hideVotes(),\n allowChangeVote: this.allowChangeVote(),\n allowMultipleVotes: this.allowMultipleVotes(),\n maxVotes: this.maxVotes(),\n options,\n };\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (this.loading) return;\n\n this.loading = true;\n\n return this.poll\n .save(this.data())\n .then(() => {\n this.hide();\n m.redraw();\n })\n .catch((e) => {\n this.loaded();\n this.onerror(e);\n });\n }\n}\n","import app from 'flarum/forum/app';\n\nimport Component from 'flarum/common/Component';\nimport Button from 'flarum/common/components/Button';\nimport LogInModal from 'flarum/forum/components/LogInModal';\nimport ListVotersModal from './ListVotersModal';\nimport classList from 'flarum/common/utils/classList';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport EditPollModal from './EditPollModal';\n\nexport default class PostPoll extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.loadingOptions = false;\n\n this.useSubmitUI = !this.attrs.poll?.canChangeVote() && this.attrs.poll?.allowMultipleVotes();\n this.pendingSubmit = false;\n this.pendingOptions = null;\n }\n\n oncreate(vnode) {\n super.oncreate(vnode);\n\n this.preventClose = this.preventClose.bind(this);\n window.addEventListener('beforeunload', this.preventClose);\n }\n\n onremove(vnode) {\n super.onremove(vnode);\n\n window.removeEventListener('beforeunload', this.preventClose);\n }\n\n view() {\n const poll = this.attrs.poll;\n const options = poll.options() || [];\n let maxVotes = poll.allowMultipleVotes() ? poll.maxVotes() : 1;\n\n if (maxVotes === 0) maxVotes = options.length;\n\n const infoItems = this.infoItems(maxVotes);\n\n return (\n
\n
\n

{poll.question()}

\n\n {poll.canSeeVoters() && (\n \n
\n\n
\n
{options.map(this.viewOption.bind(this))}
\n\n
\n {!infoItems.isEmpty() &&
{infoItems.toArray()}
}\n\n {this.useSubmitUI && this.pendingSubmit && (\n \n )}\n
\n
\n
\n );\n }\n\n infoItems(maxVotes) {\n const items = new ItemList();\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n\n if (app.session.user && !poll.canVote() && !poll.hasEnded()) {\n items.add(\n 'no-permission',\n \n \n {app.translator.trans('fof-polls.forum.no_permission')}\n \n );\n }\n\n if (poll.endDate()) {\n items.add(\n 'end-date',\n \n \n {poll.hasEnded()\n ? app.translator.trans('fof-polls.forum.poll_ended')\n : app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(poll.endDate()).fromNow() })}\n \n );\n }\n\n if (poll.canVote()) {\n items.add(\n 'max-votes',\n \n \n {app.translator.trans('fof-polls.forum.max_votes_allowed', { max: maxVotes })}\n \n );\n\n if (!poll.canChangeVote()) {\n items.add(\n 'cannot-change-vote',\n \n \n {app.translator.trans('fof-polls.forum.poll.cannot_change_vote')}\n \n );\n }\n }\n\n return items;\n }\n\n viewOption(opt) {\n const poll = this.attrs.poll;\n const hasVoted = poll.myVotes()?.length > 0;\n const totalVotes = poll.voteCount();\n\n const voted = this.pendingOptions ? this.pendingOptions.has(opt.id()) : poll.myVotes()?.some?.((vote) => vote.option() === opt);\n const votes = opt.voteCount();\n const percent = totalVotes > 0 ? Math.round((votes / totalVotes) * 100) : 0;\n\n // isNaN(null) is false, so we have to check type directly now that API always returns the field\n const canSeeVoteCount = typeof votes === 'number';\n const isDisabled = this.loadingOptions || (hasVoted && !poll.canChangeVote());\n const width = canSeeVoteCount ? percent : (Number(voted) / (poll.myVotes()?.length || 1)) * 100;\n\n const showCheckmark = !app.session.user || (!poll.hasEnded() && poll.canVote() && (!hasVoted || poll.canChangeVote()));\n\n const bar = (\n
\n {showCheckmark && (\n \n )}\n\n
\n \n {canSeeVoteCount && (\n \n )}\n
\n );\n\n return (\n \n {canSeeVoteCount ? (\n \n {bar}\n \n ) : (\n bar\n )}\n
\n );\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n const optionIds = this.pendingOptions || new Set(this.attrs.poll.myVotes().map?.((v) => v.option().id()));\n const isUnvoting = optionIds.delete(option.id());\n const allowsMultiple = this.attrs.poll.allowMultipleVotes();\n\n if (!allowsMultiple) {\n optionIds.clear();\n }\n\n if (!isUnvoting) {\n optionIds.add(option.id());\n }\n\n if (this.useSubmitUI) {\n this.pendingOptions = optionIds.size ? optionIds : null;\n this.pendingSubmit = !!this.pendingOptions;\n return;\n }\n\n return this.submit(optionIds, null, () => (evt.target.checked = isUnvoting));\n }\n\n onsubmit() {\n return this.submit(this.pendingOptions, () => {\n this.pendingOptions = null;\n this.pendingSubmit = false;\n });\n }\n\n submit(optionIds, cb, onerror) {\n this.loadingOptions = true;\n m.redraw();\n\n return app\n .request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.attrs.poll.id()}/votes`,\n body: {\n data: {\n optionIds: Array.from(optionIds),\n },\n },\n })\n .then((res) => {\n app.store.pushPayload(res);\n cb?.();\n })\n .catch((err) => {\n onerror?.(err);\n })\n .finally(() => {\n this.loadingOptions = false;\n\n m.redraw();\n });\n }\n\n showVoters() {\n // Load all the votes only when opening the votes list\n app.modal.show(ListVotersModal, {\n poll: this.attrs.poll,\n post: this.attrs.post,\n });\n }\n\n deletePoll() {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n this.attrs.poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n }\n\n /**\n * Attempting to use the `tooltipVisible` attr on the Tooltip component set to 'false' when no vote count\n * caused the tooltip to break on click. This is a workaround to hide the tooltip when no vote count is available,\n * called on 'onremove' of the Tooltip component. It doesn't always work as intended either, but it does the job.\n */\n hideOptionTooltip(vnode) {\n vnode.attrs.tooltipVisible = false;\n vnode.state.updateVisibility();\n }\n\n /**\n * Alert before navigating away using browser's 'beforeunload' event\n */\n preventClose(e) {\n if (this.pendingOptions) {\n e.preventDefault();\n return true;\n }\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/DiscussionPage'];","export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","import CreatePollModal from './CreatePollModal';\nimport PostPoll from './PostPoll';\nimport EditPollModal from './EditPollModal';\nimport ListVotersModal from './ListVotersModal';\n\nexport const components = {\n CreatePollModal,\n PostPoll,\n EditPollModal,\n ListVotersModal,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from 'flarum/common/Model';\n\nexport default class Poll extends Model {\n question = Model.attribute('question');\n hasEnded = Model.attribute('hasEnded');\n endDate = Model.attribute('endDate');\n\n publicPoll = Model.attribute('publicPoll');\n hideVotes = Model.attribute('hideVotes');\n allowChangeVote = Model.attribute('allowChangeVote');\n allowMultipleVotes = Model.attribute('allowMultipleVotes');\n maxVotes = Model.attribute('maxVotes');\n\n voteCount = Model.attribute('voteCount');\n\n canVote = Model.attribute('canVote');\n canEdit = Model.attribute('canEdit');\n canDelete = Model.attribute('canDelete');\n canSeeVoters = Model.attribute('canSeeVoters');\n canChangeVote = Model.attribute('canChangeVote');\n\n options = Model.hasMany('options');\n votes = Model.hasMany('votes');\n myVotes = Model.hasMany('myVotes');\n\n apiEndpoint() {\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollOption extends Model {\n answer = Model.attribute('answer');\n imageUrl = Model.attribute('imageUrl');\n voteCount = Model.attribute('voteCount');\n\n poll = Model.hasOne('polls');\n votes = Model.hasMany('votes');\n\n apiEndpoint() {\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/common/Model';\n\nexport default class PollVote extends Model {\n poll = Model.hasOne('poll');\n option = Model.hasOne('option');\n user = Model.hasOne('user');\n\n pollId = Model.attribute('pollId');\n optionId = Model.attribute('optionId');\n\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Poll from './Poll';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport const models = {\n Poll,\n PollOption,\n PollVote,\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Post'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/models/Forum'];","import Extend from 'flarum/common/extenders';\nimport Post from 'flarum/common/models/Post';\nimport Forum from 'flarum/common/models/Forum';\nimport Discussion from 'flarum/common/models/Discussion';\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\n\nexport default [\n new Extend.Store().add('polls', Poll).add('poll_options', PollOption).add('poll_votes', PollVote),\n\n new Extend.Model(Post).hasMany('polls').attribute('canStartPoll'),\n\n new Extend.Model(Forum).attribute('canStartPolls'),\n\n new Extend.Model(Discussion).attribute('hasPoll').attribute('canStartPoll'),\n];\n","import app from 'flarum/forum/app';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addComposerItems from './addComposerItems';\nimport addPollsToPost from './addPollsToPost';\nimport addPostControls from './addPostControls';\n\nexport * from './components';\nexport * from './models';\n\napp.initializers.add('fof/polls', () => {\n addDiscussionBadge();\n addComposerItems();\n addPollsToPost();\n addPostControls();\n});\n\nexport { default as extend } from './extend';\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CreatePollModal from './components/CreatePollModal';\nimport Button from 'flarum/common/components/Button';\n\nexport default () => {\n const createPoll = (post) =>\n app.modal.show(CreatePollModal, {\n onsubmit: (data) =>\n app.store\n .createRecord('polls')\n .save(\n {\n ...data,\n relationships: {\n post,\n },\n },\n {\n data: {\n include: 'options,myVotes,myVotes.option',\n },\n }\n )\n .then((poll) => {\n post.rawRelationship('polls')?.push?.({ type: 'polls', id: poll.id() });\n\n return poll;\n }),\n });\n\n extend(PostControls, 'moderationControls', function (items, post) {\n if (!post.isHidden() && post.canStartPoll()) {\n items.add(\n 'addPoll',\n \n );\n }\n });\n};\n","import app from 'flarum/forum/app';\n\nimport { extend } from 'flarum/common/extend';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport PostPoll from './components/PostPoll';\nimport DiscussionPage from 'flarum/forum/components/DiscussionPage';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const post = this.attrs.post;\n\n if ((!post.isHidden() || this.revealContent) && post.polls()) {\n for (const poll of post.polls()) {\n if (poll) {\n content.push();\n }\n }\n }\n });\n\n extend(CommentPost.prototype, 'oninit', function () {\n this.subtree.check(() => {\n const polls = this.attrs.post.polls();\n\n const checks = polls?.map?.(\n (poll) =>\n poll && [\n poll.data?.attributes,\n poll.options().map?.((option) => option?.data?.attributes),\n poll.myVotes().map?.((vote) => vote.option()?.id()),\n ]\n );\n\n return JSON.stringify(checks);\n });\n });\n\n extend(DiscussionPage.prototype, 'oncreate', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n // We will listen for updates to all polls and options\n // Even if that model is not in the current discussion, it doesn't really matter\n binding.channels.main.bind('updatedPollOptions', (data) => {\n const poll = app.store.getById('polls', data['pollId']);\n\n if (poll) {\n poll.pushAttributes({\n voteCount: data['pollVoteCount'],\n });\n\n // Not redrawing here, as the option below should trigger the redraw already\n }\n\n const changedOptions = data['options'];\n\n for (const optionId in changedOptions) {\n const option = app.store.getById('poll_options', optionId);\n\n if (option && option.voteCount() !== undefined) {\n option.pushAttributes({\n voteCount: changedOptions[optionId],\n });\n }\n }\n\n m.redraw();\n });\n });\n }\n });\n\n extend(DiscussionPage.prototype, 'onremove', function () {\n if (app.pusher) {\n app.pusher.then((binding) => {\n binding.channels.main.unbind('updatedPollOptions');\n });\n }\n });\n};\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","CreatePollModal","oninit","vnode","this","options","Stream","optionImageUrls","question","endDate","publicPoll","hideVotes","allowChangeVote","allowMultipleVotes","maxVotes","datepickerMinDate","formatDate","undefined","poll","attrs","Array","isArray","forEach","option","push","answer","imageUrl","dayjs","isAfter","title","app","trans","className","content","fields","toArray","items","ItemList","add","type","name","bidi","Button","icon","onclick","addOption","displayOptions","min","max","class","isBefore","time","fromNow","Switch","state","onchange","disabled","length","loading","keys","map","el","i","placeholder","attribute","removeOption","Math","alert","extractText","splice","data","dateToTimestamp","index","onsubmit","e","preventDefault","promise","Promise","then","hide","err","console","error","onerror","loaded","close","date","def","dayjsDate","isValid","format","Modal","addToComposer","composer","addPoll","show","extend","discussion","body","canStartPoll","canStartPolls","classList","ListVotersModal","find","id","include","m","redraw","optionContent","opt","votes","filter","v","voteContent","vote","user","href","avatar","username","EditPollModal","optionAnswers","createRecord","attributes","save","PostPoll","loadingOptions","useSubmitUI","canChangeVote","pendingSubmit","pendingOptions","oncreate","preventClose","window","addEventListener","onremove","removeEventListener","view","infoItems","canSeeVoters","text","showVoters","canEdit","canDelete","deletePoll","viewOption","isEmpty","hasVoted","myVotes","canVote","hasEnded","totalVotes","voteCount","voted","has","some","percent","round","canSeeVoteCount","isDisabled","width","Number","showCheckmark","bar","changeVote","checked","style","src","alt","count","hideOptionTooltip","evt","LogInModal","target","optionIds","Set","isUnvoting","clear","size","submit","cb","method","url","from","res","pushPayload","post","confirm","sync","tooltipVisible","updateVisibility","Component","_extends","assign","arguments","source","apply","components","Poll","Model","apiEndpoint","exists","PollOption","PollVote","pollId","optionId","models","Extend","Post","hasMany","Forum","Discussion","createPoll","DiscussionList","params","badges","hasPoll","Badge","label","DiscussionComposer","ReplyComposer","CommentPost","isHidden","revealContent","polls","subtree","check","checks","JSON","stringify","DiscussionPage","binding","channels","main","getById","pushAttributes","changedOptions","unbind","relationships","rawRelationship","PostControls"],"sourceRoot":""} \ No newline at end of file