jQuery(document).ready(function(a){let e=!1;new MutationObserver(function(i){a(".attachment-info .details").each(function(){const i=a(this);if(0===i.find(".pluginfamily-promote-imagify").length&&!e){const e=a("#pluginfamily_promote_imagify_uploader_template").html();a(e).appendTo(i)}})}).observe(document.body,{childList:!0,subtree:!0}),a(document).on("click","#pluginfamily_install_imagify",async e=>{e.preventDefault();const i=a("#pluginfamily_install_imagify");i.fadeTo("slow",.5);try{const e=await fetch(wpmedia_pluginfamily.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({action:"install_imagify",_ajax_nonce:wpmedia_pluginfamily.nonce}).toString()}),n=await e.json();n.success&&(i.text(n.data).attr("id",""),window.open(wpmedia_pluginfamily.plugins_page_url,"_blank")||0===a("#pluginfamily_open_plugins_fallback").length&&a("<a>").attr({href:wpmedia_pluginfamily.plugins_page_url,target:"_blank",id:"pluginfamily_open_plugins_fallback"}).text(n.data).insertAfter(i),i.remove())}catch(a){console.error("AJAX error: ",a)}i.fadeTo("slow",1)}),a(document).on("click",".pluginfamily-promote-imagify-dismiss-icon",async i=>{i.preventDefault();const n=a(".pluginfamily-promote-imagify");n.fadeTo("slow",.5);try{await fetch(wpmedia_pluginfamily.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({action:"dismiss_promote_imagify",_ajax_nonce:wpmedia_pluginfamily.nonce}).toString()})}catch(a){console.error("AJAX error: ",a)}n.fadeTo("slow",1,()=>{n.remove(),e=!0})})});