{"version":3,"file":"TrackingUTM_FreeClasses.Bm91sSSr.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/r9z2Rz6lbSEvADmocMne/pnu94M5QIWKZ8wAGrB1n/TrackingUTM_FreeClasses.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";const getCookie=name=>{if(typeof document===\"undefined\"){return null;}const value=`; ${document.cookie}`;const parts=value.split(`; ${name}=`);if(parts.length===2)return parts.pop()?.split(\";\").shift()||null;return null;};const formatQueryParams=params=>{const paramsArray=Object.entries(params).map(([key,value])=>`${key}=${value}`);return paramsArray.length>0?\"?\"+paramsArray.join(\"&\"):\"\";};const getUTMParams=()=>{let utmParams={};if(typeof window!==\"undefined\"&&window.location&&window.location.search){const searchParams=new URLSearchParams(window.location.search);for(let[key,value]of searchParams){if(key?.includes(\"utm\")&&!!value){utmParams[key]=value;}}}const cookie=getCookie(\"cookie_utms\");if(cookie){try{const cookieMba=JSON.parse(cookie);const utmKeyMap={source:\"utm_source\",medium:\"utm_medium\",campaign:\"utm_campaign\",variant:\"utm_variant\",country:\"utm_country\",product:\"utm_product\",placement:\"utm_placement\",custmpers:\"utm_custmpers\",page:\"utm_page\"};Object.keys(utmKeyMap).forEach(key=>{const utmKey=utmKeyMap[key];if(cookieMba[key]&&!utmParams[utmKey]){utmParams[utmKey]=cookieMba[key];}});}catch(error){console.error(\"Error parsing cookie_utms:\",error);}}return formatQueryParams(utmParams);};export function withUTMTracking(Component){return({href,...rest})=>{const[utmParams,setUtmParams]=useState(\"\");const[previoussource,setprevioussource]=useState(\"\");useEffect(()=>{const utms=getUTMParams();if(utms.length>0){setUtmParams(utms);}setprevioussource(window.location.pathname);},[]);// Determina el prefijo correcto para previoussource\nconst previousSourcePrefix=utmParams.length>0?\"&\":\"?\";return /*#__PURE__*/_jsx(Component,{\"data-over\":\"withUTMTracking\",...href?{href:href+utmParams+previousSourcePrefix+\"previoussource=\"+previoussource}:{},...rest});};}export function withTags(Component){return props=>{props.className=props.className?`${props.className}  clickinfofreeclasses`:\"clickinfofreeclasses\";return /*#__PURE__*/_jsx(Component,{...props});};}export function withTagsAndUTMTracking(Component){const ComponentWithTags=withTags(Component);const ComponentWithTagsAndUTMTracking=withUTMTracking(ComponentWithTags);return ComponentWithTagsAndUTMTracking;}\nexport const __FramerMetadata__ = {\"exports\":{\"withTagsAndUTMTracking\":{\"type\":\"reactHoc\",\"name\":\"withTagsAndUTMTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUTMTracking\":{\"type\":\"reactHoc\",\"name\":\"withUTMTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTags\":{\"type\":\"reactHoc\",\"name\":\"withTags\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackingUTM_FreeClasses.map"],"mappings":"kIAA6wC,SAAgB,EAAgB,EAAU,CAAC,OAAO,CAAC,OAAK,GAAG,KAAQ,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,GAAG,CAAM,CAAC,EAAe,GAAmBA,EAAS,GAAG,CAAC,MAAc,CAAC,IAAM,EAAK,GAAc,CAAI,EAAK,OAAO,GAAG,EAAa,EAAK,CAAE,EAAkB,EAAO,SAAS,SAAS,EAAG,EAAE,CAAC,CACjjD,IAAM,EAAqB,EAAU,OAAO,EAAE,IAAI,IAAI,OAAoB,EAAK,EAAU,CAAC,YAAY,kBAAkB,GAAG,EAAK,CAAC,KAAK,EAAK,EAAU,EAAqB,kBAAkB,EAAe,CAAC,EAAE,CAAC,GAAG,EAAK,CAAC,EAAI,SAAgB,EAAS,EAAU,CAAC,MAAO,KAAQ,EAAM,UAAU,EAAM,UAAU,GAAG,EAAM,UAAU,wBAAwB,uBAA2C,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,EAAI,SAAgB,EAAuB,EAAU,CAAsH,OAAnC,EAA1D,EAAS,EAAU,CAAyE,4BAD9hB,IAAsC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