/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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(c){function n(b,a,e){b=b.parents("#pmFloatingBarContent").hasClass("deletedItems-paginator")?getSelectedMessages():[b.parents(".list-item").data("nodeId")];e.nodeids=b;0<b.length&&vBulletin.AJAX({call:"/ajax/api/node/"+a,data:e,success:function(d){location.reload()}})}function k(b,a,e){if(!b&&(b=c("#private-message-toolbar .deletedItems-paginator .deletedItemsPageTo"),0==b.length))return!1;e||(e=0);var d=b.closest(".deletedItems-paginator"),l=d.find("#maxPageNum").filter(":input[type=hidden]").val(),
p=parseInt(d.find(":input[type=hidden][name=pagenum]").val(),10),r=parseInt(d.find(":input[type=hidden][name=per-page]").val(),10),t=d.find("input[name=routeInfoJson]").val(),u=c("#privateMessageContainer .main-pane .pending-posts-container");a=parseInt(a,10);if(isNaN(a)||isNaN(l)||isNaN(p))return!1;if(1>a||a>l)return b.is(".h-disabled")||vBulletin.error("error","please_enter_a_valid_page_number"),!1;if(a==p&&!e)return!1;var g={};c("#deletedItemsFilters input:checked").each(function(){g[this.name]=
this.value});g.time&&(g.time={from:g.time});vBulletin.AJAX({call:"/ajax/render/privatemessage_deleteditems_main",data:{setCurrentPage:a,setPerPage:r,getPagingInfo:e,options:g,routeInfoJson:t,isAjaxTemplateRenderWithData:!0},success:function(f){u.html(f.template);var m=f=0;a<l?(m=a+1,1<a&&(f=a-1)):f=a-1;d.find(":input[type=hidden][name=pagenum]").val(a);d.find(":input[type=hidden][name=next-page]").val(m);d.find(":input[type=hidden][name=prev-page]").val(f);d.find(".deletedItemsNext").toggleClass("h-disabled",
!m);d.find(".deletedItemsPrev").toggleClass("h-disabled",!f);d.find(".deletedItemsPageTo").val(a);e&&(f=c("#privateMessageContainer .main-pane .pending-posts-container .pending-posts-pageinfo"),d.find("#maxPageNum").filter(":input[type=hidden]").val(parseInt(f.find(".totalpages").val(),10)),d.find(".deletedItemsPageCount").text(parseInt(f.find(".totalpages").val(),10)),c(".folder-list .folder-item.pending-posts .count",$pmWidget).text(parseInt(f.find(".totalcount").val(),10)))}})}c(document).off("click",
".deletedItems-remove").on("click",".deletedItems-remove",function(){n(c(this),"deleteNodes",{hard:1})});c(".deletedItems-restore").off("click").on("click",function(b){n(c(this),"undeleteNodes",{})});var q={Prev:"prev",Next:"next"},h;for(h in q)c(document).off("click","#privatemessagePaging .deletedItems"+h).on("click","#privatemessagePaging .deletedItems"+h,function(b){return function(a){a.preventDefault();a=c(this).closest("#privatemessagePaging").find(':input[type=hidden][name="'+b+'-page"]').val();
k(c(this),a)}}(q[h]));c(document).off("keypress","#privatemessagePaging .deletedItemsPageTo").on("keypress","#privatemessagePaging .deletedItemsPageTo",function(b){if(13==b.keyCode){b.preventDefault();b=c(this);var a=parseInt(b.val(),10);if(isNaN(a))return vBulletin.error("error","please_enter_a_valid_page_number"),!1;k(b,a)}});c("#deletedItemsFilters").trigger("reset").find(".filter-options input").off("click").on("click",function(b){deletedItemsFilter.apply(this)});deletedItemsFilter=function(b){$paginateButton=
c("#private-message-toolbar .deletedItems-paginator .deletedItemsPageTo");if($paginateButton.length)k($paginateButton,1,!0);else{var a={};c(this).closest(".filter-options-list").find("input:checked").each(function(){a[this.name]=c(this).val()});a.time&&(a.time={from:a.time});c(this).prop("checked",!0);a.page=1;a.perpage=pmPerPage;vBulletin.AJAX({call:"/ajax/render/privatemessage_deleteditems_main",data:{options:a,isAjaxTemplateRenderWithData:!0},success:function(e){c("#privateMessageContainer .pending-posts-container").html(e.template);
pmPageNum=1}})}}})(jQuery);
