export{u as useDepositAddress}from"./use-deposit-address-BwThybOQ.mjs";import{P as t,f as o,a as e}from"./errors-Dd6zfYtp.mjs";import{a7 as r}from"./paths-BH8W4zMc.mjs";import{u as s}from"./context-BKnOUECq.mjs";import{a as i}from"./events-context-BJ75xIIf.mjs";import{u as n}from"./internal-context-dfitw7Ot.mjs";import"react";import"@privy-io/routes";import"zustand";import"./user-D5cqJNp9.mjs";import"./modal-context-DBwfUxD-.mjs";import"react/jsx-runtime";import"ofetch";import"@privy-io/js-sdk-core";import"tinycolor2";class a{async authenticate(){if(!this.api)throw new t("Auth flow has no API instance");try{return await this.api.post(r,{})}catch(t){throw o(t)}}async link(){throw new t("Linking is not supported for the SSO token flow")}constructor(){this.meta={}}}function m(){let o=s(),r=i(),{client:m,setUser:p,setAuthenticated:c,setIsNewUser:h}=n();return{loginWithSsoToken:async()=>{if(!o.id||!m)throw new t("SDK not yet ready");try{let o=new a;m.startAuthFlow(o);let e=await m.authenticate(),s=e.user,i=e.isNewUser??!1;if(!s)throw new t("Unable to authenticate with SSO response");return p(s),h(i),c(!0),r("login","onComplete",{user:s,isNewUser:i,wasAlreadyAuthenticated:!1,loginMethod:"sso",loginAccount:null}),s}catch(t){throw r("login","onError",t.privyErrorCode||e.UNKNOWN_AUTH_ERROR),t}}}}export{m as useLoginWithSsoToken};
//# sourceMappingURL=internal.mjs.map
