{"version":3,"file":"Cookie_back.BjdzhO2m.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/7pLj6WcHbFIlVGwZMayp/IlPWVouGkzxXnIT3fShN/Cookie_back.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";const WILLOW_ATTRIBUTION_ID_KEY=\"willow_attribution_id\";const POSTHOG_DISTINCT_ID_KEY=\"posthog_distinct_id\";function getCookie(name){const cookies=document.cookie.split(\"; \");for(let i=0;i<cookies.length;i++){const[key,value]=cookies[i].split(\"=\");if(key===name)return decodeURIComponent(value||\"\");}return null;}function getStoredValue(key){try{return window.localStorage?.getItem(key)||getCookie(key);}catch(_){return getCookie(key);}}function getPosthogDistinctId(){try{const posthogDistinctId=window.posthog?.get_distinct_id?.();if(typeof posthogDistinctId===\"string\"&&posthogDistinctId.trim()){window.localStorage?.setItem(POSTHOG_DISTINCT_ID_KEY,posthogDistinctId);return posthogDistinctId;}}catch(_){}return getStoredValue(POSTHOG_DISTINCT_ID_KEY);}function buildDeepLink(path){const referrer=getCookie(\"referrer\");const willowAttributionId=getStoredValue(WILLOW_ATTRIBUTION_ID_KEY);const posthogDistinctId=getPosthogDistinctId();const urlParams=new URLSearchParams(window.location.search);const code=urlParams.get(\"code\");const queryParams=new URLSearchParams;if(referrer)queryParams.set(\"ref\",referrer);if(code)queryParams.set(\"code\",code);if(willowAttributionId){queryParams.set(\"willow_attribution_id\",willowAttributionId);}if(posthogDistinctId){queryParams.set(\"posthog_distinct_id\",posthogDistinctId);}const queryString=queryParams.toString();return`willow://${path}${queryString?`?${queryString}`:\"\"}`;}export function withLoginCallbackLink(Component){return props=>{const[deepLinkUrl,setDeepLinkUrl]=useState(\"\");useEffect(()=>{setDeepLinkUrl(buildDeepLink(\"login-callback\"));},[]);const handleClick=()=>{if(!deepLinkUrl)return;window.location.href=deepLinkUrl;};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withPremiumCallbackLink(Component){return props=>{const[deepLinkUrl,setDeepLinkUrl]=useState(\"\");useEffect(()=>{setDeepLinkUrl(buildDeepLink(\"payment-success\"));},[]);const handleClick=()=>{if(!deepLinkUrl)return;window.location.href=deepLinkUrl;};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withLoginCallbackLink\":{\"type\":\"reactHoc\",\"name\":\"withLoginCallbackLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPremiumCallbackLink\":{\"type\":\"reactHoc\",\"name\":\"withPremiumCallbackLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Cookie_back.map"],"mappings":"uIAA6L,SAAS,EAAU,EAAK,CAAC,IAAM,EAAQ,SAAS,OAAO,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,EAAQ,OAAO,IAAI,CAAC,GAAK,CAAC,EAAI,GAAO,EAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,IAAM,EAAK,OAAO,mBAAmB,GAAO,GAAG,CAAE,OAAO,KAAM,SAAS,EAAe,EAAI,CAAC,GAAG,CAAC,OAAO,EAAO,cAAc,QAAQ,EAAI,EAAE,EAAU,EAAI,MAAU,CAAC,OAAO,EAAU,EAAI,EAAG,SAAS,GAAsB,CAAC,GAAG,CAAC,IAAM,EAAkB,EAAO,SAAS,mBAAmB,CAAC,GAAG,OAAO,GAAoB,UAAU,EAAkB,MAAM,CAA0E,OAAxE,EAAO,cAAc,QAAQ,EAAwB,EAAkB,CAAQ,OAA4B,EAAE,OAAO,EAAe,EAAwB,CAAE,SAAS,EAAc,EAAK,CAAC,IAAM,EAAS,EAAU,WAAW,CAAO,EAAoB,EAAe,EAA0B,CAAO,EAAkB,GAAsB,CAAmE,EAAlD,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAsB,IAAI,OAAO,CAAO,EAAY,IAAI,gBAAmB,GAAS,EAAY,IAA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