{"version":3,"file":"ThemeSwitchImage.CqPIntsD.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/9Zui9viICca3s1RugQem/0yseXRt5qzZUGt6fBi8V/ThemeSwitchImage.js"],"sourcesContent":["// ThemeSwitch Image component that automatically switches between light and dark mode images based on user's theme preference\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ImageToggle(props){const{lightImage={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Light mode image\"},darkImage={src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Dark mode image\"},objectFit,alt}=props;const[isDarkMode,setIsDarkMode]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;// Check if dark mode class exists on html or body element\nconst checkDarkMode=()=>{const htmlElement=document.documentElement;const bodyElement=document.body;// Check for Framer theme attribute on both html and body\nconst htmlTheme=htmlElement.getAttribute(\"data-framer-theme\");const bodyTheme=bodyElement.getAttribute(\"data-framer-theme\");const isDark=htmlTheme===\"dark\"||bodyTheme===\"dark\"||htmlElement.classList.contains(\"dark\")||htmlElement.classList.contains(\"framer-dark\")||bodyElement.classList.contains(\"dark\")||bodyElement.classList.contains(\"framer-dark\")||htmlElement.getAttribute(\"toggle-theme\")===\"dark\";startTransition(()=>{setIsDarkMode(isDark);});};// Initial check\ncheckDarkMode();// Watch for class changes on html and body elements\nconst observer=new MutationObserver(checkDarkMode);observer.observe(document.documentElement,{attributes:true,attributeFilter:[\"class\",\"data-framer-theme\",\"toggle-theme\"]});observer.observe(document.body,{attributes:true,attributeFilter:[\"class\",\"data-framer-theme\"]});// Additional polling for canvas environment (editor mode)\n// This ensures theme changes are caught even if MutationObserver misses them\nconst isCanvas=RenderTarget.current()===RenderTarget.canvas;let pollInterval;if(isCanvas){pollInterval=window.setInterval(checkDarkMode,100);}return()=>{observer.disconnect();if(pollInterval!==undefined){clearInterval(pollInterval);}};},[]);const currentImage=isDarkMode?darkImage:lightImage;const imageAlt=alt||currentImage.alt||\"Theme-aware image\";return /*#__PURE__*/_jsx(\"img\",{src:currentImage.src,srcSet:currentImage.srcSet,alt:imageAlt,style:{width:\"100%\",height:\"100%\",objectFit:objectFit,display:\"block\"}},isDarkMode?\"dark\":\"light\");}addPropertyControls(ImageToggle,{lightImage:{type:ControlType.ResponsiveImage,title:\"Light Mode Image\"},darkImage:{type:ControlType.ResponsiveImage,title:\"Dark Mode Image\"},objectFit:{type:ControlType.Enum,title:\"Object Fit\",options:[\"contain\",\"cover\",\"fill\",\"none\",\"scale-down\"],optionTitles:[\"Contain\",\"Cover\",\"Fill\",\"None\",\"Scale Down\"],defaultValue:\"cover\",displaySegmentedControl:false},alt:{type:ControlType.String,title:\"Alt Text\",defaultValue:\"Theme-aware image\",placeholder:\"Describe the image...\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageToggle\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThemeSwitchImage.map"],"mappings":"6MAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,aAAW,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,CAAC,YAAU,CAAC,IAAI,oEAAoE,IAAI,kBAAkB,CAAC,YAAU,OAAK,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAC/X,IAAM,MAAkB,CAAC,IAAM,EAAY,SAAS,gBAAsB,EAAY,SAAS,KACzF,EAAU,EAAY,aAAa,oBAAoB,CAAO,EAAU,EAAY,aAAa,oBAAoB,CAAO,EAAO,IAAY,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