import{j as e,a7 as v,al as c,bg as w,T as C,aT as l}from"./vendor-mui-core-CDEc-eG6.js";import{u as S,m as y,b as T,d as b,U as A,k as D,W as R,w as E}from"./index-CgSpL7jz.js";import{H as I}from"./addon-DIDUuqKP.js";import{K as P}from"./landing-page-BvgQ3gcP.js";import{aa as F,bk as W}from"./vendor-ux-PO0jFgJf.js";import{r as H}from"./vendor-hooks-Ca2cSNuD.js";import{r as o}from"./vendor-react-DX7tU9aY.js";import{s as L}from"./vendor-arcblock-BVQTtbN-.js";import"./vendor-utils-_C9URqjS.js";import"./theme-mode-toggle-WRMGhjzA.js";import"./question-mark-circle.svg-B0bcUgC5.js";import"./use-blocklet-logo-nVOJALp0.js";function Q(){const{t:s,locale:p}=F(),{api:f,session:d}=S(),{searchParams:m}=new URL(window.location.href),[u,x]=o.useState(!1),a=m.get("transferId"),h=window?.env?.appId,g=o.useCallback(async()=>{const{data:t}=await y.get("/blocklet/transfer",{params:{transferId:a}});return t},[a]),r=H(g),j=o.useCallback(async(t,i)=>{t&&(T(i(t.sessionToken)),b(i(t.refreshToken))),await d.refresh(),x(!0)},[]);if(r.loading)return e.jsx(v,{});if(r.error)return e.jsx(z,{children:e.jsx(A,{status:"404",title:r.error?.response?.data,description:""})});const k=r.data.status==="success";let n;return k||u?n=e.jsxs(e.Fragment,{children:[e.jsx(_,{children:e.jsx(I,{SessionContext:D})}),e.jsx(c,{sx:{pt:1,color:"success.main"},children:e.jsx(w,{style:{fontSize:80}})}),e.jsx(C,{variant:"h5",sx:{my:4},children:s("team.transferApp.successTitle")}),e.jsx("a",{href:`${R}/admin`,children:e.jsx(W,{variant:"contained",children:s("team.transferApp.visitDashboard")})})]}):n=e.jsx(E,{popup:!0,open:!0,action:"receive-transfer-app-owner",checkFn:f.get,forceConnected:!1,autoConnect:!1,checkTimeout:600*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:a,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:n})})}const _=l(L)`
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
`,z=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{Q as default};
