/*
 =======================================================================*\
|| ###################################################################### ||
|| # vBulletin 6.2.3
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2026 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
(function(){function C(n,c){function x(){h.data("nodeid",null);h.toggleClass("vb-pop-open",!1);c(".js-reactions-add-reaction").attr("aria-expanded",!1)}function z(k,p,r=!1){return n.AJAX({call:"/ajax/api/reactions/"+(r?"unvoteNode":"voteNode"),data:{nodeid:k,votetypeid:p},success:function(a){if(a.nodevotes){a=a.nodevotes;var b=c(`.js-reactions-toggle-vote[data-nodeid="${k}"]`);b.attr("data-deleteme",1);for(votetypekey in a)if(a.hasOwnProperty(votetypekey)){var d=a[votetypekey],e=parseInt(d.votetypeid,
10),g=parseInt(d.votes,10);d=d.ivoted;var f=b.filter(`[data-votetypeid="${e}"]`),l=f.length&&f.find(".js-reactions-count");if(e)if(f.length)f.data("ivoted",d),f.attr("data-ivoted",d),l.text(g),f.attr("data-deleteme",0==g?1:0);else if(0<g){f=k;d=d?1:0;e=parseInt(e,10);f=parseInt(f,10);g=parseInt(g,10);l=c(`.js-reactions-dovote[data-votetypeid="${e}"]`);let t=l.html();g=l.length?`<div class="reactions__topic-reaction js-reactions-toggle-vote"
				data-ivoted="${d}"
				data-votetypeid="${e}"
				data-nodeid="${f}"
			>
			${t}<span class="reactions__topic-reaction--count js-reactions-count">${g}</span>
		</div>`:"";""!=g&&c(g).appendTo(c(`.js-topic-reactions-list[data-nodeid="${k}"]`))}}b.filter("[data-deleteme=1]").remove()}},api_error:function(a){return D.hasError(a,"nodevote_dupe_notallowed")?(console.log("TODO: implement flashAlreadyVoted()"),!1):!0},complete:()=>x()})}function u(k,p=!0){k.data("data-vbreaction-lock",p);k.css("cursor",p?"wait":"pointer")}if(!n.reactionsinit){function k(a,b,d){p(A);A=a;E.apply(a,"qtip-whovoted",{position:{viewport:c(window),adjust:{method:"shift flip"}},content:{title:{text:y.get("people_who_liked"),
button:!0},text:function(e,g){n.AJAX({call:"/ajax/api/reactions/fetchWhovoted",data:{nodeid:b,votetypeid:d},success:f=>{let l;if(1>f.length||!f.users)l=y.get("no_one_voted");else{l='<ul class="whovoted-container">';for(const m of f.users){f=pageData.baseurl+m.profileurl;var t=(m.avatar.isfullurl?"":pageData.baseurl_core+"/")+m.avatar.avatarpath;t=c("<img>").attr({src:t,alt:m.username});$userlink=c("<a>").attr("href",f);$avatar=$userlink.clone().addClass("avatar h-inline-block");$rightcolumn=c("<div>").addClass("rightcolumn");
$li=c("<li>").addClass("whovoteditem");$li.append($avatar.append(t));$rightcolumn.append($userlink.clone().addClass("username").html(m.musername));m.doshowdisplayname&&$rightcolumn.append(c("<div>").addClass("usertitle").append($userlink.clone().html(m.username)));$rightcolumn.append(c("<div>").addClass("usertitle").html(m.usertitle));$li.append($rightcolumn);l+=c("<div>").append($li).html()}l+="</ul>"}g.set("content.text",l)}});return y.get("working_ellipsis")}},show:{event:"",ready:!0},hide:{event:"unfocus",
fixed:!0}})}function p(a){var b=a?"object"!==typeof a.data("qtip")?!1:"false"==a.qtip().tooltip.attr("aria-hidden"):!1;b&&a.qtip("hide")}function r(a){a=c(a.currentTarget);return[a,parseInt(a.data("nodeid"),10),parseInt(a.data("votetypeid"),10)]}n.reactionsinit=!0;var h=c(".js-reactions-available-list"),D=n.ajaxtools,B=c(window);c(document).offon("click",".js-reactions-add-reaction",a=>{a=c(a.currentTarget);a.data("vb-reactions-list")||a.siblings(".js-reactions-available-list");if(h)if(h.hasClass("vb-pop-open")&&
h.data("nodeid")==a.data("nodeid"))x();else{var b=parseInt(a.data("nodeid"),10);h.data("nodeid",b);b=h;B.scrollTop();var d=a.offset().top+a.outerHeight(!0);d=Math.max(d-b.outerHeight(!0),B.scrollTop());var e="ltr"==pageData.textdirection,g=a.offset().left+(e?0:a.outerWidth(!0));b.css("top",d);e?b.css("left",g):b.css("right",g);h.toggleClass("vb-pop-open",!0);c(".js-reactions-add-reaction").attr("aria-expanded",!1);a.attr("aria-expanded",!0);h.find(".js-reactions-dovote:first").focus()}return!1});
c(document).on("click.reactions",a=>{x(c(".js-reactions-available-list.vb-pop-open"))});c(document).on("click.reactions",".js-reactions-available-list",()=>!1);c(document).offon("click",".js-reactions-dovote",a=>{const b=c(a.currentTarget);a=parseInt(h.data("nodeid"),10);const d=parseInt(b.data("votetypeid"),10);b.data("data-vbreaction-lock")||(u(b),z(a,d).then(()=>u(b,!1)))});var v=!1,q=!1,w,E=n.qtip,y=n.phrase,A;c(document).offon("click",".js-reactions-toggle-vote",a=>{if(q)return q=!1;const [b,
d,e]=r(a);a=b.hasClass("js-reactions-toggle-vote")&&b.data("ivoted");b.data("data-vbreaction-lock")||(u(b),z(d,e,a).then(()=>u(b,!1)))});c(document).offon("contextmenu ",".js-topic-reactions-whovoted-container .js-reactions-toggle-vote",a=>{if(q)return q=!1;const [b,d,e]=r(a);d&&e&&(a.preventDefault(),v=!1,clearTimeout(w),k(b,d,e))});c(document).offon("mousedown mouseenter touchstart",".js-topic-reactions-whovoted-container .js-reactions-toggle-vote",a=>{const [b,d,e]=r(a);d&&e&&(a.preventDefault(),
"touchstart"!=a.type||"touchstart"==a.originalEvent.type)&&(v=!0,q=!1,clearTimeout(w),w=setTimeout(()=>{v&&(q=!0,k(b,d,e))},750))});c(document).offon("mouseup mouseleave touchend",".js-topic-reactions-whovoted-container .js-reactions-toggle-vote",a=>{v=!1;clearTimeout(w)})}}Promise.all([vBulletin.ready("global")]).then(()=>{C(vBulletin,jQuery)})})();
