{"version":3,"file":"AuthStore.BiDqlOUj.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js","https:/framerusercontent.com/modules/Dg1LQFroae2DnvOVU7lx/4WAqIRdbm6oewhNMTbuE/AuthStore.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js\";import*as React from\"react\";const AUTH_KEY=\"DS_IS_LOGGED_IN\";export const useAuthStore=createStore({isLoggedIn:false});function readAuthStamp(){try{return localStorage.getItem(AUTH_KEY)===\"true\";}catch{return false;}}function syncAuth(setStore){const v=readAuthStamp();setStore({isLoggedIn:v});}/** ✅ 로그인 유저만 보이기 */export function showWhenAuthed(){const[store,setStore]=useAuthStore();React.useEffect(()=>{// 최초 1회 동기화\nsyncAuth(setStore);// 다른 탭/윈도우에서 로그인/로그아웃 변경 시 즉시 반영\nconst onStorage=e=>{if(e.key===AUTH_KEY)syncAuth(setStore);};window.addEventListener(\"storage\",onStorage);return()=>window.removeEventListener(\"storage\",onStorage);},[setStore]);return{visible:store.isLoggedIn,style:{display:store.isLoggedIn?\"flex\":\"none\"}};}/** ✅ 비로그인 유저만 보이기 (로그인 버튼 등) */export function showWhenGuest(){const[store,setStore]=useAuthStore();React.useEffect(()=>{syncAuth(setStore);const onStorage=e=>{if(e.key===AUTH_KEY)syncAuth(setStore);};window.addEventListener(\"storage\",onStorage);return()=>window.removeEventListener(\"storage\",onStorage);},[setStore]);return{visible:!store.isLoggedIn,style:{display:!store.isLoggedIn?\"flex\":\"none\"}};}/** ✅ 현재 페이지를 기억하고 /login으로 이동 */export function goLoginAndReturnHere(){return{onTap(){const here=window.location.pathname+window.location.search+window.location.hash;// 현재 페이지 URL을 sessionStorage에 저장\nsessionStorage.setItem(\"redirectAfterLogin\",here);// 로그인 페이지로 이동\nwindow.location.href=\"/login\"// 로그인 페이지로 이동\n;}};}/** (선택) ✅ 로그아웃 버튼용: 도장 제거 + /login */export function logoutAndGoLogin(){return{onTap(){try{localStorage.removeItem(AUTH_KEY)// 로그아웃 처리\n;sessionStorage.removeItem(\"redirectAfterLogin\")// 이전 페이지 정보 제거\n;}catch{}window.location.href=\"/login\";}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withshowWhenAuthed(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...showWhenAuthed(props)});};}withshowWhenAuthed.displayName=\"showWhenAuthed\";export function withshowWhenGuest(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...showWhenGuest(props)});};}withshowWhenGuest.displayName=\"showWhenGuest\";export function withgoLoginAndReturnHere(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...goLoginAndReturnHere(props)});};}withgoLoginAndReturnHere.displayName=\"goLoginAndReturnHere\";export function withlogoutAndGoLogin(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...logoutAndGoLogin(props)});};}withlogoutAndGoLogin.displayName=\"logoutAndGoLogin\";\nexport const __FramerMetadata__ = {\"exports\":{\"withshowWhenAuthed\":{\"type\":\"reactHoc\",\"name\":\"withshowWhenAuthed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenAuthed\":{\"type\":\"override\",\"name\":\"showWhenAuthed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"goLoginAndReturnHere\":{\"type\":\"override\",\"name\":\"goLoginAndReturnHere\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useAuthStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenGuest\":{\"type\":\"override\",\"name\":\"showWhenGuest\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withgoLoginAndReturnHere\":{\"type\":\"reactHoc\",\"name\":\"withgoLoginAndReturnHere\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"logoutAndGoLogin\":{\"type\":\"override\",\"name\":\"logoutAndGoLogin\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withlogoutAndGoLogin\":{\"type\":\"reactHoc\",\"name\":\"withlogoutAndGoLogin\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withshowWhenGuest\":{\"type\":\"reactHoc\",\"name\":\"withshowWhenGuest\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AuthStore.map"],"mappings":"0MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,CAAC,CAClD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,MAAM,EAAE,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,EAAS,CAAC,EAChI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,EAAO,CAAC,CAAC,EAC7D,EAAa,IAAI,IACjB,EAAc,GAAU,CAC3B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAW,EAAE,EAAW,OAAO,GAAW,SAAS,OAAO,OAAO,CAAC,GAAG,EAAW,GAAG,EAAS,CAAC,CAAC,EACjJ,EAAa,QAAQ,GAAQ,EAAO,EAAW,CAAC,EAChD,SAAS,GAAU,CACnB,GAAK,CAAC,EAAM,GAAUA,EAAS,EAAW,CAK1C,OAHA,OACA,EAAa,IAAI,EAAS,KAAW,EAAa,OAAO,EAAS,EAAG,EAAE,CAAC,CACrE,GAAgB,GAAG,IAAM,GAAgB,CAAO,CAAC,EAAU,MAAM,EAAa,EAC3E,CAAC,EAAM,EAAc,CAAG,OAAO,mBAfC,IAAwC,qBEAkJ,SAAS,GAAe,CAAC,GAAG,CAAC,OAAO,aAAa,QAAQ,EAAS,GAAG,YAAa,CAAC,MAAO,IAAQ,SAAS,EAAS,EAAS,CAAyB,EAAS,CAAC,WAA1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