{"version":3,"file":"InsightsBadgeClickTracking.eLMvkOmA.mjs","names":["React.forwardRef","React.useRef","React.useCallback","React.useEffect","_jsx","__esmMin","init_ssg_sandbox_shims","ne","init_npm_react_18_3_1","de","window","init_jsx_runtime","J","ce","withInsightsBadgeClickTracking","Component","props","ref","wrapperRef","hasTargetBadge","root","descendants","node","text","TARGET_BADGES","element","handleNativeClick","TRACKING_ID","style","className","onClick","onKeyDown","onMouseDown","onMouseUp","onPointerDown","onPointerUp","restProps","init_InsightsBadgeClickTracking"],"sources":["https:/framerusercontent.com/modules/W6FhHAw0wzi34DluOsF0/Q2Ia66kiZemAVt4gssA5/InsightsBadgeClickTracking.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";const TRACKING_ID=\"resource-access-intent-insights-index\";const TARGET_BADGES=new Set([\"Guide\",\"Report\",\"Webinar\"]);export function withInsightsBadgeClickTracking(Component){const Wrapped=/*#__PURE__*/React.forwardRef(function Wrapped(props,ref){const wrapperRef=React.useRef(null);const hasTargetBadge=React.useCallback(()=>{const root=wrapperRef.current;if(!root)return false;try{const descendants=root.querySelectorAll(\"*\");for(const node of Array.from(descendants)){if(node.children.length>0)continue;const text=node.textContent?.trim();if(!text)continue;if(TARGET_BADGES.has(text))return true;}}catch{return false;}return false;},[]);React.useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}const element=wrapperRef.current;if(!element)return;const handleNativeClick=()=>{if(!hasTargetBadge())return;document.dispatchEvent(new CustomEvent(\"framer:click\",{detail:{trackingId:TRACKING_ID}}));};element.addEventListener(\"click\",handleNativeClick);return()=>{element.removeEventListener(\"click\",handleNativeClick);};},[hasTargetBadge]);const{style,className,onClick,onKeyDown,onMouseDown,onMouseUp,onPointerDown,onPointerUp,...restProps}=props;void onClick;void onKeyDown;void onMouseDown;void onMouseUp;void onPointerDown;void onPointerUp;return /*#__PURE__*/_jsx(\"div\",{ref:wrapperRef,style:style,className:className,...restProps,children:/*#__PURE__*/_jsx(Component,{ref:ref,...props})});});return Wrapped;}\nexport const __FramerMetadata__ = {\"exports\":{\"withInsightsBadgeClickTracking\":{\"type\":\"reactHoc\",\"name\":\"withInsightsBadgeClickTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InsightsBadgeClickTracking.map"],"mappings":"A,qJAA2L,SAAgBc,EAA+BC,EAAU,CAAyuC,MAA7sCf,kBAAiB,SAAiBgB,EAAMC,EAAI,CAAC,IAAMC,EAAWjB,EAAa,IAAI,EAAQkB,EAAejB,MAAsB,CAAC,IAAMkB,EAAKF,EAAW,QAAQ,GAAG,CAACE,EAAK,MAAO,GAAM,GAAG,CAAC,IAAMC,EAAYD,EAAK,iBAAiB,GAAG,EAAE,IAAI,IAAME,KAAQ,MAAM,KAAKD,CAAW,EAAE,CAAC,GAAGC,EAAK,SAAS,OAAO,EAAE,SAAS,IAAMC,EAAKD,EAAK,aAAa,KAAK,EAAE,GAAIC,GAAiBC,EAAc,IAAID,CAAI,EAAE,MAAO,EAAK,CAAC,MAAM,CAAC,MAAO,EAAM,CAAC,MAAO,EAAM,EAAE,CAAC,CAAC,EAAEpB,MAAoB,CAAC,GAAUO,IAAS,QAAa,OAAO,SAAW,IAAa,OAAQ,IAAMe,EAAQP,EAAW,QAAQ,GAAG,CAACO,EAAQ,OAAO,IAAMC,MAAsB,CAAKP,EAAe,GAAS,SAAS,cAAc,IAAI,YAAY,eAAe,CAAC,OAAO,CAAC,WAAWQ,CAAW,CAAC,CAAC,CAAC,CAAE,EAAsD,OAApDF,EAAQ,iBAAiB,QAAQC,CAAiB,MAAY,CAACD,EAAQ,oBAAoB,QAAQC,CAAiB,CAAE,CAAE,EAAE,CAACP,CAAc,CAAC,EAAE,GAAK,CAACS,QAAMC,YAAUC,UAAQC,YAAUC,cAAYC,YAAUC,gBAAcC,cAAY,GAAGC,GAAWpB,EAAsG,MAAoBZ,gBAAK,MAAM,CAAC,IAAIc,EAAiBU,QAAgBC,YAAU,GAAGO,EAAU,SAAsBhC,gBAAKW,EAAU,CAAKE,MAAI,GAAGD,CAAK,CAAC,CAAC,CAAC,CAAE,CAAgB,CAAE,C,kDAA/5CW,EAAY,wCAA8CH,kBAAc,IAAI,IAAI,CAAC,QAAQ,SAAS,SAAS,CAAC,C"}