{"version":3,"file":"Password_Protection_component.5E5Ub30T.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/G5EEVUCNfPvWOKr2RG0Q/fDSlTZm9gmy9r55JxjP8/Password_Protection_component.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import{useState,useEffect,useCallback}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function PasswordProtectionComponent(props){const{password,titleText,subText,titleColor,subTextColor,overlayColor,blurAmount,cardBackground,inputBackground,inputTextColor,inputPlaceholder,buttonBackground,buttonTextColor,buttonText,cancelText,cancelBackground,cancelTextColor,errorTextColor}=props;const[inputValue,setInputValue]=useState(\"\");const[error,setError]=useState(\"\");const[isAuthenticated,setIsAuthenticated]=useState(false);const[isMobile,setIsMobile]=useState(false);// Responsive detection\nuseEffect(()=>{const handleResize=()=>setIsMobile(window.innerWidth<=768);handleResize();window.addEventListener(\"resize\",handleResize);return()=>window.removeEventListener(\"resize\",handleResize);},[]);// Freeze scroll\nuseEffect(()=>{if(!isAuthenticated){document.body.style.overflow=\"hidden\";}return()=>{document.body.style.overflow=\"auto\";};},[isAuthenticated]);const handleSubmit=useCallback(()=>{if(inputValue===password){setIsAuthenticated(true);document.body.style.overflow=\"auto\";}else{setError(\"Incorrect password. Please try again.\");setInputValue(\"\");}},[inputValue,password]);const handleCancel=()=>{document.body.style.overflow=\"auto\";window.history.back();};if(isAuthenticated)return null;return /*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},style:{position:\"fixed\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:isMobile?\"20px\":\"40px\",backgroundColor:overlayColor,backdropFilter:`blur(${blurAmount}px)`,WebkitBackdropFilter:`blur(${blurAmount}px)`,zIndex:9999},children:/*#__PURE__*/_jsxs(motion.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.1},style:{width:\"100%\",maxWidth:\"420px\",padding:isMobile?\"28px 20px\":\"48px\",borderRadius:\"16px\",backgroundColor:cardBackground,display:\"flex\",flexDirection:\"column\",gap:\"18px\",textAlign:\"center\"},children:[/*#__PURE__*/_jsx(\"h2\",{style:{margin:0,color:titleColor},children:titleText}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,color:subTextColor},children:subText}),/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:inputValue,onChange:e=>setInputValue(e.target.value),onKeyDown:e=>e.key===\"Enter\"&&handleSubmit(),placeholder:inputPlaceholder,style:{width:\"100%\",padding:\"14px\",borderRadius:\"8px\",border:\"none\",outline:\"none\",backgroundColor:inputBackground,color:inputTextColor,textAlign:\"center\"}}),error&&/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:\"14px\",color:errorTextColor},children:error}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:isMobile?\"column\":\"row\",gap:\"12px\",marginTop:\"8px\"},children:[/*#__PURE__*/_jsx(\"button\",{onClick:handleSubmit,style:{flex:1,padding:\"14px\",borderRadius:\"8px\",border:\"none\",backgroundColor:buttonBackground,color:buttonTextColor,cursor:\"pointer\"},children:buttonText}),/*#__PURE__*/_jsx(\"button\",{onClick:handleCancel,style:{flex:1,padding:\"14px\",borderRadius:\"8px\",border:\"none\",backgroundColor:cancelBackground,color:cancelTextColor,cursor:\"pointer\"},children:cancelText})]})]})});}PasswordProtectionComponent.defaultProps={password:\"secret123\",titleText:\"This content is protected.\",subText:\"To view, please enter password.\",titleColor:\"#FFFFFF\",subTextColor:\"#E0E7FF\",overlayColor:\"rgba(37, 99, 235, 0.65)\",blurAmount:14,cardBackground:\"#FFFFFF\",inputBackground:\"#F3F4F6\",inputTextColor:\"#111827\",inputPlaceholder:\"Enter password\",buttonBackground:\"#2563EB\",buttonTextColor:\"#FFFFFF\",buttonText:\"Enter\",cancelText:\"Cancel\",cancelBackground:\"#E5E7EB\",cancelTextColor:\"#111827\",errorTextColor:\"#DC2626\"};addPropertyControls(PasswordProtectionComponent,{password:{type:ControlType.String,title:\"Password\"},titleText:{type:ControlType.String,title:\"Title\"},subText:{type:ControlType.String,title:\"Sub Text\"},titleColor:{type:ControlType.Color,title:\"Title Color\"},subTextColor:{type:ControlType.Color,title:\"Sub Color\"},overlayColor:{type:ControlType.Color,title:\"Overlay Color\"},blurAmount:{type:ControlType.Number,title:\"Blur\",min:0,max:40},cardBackground:{type:ControlType.Color,title:\"Card Background\"},inputBackground:{type:ControlType.Color,title:\"Input Background\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\"},inputPlaceholder:{type:ControlType.String,title:\"Input Placeholder\"},buttonBackground:{type:ControlType.Color,title:\"Primary Button\"},buttonTextColor:{type:ControlType.Color,title:\"Primary Text\"},buttonText:{type:ControlType.String,title:\"Primary Label\"},cancelBackground:{type:ControlType.Color,title:\"Cancel Button\"},cancelTextColor:{type:ControlType.Color,title:\"Cancel Text\"},cancelText:{type:ControlType.String,title:\"Cancel Label\"},errorTextColor:{type:ControlType.Color,title:\"Error Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtectionComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Password_Protection_component.map"],"mappings":"8PAGG,SAAwB,EAA4B,EAAM,CAAC,GAAK,CAAC,WAAS,YAAU,UAAQ,aAAW,eAAa,eAAa,aAAW,iBAAe,kBAAgB,iBAAe,mBAAiB,mBAAiB,kBAAgB,aAAW,aAAW,mBAAiB,kBAAgB,kBAAgB,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAgB,GAAoBA,EAAS,GAAM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