define("discourse/plugins/discourse-topic-voting/discourse/feature-voting-route-map",["exports"],(function(t){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default={resource:"user",path:"users/:username",map(){this.route("userActivity",{path:"activity",resetNamespace:!0},(function(){this.route("votes")}))}}})),define("discourse/plugins/discourse-topic-voting/discourse/initializers/discourse-topic-voting",["exports","discourse/lib/plugin-api","discourse/models/nav-item","I18n"],(function(t,e,o,i){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default={name:"discourse-topic-voting",initialize(){(0,e.withPluginApi)("0.8.32",(t=>{if(t.container.lookup("service:site-settings").topic_voting_enabled){t.container.lookup("controller:full-page-search").sortOrders.pushObject({name:i.default.t("search.most_votes"),id:5,term:"order:votes"}),t.addNavigationBarItem({name:"votes",before:"top",customFilter:t=>t&&t.can_vote,customHref:(t,e)=>`${o.default.pathFor("latest",e)}?order=votes`,forceActive:(t,e,o)=>{const i=o.currentRoute.queryParams
return i&&1===Object.keys(i).length&&"votes"===i.order}}),t.addNavigationBarItem({name:"my_votes",before:"top",customFilter:e=>e&&e.can_vote&&t.getCurrentUser(),customHref:(t,e)=>`${o.default.pathFor("latest",e)}?state=my_votes`,forceActive:(t,e,o)=>{const i=o.currentRoute.queryParams
return i&&1===Object.keys(i).length&&"my_votes"===i.state}})}})),(0,e.withPluginApi)("0.11.7",(t=>{t.container.lookup("service:site-settings").topic_voting_enabled&&t.addSearchSuggestion("order:votes")}))}}})),define("discourse/plugins/discourse-topic-voting/discourse/pre-initializers/extend-category-for-voting",["exports","discourse/lib/plugin-api","I18n"],(function(t,e,o){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default={name:"extend-category-for-voting",before:"inject-discourse-objects",initialize(){(0,e.withPluginApi)("0.8.4",(t=>function(t){t.addPostClassesCallback((t=>{if(1===t.post_number&&t.can_vote)return["voting-post"]})),t.includePostAttributes("can_vote"),t.addTagsHtmlCallback((t=>{if(!t.can_vote)return
let e=[],i=""
t.user_voted&&(i=` title='${o.default.t("topic_voting.voted")}'`)
let s=t.user_voted?" voted":""
return e.push(``),e.push(o.default.t("topic_voting.votes",{count:t.vote_count})),e.push(""),e.length>0?e.join(""):void 0}),{priority:-100})}(t))),(0,e.withPluginApi)("0.8.30",(t=>t.addCategorySortCriteria("votes")))}}})),define("discourse/plugins/discourse-topic-voting/discourse/pre-initializers/transformers",["exports","discourse/lib/plugin-api"],(function(t,e){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default={name:"discourse-topic-voting-transformers",before:"freeze-valid-transformers",initialize(){(0,e.withPluginApi)("1.35.0",(t=>{t.addBehaviorTransformerName("topic-vote-button-click")}))}}})),define("discourse/plugins/discourse-topic-voting/discourse/routes/user-activity-votes",["exports","discourse/models/user-action","discourse/routes/user-topic-list","I18n"],(function(t,e,o,i){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
class s extends o.default{userActionType=(()=>e.default.TYPES.topics)()
model(){return this.store.findFiltered("topicList",{filter:"topics/voted-by/"+this.modelFor("user").get("username_lower")}).then((t=>(t.set("emptyState",this.emptyState()),t)))}emptyState(){const t=this.modelFor("user")
return{title:this.isCurrentUser(t)?i.default.t("topic_voting.no_votes_title_self"):i.default.t("topic_voting.no_votes_title_others",{username:t.username}),body:""}}}t.default=s})),define("discourse/plugins/discourse-topic-voting/discourse/templates/connectors/category-custom-settings/feature-voting-settings",["exports","@ember/template-factory"],(function(t,e){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,e.createTemplateFactory)({id:"iTtA3x+r",block:'[[[10,"h3"],[12],[1,[28,[35,1],["topic_voting.title"],null]],[13],[1,"\\n"],[10,"section"],[14,0,"field"],[12],[1,"\\n "],[10,0],[14,0,"enable-topic-voting"],[12],[1,"\\n "],[10,"label"],[14,0,"checkbox-label"],[12],[1,"\\n "],[8,[39,5],null,[["@type","@checked"],["checkbox",[30,0,["category","custom_fields","enable_topic_voting"]]]],null],[1,"\\n "],[1,[28,[35,1],["topic_voting.allow_topic_voting"],null]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],[],false,["h3","i18n","section","div","label","input"]]',moduleName:"discourse/plugins/discourse-topic-voting/discourse/templates/connectors/category-custom-settings/feature-voting-settings.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-topic-voting/discourse/templates/connectors/topic-above-post-stream/topic-title-voting",["exports","@ember/template-factory"],(function(t,e){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,e.createTemplateFactory)({id:"jKEO7jg0",block:'[[[41,[30,0,["model","can_vote"]],[[[41,[30,0,["model","postStream","loaded"]],[[[41,[30,0,["model","postStream","firstPostPresent"]],[[[1," "],[10,0],[14,0,"voting title-voting"],[12],[1,"\\n"],[1," "],[8,[39,2],null,[["@widget","@args","@showLogin"],["vote-box",[30,0,["model"]],[28,[37,3],["showLogin"],null]]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[]],null]],[]],null]],[],false,["if","div","mount-widget","route-action"]]',moduleName:"discourse/plugins/discourse-topic-voting/discourse/templates/connectors/topic-above-post-stream/topic-title-voting.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-topic-voting/discourse/templates/connectors/user-activity-bottom/user-voted-topics",["exports","@ember/template-factory"],(function(t,e){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,e.createTemplateFactory)({id:"XjZhW1Bp",block:'[[[41,[30,0,["siteSettings","topic_voting_show_votes_on_profile"]],[[[1," "],[8,[39,1],null,[["@route"],["userActivity.votes"]],[["default"],[[[[1,"\\n "],[1,[28,[35,2],["heart"],null]],[1,"\\n "],[1,[28,[35,3],["topic_voting.vote_title_plural"],null]],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],[],false,["if","link-to","d-icon","i18n"]]',moduleName:"discourse/plugins/discourse-topic-voting/discourse/templates/connectors/user-activity-bottom/user-voted-topics.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-topic-voting/discourse/widgets/remove-vote",["exports","discourse/widgets/widget","discourse-common/lib/icon-library","I18n"],(function(t,e,o,i){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,e.createWidget)("remove-vote",{tagName:"div.remove-vote",buildClasses:()=>"vote-option",html:()=>[(0,o.iconNode)("xmark"),i.default.t("topic_voting.remove_vote")],click(){this.sendWidgetAction("removeVote")}})})),define("discourse/plugins/discourse-topic-voting/discourse/widgets/vote-box",["exports","discourse/lib/ajax","discourse/lib/ajax-error","discourse/widgets/raw-html","discourse/widgets/widget","I18n"],(function(t,e,o,i,s,r){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,s.createWidget)("vote-box",{tagName:"div.voting-wrapper",buildKey:()=>"vote-box",buildClasses(){if(this.siteSettings.topic_voting_show_who_voted)return"show-pointer"},defaultState:()=>({allowClick:!0,initialVote:!1}),html(t,e){let o=[this.attach("vote-count",t),this.attach("vote-button",t),this.attach("vote-options",t)]
if(e.votesAlert>0){const t=""
o.push(new i.default({html:t}))}return o},hideVotesAlert(){this.state.votesAlert&&(this.state.votesAlert=null,this.scheduleRerender())},click(){this.hideVotesAlert()},clickOutside(){this.hideVotesAlert()},addVote(){let t=this.attrs,i=this.state
return(0,e.ajax)("/voting/vote",{type:"POST",data:{topic_id:t.id}}).then((e=>{t.set("vote_count",e.vote_count),t.set("user_voted",!0),this.currentUser.setProperties({votes_exceeded:!e.can_vote,votes_left:e.votes_left}),e.alert&&(i.votesAlert=e.votes_left),t.set("who_voted",e.who_voted),i.allowClick=!0,this.scheduleRerender()})).catch(o.popupAjaxError)},removeVote(){let t=this.attrs,i=this.state
return(0,e.ajax)("/voting/unvote",{type:"POST",data:{topic_id:t.id}}).then((e=>{t.set("vote_count",e.vote_count),t.set("user_voted",!1),this.currentUser.setProperties({votes_exceeded:!e.can_vote,votes_left:e.votes_left}),t.set("who_voted",e.who_voted),i.allowClick=!0,this.scheduleRerender()})).catch(o.popupAjaxError)}})})),define("discourse/plugins/discourse-topic-voting/discourse/widgets/vote-button",["exports","virtual-dom","discourse/lib/cookie","discourse/lib/transformer","discourse/widgets/widget","I18n"],(function(t,e,o,i,s,r){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,s.createWidget)("vote-button",{tagName:"div",buildClasses(t){let e=""
return e=t.closed?"voting-closed":t.user_voted?this.currentUser&&this.currentUser.votes_exceeded?"vote-limited nonvote":"vote":"nonvote",this.siteSettings.topic_voting_show_who_voted&&(e+=" show-pointer"),e},buildButtonTitle(t){return this.currentUser?t.closed?r.default.t("topic_voting.voting_closed_title"):t.user_voted?r.default.t("topic_voting.voted_title"):this.currentUser.votes_exceeded?r.default.t("topic_voting.voting_limit"):r.default.t("topic_voting.vote_title"):t.vote_count?r.default.t("topic_voting.anonymous_button",{count:t.vote_count}):r.default.t("topic_voting.anonymous_button",{count:1})},html(t){return(0,e.h)("button",{attributes:{title:this.currentUser?r.default.t("topic_voting.votes_left_button_title",{count:this.currentUser.votes_left}):""},className:"btn btn-primary vote-button"},this.buildButtonTitle(t))},click(){(0,i.applyBehaviorTransformer)("topic-vote-button-click",(()=>{if(!this.currentUser)return this.sendWidgetAction("showLogin"),void(0,o.default)("destination_url",window.location.href,{path:"/"})
this.attrs.closed||!this.parentWidget.state.allowClick||this.attrs.user_voted||this.currentUser.votes_exceeded||(this.parentWidget.state.allowClick=!1,this.parentWidget.state.initialVote=!0,this.sendWidgetAction("addVote")),(this.attrs.user_voted||this.currentUser.votes_exceeded)&&document.querySelector(".vote-options").classList.toggle("hidden")}))},clickOutside(){document.querySelector(".vote-options").classList.add("hidden"),this.parentWidget.state.initialVote=!1}})})),define("discourse/plugins/discourse-topic-voting/discourse/widgets/vote-count",["exports","virtual-dom","discourse/lib/ajax","discourse/lib/cookie","discourse/widgets/widget","discourse-common/lib/get-url"],(function(t,e,o,i,s,r){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,s.createWidget)("vote-count",{tagName:"div.vote-count-wrapper",buildKey:()=>"vote-count",buildClasses(){if(0===this.attrs.vote_count)return"no-votes"},defaultState:()=>({whoVotedUsers:null}),html(t){let o=(0,e.h)("div.vote-count",t.vote_count.toString()),i=null
this.siteSettings.topic_voting_show_who_voted&&this.state.whoVotedUsers&&this.state.whoVotedUsers.length>0&&(i=this.attach("small-user-list",{users:this.state.whoVotedUsers,addSelf:t.liked,listClassName:"regular-votes"}))
let s=[o]
return i&&s.push((0,e.h)("div.who-voted.popup-menu.voting-popup-menu",[i])),s},click(){if(!this.currentUser)return this.sendWidgetAction("showLogin"),void(0,i.default)("destination_url",window.location.href,{path:"/"})
if(this.siteSettings.topic_voting_show_who_voted&&this.attrs.vote_count>0){if(null===this.state.whoVotedUsers)return this.getWhoVoted()
{const t=document.querySelector(".who-voted")
t.style.display="none"===t.style.display?"block":"none"}}},clickOutside(){const t=document.querySelector(".who-voted")
t&&(t.style.display="none")},getWhoVoted(){return(0,o.ajax)("/voting/who",{type:"GET",data:{topic_id:this.attrs.id}}).then((t=>{this.state.whoVotedUsers=t.map(n)}))}})
function n(t){return{template:t.avatar_template,username:t.username,post_url:t.post_url,url:(0,r.default)("/u/")+t.username.toLowerCase()}}})),define("discourse/plugins/discourse-topic-voting/discourse/widgets/vote-options",["exports","virtual-dom","discourse/widgets/widget","I18n"],(function(t,e,o,i){"use strict"
Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0
t.default=(0,o.createWidget)("vote-options",{tagName:"div.vote-options",buildClasses:()=>"voting-popup-menu popup-menu hidden",html(t){let o=[]
return t.user_voted?o.push(this.attach("remove-vote",t)):this.currentUser&&this.currentUser.votes_exceeded&&!t.user_voted&&o.push([(0,e.h)("div",i.default.t("topic_voting.reached_limit")),(0,e.h)("p",(0,e.h)("a",{href:this.currentUser.get("path")+"/activity/votes"},i.default.t("topic_voting.list_votes")))]),o}})}))
//# sourceMappingURL=discourse-voting-000310332193801e85216883a39656b4f8562b7088f2d969caa37d5a52c94b56.map
//!
;
Flash Sale Popup