{"version":3,"file":"Elements.DjkOSxD2.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Fbcpbb8p2QaCoGo3C5zS/bSxJAcrXvQXFG2gEvMwp/Elements.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";const APP_URL=\"https://app.stanfordtax.com\";function delay(ms,value){return new Promise(resolve=>setTimeout(()=>resolve(value),ms));}export const withLoginButton=Component=>{const LoginButton=props=>{const isTopLevel=typeof window!==\"undefined\"&&window.top===window;const loginState=useLoginState();useEffect(()=>{// only redirect on the published site\nif(loginState==\"logged_in\"&&isTopLevel){window.location.href=APP_URL;}},[isTopLevel,loginState]);const newProps={...props};if(loginState==\"logged_in\"){newProps.title=\"Continue to app \";newProps.link=APP_URL;}else{newProps.link=`${APP_URL}${props.link}`;}return /*#__PURE__*/_jsx(Component,{...newProps});};return LoginButton;};export function useLoginState(){const[state,setState]=useState(\"unknown\");const started=useRef(false);useEffect(()=>{if(started.current)return;started.current=true;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const onMessage=e=>{if(e.origin!==APP_URL)return;const d=e.data;if(d?.type===\"LOGIN_STATUS_RESPONSE\"){setState(d.status);cleanup();}};const onLoad=()=>{iframe.contentWindow?.postMessage({type:\"CHECK_LOGIN_STATUS\"},APP_URL);};const cleanup=()=>{window.removeEventListener(\"message\",onMessage);iframe.removeEventListener(\"load\",onLoad);if(iframe.isConnected)iframe.remove();};const iframe=document.createElement(\"iframe\");iframe.src=`${APP_URL}/login-status`;iframe.style.display=\"none\";window.addEventListener(\"message\",onMessage);iframe.addEventListener(\"load\",onLoad);document.body.appendChild(iframe);return cleanup;},[]);return state;}export const withAutoplay=Component=>{const AutoplayVideoComponentType=props=>{return /*#__PURE__*/_jsx(\"video\",{src:props.srcFile,autoPlay:true,loop:true,muted:true,playsInline:true,style:{cursor:\"auto\",width:\"100%\",height:\"100%\",borderRadius:0,display:\"block\",objectFit:\"cover\",backgroundColor:\"rgba(0, 0, 0, 0)\",objectPosition:\"50% 50%\"},children:/*#__PURE__*/_jsx(\"source\",{src:props.srcFile,type:\"video/mp4\"})});};return AutoplayVideoComponentType;};\nexport const __FramerMetadata__ = {\"exports\":{\"withLoginButton\":{\"type\":\"reactHoc\",\"name\":\"withLoginButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAutoplay\":{\"type\":\"reactHoc\",\"name\":\"withAutoplay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useLoginState\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Elements.map"],"mappings":"mNACuU,SAAgB,GAAe,CAAC,GAAK,CAAC,EAAM,GAAUA,EAAS,UAAU,CAAO,EAAQC,EAAO,GAAM,CAAovB,OAAnvB,MAAc,CAAgD,GAA5C,EAAQ,UAAe,EAAQ,QAAQ,GAAe,IAAS,QAAa,OAAO,SAAW,KAAY,OAAO,IAAM,EAAU,GAAG,CAAC,GAAG,EAAE,SAAS,EAAQ,OAAO,IAAM,EAAE,EAAE,KAAQ,GAAG,OAAO,0BAAyB,EAAS,EAAE,OAAO,CAAC,GAAS,GAAU,MAAW,CAAC,EAAO,eAAe,YAAY,CAAC,KAAK,qBAAqB,CAAC,EAAQ,EAAS,MAAY,CAAC,EAAO,oBAAoB,UAAU,EAAU,CAAC,EAAO,oBAAoB,OAAO,EAAO,CAAI,EAAO,aAAY,EAAO,QAAQ,EAAS,EAAO,SAAS,cAAc,SAAS,CAAwL,MAAvL,GAAO,IAAI,GAAG,EAAQ,eAAe,EAAO,MAAM,QAAQ,OAAO,EAAO,iBAAiB,UAAU,EAAU,CAAC,EAAO,iBAAiB,OAAO,EAAO,CAAC,SAAS,KAAK,YAAY,EAAO,CAAQ,GAAU,EAAE,CAAC,CAAQ,6BAD5nC,IAA6C,CAAM,EAAQ,8BAAoI,EAAgB,GAA8B,GAAO,CAAC,IAAM,EAAkB,IAAS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