import{j as s,a6 as w,ak as x}from"./vendor-mui-core-CnXrAOs3.js";import{g as v,k,b as p}from"./vendor-hooks-CjESGRlR.js";import{I as T}from"./invitation-Bu3ivg7N.js";import{K as I}from"./landing-page-sUHYSREd.js";import{V as P,y as j}from"./vendor-ux-IiQnod3w.js";import{a as R,s as S,b as E,c as N,H as W}from"./index-sNHCLgAE.js";import{g as b}from"./get-safe-url-DpalOXcM.js";import{c as C}from"./passport-Y64u4kIS.js";import{i as F}from"./vendor-react-Dvs43sk9.js";import"./vendor-utils-cJEl_UEd.js";import"./index-CkOr9jjZ.js";import"./use-passport-id-B-b-_oYF.js";import"./session-BAD0lxQk.js";import"./sdk-DFkL0HsT.js";import"./wrap-locale-fIPwg8LW.js";import"./index-x4Yvq15-.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CuFtPveO.js";import"./create-passport-svg-C7Utfs-J.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};
