{"version":3,"file":"InactivityTrigger.BXDhiMIP.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/AfxJiqVniMY7XveQXDrx/1jWGfxwHWsEwog66ckFo/InactivityTrigger.js"],"sourcesContent":["// Invisible component that triggers an event after appearing and not being hovered for X seconds\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Inactivity Trigger\n *\n * @framerIntrinsicWidth 100\n * @framerIntrinsicHeight 100\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function InactivityTrigger(props){const{delay,onTrigger,resetOnHover}=props;const[isHovered,setIsHovered]=useState(false);const timerRef=useRef(null);useEffect(()=>{// Clear any existing timer\nif(timerRef.current!==null){clearTimeout(timerRef.current);}// Only start timer if not hovered (or if resetOnHover is false)\nif(!isHovered||!resetOnHover){timerRef.current=window.setTimeout(()=>{if(onTrigger&&(!isHovered||!resetOnHover)){onTrigger();}},delay*1e3);}return()=>{if(timerRef.current!==null){clearTimeout(timerRef.current);}};},[delay,onTrigger,isHovered,resetOnHover]);const handleMouseEnter=()=>{startTransition(()=>setIsHovered(true));};const handleMouseLeave=()=>{startTransition(()=>setIsHovered(false));};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"auto\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave});}addPropertyControls(InactivityTrigger,{delay:{type:ControlType.Number,title:\"Delay\",defaultValue:3,min:.1,max:60,step:.1,unit:\"s\"},resetOnHover:{type:ControlType.Boolean,title:\"Reset on Hover\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},onTrigger:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"InactivityTrigger\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"100\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"100\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./InactivityTrigger.map"],"mappings":"8MASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,gBAAc,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAASC,EAAO,KAAK,CAEuO,OAFtO,OACrK,EAAS,UAAU,MAAM,aAAa,EAAS,QAAQ,EACvD,CAAC,GAAW,CAAC,KAAc,EAAS,QAAQ,EAAO,eAAe,CAAI,IAAY,CAAC,GAAW,CAAC,IAAe,GAAW,EAAI,EAAM,IAAI,MAAY,CAAI,EAAS,UAAU,MAAM,aAAa,EAAS,QAAQ,GAAM,CAAC,EAAM,EAAU,EAAU,EAAa,CAAC,CAAkK,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,MAAM,OAAO,OAAO,OAAO,cAAc,OAAO,CAAC,iBAA9N,CAAC,MAAoB,EAAa,GAAK,CAAC,EAAoN,iBAAtL,CAAC,MAAoB,EAAa,GAAM,CAAC,EAA2K,CAAC,sBAV5gB,IAA6D,IAAoD,CAU6Z,EAAoB,EAAkB,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,QAAQ,aAAa,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,EAAY,QAAQ,MAAM,iBAAiB,aAAa,GAAK,aAAa,MAAM,cAAc,KAAK,CAAC,UAAU,CAAC,KAAK,EAAY,aAAa,CAAC,CAAC"}