import{u as f,j as s,C as d,A as w,az as v,cx as C,aU as u,ag as I,aI as j,K as P,bD as S}from"./index-Y-QvttbJ.js";import{I as E}from"./invitation--cbaLA7C.js";import{g as R}from"./get-safe-url-GMIK5bS7.js";import"./index-RvLFbIq0.js";import"./index-BJDBjriy.js";import"./emotion-cache.browser.esm-CaLvcLFC.js";import"./sdk-vbwSpYyc.js";import"./wrap-locale-D8L6OQkL.js";import"./index-B9IBU_20.js";function T(n){const{searchParams:a}=new URL(window.location.href),g=w(),{api:i,session:r}=v(),{info:l}=f(),c=a.get("redirect"),p=a.get("id"),o=C(async()=>{if(!p)return null;const{data:t}=await i.get("/api/invitation",{params:{inviteId:p,mode:"issue-passport"}});return t}),m=u(()=>{if(o.error)throw o.error;return o?.data}),x=u(async(t,h=e=>e)=>{t&&(t.sessionToken&&I(h(t.sessionToken)),await r.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(j.WELLKNOWN_SERVICE_PATH_PREFIX)?g(e,{replace:!0}):window.location.href=R(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(d,{}):s.jsx(P,{className:"page-invite",sx:{width:"100vw",height:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"#f6f8fa",overflow:"auto",padding:"20px"},children:s.jsx(E,{...n,action:"issue-passport",getDataFn:m,createPassportSvg:t=>S(t,l),checkFn:i.get,onLoginSuccess:x,passportColor:"default",onLogin:r.login})})}function z(){return f().loading?s.jsx(d,{}):s.jsx(T,{})}export{z as default};
