import{j as e,a6 as w,ak as c,bu as k,T as C,at as l}from"./vendor-mui-core-DnR6WYuU.js";import{u as S,o as y,a as T,d as A,V as b,j as D,c as E,l as R}from"./index-BHa1_Bjz.js";import{H as I}from"./addon-C2qdiHVb.js";import{K as P}from"./landing-page-Cv6belCa.js";import{V as F,w as H}from"./vendor-ux-DfSgTRg5.js";import{q as L}from"./vendor-hooks-cYMUGE4V.js";import{r as n}from"./vendor-react-CTtPmzVP.js";import{s as V}from"./vendor-arcblock-CPCSE54a.js";import"./vendor-utils-drLlzTVq.js";import"./lottie-web-4koyQiv_.js";import"./question-mark-circle.svg-CByEVDhb.js";function M(){const{t:s,locale:p}=F(),{api:f,session:d}=S(),{searchParams:m}=new URL(window.location.href),[u,x]=n.useState(!1),r=m.get("transferId"),h=window?.env?.appId,g=n.useCallback(async()=>{const{data:t}=await y.get("/blocklet/transfer",{params:{transferId:r}});return t},[r]),a=L(g),j=n.useCallback(async(t,i)=>{t&&(T(i(t.sessionToken)),A(i(t.refreshToken))),await d.refresh(),x(!0)},[]);if(a.loading)return e.jsx(w,{});if(a.error)return e.jsx(_,{children:e.jsx(b,{status:"404",title:a.error?.response?.data,description:""})});const v=a.data.status==="success";let o;return v||u?o=e.jsxs(e.Fragment,{children:[e.jsx(W,{children:e.jsx(I,{SessionContext:D})}),e.jsx(c,{sx:{pt:1,color:"success.main"},children:e.jsx(k,{style:{fontSize:80}})}),e.jsx(C,{variant:"h5",sx:{my:4},children:s("team.transferApp.successTitle")}),e.jsx("a",{href:`${E.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`,children:e.jsx(H,{variant:"contained",children:s("team.transferApp.visitDashboard")})})]}):o=e.jsx(R,{popup:!0,open:!0,action:"receive-transfer-app-owner",checkFn:f.get,forceConnected:!1,autoConnect:!1,checkTimeout:10*60*1e3,onSuccess:j,onClose:()=>{},locale:p,messages:{title:s("team.transferApp.receiveDialog.title"),scan:s("team.transferApp.receiveDialog.scan"),confirm:s("team.transferApp.receiveDialog.confirm"),success:s("team.transferApp.receiveDialog.success")},extraParams:{transferId:r,appDid:h},hideCloseButton:!0}),e.jsx(P,{did:window.blocklet?.appPid,children:e.jsx(c,{sx:{maxWidth:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:o})})}const W=l(V)`
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
`,_=l.div`
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f6f8fa;
`;export{M as default};
