/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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   # ||
|| ###################################################################### ||
\*========================================================================*/
vBulletin.precache("error_x error_saving_customizations profile_style_customizations saving style_applied_as_site_default kilobytes set_to_default profile_theme_reset_confirmation reverting".split(" "),[]);
var cssMappings={profcustom_navbar_background_active:[".profileTabs .widget-tabs-nav li.ui-tabs-active"],profcustom_navbar_border_active:[".profileTabs .widget-tabs-nav li.ui-tabs-active a"],profcustom_navbar_text_color_active:[".profileTabs .widget-tabs-nav li.ui-tabs-active a"],profcustom_navbar_background:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active)"],profcustom_navbar_border:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active) a"],profcustom_navbar_text_color:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active) a"],
toolbar_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar",".forum-list-container .forum-list-header"],profcustom_navbar_toolbar_text_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar",".forum-list-container .forum-list-header"],profcustom_navbarbutton_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],profcustom_navbarbutton_border:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],
profcustom_navbarbutton_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],profile_button_secondary_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profcustom_navbarbuttonsecondary_border:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profcustom_navbarbuttonsecondary_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profile_content_background:["#profileTabs",
"#profileTabs .conversation-list.stream-view .list-item"],profile_content_border:[".profileTabs .tab .list-container","#profileTabs .conversation-list.stream-view"],profile_content_divider_border:[".profileTabs .post-footer-wrapper .post-footer .divider"],profile_section_background:[".profileTabs .section .section-header"],profile_section_border:[".profileTabs .section .section-header"],profile_section_text_color:[".profileTabs .section .section-header"],profile_section_font:[".profileTabs .section .section-header"],
profile_content_primarytext:["#profileTabs.profileTabs","#profileTabs.profileTabs .conversation-list.stream-view .list-item","#profileTabs.profileTabs .widget-content","#profileTabs.profileTabs .post-content"],profile_content_secondarytext:[".profile-widget .post-footer-wrapper .post-footer ul li",".profile-widget .conversation-list.stream-view .list-item-header .info .subscribed",".canvas-layout-container .canvas-widget .widget-content .profileTabs .post-date"],profile_content_linktext:[".profile-widget .widget-tabs.ui-tabs .ui-widget-content a",
".profile-widget .widget-tabs.ui-tabs .ui-widget-content a:active",".profile-widget  .widget-tabs.ui-tabs .ui-widget-content a:visited"],profile_content_font:["#profileTabs"],side_nav_background:[".profile_sidebar_content"],form_dropdown_border:[".profile_sidebar_content"],side_nav_avatar_border:[".profile-sidebar-widget .profileContainer .profile-photo-wrapper .profile-photo"],side_nav_divider_border:[".profile-sidebar-widget .profile-menulist .profile-menulist-item"],profile_userpanel_textcolor:[".profile_sidebar_content",
".profile_sidebar_content .profile-menulist-item a label"],profile_userpanel_linkcolor:[".profile_sidebar_content .profile-menulist-item a .subscriptions-count, .profile_sidebar_content .profile-menulist-item a .subscriptions-count:hover, .profile_sidebar_content .profile-menulist-item a .subscriptions-count:visited"],profile_userpanel_font:[".profile_sidebar_content"],profilesidebar_button_background:[".profile_sidebar_content .button.primary"],profilesidebar_button_border:[".profile_sidebar_content .button.primary"],
profilesidebar_button_text_color:[".profile_sidebar_content .button.primary"],button_primary_text_color:[".profileTabs .button.primary",".profileTabs .button.primary:hover"],button_primary_border:[".profileTabs .button.primary",".profileTabs .button.primary:hover"],profile_button_primary_background:[".profileTabs .button.primary",".profileTabs .button.primary:hover"]},colorTypes={profcustom_navbar_background_active:3,profcustom_navbar_background:3,toolbar_background:3,profile_content_background:3,
profile_section_background:3,side_nav_background:3,profilesidebar_button_background:3,module_tab_border_active:2,module_tab_border:2,button_secondary_border:2,profile_content_border:2,profile_content_divider_border:2,profile_section_border:2,form_dropdown_border:2,side_nav_avatar_border:2,side_nav_divider_border:2,profilesidebar_button_border:2,profcustom_navbar_text_color_active:1,profcustom_navbar_text_color:1,button_secondary_text_color:1,profcustom_navbar_toolbar_text_color:1,profile_section_color:1,
profile_section_text_color:1,profile_content_primarytext:1,profile_content_secondarytext:1,profile_content_linktext:1,profile_userpanel_textcolor:1,profile_userpanel_linkcolor:1,profilesidebar_button_text_color:1,button_primary_text_color:1,button_primary_border:2,profile_button_primary_background:3,profcustom_navbarbutton_color:1,profcustom_navbarbutton_border:2,profcustom_navbarbutton_background:3,profcustom_navbarbuttonsecondary_color:1,profcustom_navbarbuttonsecondary_border:2,profile_button_secondary_background:3},
newSettings={},revertChanges=function(a){$.each(a,function(c,d){targetEl=$("[name="+c+"]");$.each(d,function(b,e){if(e&&""!=e)switch(b){case "color":targetEl.val(e);targetEl.trigger("keyup");break;case "image":setBackgroundImage("",e,c);break;case "family":1<targetEl.length?$.each(targetEl,function(f,g){"family"==$(g).attr("data-type")&&($(g).val(e),$(g).trigger("change"))}):(targetEl.val(e),targetEl.trigger("change"));break;case "size":1<targetEl.length?$.each(targetEl,function(f,g){"size"==$(g).attr("data-type")&&
($(g).val(e),$(g).trigger("change"))}):(targetEl.val(e),targetEl.trigger("change"));break;case "repeat":targetEl=$("[name=repeat_type]"),1<targetEl.length?$.each(targetEl,function(f,g){$(g).attr("data")==c&&($(g).val(e),$(g).trigger("change"))}):(targetEl.val(e),targetEl.trigger("change"))}})})},uploadFromUrl=function(a){var c=$(a.target).closest(".frmBgImageUrl");if(c.length){var d=c.find(".profCustomBgImageUrl");d&&d.val()?(c.find(".js-upload-progress").removeClass("h-hide"),vBulletin.AJAX({call:"/uploader/url",
data:{urlupload:d.val()},success:function(b){b.imageUrl?setBackgroundImage(a,b.imageUrl):vBulletin.error("profile_style_customizations","upload_file_failed")},complete:function(){c.find(".js-upload-progress").addClass("h-hide")},title_phrase:"profile_style_customizations"})):vBulletin.error("profile_style_customizations","upload_file_failed")}},setBgRepeat=function(a){ident=$(a.target).attr("data");repeat=a.target.value;if("undefined"!=typeof cssMappings[ident])for(selectors=cssMappings[ident],addNewSetting(ident,
"repeat",repeat),"undefined"==typeof newSettings[ident].image&&(newSettings[ident].image=$(selectors[0]).css("background-image")),i=0;i<selectors.length;i++)$(selectors[i]).css("background-repeat",repeat)},clearBgImage=function(a){ident=$(a.target).attr("data");if("undefined"!=typeof cssMappings[ident])for(selectors=cssMappings[ident],addNewSetting(ident,"image","none"),i=0;i<selectors.length;i++)$(selectors[i]).css("background-image","none")},clearBgColor=function(a){var c=$(a.target);a=c.attr("data");
c=c.is(":checked");if("undefined"!=typeof cssMappings[a])for(selectors=cssMappings[a],c?(addNewSetting(a,"color","transparent"),val="transparent"):(val="none",c=$('input.colorPicker[name="'+a+'"]').val(),"string"==typeof c&&0===c.indexOf("#")&&(val=c),addNewSetting(a,"color",val)),i=0;i<selectors.length;i++)$(selectors[i]).css("background-color",val)},setBackgroundImage=function(a,c,d){"undefined"!==typeof d?a=d:(a=$(a.target).attr("data"),d=-1==c.indexOf("?")?"?":"&",c='url("'+c+d+"random="+Math.random()+
'")');if("undefined"!=typeof cssMappings[a])for(selectors=cssMappings[a],addNewSetting(a,"image",c),i=0;i<selectors.length;i++)$(selectors[i]).css("background-image",c)};function addNewSetting(a,c,d){newSettings[a]||(newSettings[a]={});newSettings[a][c]=d}
function toggleBgType(a){imgRadio=$(a.target).closest(".profCustomBackgroundEdit").find(".profCustomBgTypeColor");"color"==a.target.value?($(a.target).closest(".profCustomBackgroundEdit").find(".profCustomBgImage").addClass("h-hide"),$(a.target).closest(".profCustomBackgroundEdit").find(".profCustomBgColor").removeClass("h-hide")):($(a.target).closest(".profCustomBackgroundEdit").find(".profCustomBgColor").addClass("h-hide"),$(a.target).closest(".profCustomBackgroundEdit").find(".profCustomBgImage").removeClass("h-hide"))}
function toggleImgSource(a){"file"==a.target.value?($(a.target).closest(".profCustomBackgroundEdit").find(".frmBgImageUrl").addClass("h-hide"),$(a.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile, .ProfCustomBgRepeat").removeClass("h-hide")):"url"==a.target.value?($(a.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile").addClass("h-hide"),$(a.target).closest(".profCustomBackgroundEdit").find(".frmBgImageUrl, .ProfCustomBgRepeat").removeClass("h-hide")):$(a.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile, .frmBgImageUrl, .ProfCustomBgRepeat").addClass("h-hide")}
function updateColorFromComponent(a){addNewSetting($(this).attr("data"),"color",a);$(this).parent().find(".rdProfCustomBgColorClear").prop("checked",!1);if("undefined"!=typeof cssMappings[$(this).attr("data")])for(selector in selectors=cssMappings[$(this).attr("data")],selectors)switch(colorTypes[$(this).attr("data")]){case 1:$(selectors[selector]).css("color",a);break;case 2:$(selectors[selector]).css("border-color",a);break;case 3:$(selectors[selector]).css("background-color",a),$(selectors[selector]).css("background-image",
"none")}}function setFontFamily(a){fontname=$(a.target).find(">option:selected").text();ident=$(a.target).attr("data");addNewSetting(ident,"family",fontname);$(a.target).closest(".fontselectorWrapper").find(".fontDisplay").css("font-family",fontname).html(fontname);if("undefined"!=typeof cssMappings[ident])for(selector in selectors=cssMappings[ident],selectors)$(selectors[selector]).css("font-family",fontname)}
function setFontSize(a){ident=$(a.target).attr("data");$(a.target).closest(".fontselectorWrapper").find(".fontDisplay").css("font-size",a.target.value);addNewSetting(ident,"size",a.target.value);if("undefined"!=typeof cssMappings[ident])for(selector in selectors=cssMappings[ident],selectors)$(selectors[selector]).css("font-size",a.target.value)}function rgb2hex(a){a=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);return"#"+hex(a[1])+hex(a[2])+hex(a[3])}
function rgba2hex(a){a=a.match(/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+)\)$/);var c={};if(0==a[4])c.transparent=!0;else if(1==a[4])c.transparent=!1;else return!1;c.hex="#"+hex(a[1])+hex(a[2])+hex(a[3]);return c}function hex(a){var c="0123456789abcdef".split("");return isNaN(a)?"00":c[(a-a%16)/16]+c[a%16]}
function setCurrentBgValues(a){var c=a.attr("data");if("undefined"!=typeof cssMappings[c]){var d=$(cssMappings[c][0]),b={};let e="";b.color=d.css("background-color");b.image=d.css("background-image");b.repeat=d.css("background-repeat");if("string"==typeof b.image&&"none"!=b.image.substring(0,4))c=b.image.lastIndexOf("/")+1,e=b.image.substr(c,b.image.length-c-2),a.find(".fileText").val(e),""!=b.repeat&&a.find(".ProfCustomBgRepeatType").val(b.repeat);else if("transparent"==b.color)a.find(".rdProfCustomBgColorClear").prop("checked",
!0);else if("string"==typeof b.color){b=b.color;if(0===b.indexOf("rgba")){if(d=rgba2hex(b))b=d.hex,a.find(".rdProfCustomBgColorClear").prop("checked",d.transparent)}else 0===b.indexOf("rgb")&&(b=rgb2hex(b));a.find('input[name="'+c+'"].colorPicker').val(b)}""!=e?a.find(".rdProfCustomBgTypeImage").trigger("click"):a.find(".rdProfCustomBgTypeColor").trigger("click")}}
(function(a){if(!vBulletin.pageHasSelectors([".profileEditContent"]))return!1;a(function(){var c=0;a(".profile_custom_edit .profileTabs").tabs({activate:function(d,b){a().add(b.oldTab).add(b.newTab).find(".b-icon").toggleClass("b-icon--active");b=(d=a(b.newTab).parent().is(".profileNavOuter"))&&a(b.newPanel).find(".ui-tabs").tabs("instance");if(d&&b){d=a(b.element);let e=d.tabs("option","active")||0;b=b.panels[e];a(b).is(":visible")||(d.tabs("option","active",e),a(b).show())}}});a(".profCustomBackgroundEdit").each(function(d){c++;
d=a(".profCustomBgTemplate").clone();let b=a(this);a(d).removeClass("h-hide profCustomBgTemplate");a(d).css("display","block");b.append(d);b.find(".colorPicker").attr("data",b.attr("data"));b.find(".colorPicker").attr("name",b.attr("data"));b.find(".colorPicker").removeClass("template");b.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").off("click").on("click",toggleBgType);b.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").prop("name","profCustomBgType"+c);b.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").off("click").on("click",
toggleImgSource);b.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").attr("name","profCustomBgSrc"+c);b.find(".profCustomBgImageFile, .profCustomBgImageUrl, .rdProfCustomBgColorClear, .rdProfCustomBgImageNone, .ProfCustomBgRepeatType, .profCustomUploadUrl").attr("data",a(this).attr("data"));setCurrentBgValues(b);a(this).find(".profCustomBgImageFile").fileupload({dropZone:"vb-self",url:vBulletin.getAjaxBaseurl()+"/uploader/upload-file",type:"POST",dataType:"json",add:function(e,
f){b.find(".js-upload-progress").removeClass("h-hide");f.submit()},done:function(e,f){f?f.result.errors?"undefined"==typeof f.result.errors[0]?vBulletin.error("profile_style_customizations",f.result.errors):vBulletin.error("profile_style_customizations",f.result.errors[0][0]):f.result.imageUrl?(b.find(".profile-img-option-container .profile-img-option-field input.fileText").val(f.result.filename),setBackgroundImage(e,f.result.imageUrl)):vBulletin.error("profile_style_customizations","unable_to_upload_file"):
vBulletin.error("profile_style_customizations","invalid_server_response_please_try_again")},fail:function(e,f){e="error_uploading_image";var g="error";if(f&&0<f.files.length)switch(f.files[0].error){case "acceptFileTypes":e="invalid_image_allowed_filetypes_are",g="warning"}vBulletin.alert("upload",e,g,function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").trigger("focus")})},always:function(){b.find(".js-upload-progress").addClass("h-hide")}})});a("body").is(".view-mode")&&
(vBulletin_ColorPicker(".colorPicker",{onChange:updateColorFromComponent}),a(".selectCustomProfFontfamily").off("change").on("change",setFontFamily),a(".selectCustomProfFontsize").off("change").on("change",setFontSize),a(".rdProfCustomBgImageNone").off("click").on("click",clearBgImage),a(".rdProfCustomBgColorClear").off("click").on("click",clearBgColor),a(".ProfCustomBgRepeatType").off("change").on("change",setBgRepeat),a(".profCustomUploadUrl").off("click").on("click",uploadFromUrl));a(".profCustomSave").off("click").on("click",
function(){if(a.isEmptyObject(newSettings))vBulletin.error("profile_customization","there_are_no_changes_to_save");else{var d=newSettings;newSettings={};vBulletin.AJAX({call:"/profile/save-stylevar",data:{stylevars:d,userid:pageData.userid},success:function(b){vBulletin.alert("profile_customization","usercss_saved")},title_phrase:"profile_style_customizations",error_phrase:"error_saving_customizations"})}});a(".profCustomRevert").off("click").on("click",function(){var d=[],b=0;a.isEmptyObject(newSettings)?
vBulletin.error("profile_customization","there_are_no_changes_to_revert"):(a.each(newSettings,function(e,f){d[b]=e;b++}),vBulletin.AJAX({call:"/profile/revert-stylevars",data:{stylevars:d,userid:pageData.userid},success:function(e){revertChanges(e)},title_phrase:"profile_style_customizations",error_phrase:"error_saving_customizations"}),newSettings={})});a(".profCustomDefault").off("click").on("click",function(){var d=[],b=0;a.isEmptyObject(newSettings)||a.each(newSettings,function(e,f){d[b]=e;b++});
openConfirmDialog({title:vBulletin.phrase.get("set_to_default"),message:vBulletin.phrase.get("profile_theme_reset_confirmation"),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/profile/reset-default",data:{stylevars:d,userid:pageData.userid},success:function(e){window.location.reload()},title_phrase:"profile_style_customizations",error_phrase:"error_saving_customizations"});newSettings={}}})});a(".profCustomApplyAll").off("click").on("click",function(){vBulletin.AJAX({call:"/profile/save-default",
data:{stylevars:newSettings,userid:pageData.userid},success:function(d){vBulletin.alert("profile_customization","style_applied_as_site_default")},title_phrase:"profile_style_customizations",error_phrase:"error_saving_customizations"})});a(".profCustomCancel").off("click").on("click",function(){a(".profile_custom_edit").addClass("h-hide")})})})(jQuery);
