window.PACDIH=window.PACDIH||{},function(t){"use strict";const e=".pac_dih__image_details";PACDIH.init=function(){PACDIH.imageSwap(),PACDIH.imageEditURL(),PACDIH.moduleLink(),PACDIH.moduleLightBox()},PACDIH.imageSwap=function(){let e=pac_dih_obj.isSSL;t.each(t(".et_pb_image"),(function(i,n){let a=t(n),o=a.data("hover-img-src");if(void 0!==o&&""!==o){let t=a.find(".et_pb_image_wrap > img").attr("src");e&&(o=o.replace("http://","https://"),t=t.replace("http://","https://")),a.mouseover((function(){a.find(".et_pb_image_wrap > img").attr("src",o),a.find(".et_pb_image_wrap > img").attr("srcset",o)})).mouseout((function(){a.find(".et_pb_image_wrap > img").attr("src",t),a.find(".et_pb_image_wrap > img").attr("srcset",t)}))}}))},PACDIH.moduleLink=function(){document.querySelectorAll(`${e}`).forEach((function(t){if(null!==t&&"a"===t.previousElementSibling.nodeName.toLowerCase()){document.querySelector(e).setAttribute("style","cursor: pointer");const i=document.createElement("a");i.setAttribute("href",t.previousElementSibling.getAttribute("href")),i.setAttribute("target",t.previousElementSibling.getAttribute("target")??"_self"),t.parentNode.insertBefore(i,t),i.appendChild(t)}}))},PACDIH.moduleLightBox=function(){jQuery.each(t(e),(function(e,i){t(i).parent().find("a.et_pb_lightbox_image").length>0&&t(i).on("click",(function(t){t.preventDefault();jQuery(this).prev().magnificPopup({mainClass:"mfp-fade",zoom:{enabled:!0,duration:500},type:"image"}).magnificPopup("open")}))}))},PACDIH.imageEditURL=function(){t(document).on("DOMNodeInserted",".media-modal",(function(){let e=t("ul.attachments").find("li.selected");if(e.length>0){let i=e.data("id");if(void 0!==i&&""!==i){let e=`${pac_dih_obj.editAttachmentLabel}`;t(".pac_dih_attachment_edit_url").remove(),t(t(".et-fb-option--upload").get(0)).append(e)}}}));let e=!1;t(document).on("DOMNodeInserted",".et-fb-modal__module-settings .et-fb-form__group",(function(){setTimeout((function(){let i=window.ETBuilderBackendDynamic.pac_dih_attachment_edit_url;if(void 0!==i&&""!==i&&!1===e){let n=`${pac_dih_obj.editAttachmentLabel}`;t(t(".et-fb-option--upload").get(0)).append(n),e=!0}}),50)}))},t(PACDIH.init)}(jQuery);