{"version":3,"file":"InsightsBadgeClickTracking.Cthcrwcn.mjs","names":["React.forwardRef","React.useRef","React.useCallback"],"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":"qJAA2L,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