{"version":3,"file":"GetDistinctId.BoOrMrvb.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/qs9fdy2NPQUgrfyeNyh7/hdY9hS0FNbnn6EP3GCCP/GetDistinctId.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useState}from\"react\";export function withDistinctId(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[distinctId,setDistinctId]=useState(undefined);useEffect(()=>{if(typeof window===\"undefined\")return;const getDistinctId=()=>{const id=window.posthog?.get_distinct_id?.();if(id){setDistinctId(id);return true;}return false;};// Try immediately\nif(getDistinctId())return;// Poll until available (max 5 attempts)\nlet attempts=0;const interval=setInterval(()=>{attempts++;if(getDistinctId()||attempts>=5){clearInterval(interval);}},500);return()=>clearInterval(interval);},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,...distinctId&&props.buttonLink?{buttonLink:`${props.buttonLink}?uid=${distinctId}`}:{},...distinctId&&props.href?{href:`${props.href}?uid=${distinctId}`}:{}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withDistinctId\":{\"type\":\"reactHoc\",\"name\":\"withDistinctId\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GetDistinctId.map"],"mappings":"yIAA4F,SAAgB,EAAe,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,IAAA,GAAU,CAEnE,OAFoE,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAkB,CAAC,IAAM,EAAG,EAAO,SAAS,mBAAmB,CAAuC,OAAnC,GAAI,EAAc,EAAG,CAAQ,IAAa,IAC/Y,GAAG,GAAe,CAAC,OACnB,IAAI,EAAS,EAAQ,EAAS,gBAAgB,CAAC,KAAc,GAAe,EAAE,GAAU,IAAG,cAAc,EAAS,EAAI,IAAI,CAAC,UAAU,cAAc,EAAS,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,GAAG,GAAY,EAAM,WAAW,CAAC,WAAW,GAAG,EAAM,WAAW,OAAO,IAAa,CAAC,EAAE,CAAC,GAAG,GAAY,EAAM,KAAK,CAAC,KAAK,GAAG,EAAM,KAAK,OAAO,IAAa,CAAC,EAAE,CAAC,CAAC,EAAG,sBAF/U,IAAiD"}