/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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 error_adding_search_tips_code_x invalid_json_string invalid_search_syntax invalid_server_response_please_try_again search_tag_cloud please_select_past_date please_select_valid_date_range content_type_Text content_type_Gallery content_type_Link content_type_Photo content_type_Poll content_type_PrivateMessage content_type_Video save_as_search_module saved_search_module_as_x search_module_already_exists search_module_not_found please_enter_search_module_name error_saving_search_module_x".split(" "),
[]);
(function(c){if(!vBulletin.pageHasSelectors([".search-fields-widget",".search-results-widget","#search-config-dialog"]))return!1;vBulletin.search=vBulletin.search||{};vBulletin.search.SearchControl=function(p){function m(a){if("undefined"==typeof a){a=x();if(!a)return!1;a=JSON.stringify(a)}f.val(a);b.find(".form_row.form-row-json").removeClass("h-hide-imp").nextAll().hide();r.toggle(!1);t.toggle(!0)}function y(a){if(!b.find(".searchAdvancedFields").is(":visible")){a=x();if(!a)return!1;if(!(a.author||a.channel||
a.keywords||a.tag||a.type||a.date||a.last_visit||a.my_following||a.eventstartdate))return vBulletin.warning("error","error_no_criteria"),!1;b.find(".searchFields_searchJSON").val(JSON.stringify(a))}}function x(){var a={};if(b.find(".searchSwitchToForm").is(":visible")){a=JSON.parse(b.find(".searchFields_searchJSON").val()||"{}");if(0==a.length){vBulletin.warning("error","invalid_json_string");return}return a}var e=b.find(".js-search-keywords");0<e.length&&0<c.trim(e.val()).length&&(a.keywords=c.trim(e.val()));
0<b.find(".searchFields_title_only:checked").length&&(a.title_only=1);0<b.find(".searchFields_starter_only:checked").length&&(a.starter_only=1);0<b.find(".searchFields_myFriends:checked").length?a.author="myFriends":0<b.find(".searchFields_iFollow:checked").length?a.author="iFollow":u&&(e=u.getLabels(),0<e.length&&(a.author=e));0<b.find(".tag-input").length&&(e=b.find(".tag-input").val(),0<e.length&&(e=e.split(","),0<e.length&&(a.tag=e)));if(0<b.find(".searchFields_last_visit:checked").length)a.date=
"lastVisit";else{e={};var h=b.find(".searchFields_from_days");if(0<h.length&&0<c.trim(h.val()).length)e.from=c.trim(h.val());else{var g=b.find(".searchFields_from_date");h=Date.now();if(0<g.length&&0<c.trim(g.val()).length){var d=Date.parse(g.val());if(0>=d)return vBulletin.warning("error","invalid_start_date"),!1;if(d>h)return vBulletin.warning("error","please_select_past_date"),!1;e.from=c.trim(g.val())}g=b.find(".searchFields_to_date");if(0<g.length&&0<c.trim(g.val()).length){var l=Date.parse(g.val());
if(0>=l)return vBulletin.warning("error","invalid_end_date"),!1;if(l>h)return vBulletin.warning("error","please_select_past_date"),!1;if(d&&d>l)return vBulletin.warning("error","please_select_valid_date_range"),!1;e.to=c.trim(g.val())}}c.isEmptyObject(e)||(a.date=e)}d=["eventstartdate","eventenddate"];e=d.length;for(h=0;h<e;h++){l=d[h];g=b.find('[name="searchFields['+l+'][from]"]');g=g.length&&g.val().trim()||"";l=b.find('[name="searchFields['+l+'][to]"]');l=l.length&&l.val().trim()||"";var v={};
g&&(v.from=g);l&&(v.to=l);c.isEmptyObject(v)||(a.eventstartdate=v)}d=b.find(".searchFields_featured");0<d.length&&d.prop("checked")&&(a.featured=1);d=b.find(".searchFields_my_following");0<d.length&&d.prop("checked")&&(a.my_following=1);var z=[];b.find(".searchFields_type:checked").each(function(E,q){z.push(c(q).val())});0<c(z).length&&(a.type=z);if(0<b.find(".searchFields_channel_param:checked").length)a.channel={param:"channelid"};else if(d=b.find("select.searchFields_channel"),0<d.length&&(d=d.val()))a.channel=
d;d=b.find(".searchFields_order_field");e=b.find(".searchFields_order_direction");0<d.length&&0<e.length&&""!=d.val()&&(a.sort=d.val(),""!=e.val()&&(a.sort={},a.sort[d.val()]=e.val()));d=b.find(".searchFields_view");0<d.length&&(a.view=d.val());d=b.find(".searchFields_exclude");0<d.length&&0<c.trim(d.val()).length&&(a.exclude=c.trim(d.val()).split(","));d=b.find(".searchFields_exclude_type");0<d.length&&0<c.trim(d.val()).length&&(a.exclude_type=c.trim(d.val()).split(","));0<b.find('input[name="searchFields[approved_only]"]:checked').length&&
(a.approved_only=1);d=b.find('input[name="searchFields[has_answer]"]:checked');0<d.length&&(a.has_answer=d[0].value);d=b.find('input[name="searchFields[current_user_only]"]:checked');0<d.length&&(a.current_user_only=d[0].value);return a}function A(a,e,h,g){g=a;if("string"==typeof a)try{if(a=JSON.parse(a||"{}"),0==a.length)return vBulletin.warning("error","invalid_json_string"),!1}catch(k){return vBulletin.warning("error","invalid_json_string"),!1}else g=JSON.stringify(a);var d=b.find(".js-search-keywords");
0<d.length&&(d.val(a.keywords||""),delete a.keywords);c.each({".searchFields_myFriends":"myFriends",".searchFields_iFollow":"iFollow"},function(k,n){k=b.find(k);0<k.length&&((n=a.author&&a.author==n)&&delete a.author,k.prop("checked",n))});0<b.find(".searchFields_author").length&&(d=!1,c.isArray(a.author)?d=a.author:a.exactname&&(d=[a.author]),d&&(u.setElements(d),delete a.author,delete a.exactname));d=b.find(".tag-input");if(0<d.length){var l=a.tag||[];Array.isArray(l)||(l=[l]);d.val(l);B.setTags(l);
b.find(".tag-list span").html(l.join(", "));delete a.tag}var v=b.find(".searchFields_last_visit"),z=a.date&&a.date&&"lastVisit"==a.date;0<v.length&&(v.prop("checked",z),z&&delete a.date);c.each({".searchFields_from_date":"from",".searchFields_to_date":"to",".searchFields_from_days":"from"},function(k,n){k=b.find(k);if(0<k.length&&(vBulletin.flatpickr&&vBulletin.flatpickr.getInstance(k)&&(v.is(":checked")?vBulletin.flatpickr.disablePicker(k):vBulletin.flatpickr.enablePicker(k)),!z)){var C="";a.date&&
a.date[n]&&(C=a.date[n],delete a.date[n]);k.val(C)}});c.isEmptyObject(a.date)&&delete a.date;d=["eventstartdate","eventenddate"];l=d.length;for(var E=0;E<l;E++){var q=d[E],G=b.find('[name="searchFields['+q+'][from]"]'),H=b.find('[name="searchFields['+q+'][to]"]');a[q]&&(a[q].to&&H.length&&H.val(a[q].to),a[q].from&&G.length&&G.val(a[q].from));delete a[q]}c.each({".searchFields_featured":"featured",".searchFields_my_following":"my_following",".searchFields_starter_only":"starter_only",".searchFields_title_only":"title_only",
'input[name="searchFields[approved_only]"]':"approved_only"},function(k,n){k=b.find(k);0<k.length&&(k.prop("checked",a[n]?!0:!1),delete a[n])});c.each({'input[name="searchFields[has_answer]"]':"has_answer",'input[name="searchFields[current_user_only]"]':"current_user_only"},function(k,n){k=b.find(k);let C=a[n];k.each((K,D)=>{null==C?D.checked=null!=D.attributes.checked:D.value==C?(delete a[n],D.checked=!0):D.checked=!1})});d=b.find(".searchFields_type_container");if(0<d.length){if(e){var I=d.find(".field-desc");
I.prevAll().remove();c.each(e,function(k,n){"vBForum_PrivateMessage"!=k&&I.before(c('<label><input type="checkbox" name="searchFields[type][]" class="searchFields_type" value="'+k+'" /><span>'+vBulletin.phrase.get("content_type_"+n["class"])+"</span></label>"))})}b.find(".searchFields_type").val(a.type||[]);delete a.type;delete a.exclude_type}e=b.find(".searchFields_channel");0<e.length&&(h&&e.selectBox("options",w(h)),a.channel&&e.selectBox("value",c.makeArray(a.channel)));delete a.channel;h=b.find("select.searchFields_order_direction");
e=b.find("select.searchFields_order_field");var F="",J="";a.sort&&("string"==typeof a.sort?F=a.sort:"object"==typeof a.sort&&c.each(a.sort,function(k,n){F=k;J=n}),delete a.sort);0<h.length&&h.selectBox("value",J);0<e.length&&e.selectBox("value",F);h=b.find("select.searchFields_view");0<h.length&&(h.selectBox("value",a.view||""),delete a.view);if(c.isEmptyObject(a))f.val(g);else return m(g),!1;return!0}function w(a){var e="";c.each(a,function(h,g){e+=c("<option></option>").val(h).html(str_repeat("&nbsp;",
3*g.depth).concat(g.htmltitle));g.channels&&(e+=addChannels(g.channels))});return e}var b=c(p),B=!1,u=!1,r=b.find(".searchSwitchToAdvanced"),t=b.find(".searchSwitchToForm"),f=b.find(".searchFields_searchJSON");this.load=function(){return x()};this.set=function(a,e,h,g){return A(a,e,h,g)};(function(){var a=r.is(":visible"),e=t.is(":visible");a==e&&(r.toggle(!0),t.toggle(!1),b.find(".form_row.form-row-json").addClass("h-hide-imp").nextAll().show());r.off("click").on("click",()=>{m()});t.off("click").on("click",
()=>{A(b.find(".searchFields_searchJSON").val())&&(r.toggle(!0),t.toggle(!1),b.find(".form_row.form-row-json").addClass("h-hide-imp").nextAll().show())});var h=b.find(".advSearchForm");0<h.length&&h.submit(y);B=new vBulletin.tagEditor.instance("{0}-searchFields_tag".format(p.replace(/#/g,".")),!0);a=b.find(".searchFields_author");0<a.length&&(u=new vBulletin_Autocomplete(a,{apiClass:"user",containerClass:"entry-field h-clearfix"}));b.find(".js-search-keywords").off("keydown").on("keydown",function(g){13==
g.which&&0<h.length&&h.submit()});b.find(".searchFields_last_visit").off("click").on("click",function(g){b.find(".datefield").prop("disabled",c(this).prop("checked"));c(this).is(":checked")?(vBulletin.flatpickr.disablePicker(b.find(".searchFields_from_date")),vBulletin.flatpickr.disablePicker(b.find(".searchFields_to_date"))):(vBulletin.flatpickr.enablePicker(b.find(".searchFields_from_date")),vBulletin.flatpickr.enablePicker(b.find(".searchFields_to_date")))});b.find(".searchFields_channel_param").off("click").on("click",
function(g){c(this).prop("checked")?b.find(".searchFields_channel").selectBox("disable"):b.find(".searchFields_channel").selectBox("enable")});b.find(".search-tips").off("click").on("click",function(g){c(".search-tips-dialog").first().dialog({title:vBulletin.phrase.get("search_tips"),autoOpen:!1,modal:!0,resizable:!1,closeOnEscape:!0,showCloseButton:!0,width:500,dialogClass:"dialog-container search-tips-dialog-container dialog-box"}).dialog("open");g.stopPropagation();return!1});b.find(".searchFields_channel").selectBox();
b.find(".searchFields_order_field").selectBox();b.find(".searchFields_order_direction").selectBox();b.find(".searchFields_view").selectBox()})()};c(function(){var p=c("#advancedSearchFields"),m=c(".search-results-widget");vBulletin.truncatePostContent(m);if(0<p.length){var y=p.find(".searchFields_from_date"),x=p.find(".searchFields_to_date"),A=new Date;if(y.data("vb-flatpicker-initialized"))vBulletin.flatpickr.getInstance(y).set("maxDate",A);else y.one("vb-flatpicker-initialized",function(){vBulletin.flatpickr.getInstance(c(this)).set("maxDate",
A)});if(x.data("vb-flatpicker-initialized"))vBulletin.flatpickr.getInstance(x).set("maxDate",A);else x.one("vb-flatpicker-initialized",function(){vBulletin.flatpickr.getInstance(c(this)).set("maxDate",A)});y=new vBulletin.search.SearchControl("#advancedSearchFields");searchJSONStr=p.find(".searchFields_searchJSON").val();0<searchJSONStr.length&&y.set(searchJSONStr,!1,!1,!0)}var w=c(".sort-controls",m);0<w.length&&(w.find(".searchFields_order_field").selectBox().change(function(){var f=b.find(".searchResults_searchJSON").val()||
"{}";f=JSON.parse(f);f.sort={};f.sort[c(this).val()]=w.find(".searchFields_order_direction").selectBox().val();b.find(".searchResults_searchJSON").val(JSON.stringify(f));c(".resultSearchForm").submit()}),w.find(".searchFields_order_direction").selectBox().change(function(){var f=b.find(".searchResults_searchJSON").val()||"{}";f=JSON.parse(f);f.sort={};f.sort[w.find(".searchFields_order_field").selectBox().val()]=c(this).val();b.find(".searchResults_searchJSON").val(JSON.stringify(f));c(".resultSearchForm").submit()}),
w.removeClass("h-invisible"));var b=c(".search-controls",m);if(0<b.length){var B=!1,u=!1;p=b.find(".searchFields_author");0<p.length&&(B=new vBulletin_Autocomplete(p,{apiClass:"user",containerClass:"entry-field h-clearfix"}),b.find(".search-controls-members .removable-element .element-text").each(function(f,a){B.addElement(c(a).html())}));0<b.find(".searchResultTagEditor").length&&(u=new vBulletin.tagEditor.instance(".search-controls .searchResultTagEditor",!0),b.find(".search-controls-tags .removable-element .element-text").each(function(f,
a){u.addTag(c(a).html())}));b.find("button").off("click").on("click",function(f){f=b.find(".searchResults_searchJSON").val()||"{}";f=JSON.parse(f);switch(c(this).val()){case "keywords":f.keywords=b.find(".js-search-keywords").val();f.title_only=b.find(".searchFields_title_only").is(":checked");break;case "author":f.author=B.getLabels();f.starter_only=b.find(".searchFields_starter_only").is(":checked");break;case "tags":f.tag=u.getTags();break;default:return}b.find(".searchResults_searchJSON").val(JSON.stringify(f));
c(".resultSearchForm").submit()});b.find(".removable-element .element-x").off("click").on("click",function(f){f=b.find(".searchResults_searchJSON").val()||"{}";f=JSON.parse(f);var a=c(this).parents(".search-control-popup");if(a.hasClass("search-controls-members")){c(this).parents(".removable-element").remove();var e=[];a.find(".removable-element .element-text").each(function(g,d){e.push(c(d).html())});f.author=e;0==e.length&&delete f.author}if(a.hasClass("search-controls-tags")){c(this).parents(".removable-element").remove();
var h=[];a.find(".removable-element .element-text").each(function(g,d){h.push(c(d).html())});f.tag=h;0==h.length&&delete f.tag}b.find(".searchResults_searchJSON").val(JSON.stringify(f));c(".resultSearchForm").submit()})}vBulletin.inlinemod&&"function"==typeof vBulletin.inlinemod.init&&vBulletin.inlinemod.init(m);vBulletin.conversation.initContentEvents(m);m.off("click",".js-comment-entry__post").on("click",".js-comment-entry__post",function(f){vBulletin.conversation.postComment.apply(this,[f,function(a){location.reload()}])});
p="undefined"!=typeof m.data("keywords")?m.data("keywords").toString():"";if(0<p.length){var r;c(p.split(" ")).each(function(f,a){r=a.toUpperCase();"OR"!=r&&"AND"!=r&&(c(".post-header",m).highlight(a),c(".searchFields_title_only",m).prop("checked")||c(".post-content",m).highlight(a))})}if(1==m.length){var t=c(".pagenav-form",m).attr("action");t&&c(".js-pagenav .js-pagenav-button",m).each(function(){var f=c(this),a=f.prop("href");(!a||pageData.baseurl&&a==pageData.baseurl)&&f.prop("href",t+"&p="+parseInt(f.data("page"),
10))})}})})(jQuery);
