1import{a as r,j as n}from"./react-vendor-BGQ-fvu8.js";import{bb as E,aN as G,k as _,R as k,C as w}from"./main-BjGN4ckN.js";import{A as y}from"./Layout-DamczIiy.js";import{A as L}from"./auth.schema-Ba-_8pWS.js";import{b as C,c as I}from"./use-session-flash-Vt921m5l.js";import"./charts-vendor-fU6IkEZ_.js";import"./lodash-vendor-0cI-KiNp.js";import"./apollo-vendor-WdUFfbxi.js";import"./chevron-left-5-Gg-yzc.js";const a={init:0,success:1};function J(){const m=E(),d=C(),{handleLogin:g}=G(),{setFlash:c}=I(),[A,h]=r.useState(a.init),[f,R]=r.useState(null),p=r.useRef(!1),b=_(),x=new URLSearchParams(b.search),i=x.get("state"),t=x.get("code"),u=window.location.origin+b.pathname,s=r.useMemo(()=>{if(!i)return null;try{const e=decodeURIComponent(i);return JSON.parse(e)}catch{return null}},[i]),j=s?.next||null,S=r.useCallback(async()=>{if(!t||p.current)return;if(p.current=!0,s&&s.action==="bind"){const{result:l}=await d({code:t,redirectUri:u});l?.success?c("toast-message",{messageId:"account.connect.success",variant:"success"}):c("toast-message",{messageId:l?.error&&O[l.error]||"general.error.snackbar",variant:"error"}),h(a.success);return}const{result:e}=await m({code:t,redirectUri:u});let o=null;e?.error?o=e.error:e?.token||(o=L.unknown),o?R(o):(await g({isSignup:!0,...e,method:"GOOGLE"}),h(a.success))},[t,s,d,u,m,g,c]);return r.useEffect(()=>{S()},[S]),!t||f?n.jsx(k,{to:`/login?error=${f}&role=creator`}):A===a.success?n.jsx(k,{to:j||"/"}):n.jsx(y,{children:n.jsx(w,{})})}const O={email_inconsistent:"account.connect.error",third_party_error:"general.error.snackbar",third_party_already_bound:"general.error.snackbar",user_not_found:"general.error.snackbar"};export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.