{"version":3,"file":"ThemeVariants.DXbinwsU.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/tKcSe7SLIIAlT6NBwcwi/ODSml4tdFDE8ZWrAvwko/ThemeVariants.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,cloneElement}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ThemeVariants(props){const[isDarkTheme,setIsDarkTheme]=useState(null);useEffect(()=>{const updateTheme=()=>{// For compatibility with the theme toggle component.\n// If your site does not have a theme toggle, the device theme will be used.\nconst currentToggleState=localStorage.getItem(\"currentToggleState\");// If the toggle theme was found in local storage, use it.\nif(currentToggleState!==null){setIsDarkTheme(currentToggleState===\"dark\");}else{// If the toggle theme was not found in local storage, use the device theme.\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");setIsDarkTheme(mediaQuery.matches);}};// Event listener for changes in the device theme\nconst osThemeChange=e=>{setIsDarkTheme(e.matches);};// Update the theme when the page loads\nupdateTheme();// Listen for theme changes made by the theme toggle component\nwindow.addEventListener(\"themeChange\",updateTheme);// Listen for changes in the device theme\nconst mediaQuery=window.matchMedia(\"(prefers-color-scheme: dark)\");mediaQuery.addListener(osThemeChange);// Clean up the event listeners when the theme toggle component unmounts\nreturn()=>{window.removeEventListener(\"themeChange\",updateTheme);mediaQuery.removeListener(osThemeChange);};},[]);// Before the theme has been determined, render nothing.\n// This prevents flashing while the page loads.\nif(isDarkTheme===null){return null;}let layers=[props.light[0],props.dark[0]];for(let i=0;i<2;i++){var _props_style,_props_style1;let layer=layers[i];if(layer&&(((_props_style=props.style)===null||_props_style===void 0?void 0:_props_style.width)||((_props_style1=props.style)===null||_props_style1===void 0?void 0:_props_style1.height))){layers[i]=/*#__PURE__*/cloneElement(layer,{style:{...layer.props.style,...props.style}});}}let themeLayer=layers[isDarkTheme?1:0];if(!themeLayer){return /*#__PURE__*/_jsx(\"div\",{style:{minWidth:100,minHeight:100}});}else{return /*#__PURE__*/_jsx(_Fragment,{children:themeLayer});}}ThemeVariants.displayName=\"Theme Variants\";addPropertyControls(ThemeVariants,{light:{type:ControlType.ComponentInstance,title:\"Light\"},dark:{type:ControlType.ComponentInstance,title:\"Dark\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ThemeVariants\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThemeVariants.map"],"mappings":"6MAGG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,KAAK,CAWhG,GAXiG,MAAc,CAAC,IAAM,MAAgB,CAEtI,IAAM,EAAmB,aAAa,QAAQ,qBAAqB,CAEA,EADhE,IAAqB,KACP,EAAO,WAAW,+BAA+B,CAA2B,QADhD,IAAqB,OACmC,EAC/F,EAAc,GAAG,CAAC,EAAe,EAAE,QAAQ,EACjD,GAAa,CACb,EAAO,iBAAiB,cAAc,EAAY,CAClD,IAAM,EAAW,EAAO,WAAW,+BAA+B,CAClE,OADmE,EAAW,YAAY,EAAc,KAC9F,CAAC,EAAO,oBAAoB,cAAc,EAAY,CAAC,EAAW,eAAe,EAAc,GAAK,EAAE,CAAC,CAE9G,IAAc,KAAM,OAAO,KAAM,IAAI,EAAO,CAAC,EAAM,MAAM,GAAG,EAAM,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAgC,IAAI,EAAM,EAAO,GAAM,IAAuB,EAAM,OAAyD,OAAwB,EAAM,OAA2D,UAAU,EAAO,GAAgB,EAAa,EAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,MAAM,GAAG,EAAM,MAAM,CAAC,CAAC,EAAG,IAAI,EAAW,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