!function(){let t="satisfiScript",e=["data-url","data-popupId","data-pageId"],r=["popupId","env","cf","extid"];async function i(t){try{let e=new URL("/embed/manifest.json",t),r=await fetch(e.toString(),{cache:"no-store"});if(!r.ok)throw Error(`manifest fetch failed: ${r.status} ${r.statusText}`);let i=await r.json(),n=i?.embedder?.js?.trim();if(!n)throw Error("manifest missing embedder.js path");return n}catch(e){throw Error(`manifest fetch failed (${t}): ${e.message??e}`,{cause:e})}}!async function(){try{let s=function(){let e=document.getElementById(t);if(!e)throw Error("Missing script id="+t);return e}(),c=function(t){let e=t.getAttribute("data-url")||t.getAttribute("src");if(!e)throw Error("Script src/data-url missing");try{return new URL(e,window.location.href)}catch{throw Error("Invalid script src")}}(s);var n=s,a=c;if(!(n?.getAttribute("data-pageId")||n?.getAttribute("data-popupId")||a?.searchParams?.get("popupId"))?.trim())throw Error("popupId required");let d=r.map(t=>{let e=c.searchParams.get(t);return e?`${t}=${e}`:null}).filter(Boolean),u=await i(c.origin);var o=function(r,i,n,a){let o=Object.assign(document.createElement("script"),{type:"text/javascript",id:t+"-bundle",src:function(t,e,r){let i=new URL(e||"",t),n=(r||[]).filter(t=>t?.trim());return n.length&&(i.search="?"+n.join("&")),i.href}(r,i,n)});return e.forEach(t=>{let e=a?.getAttribute(t);null!=e&&o?.setAttribute(t,e)}),o}(c.origin,u,d,s);let l=s.parentNode??document.body??document.head??document.documentElement;s.nextSibling?l.insertBefore(o,s.nextSibling):l.appendChild(o)}catch(t){console.error("[Satisfi Embedder] Load failed:",t?.message??t,t)}}()}();