{"version":3,"file":"LinkWithUTM.xL0YRQMs.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/7gtDhy2foYv7Lrdkp19K/5LGHACq8rdfsis6BGZeJ/LinkWithUTM.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useState}from\"react\";export function withForwardParams(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[modifiedLink,setModifiedLink]=useState(props.link);useEffect(()=>{// Only run in browser environment\nif(typeof window!==\"undefined\"&&window.location&&props.link){try{const currentParams=new URLSearchParams(window.location.search);const paramsObj=Object.fromEntries(currentParams);// Only modify if we have parameters to forward\nif(Object.keys(paramsObj).length>0){let finalUrl;if(props.link.startsWith(\"http\")){finalUrl=new URL(props.link);}else if(props.link.startsWith(\"/\")){finalUrl=new URL(props.link,window.location.origin);}else{finalUrl=new URL(props.link,window.location.href);}// Add all current URL parameters to the target link\nObject.entries(paramsObj).forEach(([key,value])=>{finalUrl.searchParams.set(key,value);});setModifiedLink(finalUrl.toString());}}catch(error){// Silently fail and use original link\nconsole.error(\"Error forwarding URL parameters:\",error);}}},[props.link]);const handleClick=e=>{// Call original onClick if it exists\nif(props.onClick){props.onClick(e);}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,link:modifiedLink,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withForwardParams\":{\"type\":\"reactHoc\",\"name\":\"withForwardParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LinkWithUTM.map"],"mappings":"8IAA4F,SAAgB,EAAkB,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAa,GAAiBA,EAAS,EAAM,KAAK,CAAC,MAAc,CAC7P,GAAU,IAAS,QAAa,EAAO,UAAU,EAAM,KAAM,GAAG,CAAC,IAAM,EAAc,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAO,EAAU,OAAO,YAAY,EAAc,CAClL,GAAG,OAAO,KAAK,EAAU,CAAC,OAAO,EAAE,CAAC,IAAI,EAAS,AAA8J,EAA3J,EAAM,KAAK,WAAW,OAAO,CAAW,IAAI,IAAI,EAAM,KAAK,CAAU,EAAM,KAAK,WAAW,IAAI,CAAW,IAAI,IAAI,EAAM,KAAK,EAAO,SAAS,OAAO,CAAgB,IAAI,IAAI,EAAM,KAAK,EAAO,SAAS,KAAK,CAChQ,OAAO,QAAQ,EAAU,CAAC,SAAS,CAAC,EAAI,KAAS,CAAC,EAAS,aAAa,IAAI,EAAI,EAAM,EAAG,CAAC,EAAgB,EAAS,UAAU,CAAC,QAAS,EAAM,CAC7I,QAAQ,MAAM,mCAAmC,EAAM,GAAK,CAAC,EAAM,KAAK,CAAC,CAAC,IAAM,EAAY,GAAG,CAC5F,EAAM,SAAS,EAAM,QAAQ,EAAE,EAAI,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,KAAK,EAAa,QAAQ,EAAY,CAAC,EAAG,sBAL1F,IAAiD"}