{"version":3,"file":"WithQueryParams.BZPb2OKD.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/prAOHHvzcLUsUIfZ4Bk9/HAtO8MgkbbB2blO01t03/WithQueryParams.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";export function withQueryParams(Component){return props=>{const[computedLink,setComputedLink]=useState(props.link);useEffect(()=>{const currentQuery=window.location.search;console.log(currentQuery);// Only do the work if we have an original href and there is a query string\nif(props.link&&currentQuery){try{// Create a URL object from the original href\nconst url=new URL(props.link);// Append each query parameter from the current URL\nconst currentParams=new URLSearchParams(currentQuery);currentParams.forEach((value,key)=>{// Adjust logic if you want to avoid duplicates\nurl.searchParams.append(key,value);});// Update state with the new URL\nsetComputedLink(url.toString());}catch(error){console.error(\"Invalid URL provided to the button:\",error);}}},[props.link]);// Pass the computed href back to the Button (or default to original)\nreturn /*#__PURE__*/_jsx(Component,{...props,link:computedLink??props.link});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withQueryParams\":{\"type\":\"reactHoc\",\"name\":\"withQueryParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithQueryParams.map"],"mappings":"kIAAiF,SAAgB,EAAgB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAa,GAAiBA,EAAS,EAAM,KAAK,CAMnM,OANoM,MAAc,CAAC,IAAM,EAAa,EAAO,SAAS,OACtP,GAD6P,QAAQ,IAAI,EAAa,CACnR,EAAM,MAAM,EAAc,GAAG,CAChC,IAAM,EAAI,IAAI,IAAI,EAAM,KAAK,CACT,IAAI,gBAAgB,EAAa,CAAe,SAAS,EAAM,IAAM,CACzF,EAAI,aAAa,OAAO,EAAI,EAAM,EAAG,CACrC,EAAgB,EAAI,UAAU,CAAC,OAAQ,EAAM,CAAC,QAAQ,MAAM,sCAAsC,EAAM,GAAK,CAAC,EAAM,KAAK,CAAC,CACtG,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,GAAc,EAAM,KAAK,CAAC,uBANjC,IAAsC"}