{"version":3,"file":"Form.DRCF_Mpr.mjs","names":["url"],"sources":["https:/framerusercontent.com/modules/kuMpOglNYyZNzAu4WX4k/TkrJqnuy53l4gNL6NsRx/Form.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function WebAppEmbed({label,lang}){const[domain,setDomain]=React.useState(\"\");const[iframeHeight,setIframeHeight]=React.useState(\"100%\");React.useEffect(()=>{// This code runs only on the client.\nconst hostname=window.location.hostname;const cleanHostname=hostname.replace(/^www\\./,\"\");const extractedDomain=cleanHostname.split(\".\")[0];setDomain(extractedDomain);console.log(\"Hostname:\",hostname);console.log(\"Cleaned Hostname:\",cleanHostname);console.log(\"Extracted Domain:\",extractedDomain);const handleMessage=event=>{if(event.data?.type===\"heightUpdate\"){setIframeHeight(event.data.height+\"px\");}};window.addEventListener(\"message\",handleMessage);return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);React.useEffect(()=>{if(domain){const url=`https://forms.scaile.it/?label=${label}&lang=${lang}&port=${domain}`;const iframe=document.getElementById(\"embeddedWebApp\");if(iframe){iframe.onload=()=>{// Post message to the iframe to request height\niframe.contentWindow.postMessage({type:\"requestHeight\"},\"*\");};}}},[domain,label,lang]);// Only render iframe if domain is computed.\nif(!domain)return null;const url=`https://forms.scaile.it/?label=${label}&lang=${lang}&port=${domain}`;console.log(\"Constructed URL:\",url);return /*#__PURE__*/_jsx(\"iframe\",{id:\"embeddedWebApp\",src:url,style:{width:\"100%\",height:iframeHeight,border:\"none\"},title:\"Embedded Web App\"});}WebAppEmbed.defaultProps={label:\"general\",lang:\"EN\"};addPropertyControls(WebAppEmbed,{label:{type:ControlType.String,title:\"Label\"},lang:{type:ControlType.String,title:\"Lang\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"WebAppEmbed\":{\"type\":\"reactComponent\",\"name\":\"WebAppEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\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