{"version":3,"file":"Switch.6NfvxBUe.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/gHfMf9ScbTLrFCQmZeRv/CiPJ2gYw9VsnGfq2C0LQ/Switch.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{Frame,addPropertyControls,ControlType}from\"framer\";// 🔒 Disable tap highlight, long-press, and text selection\nfunction useDisableTapHighlight(){React.useEffect(()=>{const style=document.createElement(\"style\");style.innerHTML=`\n          * {\n            -webkit-tap-highlight-color: transparent !important;\n            -webkit-touch-callout: none !important;\n            user-select: none !important;\n          }\n        `;document.head.appendChild(style);return()=>{document.head.removeChild(style);};},[]);}function getStoredTheme(){return localStorage.getItem(\"theme\");}function SystemThemeDetector({onThemeDetected}){React.useEffect(()=>{const mq=window.matchMedia(\"(prefers-color-scheme: dark)\");const handleChange=e=>{const theme=e.matches?\"dark\":\"light\";onThemeDetected(theme);};handleChange(mq)// initial call\n;mq.addEventListener(\"change\",handleChange);return()=>mq.removeEventListener(\"change\",handleChange);},[onThemeDetected]);return null;}export function ThemeSwitch({backgroundColor,iconColor,switchSize,circleColor}){useDisableTapHighlight()// 🚫 no highlight or copy\n;const[isLight,setIsLight]=React.useState(true);const[isReady,setIsReady]=React.useState(false);const applyTheme=theme=>{document.documentElement.setAttribute(\"data-theme\",theme);localStorage.setItem(\"theme\",theme);};const toggle=()=>{const newTheme=isLight?\"dark\":\"light\";setIsLight(!isLight);applyTheme(newTheme);};const handleSystemTheme=theme=>{if(!getStoredTheme()){setIsLight(theme===\"light\");applyTheme(theme);}};React.useEffect(()=>{const saved=getStoredTheme();if(saved){setIsLight(saved===\"light\");applyTheme(saved);}setIsReady(true);},[]);const circleSize=switchSize/2-switchSize/8;const iconSize=circleSize;return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(SystemThemeDetector,{onThemeDetected:handleSystemTheme}),/*#__PURE__*/_jsx(Frame,{width:switchSize,height:switchSize/2,background:backgroundColor,radius:switchSize/4,onTap:toggle,style:{cursor:\"pointer\",position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",padding:`0 ${switchSize/8}px`},children:isReady&&/*#__PURE__*/_jsx(Frame,{width:circleSize,height:circleSize,background:circleColor,radius:\"50%\",left:isLight?`calc(100% - ${circleSize+switchSize/16}px)`:`${switchSize/16}px`,style:{position:\"absolute\",transition:\"left 0.3s ease\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",viewBox:\"0 0 24 24\",fill:iconColor,width:iconSize,height:iconSize,children:isLight?/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"5\"}):/*#__PURE__*/_jsx(\"path\",{d:\"M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z\"})})})})]});}ThemeSwitch.defaultProps={backgroundColor:\"#e0e0e0\",iconColor:\"#000000\",switchSize:60,circleColor:\"#ffffff\"};addPropertyControls(ThemeSwitch,{backgroundColor:{title:\"Background\",type:ControlType.Color},switchSize:{title:\"Size\",type:ControlType.Number,defaultValue:60,min:20,max:200},circleColor:{title:\"Circle\",type:ControlType.Color}});\nexport const __FramerMetadata__ = {\"exports\":{\"ThemeSwitch\":{\"type\":\"reactComponent\",\"name\":\"ThemeSwitch\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Switch.map"],"mappings":"2UACA,SAAS,GAAwB,CAAC,MAAoB,CAAC,IAAM,EAAM,SAAS,cAAc,QAAQ,CAMvD,MANwD,GAAM,UAAU;;;;;;UAMzG,SAAS,KAAK,YAAY,EAAM,KAAW,CAAC,SAAS,KAAK,YAAY,EAAM,GAAK,EAAE,CAAC,CAAE,SAAS,GAAgB,CAAC,OAAO,aAAa,QAAQ,QAAQ,CAAE,SAAS,E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