{"version":3,"file":"Password_protection.CWCYtsqA.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/N7gMRc31Tqmq9l33TCSY/LIyboBbPH0OWN5dcvNKO/Password_protection.js"],"sourcesContent":["/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,useEffect}from\"react\";import{motion,AnimatePresence}from\"framer-motion\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";export default function PasswordProtectedScreen(props){const{password,hint,overlayType=\"color\",overlayColor=\"#ffffff\",overlayImage,inputBackground=\"#ffffff\",inputTextColor=\"#000000\",inputBorderColor=\"#dddddd\",buttonBackground=\"#000000\",buttonTextColor=\"#ffffff\",errorTextColor=\"#ff0000\"}=props;const[inputValue,setInputValue]=useState(\"\");const[isAuthenticated,setIsAuthenticated]=useState(false);const[error,setError]=useState(\"\");const[isVisible,setIsVisible]=useState(true);// Hide overlay after successful auth, with fade-out\nuseEffect(()=>{if(isAuthenticated){const timer=setTimeout(()=>setIsVisible(false),300);return()=>clearTimeout(timer);}},[isAuthenticated]);const handlePasswordSubmit=useCallback(()=>{if(inputValue===password){setIsAuthenticated(true);setError(\"\");}else{setError(\"Incorrect password. Please try again.\");setInputValue(\"\");}},[inputValue,password]);const handleKeyDown=useCallback(e=>{if(e.key===\"Enter\")handlePasswordSubmit();},[handlePasswordSubmit]);const getOverlayStyle=()=>{return overlayType===\"image\"&&overlayImage?{backgroundImage:`url(${overlayImage})`,backgroundSize:\"cover\",backgroundPosition:\"center\"}:{backgroundColor:overlayColor};};// Don't render on the Framer canvas (editor)\nif(RenderTarget.current()===RenderTarget.canvas){return null;}// Fully unmounted after fade-out completes\nif(!isVisible)return null;return /*#__PURE__*/_jsx(AnimatePresence,{children:!isAuthenticated&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:1},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",padding:\"20px\",zIndex:9999,...getOverlayStyle()},children:/*#__PURE__*/_jsxs(motion.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.1},style:{maxWidth:\"400px\",width:\"100%\",textAlign:\"center\",backgroundColor:overlayType===\"image\"?\"rgba(255,255,255,0.8)\":\"transparent\",padding:\"32px\",borderRadius:\"16px\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{marginBottom:\"8px\",color:overlayType===\"image\"?\"#000000\":\"inherit\"},children:\"Enter Password\"}),hint&&/*#__PURE__*/_jsxs(\"p\",{style:{opacity:.7,marginBottom:\"24px\",color:overlayType===\"image\"?\"#000000\":\"inherit\"},children:[\"Hint: \",hint]}),/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:inputValue,onChange:e=>setInputValue(e.target.value),onKeyDown:handleKeyDown,autoComplete:\"off\",style:{padding:\"12px 16px\",borderRadius:\"8px\",border:`1px solid ${inputBorderColor}`,fontSize:\"16px\",width:\"100%\",marginBottom:\"16px\",backgroundColor:inputBackground,color:inputTextColor,boxSizing:\"border-box\"},placeholder:\"Enter password\",autoFocus:true}),error&&/*#__PURE__*/_jsx(motion.p,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},style:{color:errorTextColor,margin:\"8px 0 16px\"},children:error}),/*#__PURE__*/_jsx(motion.button,{whileHover:{scale:1.03},whileTap:{scale:.98},onClick:handlePasswordSubmit,style:{padding:\"12px 24px\",borderRadius:\"8px\",border:\"none\",backgroundColor:buttonBackground,color:buttonTextColor,fontSize:\"16px\",cursor:\"pointer\",width:\"100%\",fontWeight:\"500\"},children:\"Continue\"})]})})});}PasswordProtectedScreen.defaultProps={password:\"secret123\",hint:\"\",overlayType:\"color\",overlayColor:\"#ffffff\",inputBackground:\"#ffffff\",inputTextColor:\"#000000\",inputBorderColor:\"#dddddd\",buttonBackground:\"#000000\",buttonTextColor:\"#ffffff\",errorTextColor:\"#ff0000\"};addPropertyControls(PasswordProtectedScreen,{password:{type:ControlType.String,title:\"Password\",defaultValue:\"secret123\"},hint:{type:ControlType.String,title:\"Hint\",defaultValue:\"\"},overlayType:{type:ControlType.Enum,title:\"Overlay Type\",options:[\"color\",\"image\"],optionTitles:[\"Color\",\"Image\"],defaultValue:\"color\"},overlayColor:{type:ControlType.Color,title:\"Overlay Color\",defaultValue:\"#ffffff\",hidden:props=>props.overlayType!==\"color\"},overlayImage:{type:ControlType.Image,title:\"Overlay Image\",hidden:props=>props.overlayType!==\"image\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtectedScreen\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Password_protection.map"],"mappings":"8PAGiO,SAAwB,EAAwB,EAAM,CAAC,GAAK,CAAC,WAAS,OAAK,cAAY,QAAQ,eAAa,UAAU,eAAa,kBAAgB,UAAU,iBAAe,UAAU,mBAAiB,UAAU,mBAAiB,UAAU,kBAAgB,UAAU,iBAAe,WAAW,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAG,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAC7rB,MAAc,CAAC,GAAG,EAAgB,CAAC,IAAM,EAAM,eAAe,EAAa,GAAM,CAAC,IAAI,CAAC,UAAU,aAAa,EAAM,GAAI,CAAC,EAAgB,CAAC,CAAC,IAAM,EAAqBC,MAAgB,CAAI,IAAa,GAAU,EAAmB,GAAK,CAAC,EAAS,GAAG,GAAO,EAAS,wCAAwC,CAAC,EAAc,GAAG,GAAI,CAAC,EAAW,EAAS,CAAC,CAAO,EAAcA,EAAY,GAAG,CAAI,EAAE,MAAM,SAAQ,GAAsB,EAAG,CAAC,EAAqB,CAAC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