const urlParams=new URLSearchParams(window.location.search),url=decodeURIComponent(urlParams.get("src")),allow=filterAllow(urlParams.get("allow")),sandbox=filterSandbox(urlParams.get("sandbox"));let iframe=document.createElement("iframe");function filterAllow(e){const a=["clipboard-write","autoplay","microphone"];return e?e.split(";").filter((e=>a.includes(e))).join(";"):""}function filterSandbox(e){if(!e)return"";const a=["allow-downloads","allow-forms","allow-modals","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-same-origin","allow-scripts"];return e.split(" ").filter((e=>a.includes(e))).join(" ")}function applyCss(e,a){const n=document.getElementById(e),t=n||document.createElement("style");t.id=e,t.innerText=a||"";const l=document.getElementsByTagName("head")[0];l&&!n&&l.appendChild(t)}function ensureValidUrl(e){return e&&"string"==typeof e&&e.includes("%")?e.replace(/%(?![0-9a-fA-F]{2})/g,"%25"):e}iframe.src=ensureValidUrl(url),iframe.id="definer-iframe-inner",iframe.name=window.name,iframe.style.width="100%",iframe.style.height="100%",iframe.style.border="none",allow&&(iframe.allow=allow),sandbox&&(iframe.sandbox=sandbox),document.addEventListener("DOMContentLoaded",(function(){document.body.appendChild(iframe)})),window.addEventListener("message",(e=>{if("setCssVariables"===e.data.type){const a=e.data.value||{};applyCss("lumetrium-theme",`:root { ${Object.entries(a).reduce(((e,[a,n])=>`${e} ${a}: ${n};`),"")} }`)}else window.parent.postMessage(e.data,"*")}));