jQuery(function(v){varr,h=wp.i18n.__;functionw(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}functionx(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}functionT(e,t,a,o){vars="",n="request-results";x(e),o.length&&(v.each(o,function(e,t){s=s+"<li>"+t+"</li>"}),s="<ul>"+s+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(n+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(n+=" status-request-failed"),e.after(function(){return'<tr class="'+n+'"><th colspan="5"><div class="notice inline notice-alt '+t+'" role="alert"><p>'+a+"</p>"+s+"</div></td></tr>"})}v(".export-personal-data-handle").on("click",function(e){vart=v(this),n=t.parents(".export-personal-data"),r=t.parents("tr"),a=r.find(".export-progress"),i=t.parents(".row-actions"),c=n.data("request-id"),d=n.data("nonce"),l=n.data("exporters-count"),u=!!n.data("send-as-email");functionp(e){vart=h("An error occurred while attempting to export personal data.");w(n,"export-personal-data-failed"),e&&T(r,"notice-error",t,[e]),setTimeout(function(){i.removeClass("processing")},500)}functionm(e){e=Math.round(100*(0<l?e/l:0)).toString()+"%";a.html(e)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),n.trigger("blur"),x(r),m(0),w(n,"export-personal-data-processing"),functiont(o,s){v.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:o,id:c,page:s,security:d,sendAsEmail:u},method:"post"}).done(function(e){vara=e.data;e.success?a.done?(m(o),o<l?setTimeout(t(o+1,1)):setTimeout(function(){vare,t;e=a.url,t=h("This user’s personal data export link was sent."),void0!==e&&(t=h("This user’s personal data export file was downloaded.")),w(n,"export-personal-data-success"),T(r,"notice-success",t,[]),void0!==e?window.location=e:u||p(h("No personal data export file was generated.")),setTimeout(function(){i.removeClass("processing")},500)},500)):setTimeout(t(o,s+1)):setTimeout(function(){p(e.data)},500)}).fail(function(e,t,a){setTimeout(function(){p(a)},500)})}(1,1)}),v(".remove-personal-data-handle").on("click",function(e){vart=v(this),n=t.parents(".remove-personal-data"),r=t.parents("tr"),a=r.find(".erasure-progress"),i=t.parents(".row-actions"),c=n.data("request-id"),d=n.data("nonce"),l=n.data("erasers-count"),u=!1,p=!1,m=[];functionf(){vare=h("An error occurred while attempting to find and erase personal data.");w(n,"remove-personal-data-failed"),T(r,"notice-error",e,[]),setTimeout(function(){i.removeClass("processing")},500)}functiong(e){e=Math.round(100*(0<l?e/l:0)).toString()+"%";a.html(e)}e.preventDefault(),e.stopPropagation(),i.addClass("processing"),n.trigger("blur"),x(r),g(0),w(n,"remove-personal-data-processing"),functiona(o,s){v.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:o,id:c,page:s,security:d},method:"post"}).done(function(e){vart=e.data;e.success?(t.items_removed&&(u=u||t.items_removed),t.items_retained&&(p=p||t.items_retained),t.messages&&(m=m.concat(t.messages)),t.done?(g(o),o<l?setTimeout(a(o+1,1)):setTimeout(function(){vare,t;e=h("No personal data was found for this user."),t="notice-success",w(n,"remove-personal-data-success"),!1===u?!1===p?e=h("No personal data was found for this user."):(e=h("Personal data was found for this user but was not erased."),t="notice-warning"):!1===p?e=h("All of the personal data found for this user was erased."):(e=h("Personal data was found for this user but some of the personal data found was not erased."),t="notice-warning"),T(r,t,e,m),setTimeout(function(){i.removeClass("processing")},500)},500)):setTimeout(a(o,s+1))):setTimeout(function(){f()},500)}).fail(function(){setTimeout(function(){f()},500)})}(1,1)}),v(document).on("click",function(e){vart,a,e=v(e.target),o=e.siblings(".success");if(clearTimeout(r),e.is("button.privacy-text-copy")&&(t=e.closest(".privacy-settings-accordion-panel")).length)try{vars=document.documentElement.scrollTop,n=document.body.scrollTop;window.getSelection().removeAllRange