{"version":3,"file":"PasswordProtectV2.DdvmmEO5.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/vDo57WnhM92megyPIRyi/0ERWIBBLtTpaNafvs6vt/PasswordProtectV2.js"],"sourcesContent":["/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * version=3\n *\n * Password Protection Component\n * - Single shared password for all /project/* pages\n * - Stores auth at /project level in localStorage so one unlock covers all subpages\n * - Validates stored password against current password on mount (auto-clears if changed)\n */// @ts-expect-error\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useState,useCallback,useLayoutEffect,useRef}from\"react\";import{createPortal}from\"react-dom\";// @ts-expect-error\nimport{motion}from\"framer-motion\";// ─── Auth helpers ────────────────────────────────────────────────────────────\nconst AUTH_ROOT=\"/project\";const storageKey=path=>`password-protect-auth-${path}`;function isAuthenticated(password){if(typeof localStorage===\"undefined\")return false;if(localStorage.getItem(storageKey(AUTH_ROOT))===password)return true;const current=typeof window!==\"undefined\"?window.location.pathname:\"/\";return localStorage.getItem(storageKey(current))===password;}function storeAuth(password){if(typeof localStorage===\"undefined\")return;localStorage.setItem(storageKey(AUTH_ROOT),password);}function clearAuth(){if(typeof localStorage===\"undefined\")return;Object.keys(localStorage).forEach(k=>{if(k.startsWith(\"password-protect-auth-\"))localStorage.removeItem(k);});}// ─── Lock icon ───────────────────────────────────────────────────────────────\nconst LockIcon=()=>/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M17 10V8C17 5.23858 14.7614 3 12 3C9.23858 3 7 5.23858 7 8V10M12 14.5V16.5M8.8 21H15.2C16.8802 21 17.7202 21 18.362 20.673C18.9265 20.3854 19.3854 19.9265 19.673 19.362C20 18.7202 20 17.8802 20 16.2V14.8C20 13.1198 20 12.2798 19.673 11.638C19.3854 11.0735 18.9265 10.6146 18.362 10.327C17.7202 10 16.8802 10 15.2 10H8.8C7.11984 10 6.27976 10 5.63803 10.327C5.07354 10.6146 4.6146 11.0735 4.32698 11.638C4 12.2798 4 13.1198 4 14.8V16.2C4 17.8802 4 18.7202 4.32698 19.362C4.6146 19.9265 5.07354 20.3854 5.63803 20.673C6.27976 21 7.11984 21 8.8 21Z\",stroke:\"white\",strokeOpacity:\"0.75\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})});export default function PasswordProtect(props){const{password=\"project_4121!\",errorTextColor=\"#ff4444\"}=props;// ── Editor detection ──────────────────────────────────────────────────\nlet shouldRender=true;try{if(RenderTarget.current()===RenderTarget.canvas)shouldRender=false;}catch{}// ── Synchronous blocking overlay (before React paint) ─────────────────\nif(shouldRender&&typeof document!==\"undefined\"&&typeof window!==\"undefined\"){const alreadyAuthed=isAuthenticated(password);if(!alreadyAuthed&&!document.body.hasAttribute(\"data-password-protect-blocking\")){document.body.setAttribute(\"data-password-protect-blocking\",\"true\");document.body.__ppOriginalVisibility=document.body.style.visibility||\"\";document.body.__ppOriginalOverflow=document.body.style.overflow||\"\";document.body.style.visibility=\"hidden\";document.body.style.overflow=\"hidden\";if(!document.getElementById(\"pp-blocking-overlay\")){const el=document.createElement(\"div\");el.id=\"pp-blocking-overlay\";Object.assign(el.style,{position:\"fixed\",inset:\"0\",width:\"100%\",height:\"100%\",backgroundColor:\"#111111\",zIndex:\"999998\",pointerEvents:\"auto\",display:\"block\"});document.body.appendChild(el);}}}// ── Editor cleanup ────────────────────────────────────────────────────\nif(!shouldRender){if(typeof document!==\"undefined\"){document.body.removeAttribute(\"data-password-protect-blocking\");document.getElementById(\"pp-blocking-overlay\")?.remove();document.body.style.visibility=document.body.__ppOriginalVisibility||\"\";document.body.style.overflow=document.body.__ppOriginalOverflow||\"\";}return null;}// ── State ─────────────────────────────────────────────────────────────\nconst[inputValue,setInputValue]=useState(\"\");const[authed,setAuthed]=useState(()=>isAuthenticated(password));const[error,setError]=useState(\"\");const[btnHovered,setBtnHovered]=useState(false);const overlayRef=useRef(null);// Restore body visibility once React overlay is painted\nuseLayoutEffect(()=>{if(authed)return;requestAnimationFrame(()=>{if(document.body.hasAttribute(\"data-password-protect-blocking\")&&overlayRef.current){const r=overlayRef.current.getBoundingClientRect();if(r.width>0)document.body.style.visibility=\"visible\";}});},[authed]);// Clear stale auth if password changed\nuseLayoutEffect(()=>{const stored=localStorage.getItem(storageKey(AUTH_ROOT));if(stored&&stored!==password){clearAuth();setAuthed(false);}},[password]);// Cleanup on unmount\nuseLayoutEffect(()=>{return()=>{document.getElementById(\"pp-blocking-overlay\")?.remove();if(document.body.hasAttribute(\"data-password-protect-blocking\")){document.body.removeAttribute(\"data-password-protect-blocking\");document.body.style.visibility=document.body.__ppOriginalVisibility||\"\";document.body.style.overflow=document.body.__ppOriginalOverflow||\"\";}};},[]);// ── Submit handler ────────────────────────────────────────────────────\nconst handleSubmit=useCallback(()=>{if(inputValue===password){storeAuth(password);document.getElementById(\"pp-blocking-overlay\")?.remove();if(document.body.hasAttribute(\"data-password-protect-blocking\")){document.body.removeAttribute(\"data-password-protect-blocking\");requestAnimationFrame(()=>{document.body.style.visibility=document.body.__ppOriginalVisibility||\"visible\";document.body.style.overflow=document.body.__ppOriginalOverflow||\"\";delete document.body.__ppOriginalVisibility;delete document.body.__ppOriginalOverflow;});}setAuthed(true);}else{setError(\"Incorrect password. Please try again.\");setInputValue(\"\");}},[inputValue,password]);const handleKeyDown=useCallback(e=>{if(e.key===\"Enter\")handleSubmit();},[handleSubmit]);if(authed)return null;if(typeof document===\"undefined\")return null;return /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{ref:overlayRef,style:{position:\"fixed\",inset:0,width:\"100%\",height:\"100%\",backgroundColor:\"#000000\",zIndex:999999,pointerEvents:\"auto\",display:\"block\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:\"50%\",transform:\"translate(-50%, -50%)\",backgroundColor:\"#141414\",border:\"1px solid #222222\",borderRadius:\"15px\",width:\"310px\",padding:\"20px\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:\"20px\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:\"8px\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(LockIcon,{}),/*#__PURE__*/_jsxs(\"p\",{style:{fontFamily:\"Inter, sans-serif\",fontWeight:500,fontSize:\"14px\",lineHeight:\"normal\",color:\"rgba(255,255,255,0.75)\",textAlign:\"center\",margin:0},children:[\"Enter password\",/*#__PURE__*/_jsx(\"br\",{}),\"to access this case study\"]})]}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:\"12px\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                            #pp-input::placeholder { color: rgba(255,255,255,0.35); opacity: 1; }\n                        `}),/*#__PURE__*/_jsx(\"input\",{id:\"pp-input\",type:\"password\",value:inputValue,onChange:e=>{setInputValue(e.target.value);setError(\"\");},onKeyDown:handleKeyDown,placeholder:\"Password\",autoFocus:true,style:{backgroundColor:\"#111111\",height:\"40px\",borderRadius:\"10px\",border:error?`1px solid ${errorTextColor}`:\"1px solid transparent\",width:\"100%\",padding:\"0 14px\",fontSize:\"14px\",color:\"#ffffff\",fontFamily:\"Inter, sans-serif\",outline:\"none\",boxSizing:\"border-box\"}}),error&&/*#__PURE__*/_jsx(motion.p,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},style:{color:errorTextColor,margin:0,fontSize:\"12px\",fontFamily:\"Inter, sans-serif\"},children:error}),/*#__PURE__*/_jsx(\"button\",{onClick:handleSubmit,onMouseEnter:()=>setBtnHovered(true),onMouseLeave:()=>setBtnHovered(false),style:{backgroundColor:btnHovered?\"rgba(255,255,255,0.12)\":\"rgba(255,255,255,0.06)\",height:\"40px\",borderRadius:\"10px\",border:\"none\",width:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",fontFamily:\"Inter, sans-serif\",fontWeight:600,fontSize:\"13px\",color:btnHovered?\"#ffffff\":\"rgba(255,255,255,0.55)\",transition:\"background-color 0.2s, color 0.2s\"},children:\"Unlock\"})]})]})})}),document.body);}PasswordProtect.defaultProps={password:\"project_4121!\",errorTextColor:\"#ff4444\"};addPropertyControls(PasswordProtect,{password:{type:ControlType.String,title:\"Password\",defaultValue:\"project_4121!\"},errorTextColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#ff4444\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtect\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtectV2.map"],"mappings":"0RAYkF,SAAS,EAAgB,EAAS,CAAC,GAAG,OAAO,aAAe,IAAY,MAAO,GAAM,GAAG,aAAa,QAAQ,EAAW,EAAU,CAAC,GAAG,EAAS,MAAO,GAAK,IAAM,EAAe,IAAS,OAAqC,IAAzB,EAAO,SAAS,SAAa,OAAO,aAAa,QAAQ,EAAW,EAAQ,CAAC,GAAG,EAAU,SAAS,EAAU,EAAS,CAAI,OAAO,aAAe,KAAmB,aAAa,QAAQ,EAAW,EAAU,CAAC,EAAS,CAAE,SAAS,GAAW,CAAI,OAAO,aAAe,KAAmB,OAAO,KAAK,aAAa,CAAC,QAAQ,GAAG,CAAI,EAAE,WAAW,yBAAyB,EAAC,aAAa,WAAW,EAAE,EAAG,CACsJ,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,WAAS,gBAAgB,iBAAe,WAAW,EACx5B,EAAa,GAAK,GAAG,CAAI,EAAa,SAAS,GAAG,EAAa,SAAO,EAAa,SAAY,EACnG,GAAG,GAAc,OAAO,SAAW,KAAoB,IAAS,QAA8D,CAA7B,EAAgB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