import{j as s,a6 as w,ak as x}from"./vendor-mui-core-B5XNUjey.js";import{g as v,k,b as p}from"./vendor-hooks-U4TTuKG0.js";import{I as T}from"./invitation-Cjg3Rgxl.js";import{K as I}from"./landing-page-zT1Tduxx.js";import{V as P,y as j}from"./vendor-ux-BX9dSNUy.js";import{a as R,s as S,b as E,c as N,H as W}from"./index-Dijoh4El.js";import{g as b}from"./get-safe-url-pZvXlaJu.js";import{c as C}from"./passport-BcfDxGFq.js";import{i as F}from"./vendor-react-CUXIiAnY.js";import"./vendor-utils-CFxoplqC.js";import"./index-CUIcSX4q.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DUT2afHJ.js";import"./sdk-Do4pV1s0.js";import"./wrap-locale-Dk2yVg3Y.js";import"./index-5B_H2zYd.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D4Rvz_D3.js";import"./create-passport-svg-BwqsyTOz.js";function Z(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:f}=R(),d=F(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await f.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?d(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[h("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:C,onLoginSuccess:g,inService:!0,status:u.state})})]})}export{Z as default};
