{"version":3,"file":"Cookies.BlVBisjc.mjs","names":["CookieScriptCookie"],"sources":["https:/framerusercontent.com/modules/ndZ1po3pTvtryXNx2ESR/oiLmgJSCULCLJu8Nj3SF/Cookies.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const COOKIE_SCRIPT_ACCEPT=\"accept\";const getCookieValue=name=>{if(!document){console.log(\"no document found - cant extract cookies consent value\");return;}const match=document.cookie.match(\"(^|;)\\\\s*\"+name+\"\\\\s*=\\\\s*([^;]+)\");return match?match.pop():null;};const useStore=createStore({visible:false});export function withCookie(Component){return props=>{const[store,setStore]=useStore();const loadTwitterPixel=()=>{console.log(\"Cookie - init Twitter Pixel\");(function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);},s.version=\"1.1\",s.queue=[],u=t.createElement(n),u.async=true,u.src=\"//static.ads-twitter.com/uwt.js\",a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a));})(window,document,\"script\");twq(\"init\",\"nw02q\");twq(\"track\",\"PageView\");};return /*#__PURE__*/_jsx(Component,{...props,onAccept:e=>{console.log(\"Cookie - onAccept\");console.log(store.visible);setStore({visible:true});localStorage.setItem(\"cookieVisible\",\"true\");loadTwitterPixel()// Carga el Pixel de Twitter al aceptar\n;},onDismiss:e=>{console.log(\"Cookie - onDismiss\");console.log(\"onDismiss\",e);setStore({visible:false});localStorage.setItem(\"cookieVisible\",\"false\");removeNonEssentialCookies();},onReject:e=>{console.log(\"Cookie - onReject\");console.log(\"onReject\",e);setStore({visible:false});localStorage.setItem(\"cookieVisible\",\"false\");removeNonEssentialCookies();}});};}function removeNonEssentialCookies(){const cookies=document.cookie.split(\"; \");for(let c=0;c<cookies.length;c++){const cookie=cookies[c].split(\"=\")[0];if(![\"essentialCookie1\",\"essentialCookie2\"].includes(cookie)){document.cookie=`${cookie}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;}}}export function updateVisibility(Component){return props=>{const[store,setStore]=useStore();useEffect(()=>{const CookieScriptCookie=getCookieValue(\"CookieScriptConsent\");const parsedCookieScriptCookie=JSON.parse(CookieScriptCookie);const initialVisibility=parsedCookieScriptCookie?.action===COOKIE_SCRIPT_ACCEPT;setStore({visible:initialVisibility});const handleStorageChange=()=>{const CookieScriptCookie=getCookieValue(\"CookieScriptConsent\");const parsedCookieScriptCookie=JSON.parse(CookieScriptCookie);const visible=parsedCookieScriptCookie?.action===COOKIE_SCRIPT_ACCEPT;setStore({visible});};document?.addEventListener(\"storage\",handleStorageChange);return()=>{document?.removeEventListener(\"storage\",handleStorageChange);};},[]);useEffect(()=>{const handleEmbedVisibilityByCookieConsent=()=>{localStorage.setItem(\"cookieVisible\",\"true\");setStore({visible:true});};document?.addEventListener(\"CookieScriptAcceptAll\",handleEmbedVisibilityByCookieConsent);return()=>{document?.removeEventListener(\"click\",handleEmbedVisibilityByCookieConsent);};},[]);const variant=store.visible?\"Visible\":\"Hidden\";return /*#__PURE__*/_jsx(Component,{...props,variant:variant});};}export function withCookieButton(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props,onClick:()=>{console.log(store.visible);setStore({visible:true});localStorage.setItem(\"cookieVisible\",\"true\");}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"updateVisibility\":{\"type\":\"reactHoc\",\"name\":\"updateVisibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCookie\":{\"type\":\"reactHoc\",\"name\":\"withCookie\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCookieButton\":{\"type\":\"reactHoc\",\"name\":\"withCookieButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Cookies.map"],"mappings":"0QAC4oB,SAAgB,EAAiB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAM,GAAU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