{"version":3,"file":"useWindowInstance.DxffsN4p.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/aS1c4NE6ajnmpCJ1u5QW/ET6MAWNyyRmjTRyI3Lt2/useWindowInstance.js"],"sourcesContent":["import{useState,useEffect}from\"react\";export function useWindowInstance(instanceName){const[instance,setInstance]=useState(()=>{return window?.[instanceName]||null;});useEffect(()=>{// If window is not available or instance is already found, do nothing\nif(!window||instance)return;let intervalId;const checkInstance=()=>{const foundInstance=window?.[instanceName];// Check if instance exists and is valid\nif(foundInstance){// Clear interval first\nif(intervalId){clearInterval(intervalId);intervalId=undefined;}// Update state - use functional update to ensure React processes it correctly\nsetInstance(prevInstance=>{// Only update if the value has changed\nif(prevInstance!==foundInstance){return foundInstance;}else{return prevInstance;}});}};// Check immediately\ncheckInstance();// Set up interval to keep checking until found\n// The effect will re-run when instance changes, and if instance is defined,\n// it will return early, so the interval will be cleared\nintervalId=setInterval(checkInstance,250);return()=>{if(intervalId){clearInterval(intervalId);}};},[instanceName,instance]);return instance;}\nexport const __FramerMetadata__ = {\"exports\":{\"useWindowInstance\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useWindowInstance.map"],"mappings":"yHAAsC,SAAgB,EAAkB,EAAa,CAAC,GAAK,CAAC,EAAS,GAAaA,MAAqB,IAAS,IAAe,KAAO,CAS1C,OAT2C,MAAc,CACrL,GAAG,CAAC,GAAQ,EAAS,OAAO,IAAI,EAAiB,MAAkB,CAAC,IAAM,EAAc,IAAS,GAC9F,IACH,AAAyC,KAA1B,cAAc,EAAW,CAAY,IAAA,IACpD,EAAY,GACT,IAAe,EAAiD,EAA3B,EAA2C,GAIzC,OAH1C,GAAe,CAGf,EAAW,YAAY,EAAc,IAAI,KAAW,CAAI,GAAY,cAAc,EAAW,GAAM,CAAC,EAAa,EAAS,CAAC,CAAQ,uBAT7F"}