{"version":3,"file":"RegistrationReturn.C_tI2YM2.mjs","names":["useState","startTransition","Framer.useRouter"],"sources":["https:/framerusercontent.com/modules/ftvHQNTpUZuA3fnOWgMO/cx5ArlO8roysDihgLbZb/RegistrationReturn.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useState,startTransition}from\"react\";import*as Framer from\"framer\";const KEY=\"ewc-registration-return\";const EVENT=\"ewc-registration-journey\";const RETURN_URL=\"ewc-registration-return-url\";function formReturnURL(){try{const saved=sessionStorage.getItem(RETURN_URL);const url=new URL(saved||\"/registration-form?ewc_role=Teacher\",window.location.origin);if(url.origin===window.location.origin&&url.pathname.replace(/\\/$/,\"\")===\"/registration-form\")return url.pathname+url.search+url.hash;}catch{}return\"/registration-form?ewc_role=Teacher\";}const useRouter=Framer.useRouter||(()=>null);function remember(active){try{active?sessionStorage.setItem(KEY,\"1\"):sessionStorage.removeItem(KEY);}catch{}window.dispatchEvent(new Event(EVENT));}function readJourney(){if(typeof window===\"undefined\")return false;const fromForm=new URLSearchParams(window.location.search).get(\"from\")===\"registration-form\";try{return fromForm||sessionStorage.getItem(KEY)===\"1\";}catch{return fromForm;}}function navigate(router,routeId,fallback){if(router?.navigate){router.navigate(routeId,\"\");return;}window.location.assign(fallback);}export function withLearnAboutEWC(Component){return /*#__PURE__*/forwardRef(function LearnAboutEWC(props,ref){const router=useRouter();function learn(event){if(event?.metaKey||event?.ctrlKey||event?.shiftKey||event?.altKey)return;event?.preventDefault?.();event?.stopPropagation?.();try{sessionStorage.setItem(RETURN_URL,window.location.pathname+window.location.search+window.location.hash);}catch{}remember(true);window.location.assign(\"/teacher?from=registration-form\");}return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClick:learn});});}export function withBackToForm(Component){return /*#__PURE__*/forwardRef(function BackToForm(props,ref){const router=useRouter();const[returning,setReturning]=useState(false);useEffect(()=>{const update=()=>startTransition(()=>setReturning(readJourney()));update();window.addEventListener(EVENT,update);window.addEventListener(\"popstate\",update);return()=>{window.removeEventListener(EVENT,update);window.removeEventListener(\"popstate\",update);};},[router?.currentRouteId]);const teacher=router?.currentRouteId?router.currentRouteId===\"augiA20Il\":typeof window!==\"undefined\"&&window.location.pathname.replace(/\\/$/,\"\")===\"/teacher\";if(!returning||!teacher)return /*#__PURE__*/_jsx(Component,{...props,ref:ref});function back(event){event?.preventDefault?.();event?.stopPropagation?.();const destination=formReturnURL();remember(false);window.location.assign(destination);}return /*#__PURE__*/_jsx(Component,{...props,ref:ref,uaKhKCnY3:\"Back to your form\",variantOfTextInsideBox:\"Back to your form\",onClick:back,onTap:back,vzp2ECtHq:back,l6T3ZNvHo:undefined,link:undefined,\"aria-label\":\"Back to your form\"});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withBackToForm\":{\"type\":\"reactHoc\",\"name\":\"withBackToForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLearnAboutEWC\":{\"type\":\"reactHoc\",\"name\":\"withLearnAboutEWC\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RegistrationReturn.map"],"mappings":"kMAAoQ,SAAS,GAAe,CAAC,GAAG,CAAC,IAAM,EAAM,eAAe,QAAQ,CAAU,EAAQ,EAAI,IAAI,IAAI,GAAO,sCAAsC,EAAO,SAAS,MAAM,EAAE,GAAG,EAAI,SAAS,EAAO,SAAS,QAAQ,EAAI,SAAS,QAAQ,MAAM,EAAE,IAAI,qBAAqB,OAAO,EAAI,SAAS,EAAI,OAAO,EAAI,IAAK,MAAM,CAAC,CAAC,MAAM,qCAAsC,CAA8C,SAAS,EAAS,EAAO,CAAC,GAAG,CAAC,EAAO,eAAe,QAAQ,EAAI,GAAG,EAAE,eAAe,WAAW,CAAG,CAAE,MAAM,CAAC,CAAC,EAAO,cAAc,IAAI,MAAM,CAAK,CAAC,CAAE,CAAC,SAAS,GAAa,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,IAA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