{"version":3,"file":"Password.BV_FmiWc.mjs","names":["useState","React.useMemo"],"sources":["https:/framerusercontent.com/modules/7vgntlvbmNMQzwU7aIJe/Bvhm3gPmQECpUexkoPiv/Password.js"],"sourcesContent":["/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType,useRouter}from\"framer\";function normalize(s){// Normalize & trim to avoid issues with accidental spaces or different unicode forms\nreturn(s??\"\").normalize(\"NFKC\").trim();}export default function PasswordGate(props){const{password,targetPath,rememberSession,placeholder,buttonLabel,secondaryButtonLabel,secondaryTargetPath,title,minHeight}=props;const[input,setInput]=useState(\"\");const[error,setError]=useState(\"\");const router=useRouter();const storageKey=React.useMemo(()=>`pg_unlocked_${encodeURIComponent(targetPath||\"\")}`,[targetPath]);// If already unlocked for this session, auto-redirect\nuseEffect(()=>{if(!rememberSession)return;if(typeof window===\"undefined\")return;const ok=window.localStorage.getItem(storageKey)===\"1\";if(ok&&targetPath){navigate(targetPath);}// eslint-disable-next-line react-hooks/exhaustive-deps\n},[rememberSession,storageKey,targetPath]);const navigate=path=>{if(!path)return;try{router?.push(path);}catch{window.location.href=path;}};const submit=e=>{e?.preventDefault();setError(\"\");if(!password){setError(\"Password is not set.\");return;}if(!targetPath){setError(\"Target Path is not set.\");return;}const ok=normalize(input)===normalize(password);if(ok){if(rememberSession&&typeof window!==\"undefined\"){window.localStorage.setItem(storageKey,\"1\");}navigate(targetPath);}else{setError(\"Wrong password. Please try again.\");}};const goSecondary=()=>{if(!secondaryTargetPath)return;navigate(secondaryTargetPath);};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",minHeight,display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",padding:24,boxSizing:\"border-box\"},children:[title&&/*#__PURE__*/_jsx(\"div\",{style:{fontWeight:700,fontSize:20,lineHeight:1.2,textAlign:\"center\",marginBottom:12},children:title}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:submit,style:{display:\"flex\",flexDirection:\"column\",gap:12,width:\"100%\",maxWidth:420},children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:input,onChange:e=>setInput(e.target.value),placeholder:placeholder,\"aria-label\":\"Password\",style:{width:\"100%\",padding:\"14px 16px\",borderRadius:10,border:\"1px solid rgba(0,0,0,0.16)\",outline:\"none\",fontSize:16,boxSizing:\"border-box\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{width:\"100%\",padding:\"14px 16px\",borderRadius:10,border:\"1px solid rgba(0,0,0,0.16)\",background:\"Black\",color:\"white\",fontSize:16,fontWeight:600,cursor:\"pointer\",boxSizing:\"border-box\"},children:buttonLabel}),secondaryButtonLabel&&/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:goSecondary,style:{width:\"100%\",padding:\"14px 16px\",borderRadius:10,border:\"1px solid rgba(0,0,0,0.16)\",background:\"transparent\",color:\"#FD2841\",fontSize:16,fontWeight:600,cursor:\"pointer\",boxSizing:\"border-box\"},children:secondaryButtonLabel})]}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"#d00\",fontSize:13,marginTop:8,textAlign:\"center\",maxWidth:420},children:error})]});}PasswordGate.defaultProps={password:\"rydesign\",targetPath:\"/xiaomi\",rememberSession:true,placeholder:\"Enter password\",buttonLabel:\"Enter\",secondaryButtonLabel:\"\",secondaryTargetPath:\"/\",title:\"Check password on my resume:)\",minHeight:260};addPropertyControls(PasswordGate,{password:{type:ControlType.String,title:\"Password\"},targetPath:{type:ControlType.String,title:\"Target Path\"},rememberSession:{type:ControlType.Boolean,title:\"Remember (localStorage)\",defaultValue:true},placeholder:{type:ControlType.String,title:\"Placeholder\"},buttonLabel:{type:ControlType.String,title:\"Button Label\"},secondaryButtonLabel:{type:ControlType.String,title:\"2nd Button Label\"},secondaryTargetPath:{type:ControlType.String,title:\"2nd Button Path\"},title:{type:ControlType.String,title:\"Title\"},minHeight:{type:ControlType.Number,title:\"Min Height\",min:0,max:1200}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordGate\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Password.map"],"mappings":"gVAG4L,SAAS,EAAU,EAAE,CACjN,OAAO,GAAG,IAAI,UAAU,OAAO,CAAC,MAAM,CAAE,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,aAAW,kBAAgB,cAAY,cAAY,uBAAqB,sBAAoB,QAAM,aAAW,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAO,EAAO,GAAW,CAAO,EAAWC,MAAkB,eAAe,mBAAmB,GAAY,GAAG,GAAG,CAAC,EAAW,CAAC,CACzZ,MAAc,CAAK,GAAiC,IAAS,QAA4B,EAAO,aAAa,QAAQ,EAAW,GAAG,KAAW,GAAY,EAAS,EAAW,EAC5K,CAAC,EAAgB,EAAW,EAAW,CAAC,CAAC,IAAM,EAAS,GAAM,CAAK,KAAY,GAAG,CAAC,GAAQ,KAAK,EAAK,MAAO,CAAC,EAAO,SAAS,KAAK,IAAc,EAAO,GAAG,CAAkC,GAAjC,GAAG,gBAAgB,CAAC,EAAS,GAAG,CAAI,CAAC,EAAS,CAAC,EAAS,uBAAuB,CAAC,OAAQ,GAAG,CAAC,EAAW,CAAC,EAAS,0BAA0B,CAAC,OAAiB,EAAU,EAAM,GAAG,EAAU,EAAS,EAAW,GAAwB,IAAS,QAAa,EAAO,aAAa,QAAQ,EAAW,IAAI,CAAE,EAAS,EAAW,EAAO,EAAS,oCAAoC,EAAU,MAAgB,CAAK,GAA2B,EAAS,EAAoB,EAAG,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,YAAU,QAAQ,OAAO,cAAc,SAAS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