import{j as i,al as w}from"./vendor-mui-core-CDEc-eG6.js";import{u as g,r as v}from"./vendor-react-DX7tU9aY.js";import{b as x}from"./vendor-hooks-BrgYeCrj.js";import{I as u}from"./invitation-NVra7-eg.js";import{K as I}from"./landing-page-C9IV5jp5.js";import{W as k,ab as T}from"./vendor-ux-bFYdDLNG.js";import{u as S,m as W,W as c,b as j,d as E,H as P}from"./index-DGZk149v.js";import{g as R}from"./get-safe-url-B1bR9jl-.js";import{c as b}from"./passport-sgLXIGRN.js";import"./vendor-utils-_C9URqjS.js";import"./index-xYYHLOvz.js";import"./purify.es-HRjpPm7y.js";import"./use-passport-id-B-b-_oYF.js";import"./session-Dxo7LCKC.js";import"./sdk-BxbfHGV5.js";import"./wrap-locale-DSF06-Vj.js";import"./index-91KnTNni.js";import"./use-blocklet-logo-BSClbuwz.js";import"./vendor-arcblock-DY2miJjh.js";import"./create-passport-svg-BYi3UIaq.js";function J(m){const p=g(),{searchParams:n}=new URL(window.location.href),{api:d,session:s}=S(),{t:f}=k(),r=n.get("inviteId"),a=n.get("redirect"),h=v.useCallback(async()=>{const{data:o}=await W.get("invitation",{params:{inviteId:r}});if(!!o?.orgId&&!s.user){const t=encodeURIComponent(`${window.location.pathname}${window.location.search}`);window.location.href=`${c}/login?redirect=${t}`}return o},[r,s.user]),l=x(async(o,e=t=>t)=>{o&&o.sessionToken&&o.refreshToken&&(j(e(o.sessionToken)),E(e(o.refreshToken)),o.visitorId&&T(e(o.visitorId))),await s.refresh(),setTimeout(()=>{if(a){const t=decodeURIComponent(a);t.startsWith(c)?p(t,{replace:!0}):window.location.href=R(t)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:window.blocklet?.appPid,children:[i.jsx(P,{children:i.jsxs("title",{children:[f("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(w,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(u,{...m,getDataFn:h,checkFn:d.get,createPassportSvg:o=>b({...o}),onLoginSuccess:l,inService:!0})})]})}export{J as default};
