{"version":3,"file":"PasswordProtection.DlfmVedd.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/shrffXryaxkOgA32XeQn/F1NnKMA5KVMVJMcozB6P/PasswordProtection.js"],"sourcesContent":["// Full-screen password protection component with OTP-style input\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * Password Protection\n *\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 800\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PasswordProtection(props){const{password=\"1234\",redirectUrl=\"\",rememberPassword=true,backgroundColor=\"#000000\",overlayOpacity=95,title=\"Enter Passcode\",titleFont}=props;const[digits,setDigits]=useState([\"\",\"\",\"\",\"\"]);const[isUnlocked,setIsUnlocked]=useState(false);const[isError,setIsError]=useState(false);const inputRefs=useRef([]);useEffect(()=>{if(typeof window!==\"undefined\"&&rememberPassword){const stored=localStorage.getItem(\"sitePasswordUnlocked\");if(stored===password){startTransition(()=>setIsUnlocked(true));}}},[password,rememberPassword]);useEffect(()=>{if(inputRefs.current[0]&&!isUnlocked){inputRefs.current[0].focus();}},[isUnlocked]);const handleChange=(index,value)=>{if(!/^\\d*$/.test(value))return;const newDigits=[...digits];newDigits[index]=value.slice(-1);startTransition(()=>{setDigits(newDigits);setIsError(false);});if(value&&index<3){inputRefs.current[index+1]?.focus();}};const handleKeyDown=(index,e)=>{if(e.key===\"Backspace\"&&!digits[index]&&index>0){inputRefs.current[index-1]?.focus();}};const handlePaste=e=>{e.preventDefault();const pastedData=e.clipboardData.getData(\"text\").replace(/\\D/g,\"\").slice(0,4);if(pastedData.length===4){const newDigits=pastedData.split(\"\");startTransition(()=>{setDigits(newDigits);setIsError(false);});inputRefs.current[3]?.focus();}};const handleSubmit=()=>{const enteredPassword=digits.join(\"\");if(enteredPassword===password){if(typeof window!==\"undefined\"&&rememberPassword){localStorage.setItem(\"sitePasswordUnlocked\",password);}startTransition(()=>setIsUnlocked(true));if(redirectUrl&&typeof window!==\"undefined\"){setTimeout(()=>{window.location.href=redirectUrl;},500);}}else{startTransition(()=>setIsError(true));setTimeout(()=>{startTransition(()=>{setIsError(false);setDigits([\"\",\"\",\"\",\"\"]);});inputRefs.current[0]?.focus();},500);}};// Auto-submit when all 4 digits are entered\nuseEffect(()=>{if(digits.every(d=>d!==\"\")){handleSubmit();}},[digits,password,redirectUrl,rememberPassword]);if(isUnlocked){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\"}});}return /*#__PURE__*/_jsx(motion.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.5},style:{position:\"fixed\",top:0,left:0,right:0,bottom:0,width:\"100vw\",height:\"100vh\",backgroundColor:backgroundColor,opacity:overlayOpacity/100,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:isUnlocked?0:9999,borderRadius:0,overflow:\"hidden\"},children:/*#__PURE__*/_jsxs(motion.div,{animate:isError?{x:[-10,10,-10,10,0]}:{},transition:{duration:.4},style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:16,padding:40,pointerEvents:\"auto\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{textAlign:\"center\"},children:/*#__PURE__*/_jsx(\"h1\",{style:{margin:0,color:\"rgba(38, 38, 38, 0.65)\",...titleFont},children:title})}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:12},children:digits.map((digit,index)=>/*#__PURE__*/_jsx(\"input\",{ref:el=>{inputRefs.current[index]=el;},type:\"text\",inputMode:\"numeric\",maxLength:1,value:digit,onChange:e=>handleChange(index,e.target.value),onKeyDown:e=>handleKeyDown(index,e),onPaste:index===0?handlePaste:undefined,style:{width:40,height:40,fontSize:16,fontWeight:500,textAlign:\"center\",backgroundColor:\"rgba(255, 255, 255, 0.1)\",backdropFilter:\"blur(50px)\",border:`1px solid ${isError?\"rgba(255, 88, 88, 0.5)\":\"rgba(38, 38, 38, 0.3)\"}`,borderRadius:12,color:\"#262626\",outline:\"none\",transition:\"all 0.2s ease\",caretColor:\"#262626\"},onFocus:e=>{e.target.style.border=\"1px solid #262626\";e.target.style.backgroundColor=\"rgba(255, 255, 255, 0.15)\";e.target.style.color=\"#262626\";},onBlur:e=>{e.target.style.border=`1px solid ${isError?\"rgba(255, 88, 88, 0.5)\":\"rgba(38, 38, 38, 0.3)\"}`;e.target.style.backgroundColor=\"rgba(255, 255, 255, 0.1)\";}},index))})]})});}addPropertyControls(PasswordProtection,{password:{type:ControlType.String,title:\"Password\",defaultValue:\"1234\",placeholder:\"Enter 4-digit code\"},redirectUrl:{type:ControlType.String,title:\"Redirect URL\",defaultValue:\"\",placeholder:\"https://example.com\"},rememberPassword:{type:ControlType.Boolean,title:\"Remember\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},overlayOpacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:95,min:0,max:100,step:1,unit:\"%\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Enter Passcode\"},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtection\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"1200\",\"framerIntrinsicHeight\":\"800\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtection.map"],"mappings":"gQASG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,WAAS,OAAO,cAAY,GAAG,mBAAi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