define("discourse/plugins/discourse-reactions/discourse/adapters/discourse-reactions-adapter",["exports","discourse/adapters/rest"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class s extends t.default{basePath(){return"/discourse-reactions/"}}e.default=s})),define("discourse/plugins/discourse-reactions/discourse/adapters/discourse-reactions-custom-reaction",["exports","discourse/plugins/discourse-reactions/discourse/adapters/discourse-reactions-adapter"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class s extends t.default{pathFor(e,t,s){const i=this.basePath(e,t,s)+e.pluralize(this.apiNameFor(t))
return this.appendQueryParams(i,s)}apiNameFor(){return"custom-reaction"}}e.default=s})),define("discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-button",["exports","@ember/helper","discourse/components/mount-widget","@ember/component","@ember/template-factory","@ember/component/template-only"],(function(e,t,s,i,o,r){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
const n=(0,i.setComponentTemplate)((0,o.createTemplateFactory)({id:"L0ZVm9QZ",block:'[[[1,"\\n"],[1," "],[8,[32,0],[[24,0,"discourse-reactions-actions-button-shim"]],[["@widget","@args"],["discourse-reactions-actions",[28,[32,1],null,[["post","showLogin"],[[30,1],[30,2,["showLogin"]]]]]]],null],[1,"\\n"]],["@post","@buttonActions"],false,[]]',moduleName:"/var/www/discourse/app/assets/javascripts/discourse/discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-button.js",scope:()=>[s.default,t.hash],isStrictMode:!0}),(0,r.default)(void 0,"discourse-reactions-actions-button:ReactionsActionButton"))
e.default=n})),define("discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-summary",["exports","@glimmer/component","@ember/helper","discourse/components/mount-widget","@ember/component","@ember/template-factory"],(function(e,t,s,i,o,r){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class n extends t.default{static extraControls=!0
static shouldRender(e,t,s){if(s.lookup("service:site").mobileView||e.post.deleted)return!1
const i=s.lookup("service:site-settings").discourse_reactions_reaction_for_like
return!(e.post.reactions&&1===e.post.reactions.length&&e.post.reactions[0].id===i)}static#e=(()=>(0,o.setComponentTemplate)((0,r.createTemplateFactory)({id:"twcpD1kO",block:'[[[1,"\\n"],[41,[30,1],[[[1," "],[8,[32,0],null,[["@widget","@args"],["discourse-reactions-actions",[28,[32,1],null,[["post","position"],[[30,2],"left"]]]]],null],[1,"\\n"]],[]],null],[1," "]],["@shouldRender","@post"],false,["if"]]',moduleName:"/var/www/discourse/app/assets/javascripts/discourse/discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-summary.js",scope:()=>[i.default,s.hash],isStrictMode:!0}),this))()}e.default=n})),define("discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-reaction-post",["exports","@ember/component","@glimmer/component","@ember/object/computed","@ember/service","discourse/lib/text","discourse-common/lib/get-url","@ember/template-factory"],(function(e,t,s,i,o,r,n,c){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
const a=(0,c.createTemplateFactory)({id:"c8HGjxb8",block:'[[[8,[39,0],null,[["@item"],[[28,[37,1],null,[["username","name","avatar_template","created_at","postUrl","category","title","expandedExcerpt","excerpt","topic_id","post_id","user_id"],[[30,1,["post_user","username"]],[30,1,["post_user","name"]],[30,1,["post_user","avatar_template"]],[30,1,["created_at"]],[30,0,["postUrl"]],[30,1,["category"]],[30,1,["topic","title"]],[30,1,["post","expandedExcerpt"]],[30,1,["post","excerpt"]],[30,1,["topic_id"]],[30,1,["post_id"]],[30,1,["user_id"]]]]]]],[["bottom"],[[[[1,"\\n"],[41,[30,1,["reaction","reaction_users_count"]],[[[1," "],[10,0],[14,0,"discourse-reactions-my-reaction"],[12],[1,"\\n "],[10,"img"],[15,"src",[30,0,["emojiUrl"]]],[14,0,"reaction-emoji"],[12],[13],[1,"\\n "],[10,3],[15,6,[30,1,["user","userUrl"]]],[15,"data-user-card",[30,1,["user","username"]]],[14,0,"avatar-link"],[12],[1,"\\n "],[1,[28,[35,7],[[30,1,["user"]]],[["imageSize","extraClasses","ignoreTitle"],["tiny","actor","true"]]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "]],[]]]]]],["@reaction"],false,["user-stream-item","hash",":bottom","if","div","img","a","avatar"]]',moduleName:"discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-reaction-post.hbs",isStrictMode:!1})
class u extends s.default{static#e=(()=>dt7948.g(this.prototype,"site",[o.service]))()
#t=(()=>{dt7948.i(this,"site")})()
static#s=(()=>dt7948.g(this.prototype,"moderatorAction",[(0,i.equal)("args.reaction.post.post_type","site.post_types.moderator_action")]))()
#i=(()=>{dt7948.i(this,"moderatorAction")})()
get postUrl(){return(0,n.default)(this.args.reaction.post.url)}get emojiUrl(){const e=this.args.reaction.reaction.reaction_value
if(e)return(0,r.emojiUrlFor)(e)}}e.default=u,(0,t.setComponentTemplate)(a,u)})),define("discourse/plugins/discourse-reactions/discourse/controllers/user-activity-reactions",["exports","@glimmer/tracking","@ember/controller","@ember/object","@ember/service","discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction"],(function(e,t,s,i,o,r){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class n extends s.default{static#e=(()=>dt7948.g(this.prototype,"siteSettings",[o.service]))()
#o=(()=>{dt7948.i(this,"siteSettings")})()
static#s=(()=>dt7948.g(this.prototype,"application",[s.inject]))()
#r=(()=>{dt7948.i(this,"application")})()
static#n=(()=>dt7948.g(this.prototype,"canLoadMore",[t.tracked],(function(){return!0})))()
#c=(()=>{dt7948.i(this,"canLoadMore")})()
static#a=(()=>dt7948.g(this.prototype,"loading",[t.tracked],(function(){return!1})))()
#u=(()=>{dt7948.i(this,"loading")})()
static#d=(()=>dt7948.g(this.prototype,"beforeLikeId",[t.tracked],(function(){return null})))()
#l=(()=>{dt7948.i(this,"beforeLikeId")})()
static#p=(()=>dt7948.g(this.prototype,"beforeReactionUserId",[t.tracked],(function(){return null})))()
#h=(()=>{dt7948.i(this,"beforeReactionUserId")})()
#_(e){return e.length?e[e.length-1].get("id"):null}#m(e){if(this.includeLikes){const t=this.siteSettings.discourse_reactions_reaction_for_like,[s,i]=e.reduce(((e,s)=>(s.reaction.reaction_value===t?e[0].push(s):e[1].push(s),e)),[[],[]])
this.beforeLikeId=this.#_(s),this.beforeReactionUserId=this.#_(i)}else this.beforeReactionUserId=this.#_(e)}loadMore(){if(!this.canLoadMore||this.loading)return
this.loading=!0
const e=this.model
this.beforeReactionUserId||this.#m(e)
const t={actingUsername:this.actingUsername,includeLikes:this.includeLikes,beforeLikeId:this.beforeLikeId,beforeReactionUserId:this.beforeReactionUserId}
r.default.findReactions(this.reactionsUrl,this.username,t).then((t=>{e.addObjects(t),this.#m(t),0===t.length&&(this.canLoadMore=!1)})).finally((()=>{this.loading=!1}))}static#g=(()=>dt7948.n(this.prototype,"loadMore",[i.action]))()}e.default=n})),define("discourse/plugins/discourse-reactions/discourse/discourse-reactions-user-activity-route-map",["exports"],(function(e){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default={resource:"user.userActivity",map(){this.route("reactions")}}})),define("discourse/plugins/discourse-reactions/discourse/discourse-reactions-user-notifications-route-map",["exports"],(function(e){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default={resource:"user.userNotifications",map(){this.route("reactionsReceived",{path:"reactions-received"})}}})),define("discourse/plugins/discourse-reactions/discourse/initializers/discourse-reactions",["exports","discourse/lib/plugin-api","discourse/lib/text","discourse/lib/url","discourse/lib/utilities","discourse-common/lib/deprecated","discourse-common/lib/icon-library","I18n","discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-actions","discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-button","discourse/plugins/discourse-reactions/discourse/components/discourse-reactions-actions-summary"],(function(e,t,s,i,o,r,n,c,a,u,d){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
const l="discourse-reactions"
function p(e){(function(e){const t=e.registerValueTransformer("post-menu-buttons",(e=>{let{value:t,context:{buttonKeys:s}}=e
t.replace(s.LIKE,u.default),t.add("discourse-reactions-actions",d.default,{after:s.REPLIES})})),s=t&&"discourse.post-menu-widget-overrides";(0,r.withSilencedDeprecations)(s,(()=>function(e){e.replacePostMenuButton?e.replacePostMenuButton("like",{name:"discourse-reactions-actions",buildAttrs:e=>({post:e.findAncestorModel()}),shouldRender:e=>{const t=e.findAncestorModel()
return t&&!t.deleted_at}}):(e.removePostMenuButton("like"),e.decorateWidget("post-menu:before-extra-controls",(e=>{const t=e.getModel()
if(t&&!t.deleted_at)return e.attach("discourse-reactions-actions",{post:t})})))
e.decorateWidget("post-menu:extra-post-controls",(e=>{if(e.widget.site.mobileView)return
const t=e.widget.siteSettings.discourse_reactions_reaction_for_like,s=e.getModel()
return!s||s.deleted_at||s.reactions&&1===s.reactions.length&&s.reactions[0].id===t?void 0:e.attach("discourse-reactions-actions",{post:s,position:"left"})}))}(e)))})(e),e.addKeyboardShortcut("l",null,{click:".topic-post.selected .discourse-reactions-reaction-button"}),e.modifyClass("component:scrolling-post-stream",{pluginId:l,didInsertElement(){this._super(...arguments)
const e=this?.posts?.firstObject?.topic_id
e&&this.messageBus.subscribe(`/topic/${e}/reactions`,(e=>{this.dirtyKeys.keyDirty(`discourse-reactions-counter-${e.post_id}`,{onRefresh:"reactionsChanged",refreshArg:e}),this._refresh({id:e.post_id})}))}}),e.modifyClass("controller:topic",{pluginId:l,unsubscribe(){this._super(...arguments)
const e=this.model.id
e&&this.messageBus.unsubscribe(`/topic/${e}/reactions`)}}),e.modifyClass("component:emoji-value-list",{pluginId:l,didReceiveAttrs(){if(this._super(...arguments),"discourse_reactions_enabled_reactions"!==this.setting.setting)return
if(this.values.includes(this.siteSettings.discourse_reactions_reaction_for_like)){const e=this.collection.findBy("value",this.siteSettings.discourse_reactions_reaction_for_like)
e&&(e.isEditable=!1)}else this.collection.unshiftObject({emojiUrl:(0,s.emojiUrlFor)(this.siteSettings.discourse_reactions_reaction_for_like),isEditable:!1,isEditing:!1,value:this.siteSettings.discourse_reactions_reaction_for_like})}},{ignoreMissing:!0}),e.replaceIcon("notification.reaction","discourse-emojis"),e.registerNotificationTypeRenderer&&e.registerNotificationTypeRenderer("reaction",(e=>class extends e{get linkTitle(){return c.default.t("notifications.titles.reaction")}get linkHref(){const e=super.linkHref
if(e)return e
let t="reactions-received"
return this.notification.data.reaction_icon&&(t="likes-received"),(0,i.userPath)(`${this.currentUser.username}/notifications/${t}?acting_username=${this.notification.data.display_username}&include_likes=true`)}get icon(){return this.notification.data.reaction_icon||`notification.${this.notificationName}`}get label(){const e=this.notification.data.count,t=this.username
return e&&1!==e&&this.notification.data.username2?e>2?c.default.t("notifications.reaction_multiple_users",{username:t,count:e-1}):c.default.t("notifications.reaction_2_users",{username:t,username2:(0,o.formatUsername)(this.notification.data.username2)}):t}get labelClasses(){if(this.notification.data.username2)return this.notification.data.count>2?["multi-user"]:["double-user"]}get description(){return this.notification.data.count>1&&!this.notification.data.username2?c.default.t("notifications.reaction_1_user_multiple_posts",{count:this.notification.data.count}):super.description}}))}(0,n.replaceIcon)("notification.reaction","bell")
e.default={name:"discourse-reactions",initialize(e){e.lookup("service:site-settings").discourse_reactions_enabled&&(0,t.withPluginApi)("1.34.0",p)},teardown(){(0,a.resetCurrentReaction)()}}})),define("discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction",["exports","@ember/object","discourse/lib/ajax","discourse/models/category","discourse/models/post","discourse/models/rest","discourse/models/topic","discourse/models/user"],(function(e,t,s,i,o,r,n,c){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class a extends r.default{static toggle(e,t){return(0,s.ajax)(`/discourse-reactions/posts/${e.id}/custom-reactions/${t}/toggle.json`,{type:"PUT"}).then((t=>{e.appEvents.trigger("discourse-reactions:reaction-toggled",{post:t,reaction:t.current_user_reaction})}))}static findReactions(e,r,a){const u={username:r}
return(a=a||{}).beforeReactionUserId&&(u.before_reaction_user_id=a.beforeReactionUserId),a.beforeLikeId&&(u.before_like_id=a.beforeLikeId),a.includeLikes&&(u.include_likes=a.includeLikes),a.actingUsername&&(u.acting_username=a.actingUsername),(0,s.ajax)(`/discourse-reactions/posts/${e}.json`,{data:u}).then((e=>e.map((e=>{e.user=c.default.create(e.user),e.topic=n.default.create(e.post.topic),e.post_user=c.default.create(e.post.user),e.category=i.default.findById(e.post.category_id)
const s={...e.post}
return delete s.url,e.post=o.default.create(s),t.default.create(e)}))))}static findReactionUsers(e,t){const i={}
return(t=t||{}).reactionValue&&(i.reaction_value=t.reactionValue),(0,s.ajax)(`/discourse-reactions/posts/${e}/reactions-users.json`,{data:i})}init(){super.init(...arguments),this.__type="discourse-reactions-custom-reaction"}}e.default=a})),define("discourse/plugins/discourse-reactions/discourse/routes/user-activity-reactions",["exports","discourse/routes/discourse","discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction"],(function(e,t,s){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class i extends t.default{model(){return s.default.findReactions("reactions",this.modelFor("user").get("username"))}setupController(e,t){let s=t.length<20
this.controllerFor("user-activity-reactions").setProperties({model:t,canLoadMore:!s,reactionsUrl:"reactions",username:this.modelFor("user").get("username")})}}e.default=i})),define("discourse/plugins/discourse-reactions/discourse/routes/user-notifications-reactions-received",["exports","discourse/routes/discourse","discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction"],(function(e,t,s){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
class i extends t.default{templateName="user-activity-reactions"
controllerName="user-activity-reactions"
queryParams={acting_username:{refreshModel:!0},include_likes:{refreshModel:!0}}
model(e){return s.default.findReactions("reactions-received",this.modelFor("user").get("username"),{actingUsername:e.acting_username,includeLikes:e.include_likes})}setupController(e,t){let s=t.length<20
this.controllerFor("user-activity-reactions").setProperties({model:t,canLoadMore:!s,reactionsUrl:"reactions-received",username:this.modelFor("user").get("username"),actingUsername:e.acting_username,includeLikes:e.include_likes}),this.controllerFor("application").set("showFooter",s)}}e.default=i})),define("discourse/plugins/discourse-reactions/discourse/templates/connectors/user-activity-bottom/discourse-reactions-user-activity-reactions",["exports","@ember/template-factory"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,t.createTemplateFactory)({id:"DCXJdd7J",block:'[[[41,[30,0,["siteSettings","discourse_reactions_enabled"]],[[[1," "],[8,[39,1],null,[["@route"],["userActivity.reactions"]],[["default"],[[[[1,"\\n "],[1,[28,[35,2],["far-face-smile"],null]],[1,"\\n "],[10,1],[12],[1,[28,[35,4],["discourse_reactions.reactions_title"],null]],[13],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],[],false,["if","link-to","d-icon","span","i18n"]]',moduleName:"discourse/plugins/discourse-reactions/discourse/templates/connectors/user-activity-bottom/discourse-reactions-user-activity-reactions.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-reactions/discourse/templates/connectors/user-notifications-bottom/discourse-reactions-user-notification-reactions",["exports","@ember/template-factory"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,t.createTemplateFactory)({id:"Mgs9xR0w",block:'[[[41,[30,0,["siteSettings","discourse_reactions_enabled"]],[[[1," "],[8,[39,1],null,[["@route"],["userNotifications.reactionsReceived"]],[["default"],[[[[1,"\\n "],[1,[28,[35,2],["far-face-smile"],null]],[1,"\\n "],[10,1],[12],[1,[28,[35,4],["discourse_reactions.reactions_title"],null]],[13],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],[],false,["if","link-to","d-icon","span","i18n"]]',moduleName:"discourse/plugins/discourse-reactions/discourse/templates/connectors/user-notifications-bottom/discourse-reactions-user-notification-reactions.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-reactions/discourse/templates/user-activity-reactions",["exports","@ember/template-factory"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,t.createTemplateFactory)({id:"6thmHTAX",block:'[[[8,[39,0],null,[["@selector","@action"],[".user-stream-item",[28,[37,1],[[30,0],"loadMore"],null]]],[["default"],[[[[1,"\\n "],[10,0],[14,0,"user-stream"],[12],[1,"\\n"],[42,[28,[37,4],[[28,[37,4],[[30,1]],null]],null],null,[[[1," "],[8,[39,5],null,[["@reaction"],[[30,2]]],null],[1,"\\n"]],[2]],[[[1," "],[10,0],[14,0,"alert alert-info"],[12],[1,[28,[35,6],["notifications.empty"],null]],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n "],[8,[39,7],null,[["@condition"],[[30,0,["loading"]]]],null],[1,"\\n"]],[]]]]]],["@model","reaction"],false,["load-more","action","div","each","-track-array","discourse-reactions-reaction-post","i18n","conditional-loading-spinner"]]',moduleName:"discourse/plugins/discourse-reactions/discourse/templates/user-activity-reactions.hbs",isStrictMode:!1})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-actions",["exports","@ember/runloop","@popperjs/core","jquery","rsvp","discourse/lib/text","discourse/widgets/widget","discourse-common/config/environment","I18n","discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction"],(function(e,t,s,i,o,r,n,c,a,u){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.resetCurrentReaction=function(){l=null}
let d,l
function p(e,t,s,o,n){if((0,c.isTesting)())return
const a=function(e){const t=document.createElement("img")
return t.src=(0,r.emojiUrlFor)(e),t.classList.add("btn-toggle-reaction-emoji","reaction-button","fake-reaction"),t}(t)
e.querySelector(".reaction-button").appendChild(a)
a.style.top=s,a.style.opacity=0,(0,i.default)(a).animate({top:o,opacity:1},{duration:350,complete:()=>{a.remove(),n()}},"swing")}function h(e,s,o,r){return(0,c.isTesting)()?(0,t.run)(this,r):(0,i.default)(e).stop().css("textIndent",s).animate({textIndent:o},{complete:r,step(e){(0,i.default)(this).css("transform",`scale(${e})`).addClass("far-heart").removeClass("heart")},duration:150},"linear")}e.default=(0,n.createWidget)("discourse-reactions-actions",{tagName:"div.discourse-reactions-actions",services:["dialog"],defaultState:()=>({reactionsPickerExpanded:!1,statePanelExpanded:!1}),buildKey:e=>`discourse-reactions-actions-${e.post.id}-${e.position||"right"}`,buildClasses(e){if(!e.post.reactions)return
const t=e.post,s=t.reactions.length,i=t.current_user_reaction,o=[]
return t.reactions.length&&t.reactions.filter((e=>e.id!==this.siteSettings.discourse_reactions_reaction_for_like)).length&&o.push("custom-reaction-used"),t.yours&&o.push("my-post"),s&&o.push("has-reactions"),i&&o.push("has-reacted"),t.current_user_used_main_reaction&&o.push("has-used-main-reaction"),t.current_user_reaction&&!t.current_user_reaction.can_undo||!t.likeAction?.canToggle||o.push("can-toggle-reaction"),o},toggleReactions(e){this.state.reactionsPickerExpanded||(this.state.statePanelExpanded?this.scheduleExpand("expandReactionsPicker"):this.expandReactionsPicker(e))},touchStart(){if(this._validTouch=!0,(0,t.cancel)(this._touchTimeout),this.capabilities.touch)return document.documentElement?.classList?.toggle("discourse-reactions-no-select",!0),this._touchStartAt=Date.now(),this._touchTimeout=(0,t.later)((()=>{this._touchStartAt=null,this.toggleReactions()}),400),!1},touchMove(){this._validTouch=!1,(0,t.cancel)(this._touchTimeout)},touchEnd(e){if((0,t.cancel)(this._touchTimeout),this._validTouch&&this.capabilities.touch){if(e.originalEvent.changedTouches.length){const t=document.elementFromPoint(e.originalEvent.changedTouches[0].clientX,e.originalEvent.changedTouches[0].clientY)
if(t){const e=t.parentNode
if(t.classList.contains("pickable-reaction"))return void t.click()
if(e&&e.classList.contains("pickable-reaction"))return void e.click()}}const t=Date.now()-(this._touchStartAt||0)
this._touchStartAt=null,t>400?e.originalEvent&&e.originalEvent.target&&e.originalEvent.target.classList.contains("discourse-reactions-reaction-button")&&this.toggleReactions(e):e.target&&(e.target.classList.contains("discourse-reactions-reaction-button")||e.target.classList.contains("reaction-button"))&&this.toggleFromButton({reaction:this.attrs.post.current_user_reaction?this.attrs.post.current_user_reaction.id:this.siteSettings.discourse_reactions_reaction_for_like})}},toggle(e){if(!this.currentUser)return this.attrs.showLogin?void this.attrs.showLogin():this.sendWidgetAction("showLogin")
if(!this.attrs.post.current_user_reaction||this.attrs.post.current_user_reaction.can_undo&&this.attrs.post.likeAction.canToggle){this.capabilities.userHasBeenActive&&this.capabilities.canVibrate&&navigator.vibrate(5)
const s=document.querySelector(`[data-post-id="${e.postId}"] .discourse-reactions-picker .pickable-reaction.${CSS.escape(e.reaction)} .emoji`),i=[1,1.75]
return new o.Promise((o=>{h(s,i[0],i[1],(()=>{h(s,i[1],i[0],(()=>{const s=this.attrs.post,i=document.querySelector(`[data-post-id="${e.postId}"]`)
var r,n
s.current_user_reaction&&s.current_user_reaction.id===e.reaction?(this.toggleReaction(e),(0,t.later)((()=>{var t,r
t=i,r=e.reaction,p(t,r,"8px","42px",(()=>u.default.toggle(this.attrs.post,e.reaction).then(o).catch((e=>{this.dialog.alert(this._extractErrors(e)),this._rollbackState(s)}))))}),100)):(r=i,n=e.reaction,p(r,n,"-50px","8px",(()=>{this.toggleReaction(e),u.default.toggle(this.attrs.post,e.reaction).then(o).catch((e=>{this.dialog.alert(this._extractErrors(e)),this._rollbackState(s)}))})))}))}))})).finally((()=>{this.collapseAllPanels(),this.scheduleRerender()}))}},toggleReaction(e){if(this.collapseAllPanels(),this.attrs.post.current_user_reaction&&!this.attrs.post.current_user_reaction.can_undo&&!this.attrs.post.likeAction.canToggle)return
const t=this.attrs.post
if(t.current_user_reaction&&t.reactions.every(((e,s)=>e.count<=1&&e.id===t.current_user_reaction.id?(t.reactions.splice(s,1),!1):e.id!==t.current_user_reaction.id||(t.reactions[s].count-=1,!1))),!e.reaction||t.current_user_reaction&&e.reaction===t.current_user_reaction.id)t.reaction_users_count-=1,t.current_user_reaction=null
else{let s=!1
if(t.reactions.every(((i,o)=>i.id!==e.reaction||(t.reactions[o].count+=1,s=!0,!1))),!s){const s={id:e.reaction,type:"emoji",count:1},i=Object.assign([],t.reactions)
i.push(s)
const o=i.sort(((e,t)=>e.count>t.count?-1:e.countt.id?1:e.id{this.dialog.alert(this._extractErrors(e)),this._rollbackState(s)}))
let r
r=s.reactions&&1===s.reactions.length&&s.reactions[0].id===t?`[data-post-id="${this.attrs.post.id}"] .discourse-reactions-double-button .discourse-reactions-reaction-button .d-icon`:e.reaction&&e.reaction!==t?`[data-post-id="${this.attrs.post.id}"] .discourse-reactions-reaction-button .reaction-button .btn-toggle-reaction-emoji`:`[data-post-id="${this.attrs.post.id}"] .discourse-reactions-reaction-button .d-icon`
const n=document.querySelector(r),c=[1,1.5]
return new o.Promise((i=>{h(n,c[0],c[1],(()=>{h(n,c[1],c[0],(()=>{this.toggleReaction(e)
let o=e.reaction&&e.reaction!==t?e.reaction:this.siteSettings.discourse_reactions_reaction_for_like
u.default.toggle(this.attrs.post,o).then(i).catch((e=>{this.dialog.alert(this._extractErrors(e)),this._rollbackState(s)}))}))}))}))},cancelCollapse(){(0,t.cancel)(this._collapseHandler)},cancelExpand(){(0,t.cancel)(this._expandHandler)},scheduleExpand(e){this.cancelExpand(),this._expandHandler=(0,t.later)(this,this[e],250)},scheduleCollapse(e){this.cancelCollapse(),this._collapseHandler=(0,t.later)(this,this[e],500)},buildId:e=>`discourse-reactions-actions-${e.post.id}-${e.position||"right"}`,clickOutside(){(this.state.reactionsPickerExpanded||this.state.statePanelExpanded)&&this.collapseAllPanels()},expandReactionsPicker(){(0,t.cancel)(this._collapseHandler),l?.collapseAllPanels(),this.state.statePanelExpanded=!1,this.state.reactionsPickerExpanded=!0,this.scheduleRerender(),this._setupPopper([".discourse-reactions-reaction-button",".discourse-reactions-picker"])},expandStatePanel(){(0,t.cancel)(this._collapseHandler),l?.collapseAllPanels(),this.state.statePanelExpanded=!0,this.state.reactionsPickerExpanded=!1,this.scheduleRerender(),this._setupPopper([".discourse-reactions-counter",".discourse-reactions-state-panel"])},collapseStatePanel(){(0,t.cancel)(this._collapseHandler),this._collapseHandler=null,this.state.statePanelExpanded=!1,this.scheduleRerender()},collapseReactionsPicker(){(0,t.cancel)(this._collapseHandler),this._collapseHandler=null,this.state.reactionsPickerExpanded=!1,this.scheduleRerender()},collapseAllPanels(){(0,t.cancel)(this._collapseHandler),document.documentElement?.classList?.toggle("discourse-reactions-no-select",!1),this._collapseHandler=null,this.state.statePanelExpanded=!1,this.state.reactionsPickerExpanded=!1,this.scheduleRerender()},updatePopperPosition(){d?.update()},html(e){const t=e.post,s=[],i=this.siteSettings.discourse_reactions_reaction_for_like,o=Object.assign({},e,{reactionsPickerExpanded:this.state.reactionsPickerExpanded,statePanelExpanded:this.state.statePanelExpanded})
return this.currentUser&&t.user_id!==this.currentUser.id&&s.push(this.attach("discourse-reactions-picker",o)),"left"===e.position?(s.push(this.attach("discourse-reactions-counter",o)),s):(t.reactions&&1===t.reactions.length&&t.reactions[0].id===i?s.push(this.attach("discourse-reactions-double-button",o)):this.site.mobileView?t.yours?t.yours&&t.reactions&&t.reactions.length&&s.push(this.attach("discourse-reactions-counter",o)):(s.push(this.attach("discourse-reactions-counter",o)),s.push(this.attach("discourse-reactions-reaction-button",o))):t.yours||s.push(this.attach("discourse-reactions-reaction-button",o)),s)},_setupPopper(e){(0,t.schedule)("afterRender",(()=>{const t=this.attrs.position||"right",s=this.attrs.post.id,i=document.querySelector(`#discourse-reactions-actions-${s}-${t} ${e[0]}`),o=document.querySelector(`#discourse-reactions-actions-${s}-${t} ${e[1]}`)
d?.destroy(),d=this._applyPopper(i,o),l=this}))},_applyPopper:(e,t)=>(0,s.createPopper)(e,t,{placement:"top",modifiers:[{name:"offset",options:{offset:[0,-5]}},{name:"preventOverflow",options:{padding:5}}]}),_rollbackState(e){const t=e.current_user_reaction,s=e.current_user_used_main_reaction,i=Object.assign([],e.reactions),o=e.reaction_users_count
e.current_user_reaction=t,e.current_user_used_main_reaction=s,e.reactions=i,e.reaction_users_count=o,this.scheduleRerender()},_extractErrors(e){const t=e.xhr||e.jqXHR
return t&&t.status?429===t.status&&t.responseJSON&&t.responseJSON.errors&&t.responseJSON.errors[0]?t.responseJSON.errors[0]:403===t.status?a.default.t("discourse_reactions.reaction.forbidden"):a.default.t("errors.desc.unknown"):a.default.t("errors.desc.network")}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-counter",["exports","virtual-dom","discourse/widgets/widget","discourse-common/lib/icon-library","discourse/plugins/discourse-reactions/discourse/models/discourse-reactions-custom-reaction"],(function(e,t,s,i,o){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,s.createWidget)("discourse-reactions-counter",{tagName:"div",buildKey:e=>`discourse-reactions-counter-${e.post.id}-${e.position||"right"}`,buildId:e=>`discourse-reactions-counter-${e.post.id}-${e.position||"right"}`,reactionsChanged(e){e.reactions.uniq().forEach((e=>{this.getUsers(e)}))},defaultState:()=>({reactionsUsers:{},statePanelExpanded:!1}),getUsers(e){return o.default.findReactionUsers(this.attrs.post.id,{reactionValue:e}).then((e=>{e.reaction_users.forEach((e=>{this.state.reactionsUsers[e.id]=e.users})),this.scheduleRerender(),this.callWidgetFunction("updatePopperPosition")}))},mouseDown:e=>(e.stopImmediatePropagation(),!1),mouseUp:e=>(e.stopImmediatePropagation(),!1),click(e){this.callWidgetFunction("cancelCollapse"),this.capabilities.touch&&this.site.mobileView||(e.stopPropagation(),e.preventDefault(),this.attrs.statePanelExpanded||this.getUsers(),this.toggleStatePanel(e))},clickOutside(){this.attrs.statePanelExpanded&&this.callWidgetFunction("collapseAllPanels")},touchStart(e){return this.callWidgetFunction("cancelCollapse"),!(!e.target.classList.contains("show-users")&&!e.target.classList.contains("avatar"))||(this.attrs.statePanelExpanded?(e.stopPropagation(),void e.preventDefault()):void(this.capabilities.touch&&(e.stopPropagation(),e.preventDefault(),this.getUsers(),this.toggleStatePanel(e))))},buildClasses(e){const t=[],s=this.siteSettings.discourse_reactions_reaction_for_like
return e.post.reactions&&1===e.post.reactions.length&&e.post.reactions[0].id===s&&t.push("only-like"),e.post.reaction_users_count>0&&t.push("discourse-reactions-counter"),t},html(e){if(e.post.reaction_users_count){const s=e.post,o=s.reaction_users_count
if(o<=0)return
const r=this.siteSettings.discourse_reactions_reaction_for_like,n=this.siteSettings.discourse_reactions_like_icon,c=[]
return c.push(this.attach("discourse-reactions-state-panel",Object.assign({},e,{reactionsUsers:this.state.reactionsUsers}))),1===s.reactions.length&&s.reactions[0].id===r||c.push(this.attach("discourse-reactions-list",{reactionsUsers:this.state.reactionsUsers,post:e.post})),c.push((0,t.h)("span.reactions-counter",o.toString())),s.yours&&s.reactions&&1===s.reactions.length&&s.reactions[0].id===r&&c.push((0,t.h)("div.discourse-reactions-reaction-button.my-likes",(0,t.h)("button.btn-toggle-reaction-like.btn-icon.no-text.reaction-button",[(0,i.iconNode)(`${n}`)]))),c}},toggleStatePanel(){this.attrs.statePanelExpanded?this.callWidgetFunction("collapseStatePanel"):this.callWidgetFunction("expandStatePanel")},mouseOver(){this.callWidgetFunction("cancelCollapse")},mouseOut(e){e.relatedTarget?.closest(`#${this.buildId(this.attrs)}`)||this.callWidgetFunction("scheduleCollapse","collapseStatePanel")}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-double-button",["exports","discourse/widgets/widget"],(function(e,t){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,t.createWidget)("discourse-reactions-double-button",{tagName:"div.discourse-reactions-double-button",buildKey:e=>`discourse-reactions-double-button-${e.post.id}`,html(e){const t=[]
return e.post.reaction_users_count>0&&t.push(this.attach("discourse-reactions-counter",e)),e.post.yours||t.push(this.attach("discourse-reactions-reaction-button",e)),t}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-list-emoji",["exports","@ember/runloop","@popperjs/core","virtual-dom","discourse/lib/text","discourse/widgets/raw-html","discourse/widgets/widget","I18n"],(function(e,t,s,i,o,r,n,c){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
let a
e.default=(0,n.createWidget)("discourse-reactions-list-emoji",{tagName:"div.discourse-reactions-list-emoji",buildId:e=>`discourse-reactions-list-emoji-${e.post.id}-${e.reaction.id}`,mouseOver(){this._allowHover()&&(this._setupPopper(".user-list"),this.attrs.users?.length||this.loadingReactions||(0,t.debounce)(this,this._loadReactionUsers,3e3,!0))},html(e){if(e.reaction.count<=0)return
const t=e.reaction,s=e.users||[],n=[(0,i.h)("span.heading",e.reaction.id)]
s.length?(s.slice(0,19).forEach((e=>{let t
t=this.siteSettings.prioritize_username_in_ux?e.username:e.name?e.name:e.username,n.push((0,i.h)("span.username",t))})),e.reaction.count>19&&n.push((0,i.h)("span.other-users",c.default.t("discourse_reactions.state_panel.more_users",{count:e.reaction.count-19})))):n.push((0,i.h)("div.center",(0,i.h)("div.spinner.small")))
const a=[new r.default({html:(0,o.emojiUnescape)(`:${t.id}:`,{skipTitle:!0,class:this.siteSettings.discourse_reactions_desaturated_reaction_panel?"desaturated":""})})]
return this._allowHover()&&a.push((0,i.h)("div.user-list",(0,i.h)("div.container",n))),a},_setupPopper(e){(0,t.schedule)("afterRender",(()=>{const t=CSS.escape(this.buildId(this.attrs)),i=document.querySelector(`#${t}`),o=document.querySelector(`#${t} ${e}`)
o&&(a&&a.destroy(),a=(0,s.createPopper)(i,o,{placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,-5]}},{name:"preventOverflow",options:{padding:5}}]}))}))},_loadReactionUsers(){this.loadingReactions=!0,this.callWidgetFunction("getUsers",this.attrs.reaction.id).finally((()=>{this.loadingReactions=!1}))},_allowHover:()=>window.isSystemTest||!window.matchMedia("(hover: none)").matches})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-list",["exports","virtual-dom","discourse/widgets/widget"],(function(e,t,s){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,s.createWidget)("discourse-reactions-list",{tagName:"div.discourse-reactions-list",html(e){if(!(e.post.reaction_users_count<=0))return[(0,t.h)("div.reactions",e.post.reactions.map((t=>this.attach("discourse-reactions-list-emoji",{reaction:t,users:e.reactionsUsers[t.id],post:e.post}))))]}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-picker",["exports","virtual-dom","discourse/lib/text","discourse/widgets/raw-html","discourse/widgets/widget"],(function(e,t,s,i,o){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,o.createWidget)("discourse-reactions-picker",{tagName:"div.discourse-reactions-picker",buildKey:e=>`discourse-reactions-picker-${e.post.id}`,buildClasses(e){const t=[]
return e.reactionsPickerExpanded&&t.push("is-expanded"),t},mouseOut(){window.matchMedia("(hover: none)").matches||this.callWidgetFunction("scheduleCollapse","collapseReactionsPicker")},mouseOver(){window.matchMedia("(hover: none)").matches||this.callWidgetFunction("cancelCollapse")},html(e){if(e.reactionsPickerExpanded){const o=this.siteSettings.discourse_reactions_enabled_reactions.split("|").filter(Boolean)
o.includes(this.siteSettings.discourse_reactions_reaction_for_like)||o.unshift(this.siteSettings.discourse_reactions_reaction_for_like)
const r=e.post.current_user_reaction
return[(0,t.h)(`div.discourse-reactions-picker-container.col-${this._getOptimalColsCount(o.length)}`,o.map((t=>{let o,n,c,a
return o=t===this.siteSettings.discourse_reactions_reaction_for_like?e.post.current_user_used_main_reaction:r&&r.id===t,n=r?r.can_undo&&e.post.likeAction.canToggle:e.post.likeAction.canToggle,n?(c="discourse_reactions.picker.react_with",a={reaction:t}):c="discourse_reactions.picker.cant_remove_reaction",this.attach("button",{action:"toggle",data:{reaction:t},actionParam:{reaction:t,postId:e.post.id,canUndo:n},className:`pickable-reaction ${t} ${n?"can-undo":""} ${o?"is-used":""}`,title:c,titleOptions:a,contents:[new i.default({html:(0,s.emojiUnescape)(`:${t}:`)})]})})))]}},_getOptimalColsCount(e){let t
const s=[5,6,7,8]
if(ee%(o-1))&&(t=o)}return t}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-reaction-button",["exports","@ember/utils","virtual-dom","discourse/lib/text","discourse/widgets/widget","discourse-common/lib/icon-library","I18n"],(function(e,t,s,i,o,r,n){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,o.createWidget)("discourse-reactions-reaction-button",{tagName:"div.discourse-reactions-reaction-button",buildKey:e=>`discourse-reactions-reaction-button-${e.post.id}`,click(){this.callWidgetFunction("cancelCollapse")
const e=this.attrs.post.current_user_reaction
this.capabilities.touch&&this.site.mobileView||this.callWidgetFunction("toggleFromButton",{reaction:e?e.id:this.siteSettings.discourse_reactions_reaction_for_like})},mouseOver(e){this.callWidgetFunction("cancelCollapse")
const s=this.attrs.post.likeAction,i=this.attrs.post.current_user_reaction;(!i||i.can_undo||s&&!(0,t.isBlank)(s.can_undo))&&(window.matchMedia("(hover: none)").matches||this.callWidgetFunction("toggleReactions",e))},mouseOut(){this.callWidgetFunction("cancelExpand"),window.matchMedia("(hover: none)").matches||this.callWidgetFunction("scheduleCollapse","collapseReactionsPicker")},buildAttributes(e){if(!this.currentUser)return{title:n.default.t("discourse_reactions.main_reaction.unauthenticated")}
const s=e.post.likeAction
if(!s)return{}
let i,o
const r=this.attrs.post.current_user_reaction
return s.canToggle&&(0,t.isBlank)(s.can_undo)&&(i="discourse_reactions.main_reaction.add"),s.canToggle&&s.can_undo&&(i="discourse_reactions.main_reaction.remove"),s.canToggle||(i="discourse_reactions.main_reaction.cant_remove"),r&&r.can_undo&&(0,t.isBlank)(s.can_undo)&&(i="discourse_reactions.picker.remove_reaction",o={reaction:r.id}),r&&!r.can_undo&&(0,t.isBlank)(s.can_undo)&&(i="discourse_reactions.picker.cant_remove_reaction"),o?{title:n.default.t(i,o)}:{title:n.default.t(i)}},html(e){const t=this.siteSettings.discourse_reactions_like_icon,o=e.post.current_user_used_main_reaction,n=e.post.current_user_reaction
return o?(0,s.h)("button.btn-toggle-reaction-like.btn-icon.no-text.reaction-button",{title:this.buildAttributes(e).title},[(0,r.iconNode)(t)]):n?(0,s.h)("button.btn-icon.no-text.reaction-button",{title:this.buildAttributes(e).title},(0,s.h)("img.btn-toggle-reaction-emoji.reaction-button",{src:(0,i.emojiUrlFor)(n.id),alt:`:${n.id}:`})):(0,s.h)("button.btn-toggle-reaction-like.btn-icon.no-text.reaction-button",{title:this.buildAttributes(e).title},[(0,r.iconNode)(`far-${t}`)])}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-state-panel-reaction",["exports","virtual-dom","discourse/lib/text","discourse/widgets/post","discourse/widgets/raw-html","discourse/widgets/widget","discourse-common/lib/icon-library","I18n"],(function(e,t,s,i,o,r,n,c){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,r.createWidget)("discourse-reactions-state-panel-reaction",{tagName:"div.discourse-reactions-state-panel-reaction",buildClasses(e){if(e.isDisplayed)return"is-displayed"},click(e){e?.target?.classList?.contains("show-users")&&(e.preventDefault(),e.stopPropagation(),this.sendWidgetAction("showUsers",this.attrs?.reaction?.id))},html(e){const r=[]
if(!e.users)return
r.push((0,t.h)("div.reaction-wrapper",[(0,t.h)("div.emoji-wrapper",[new o.default({html:(0,s.emojiUnescape)(`:${e.reaction.id}:`)})]),(0,t.h)("div.count",e.reaction.count.toString())]))
const a=e.users.slice(0,8),u=a.map((e=>(0,i.avatarFor)("tiny",{username:e.username,template:e.avatar_template})))
let d
e.users.length>8&&u.push((0,t.h)("button.show-users",(0,n.iconNode)(e.isDisplayed?"chevron-up":"chevron-down"))),e.isDisplayed&&u.push(e.users.slice(8,26).map((e=>(0,i.avatarFor)("tiny",{username:e.username,template:e.avatar_template})))),e.isDisplayed&&e.reaction.count>26&&(d=c.default.t("discourse_reactions.state_panel.more_users",{count:e.reaction.count-26}))
const l=e.users.length>8?a.length+1:a.length
return r.push((0,t.h)("div.users",[(0,t.h)(`div.list.list-columns-${l}`,u),(0,t.h)("span.more",d)])),r}})})),define("discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-state-panel",["exports","virtual-dom","discourse/widgets/widget"],(function(e,t,s){"use strict"
Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
e.default=(0,s.createWidget)("discourse-reactions-state-panel",{tagName:"div.discourse-reactions-state-panel",buildKey:e=>`discourse-reactions-state-panel-${e.post.id}`,buildClasses(e){const t=[]
if(e.post&&e.post.reactions){const s=Math.max(...e.post.reactions.mapBy("count")).toString().length
t.push(`max-length-${s}`)}return e.statePanelExpanded&&t.push("is-expanded"),t},mouseOut(){window.matchMedia("(hover: none)").matches||this.callWidgetFunction("scheduleCollapse","collapseStatePanel")},mouseOver(){window.matchMedia("(hover: none)").matches||this.callWidgetFunction("cancelCollapse")},showUsers(e){this.state.displayedReactionId?this.state.displayedReactionId===e?this.hideUsers():this.state.displayedReactionId!==e&&(this.state.displayedReactionId=e):this.state.displayedReactionId=e},hideUsers(){this.state.displayedReactionId=null},defaultState:()=>({displayedReactionId:null}),html(e){if(!e.statePanelExpanded||!e.post.reactions.length)return
const s=Object.keys(e.reactionsUsers).length?(0,t.h)("div.counters",e.post.reactions.map((t=>this.attach("discourse-reactions-state-panel-reaction",{reaction:t,users:e.reactionsUsers[t.id],post:e.post,isDisplayed:t.id===this.state.displayedReactionId})))):(0,t.h)("div.spinner-container",(0,t.h)("div.spinner.small"))
return(0,t.h)("div.container",s)}})}))
//# sourceMappingURL=discourse-reactions-505f5977308c3066423ee95dcfc00e8624d70a76e6462af90f30c8c67d9b9a83.map
//!
;
Flash Sale Popup