/*! This file is auto-generated */
jQuery(document).ready(function(f){var h=window.privacyToolsL10n||{};function g(e,t){e.children().addClass("hidden"),e.children("."+t).removeClass("hidden")}function x(e){e.removeClass("has-request-results"),e.next().hasClass("request-results")&&e.next().remove()}function w(e,t,a,n){var o="",r="request-results";x(e),n.length&&(f.each(n,function(e,t){o=o+"<li>"+t+"</li>"}),o="<ul>"+o+"</ul>"),e.addClass("has-request-results"),e.hasClass("status-request-confirmed")&&(r+=" status-request-confirmed"),e.hasClass("status-request-failed")&&(r+=" status-request-failed"),e.after(function(){return'<tr class="'+r+'"><th colspan="5"><div class="notice inline notice-alt '+t+'"><p>'+a+"</p>"+o+"</div></td></tr>"})}f(".export-personal-data-handle").click(function(e){var r=f(this),s=r.parents(".export-personal-data"),i=r.parents("tr"),n=i.find(".export-progress"),t=s.data("request-id"),d=s.data("nonce"),c=s.data("exporters-count"),l=!!s.data("send-as-email");function u(e){g(s,"export-personal-data-failed"),e&&w(i,"notice-error",h.exportError,[e])}function p(e){var t=0<c?e/c:0,a=Math.round(100*t).toString()+"%";n.html(a)}e.preventDefault(),e.stopPropagation(),s.blur(),x(i),p(0),g(s,"export-personal-data-processing"),function a(n,o){f.ajax({url:window.ajaxurl,data:{action:"wp-privacy-export-personal-data",exporter:n,id:t,page:o,security:d,sendAsEmail:l},method:"post"}).done(function(e){var t=e.data;e.success?t.done?n<c?(p(n),setTimeout(a(n+1,1))):function(e){var t=h.emailSent;g(s,"export-personal-data-success"),w(i,"notice-success",t,[]),r.hide(),void 0!==e?window.location=e:l||u(h.noExportFile)}(t.url):setTimeout(a(n,o+1)):u(e.data)}).fail(function(e,t,a){u(a)})}(1,1)}),f(".remove-personal-data-handle").click(function(e){var r=f(this),s=r.parents(".remove-personal-data"),i=r.parents("tr"),n=i.find(".erasure-progress"),t=s.data("request-id"),d=s.data("nonce"),c=s.data("erasers-count"),l=!1,u=!1,p=[];function m(){g(s,"remove-personal-data-failed"),w(i,"notice-error",h.removalError,[])}function v(e){var t=0<c?e/c:0,a=Math.round(100*t).toString()+"%";n.html(a)}e.stopPropagation(),s.blur(),x(i),v(0),g(s,"remove-personal-data-processing"),function a(n,o){f.ajax({url:window.ajaxurl,data:{action:"wp-privacy-erase-personal-data",eraser:n,id:t,page:o,security:d},method:"post"}).done(function(e){var t=e.data;e.success?(t.items_removed&&(l=l||t.items_removed),t.items_retained&&(u=u||t.items_retained),t.messages&&(p=p.concat(t.messages)),t.done?n<c?(v(n),setTimeout(a(n+1,1))):function(){var e=h.noDataFound,t="notice-success";g(s,"remove-personal-data-success"),!1===l?!1===u?e=h.noDataFound:(e=h.noneRemoved,t="notice-warning"):!1===u?e=h.foundAndRemoved:(e=h.someNotRemoved,t="notice-warning"),w(i,t,e,p),r.hide()}():setTimeout(a(n,o+1))):m()}).fail(function(){m()})}(1,1)}),f(document).on("click",function(e){var t,a,n,o=f(e.target);if(o.is("button.privacy-text-copy")&&((a=(t=o.parent().parent()).find("div.wp-suggested-text")).length||(a=t.find("div.policy-text")),a.length))try{window.getSelection().removeAllRanges(),n=document.createRange(),a.addClass("hide-privacy-policy-tutorial"),n.selectNodeContents(a[0]),window.getSelection().addRange(n),document.execCommand("copy"),a.removeClass("hide-privacy-policy-tutorial"),window.getSelection().removeAllRanges()}catch(e){}})});