elementor.hooks.addAction("panel/open_editor/widget",function(e,t){let o=t.get("widgetType");if(o.split("-").includes("mf")){let t=jQuery(e.el).find("[data-setting=mf_input_name]"),n=Math.floor(9e5*Math.random())+1e5;t.on("input",function(){let e=jQuery(this).val().replace(/[^a-zA-Z0-9_-]/g,"_");jQuery(this).val(e)}),t.blur(()=>{t.val()||(jQuery(t).val(o.concat("_",n)),t.trigger("input"))});const i=jQuery(e.el).find('[data-setting="mf_input_option_text"]'),r=jQuery(e.el).find('[data-setting="mf_input_option_value"]');["mf-checkbox","mf-multi-select","mf-radio","mf-image-select","mf-toggle-select","mf-select"].includes(o)&&(i.on("input",function(){let e=jQuery(this).val().replace(/["]/g,"''");jQuery(this).val(e)}),r.on("input",function(){let e=jQuery(this).val().replace(/["]/g,"''");jQuery(this).val(e)}))}});const uniqueId=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);elementor.hooks.addAction("panel/open_editor/widget",function(e,t,o){"mf-simple-repeater"==t.get("widgetType")&&jQuery(e.el).find(".elementor-repeater-add").length>0&&jQuery(e.el).find(".elementor-repeater-add").on("click",function(){setTimeout(()=>{jQuery(this).closest(".elementor-button").parent().prev().find(".elementor-repeater-fields").last().find('[data-setting="mf_input_repeater_name"]').prop("value","repeater-input-name-"+uniqueId()).trigger("input")},50)})}),document.addEventListener("mousedown",function(e){let t=document.querySelectorAll(".elementor-element--promotion");if(t.length>0)for(let o=0;o<t.length;o++)if(t[o].contains(e.target)){let n=document.querySelector("#elementor-element--promotion__dialog"),i=t[o].querySelector(".icon > i").classList.toString();if(n.querySelectorAll(".metform-dialog-buttons-action").forEach(e=>e.remove()),i.indexOf("metform")>=0){e.stopImmediatePropagation(),n.querySelectorAll(".dialog-buttons-action:not(.metform-dialog-buttons-action)").forEach(e=>e.remove());let t=document.createElement("a"),o=document.createTextNode("Upgrade MetForm");t.setAttribute("href","https://wpmet.com/plugin/metform/pricing/"),t.setAttribute("target","_blank"),t.classList.add("dialog-button","dialog-action","dialog-buttons-action","elementor-button","go-pro","elementor-button-success","metform-dialog-buttons-action"),t.appendChild(o),n.querySelector(".dialog-buttons-wrapper").appendChild(t)}else{n.querySelectorAll(".dialog-buttons-action:not(.metform-dialog-buttons-action)").forEach(e=>e.style.display="");let e=n.querySelector(".metform-dialog-buttons-action");e&&e.remove()}break}});