diff --git a/js/dist/admin.js b/js/dist/admin.js index 902e348e..8881cba0 100644 --- a/js/dist/admin.js +++ b/js/dist/admin.js @@ -1,2 +1,2 @@ -(()=>{var s={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return s.d(o,{a:o}),o},d:(e,o)=>{for(var i in o)s.o(o,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:o[i]})},o:(s,e)=>Object.prototype.hasOwnProperty.call(s,e),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},e={};(()=>{"use strict";s.r(e);const o=flarum.core.compat["admin/app"];var i=s.n(o);i().initializers.add("fof/polls",(function(){i().extensionData.for("fof-polls").registerSetting({setting:"fof-polls.allowOptionImage",type:"switch",label:i().translator.trans("fof-polls.admin.settings.allow_option_image")}).registerSetting({setting:"fof-polls.maxOptions",type:"number",label:i().translator.trans("fof-polls.admin.settings.max_options"),min:2}).registerPermission({icon:"fas fa-signal",label:i().translator.trans("fof-polls.admin.permissions.view_results_without_voting"),permission:"discussion.polls.viewResultsWithoutVoting",allowGuest:!0},"view").registerPermission({icon:"fas fa-signal",label:i().translator.trans("fof-polls.admin.permissions.start"),permission:"discussion.polls.start"},"start").registerPermission({icon:"fas fa-pencil-alt",label:i().translator.trans("fof-polls.admin.permissions.self_edit"),permission:"polls.selfEdit"},"start").registerPermission({icon:"fas fa-pencil-alt",label:i().translator.trans("fof-polls.admin.permissions.self_post_edit"),permission:"polls.selfPostEdit"},"start").registerPermission({icon:"fas fa-signal",label:i().translator.trans("fof-polls.admin.permissions.vote"),permission:"discussion.polls.vote"},"reply").registerPermission({icon:"fas fa-signal",label:i().translator.trans("fof-polls.admin.permissions.change_vote"),permission:"polls.changeVote"},"reply").registerPermission({icon:"fas fa-pencil-alt",label:i().translator.trans("fof-polls.admin.permissions.moderate"),permission:"discussion.polls.moderate"},"moderate")}))})(),module.exports=e})(); +(()=>{var s={n:o=>{var e=o&&o.__esModule?()=>o.default:()=>o;return s.d(e,{a:e}),e},d:(o,e)=>{for(var t in e)s.o(e,t)&&!s.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},o:(s,o)=>Object.prototype.hasOwnProperty.call(s,o),r:s=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})}},o={};(()=>{"use strict";s.r(o);const e=flarum.core.compat["admin/app"];var t=s.n(e);t().initializers.add("fof/polls",(function(){t().extensionData.for("fof-polls").registerSetting({setting:"fof-polls.allowOptionImage",type:"switch",label:t().translator.trans("fof-polls.admin.settings.allow_option_image")}).registerSetting({setting:"fof-polls.optionsColorBlend",type:"switch",label:t().translator.trans("fof-polls.admin.settings.options_color_blend"),help:t().translator.trans("fof-polls.admin.settings.options_color_blend_help")}).registerSetting({setting:"fof-polls.maxOptions",type:"number",label:t().translator.trans("fof-polls.admin.settings.max_options"),min:2}).registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.view_results_without_voting"),permission:"discussion.polls.viewResultsWithoutVoting",allowGuest:!0},"view").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.start"),permission:"discussion.polls.start"},"start").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.self_edit"),permission:"polls.selfEdit"},"start").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.self_post_edit"),permission:"polls.selfPostEdit"},"start").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.vote"),permission:"discussion.polls.vote"},"reply").registerPermission({icon:"fas fa-signal",label:t().translator.trans("fof-polls.admin.permissions.change_vote"),permission:"polls.changeVote"},"reply").registerPermission({icon:"fas fa-pencil-alt",label:t().translator.trans("fof-polls.admin.permissions.moderate"),permission:"discussion.polls.moderate"},"moderate")}))})(),module.exports=o})(); //# sourceMappingURL=admin.js.map \ No newline at end of file diff --git a/js/dist/admin.js.map b/js/dist/admin.js.map index 4d4f8c6e..ed33b1bb 100644 --- a/js/dist/admin.js.map +++ b/js/dist/admin.js.map @@ -1 +1 @@ -{"version":3,"file":"admin.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,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAiBC,IAAI,aAAa,WAChCD,IAAAA,cAAiB,IACV,aACJE,gBAAgB,CACfC,QAAS,6BACTC,KAAM,SACNC,MAAOL,IAAAA,WAAeM,MAAM,iDAE7BJ,gBAAgB,CACfC,QAAS,uBACTC,KAAM,SACNC,MAAOL,IAAAA,WAAeM,MAAM,wCAC5BC,IAAK,IAENC,mBACC,CACEC,KAAM,gBACNJ,MAAOL,IAAAA,WAAeM,MAAM,2DAC5BI,WAAY,4CACZC,YAAY,GAEd,QAEDH,mBACC,CACEC,KAAM,gBACNJ,MAAOL,IAAAA,WAAeM,MAAM,qCAC5BI,WAAY,0BAEd,SAEDF,mBACC,CACEC,KAAM,oBACNJ,MAAOL,IAAAA,WAAeM,MAAM,yCAC5BI,WAAY,kBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNJ,MAAOL,IAAAA,WAAeM,MAAM,8CAC5BI,WAAY,sBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNJ,MAAOL,IAAAA,WAAeM,MAAM,oCAC5BI,WAAY,yBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNJ,MAAOL,IAAAA,WAAeM,MAAM,2CAC5BI,WAAY,oBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNJ,MAAOL,IAAAA,WAAeM,MAAM,wCAC5BI,WAAY,6BAEd,WAEN,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['admin/app']\"","webpack://@fof/polls/./src/admin/index.ts"],"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['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('fof/polls', () => {\n app.extensionData\n .for('fof-polls')\n .registerSetting({\n setting: 'fof-polls.allowOptionImage',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.allow_option_image'),\n })\n .registerSetting({\n setting: 'fof-polls.maxOptions',\n type: 'number',\n label: app.translator.trans('fof-polls.admin.settings.max_options'),\n min: 2,\n })\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.view_results_without_voting'),\n permission: 'discussion.polls.viewResultsWithoutVoting',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.start'),\n permission: 'discussion.polls.start',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_edit'),\n permission: 'polls.selfEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_post_edit'),\n permission: 'polls.selfPostEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.vote'),\n permission: 'discussion.polls.vote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.change_vote'),\n permission: 'polls.changeVote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.moderate'),\n permission: 'discussion.polls.moderate',\n },\n 'moderate'\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","app","add","registerSetting","setting","type","label","trans","min","registerPermission","icon","permission","allowGuest"],"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OL,IAAAA,WAAeM,MAAM,yCAC5BK,WAAY,kBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNL,MAAOL,IAAAA,WAAeM,MAAM,8CAC5BK,WAAY,sBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,oCAC5BK,WAAY,yBAEd,SAEDF,mBACC,CACEC,KAAM,gBACNL,MAAOL,IAAAA,WAAeM,MAAM,2CAC5BK,WAAY,oBAEd,SAEDF,mBACC,CACEC,KAAM,oBACNL,MAAOL,IAAAA,WAAeM,MAAM,wCAC5BK,WAAY,6BAEd,WAEN,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['admin/app']\"","webpack://@fof/polls/./src/admin/index.ts"],"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['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('fof/polls', () => {\n app.extensionData\n .for('fof-polls')\n .registerSetting({\n setting: 'fof-polls.allowOptionImage',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.allow_option_image'),\n })\n .registerSetting({\n setting: 'fof-polls.optionsColorBlend',\n type: 'switch',\n label: app.translator.trans('fof-polls.admin.settings.options_color_blend'),\n help: app.translator.trans('fof-polls.admin.settings.options_color_blend_help'),\n })\n .registerSetting({\n setting: 'fof-polls.maxOptions',\n type: 'number',\n label: app.translator.trans('fof-polls.admin.settings.max_options'),\n min: 2,\n })\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.view_results_without_voting'),\n permission: 'discussion.polls.viewResultsWithoutVoting',\n allowGuest: true,\n },\n 'view'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.start'),\n permission: 'discussion.polls.start',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_edit'),\n permission: 'polls.selfEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.self_post_edit'),\n permission: 'polls.selfPostEdit',\n },\n 'start'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.vote'),\n permission: 'discussion.polls.vote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-signal',\n label: app.translator.trans('fof-polls.admin.permissions.change_vote'),\n permission: 'polls.changeVote',\n },\n 'reply'\n )\n .registerPermission(\n {\n icon: 'fas fa-pencil-alt',\n label: app.translator.trans('fof-polls.admin.permissions.moderate'),\n permission: 'discussion.polls.moderate',\n },\n 'moderate'\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","app","add","registerSetting","setting","type","label","trans","help","min","registerPermission","icon","permission","allowGuest"],"sourceRoot":""} \ No newline at end of file diff --git a/js/dist/forum.js b/js/dist/forum.js index 99afc8eb..3542e39f 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:()=>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})(); +(()=>{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:()=>it,extend:()=>wt,models:()=>dt});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 x=t.n(P);const N=flarum.core.compat["common/components/Switch"];var M=t.n(N);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,style:"--poll-option-width: "+f+"%"},v&&m("label",{className:"PollAnswer-checkbox checkbox"},m("input",{onchange:this.changeVote.bind(this,t),type:"checkbox",checked:r,disabled:h}),m("span",{className:"checkmark"})),m("div",{className:"PollAnswer-text"},m("span",{className:"PollAnswer-text-answer"},t.answer()),r&&!v&&X()("fas fa-check-circle",{className:"PollAnswer-check"}),c&&m("span",{className:d()("PollPercent",100!==u&&"PollPercent--option")},u,"%")),t.imageUrl()?m("img",{className:"PollAnswer-image",src:t.imageUrl(),alt:t.answer()}):null);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 ot=flarum.core.compat["forum/components/DiscussionPage"];var nt=t.n(ot);function et(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(tt,{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)(nt().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)(nt().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(at({},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)(st(),"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 55b88a63..7309085c 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,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,Q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,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 +{"version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AK,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/external root \"flarum.core.compat['common/helpers/icon']\"","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'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/helpers/icon'];","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 icon from 'flarum/common/helpers/icon';\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 {opt.answer()}\n {voted && !showCheckmark && icon('fas fa-check-circle', { className: 'PollAnswer-check' })}\n {canSeeVoteCount && {percent}%}\n
\n\n {opt.imageUrl() ? {opt.answer()} : null}\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","style","changeVote","checked","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