jQuery(document).ready(function(t){let e=t("#cdp-purl").val(),i=[];function o(){setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:token}).done(()=>{delete i[i.findIndex(t=>t===token)]}).fail(()=>{o(token)})},500*i.length)}function n(){let e=t(".cdp-dd-item").length,i=t(".cdp-dd-d").length,o=t(".cdp-dd-ud").length;i<=0?(t(".cdp-done-notis, .cdp-done-notis").addClass("cdp-noti-hide"),t(".cdp-done-hr").hide()):(t(".cdp-done-notis, .cdp-done-notis").removeClass("cdp-noti-hide"),t(".cdp-done-hr").show()),o<=0?(t(".cdp-undone-notis, .cdp-undone-notis").addClass("cdp-noti-hide"),t(".cdp-undone-hr").hide()):(t(".cdp-undone-notis, .cdp-undone-notis").removeClass("cdp-noti-hide"),t(".cdp-undone-hr").show()),e<=0?t(".cdp-admin-bar-noti").addClass("cdp-noti-hide"):t(".cdp-admin-bar-noti").removeClass("cdp-noti-hide"),t(".cdp-notis-counter").text(t(".cdp-bnew-notis").length)}if(t("body").on("click",".cdp-notification .cdp-times-button",t.cdpRemoveNotifiaction),t("body").on("mouseover",".cdp-bnew-notis",function(){let e=parseInt(t(".cdp-notis-counter").text()),n=t(".cdp-bnew-notis").length,s=t(this).attr("data-token");t(this).hasClass("cdp-bnew-notis")&&e-1>=0&&(t(this).removeClass("cdp-bnew-notis"),t(".cdp-notis-counter").text(e-1));(e>0||n>0)&&(i.push(s),setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:s}).done(()=>{delete i[i.findIndex(t=>t===s)]}).fail(()=>{o()})},500*i.length))}),t("body").on("mouseover",".cdp-dropdown-left",function(){if(!t(this).hasClass("tooltipstered")){let e=t(t(this).parents(".cdp-dd-d")[0]),i=e.attr("data-fdate");if(fdate=e.attr("data-ftext"),!fdate)return;i=i?`
${i}`:"",t(this).tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"left",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:`${fdate}${i}`,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t(this).tooltipster("open")}}),t("body").on("click",".cdp-dropdown-clear-all-notis",function(e){e.preventDefault(),t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"clear_crons"}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status){let e=t(".cdp-dd-item");e.hide(300),setTimeout(()=>{e.remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTasksCleared)}else"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTasksUpdateIssue)}).fail(e=>{t.cdpNotification("error",cdpGlobalJS.strTasksUpdateIssue2)})}),t("body").on("click",".cdp-noti-hide-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_hide_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTaskHide)):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTaskHideIssue)}).fail(()=>{t.cdpNotification("error",cdpGlobalJS.strTaskHideIssue2)})}),t("body").on("click",".cdp-noti-kill-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_kill_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTaskKill)):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTaskKillIssue)}).fail(()=>{t.cdpNotification("error",cdpGlobalJS.strTaskKillIssue2)})}),t("body").on("click",".cdp-review-button",function(){function e(){t("#cdp-review-notice").css({"max-height":`${t("#cdp-review-notice").height()}px`,opacity:1}),t("#cdp-review-notice").animate({"max-height":"0px",opacity:0},300)}function i(i){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"review_dismiss",decision:i}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),"success"!=i.status&&t.cdpNotification("warning",cdpGlobalJS.strDissmisIssue),e()}).fail(i=>{t.cdpNotification("error",cdpGlobalJS.strDissmisRequestIssue),e()})}"cdp-review-review"==t(this).attr("id")?(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewReview)):"cdp-review-already"==t(this).attr("id")?(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewAlready)):"cdp-review-later"==t(this).attr("id")?(i("remind"),t.cdpNotification("success",cdpGlobalJS.strReviewLater)):(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewDefault))}),t("body").on("mouseenter","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:1})}),t("body").on("mouseleave","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:0})}),t(".cdp-copy-loader-overlay").length>0&&t(".cdp-copy-loader-overlay").prependTo("body"),t("#cdp-show-copy-banner").length>0&&(t(".cdp-copy-alert-success").prependTo("body"),setTimeout(()=>{"-28"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3)},110)),t(".cdp-preloader-c").hasClass("cdp_is_cool_installed")&&setTimeout(()=>{t.cdpNotification("info",cdpGlobalJS.strCDPInstallSuccess,3e3)},500),"undefined"!=typeof pagenow&&["toplevel_page_copy-delete-posts","plugins"].includes(pagenow)){let i=`background:url('${`${e}/assets/imgs/stars.gif`}')`;t('[data-slug="copy-delete-posts-premium"]').find("strong").html(''+cdpGlobalJS.strCDPInfo+` `+cdpGlobalJS.strCDPInfoPremium+"")}t.cdpTooltipsTop(),t("#cdp-review-notice").find(".notice-dismiss").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!1,distance:-4,side:"top",contentAsHTML:!0,maxWidth:800,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:cdpGlobalJS.strHideBannerNow,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-banner","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t("#cdp-copy-modal-global").length>0&&t("#cdp-copy-modal-global").appendTo("body")}),function(t){t.extend({cdpNotification:function(e="default",i=cdpGlobalJS.strErrWithNotif,o=7e3){t(".cdp-notification-box").length<=0&&t("body").prepend(t('
')),e="default"==e?"":"success"==e?" is-success":"warning"==e?" is-warning":"error"==e?" is-danger":" is-info";let n=Math.floor(Math.random()*Math.floor(64e3)),s=``;t(".cdp-notification-box").prepend(s);let c=t(`#ntf-${n}`);c.css({opacity:0,display:"block"});let d=c.outerWidth();c.outerHeight();c.css({right:"-35vw","font-size":"0px",width:0,padding:0,opacity:"0"}),c.animate({right:"15px",width:d,padding:"1rem 2rem 1rem 1.5rem",opacity:"1"},{duration:200,queue:!1}),c.animate({"font-size":"16px"},{duration:300,queue:!1}),setTimeout(()=>{t(`#ntf-${n}`).css({width:""})},250),setTimeout(()=>{c.animate({"font-size":"0px"},{duration:200,queue:!1}),c.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){c.remove()})},o)},cdpRemoveNotifiaction:function(){let e=t(this).parents(".cdp-notification");e.animate({"font-size":"0px"},{duration:200,queue:!1}),e.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){e.remove()})},tooltipReposition:function(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)},cdpTooltipsTop:function(){t(".cdp-tooltip-top").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"top",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}})},isJsonString:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return!0}return!1}return!0},cdpReverseString:function(e){return"string"==typeof e?""===e?"":t.cdpReverseString(e.substr(1))+e.charAt(0):e},cdpParse:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return JSON.parse(e)}return!1}return JSON.parse(e)},cdpModal:function(e){let i;(i=t("string"==typeof e?`#${e}`:`#${t(this).attr("data-modal-name")}`)).is(":hidden")&&($content=t(i.find(".cdp-modal-content")),i.css({opacity:0}),$content.css({opacity:0,top:"60%"}),i.show(),i.animate({opacity:1},300),$content.animate({opacity:1,top:"50%"},300))},cdpModalClose:function(e){let i,o=e.target,n="string"==typeof e;(o&&(t(o).hasClass("cdp-modal-times")||t(o).hasClass("cdp-modal"))||n)&&((i=n?t(`#${e}`):t(this).hasClass("cdp-modal")?t(this):t(this).parents(".cdp-modal")).is(":hidden")||($content=t(i.find(".cdp-modal-content")),i.animate({opacity:0},300),$content.animate({opacity:0,top:"60%"},300,function(){i.hide()})))}})}(jQuery);