function loadJQuery(t){var e;void 0===window.jQuery?((e=document.createElement("script")).src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js",e.integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT",e.crossOrigin="anonymous",e.onload=function(){window.$=window.jQuery.noConflict(),t()},e.onerror=function(){console.error("Failed to load jQuery")},document.head.appendChild(e)):t()}function handleSetupCustomEvent(){var o="/admin/apps/"+ot_feature_settings.app_name,t=ot_feature_settings?.app_root_url||"https://apps.omegatheme.com/shopify/facebook-multi-pixels",e=t+"https://cdn.shopify.com/images/custom-event/menuIcon-black.png",n=t+"https://cdn.shopify.com/images/custom-event/qaIcon-black.png",i=t+"https://cdn.shopify.com/images/custom-event/shareIcon-black.png",l=t+"https://cdn.shopify.com/images/custom-event/shareIcon-white.png",s=t+"https://cdn.shopify.com/images/custom-event/tickIcon-blue.png",t=($("body").append(` `),$("body").append(`
.

Click the middle of the highlighted button to set up your event

(scroll down to see buttons)

`),$(".event_content").append(`
Custom Event Setup
Tracking button

No button chosen

`),document.querySelector("#ot-fb__backdrop-loading-custom-event"));t&&(t.style.display="none",console.log("Hide loading event builder!"));let a=document.getElementById("ot_fb_modal");e=document.getElementById("ot-close");let r=document.getElementById("ot_fb_modal_notification"),c=document.getElementById("otIconShare"),d=document.getElementById("ot_close_button"),p=document.getElementById("ot_fb_backDrop");n=document.getElementById("ot_track_button");let u=document.querySelectorAll("a:not(#tutorial):not(#ot-close), button:not(#ot_track_button):not(#ot_close_button)");var g,b,m,y,x;document.getElementById("ot_no_button_text");let _=JSON.stringify({}),f=_;function h(t){(t=t||window.event).preventDefault(),y=t.clientX,x=t.clientY,document.onmouseup=k,document.onmousemove=v}function v(t){(t=t||window.event).preventDefault(),b=y-t.clientX,m=x-t.clientY,y=t.clientX,x=t.clientY,g.style.top=g.offsetTop-m+"px",g.style.left=g.offsetLeft-b+"px"}function k(){document.onmouseup=null,document.onmousemove=null}g=a,x=y=m=b=0,document.getElementById(g.id)?document.getElementById(g.id).onmousedown=h:g.onmousedown=h,d.onclick=async()=>{var t=window.location.search,t=new URLSearchParams(t),e=t.get("cta"),t=t.get("custom");ot_endPointUrl;p.style.display="none",a.style.display="none",f=encodeURIComponent(f),w(u),window.open(`https://${Shopify.shop}${o}?redirect-action=custom-events&otStoreLanguage=en&cta=${e}&custom=${t}&button_fires=`+f,"_self")},e.onclick=()=>{r.style.display="none"},n.onclick=()=>{$("#ot_no_button_text").replaceWith(`

No button chosen

`),d.style.backgroundColor="#e6e5e5",d.style.boxShadow="none",d.style.pointerEvents="none",d.style.color="#727272",c.setAttribute("src",i),"undefined"!=typeof OMGRFQConfigs&&(OMGRFQConfigs.stopPropagation=!0),u.forEach(n=>{$(n).unbind("click"),n.style.border="2px #1877F2 solid",n.style.cursor="pointer",n.style.boxShadow="0px 0px 6px #1877F2",n.style.opacity=1,n.style.backgroundImage="unset",n.style.backgroundRepeat="unset",n.style.backgroundPosition="unset",p.style.zIndex=-1,p.style.backgroundColor="rgba(0, 0, 0, 0.4)",p.style.position="fixed",p.style.display="block",n.style.zIndex=400,f=_,$(n).off("click");$(n).on("click",function(t){t.stopPropagation(),t.preventDefault(),console.log("Class of dom click: ",t.target.classList.value),console.log("ID of dom click: ",t.target.id),d.style.backgroundColor="#1877F2",d.style.boxShadow="0px 8px 15px rgba(0, 0, 0, 0.1)",d.style.pointerEvents="auto",d.style.color="white",c.setAttribute("src",l),n.style.pointerEvents="unset",n.style.border="2px red solid",n.style.backgroundImage=`url(${s})`,n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="top right",n.style.backgroundSize="1em",p.style.zIndex=600,p.style.backgroundColor="rgba(0, 0, 0, 0)",p.style.position="fixed",p.style.top=0,p.style.right=0,p.style.bottom=0,p.style.left=0,p.style.display="block",n.classList.add("event_selected"),listEventTemp=document.querySelectorAll("a:not(.tutorial):not(.event_selected), button:not(#ot_track_button):not(#ot_close_button):not(.event_selected)"),w(listEventTemp),n.classList.remove("event_selected");var e=n.textContent?.trim().length?n.textContent?.trim().replace(/\s+/g,"_"):n.getAttribute("aria-label")?.trim().replace(/ /g,""),o=t.target.textContent?.trim().length?t.target.textContent?.trim().replace(/\s+/g," "):"",t=(t.target.classList.value.trim().length?"."+t.target.classList.value.trim().replace(/\s+/g,"."):"")+(t.target.id.trim().length?"#"+t.target.id.trim():"");return f=JSON.stringify({button_fires_by_text:o,button_fires_by_class_id:t,button_fires_label:e}),console.log("button_fires",JSON.parse(f)),$("#ot_no_button_text").replaceWith(`

${e}

`),!1})})};let w=t=>{t.forEach(t=>{t.style.border="unset",t.style.boxShadow="unset",t.style.cursor="unset",t.style.opacity="unset",t.style.backgroundImage="unset",t.style.backgroundRepeat="unset",t.style.backgroundPosition="unset"})}}function includeSetUpEventPage(){var t=sessionStorage.getItem("OT_FACEBOOK_EVENT_SETUP"),e=ot_getUrlParam("otCustomEvent");"show"!=t&&"1"!=e||(sessionStorage.setItem("OT_FACEBOOK_EVENT_SETUP","show"),handleSetupCustomEvent())}loadJQuery(includeSetUpEventPage);