const i=o=>{const{id:a}=window.FAB_TEMPLATE,{rest_url:e,path:t}=window.FAB_PLUGIN;fetch(e+"fab/v1/add_new_fab",{method:"POST",body:JSON.stringify({id:a,cf7id:o})}).then(n=>n.json()).then(n=>{const c=n.post_id,s=`${t.home_url}/wp-admin/post.php?post=${c}&action=edit`;window.location.href=s})},r=()=>{const{label:o}=window.FAB_TEMPLATE,a=jQuery("<span/>",{class:"fab-container"}).append(jQuery("<button/>",{type:"button",text:o.button,class:"cf7-turn-into-popup ml-2 button button-secondary"})),e=jQuery('#postbox-container-2 input[type="submit"][name="wpcf7-save"]');e.length&&e.after(a.clone());const t=jQuery('#submitpost input[type="submit"][name="wpcf7-copy"]');t.length&&t.after(a.clone())};jQuery(document).ready(function(){const{label:o}=window.FAB_TEMPLATE;new URLSearchParams(window.location.search).get("action")==="edit"&&r(),jQuery(".row-actions .copy").each(function(){const t=jQuery(this).clone(),n=jQuery(this).find("a").attr("href"),s=new URLSearchParams(n).get("post");t.attr("class","turn-into-popup"),t.find("a").text(" | "+o.button),t.find("a").attr("href","#"),t.find("a").attr("data-post-id",s),t.find("a").attr("class","cf7-turn-into-popup"),t.insertAfter(this)}),jQuery(".cf7-turn-into-popup").on("click",function(){let n=new URLSearchParams(window.location.search).get("post");n||(n=jQuery(this).attr("data-post-id")),n&&i(n)})});
//# sourceMappingURL=contact-form-7.min.D4N6s16d.js.map
