1import{a as l,j as e}from"./react-vendor-DJtAp8P_.js";import{f as ce,g as je,h as ye,q as Y,L as Mt,j as Ue,u as it,d as qt,bN as Me,E as lt,eP as ct,eQ as dt,d1 as Be,ep as qe,c1 as H,bI as ze,ac as We,ae as ut,c0 as Ve,bZ as K,dD as zt,N as pt,$ as ie,ah as tt,a1 as Wt,R as fe,eR as mt,T as Vt,a0 as $t}from"./index-D7JOLfRZ.js";import Ht from"./SignUpSimplified-8cLJYZYP.js";import{c as Ee,d as W,a as Kt,u as ke}from"./index.esm-M6qXUo6E.js";import{a as Gt}from"./auth-CD706yVH.js";import{g as $e,h as xt,a as ht}from"./useBetterAuth-D-O8sKpv.js";import{V as Jt,bN as Qt}from"./mutation-CBAS9dQ5.js";import{T as Zt}from"./TrailSlider-vtkY_jWA.js";import{z as i,w as le,T as S,ag as Pe,ah as Te,E as Le,$ as Ae,ai as Ie,u as He,c5 as at,an as Xt}from"./mui-DM4FB6Od.js";import{C as nt}from"./swiper-react-BdHqbMUq.js";import{T as he}from"./Search-DtNbnsKK.js";import{B as be}from"./Button-C12sdXE_.js";import{as as ea}from"./query-C7Xvvnmk.js";import{DatePicker as rt}from"./DatePicker-EVZZ-tOu.js";import"./dayjs-CeefjyDY.js";import"./moment-Bj79pgB5.js";import{O as ft}from"./OAuthButtons-DkemprrG.js";import{c as ta}from"./SessionPlannerMobile-btstsT3g.js";import{T as Ke}from"./TouchTightHeader-DeIP1zMU.js";import{S as aa}from"./ArrowLeft-DVpMoRCF.js";import{E as na,l as ra}from"./stripe.esm-BOErhKRp.js";import{C as sa,P as oa}from"./PaymentSummary-EsGzEmkH.js";import{S as st}from"./Checked-CRmyWIl6.js";import{S as ia,a as la}from"./SessionPlanner-Ciz2P5Xo.js";import{n as gt,e as ca}from"./apollo-WxVwhmyD.js";import{u as da,I as ua,r as pa}from"./useOAuthSignupCompletion-B_BWXT9V.js";import{g as bt}from"./planConstants-_-t6GZnA.js";import{O as jt,A as yt}from"./OAuthButtonsV2-BfOPM6f7.js";import{C as ma,A as wt,a as St,c as ge,b as vt}from"./AuthWordmark-BANVEWO-.js";import{P as Ct}from"./PasswordStrength-DxqSfOVb.js";import"./mui-styles-Cs1eTw1A.js";import"./babel-helpers-GYAhpWPp.js";import"./_baseClone-CI_UATaE.js";import"./_baseAssignValue-DA5RZPFC.js";import"./cloneDeep-DBd8ERDR.js";import"./imageOptimization-zUL1CBPb.js";import"./Modal-BMf2ZRZ1.js";import"./lodash-CKgJFN-2.js";import"./merge-BSbDH-s2.js";import"./isArrayLikeObject-BWZNxdtJ.js";import"./map-DazS0jXn.js";import"./browser-CbB-A17s.js";import"./hello-pangea-dnd-V9uYMV7h.js";import"./some-DWTvIxlZ.js";import"./_baseIndexOf-DqPIyCu4.js";import"./values-KC-0YRfW.js";import"./index-DCj5Y0Ve.js";import"./_baseDifference-DAp4QVb4.js";import"./_arrayIncludes-Ck-iFXGO.js";import"./omit-BVrVjzv1.js";import"./index-DH6i3Hvs.js";import"./mui-x-YwRs-dk2.js";import"./s3FileHandler-C17YuASz.js";import"./_baseUniq-CmchZ_xr.js";import"./compact-DZdspzxW.js";import"./Apple-CWQbj0rv.js";import"./LogoDark-BynYVOdd.js";import"./react-paypal-js-Do2Eg3MH.js";import"./isNil-R7kYXCYw.js";import"./compass-O0N19w0X.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},m=new t.Error().stack;m&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[m]="61e5478a-bd78-4da0-8eed-30c6df02de5a",t._sentryDebugIdIdentifier="sentry-dbid-61e5478a-bd78-4da0-8eed-30c6df02de5a")}catch{}const xa=t=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},l.createElement("path",{d:"M10.0001 18.9999C9.7664 19.0004 9.53997 18.919 9.36005 18.7699C9.15555 18.6004 9.02691 18.3564 9.00252 18.0919C8.97813 17.8274 9.06 17.564 9.23005 17.3599L13.7101 11.9999L9.39005 6.62994C9.22228 6.42335 9.14379 6.1584 9.17194 5.89376C9.20009 5.62912 9.33257 5.38662 9.54005 5.21994C9.74922 5.03591 10.0257 4.94747 10.3028 4.97594C10.58 5.00442 10.8327 5.14722 11.0001 5.36994L15.8301 11.3699C16.1334 11.7389 16.1334 12.2709 15.8301 12.6399L10.8301 18.6399C10.6266 18.8854 10.3183 19.0191 10.0001 18.9999Z",fill:"white"}));for(var ot="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nt=new Map,Ne=0;Ne<ot.length;Ne++){var De=Ne.toString(2);De="0".repeat(6-De.length)+De,Nt.set(ot.charCodeAt(Ne),De)}function Dt(t){try{if(typeof t!="string"||t.split(".").length!==3)return null;var m=(function(r){for(var a,d="",c=r.length,n=0;n<c;n++)a=r[n],d+=String.fromCodePoint(a>251&&a<254&&n+5<c?1073741824*(a-252)+(r[++n]-128<<24)+(r[++n]-128<<18)+(r[++n]-128<<12)+(r[++n]-128<<6)+r[++n]-128:a>247&&a<252&&n+4<c?(a-248<<24)+(r[++n]-128<<18)+(r[++n]-128<<12)+(r[++n]-128<<6)+r[++n]-128:a>239&&a<248&&n+3<c?(a-240<<18)+(r[++n]-128<<12)+(r[++n]-128<<6)+r[++n]-128:a>223&&a<240&&n+2<c?(a-224<<12)+(r[++n]-128<<6)+r[++n]-128:a>191&&a<224&&n+1<c?(a-192<<6)+r[++n]-128:a);return d})((function(r){for(var a="",d=0;d<r.length;d++)a+=Nt.get(r.charCodeAt(d));a=a.slice(0,a.length-a.length%8);for(var c=[],n=0;n<a.length/8;n++)c.push(a.slice(8*n,8*n+8));return c})(t.split(".")[1].replaceAll("=","").replaceAll("-","+").replaceAll("_","/")).map(function(r){return parseInt(r,2)}));return JSON.parse(m)}catch(r){return console.error("There was an error decoding token: ",r),null}}function ha(t){var m=Dt(t),r=!0;if(m&&m.exp){var a=new Date(0);a.setUTCSeconds(m.exp),r=a.valueOf()<new Date().valueOf()}return r}function Pt(t){var m=l.useState(!1),r=m[0],a=m[1],d=l.useState(null),c=d[0],n=d[1];l.useEffect(function(){j(t)},[t]);var j=function(E){n(Dt(E)),a(ha(E))};return{isExpired:r,decodedToken:c,reEvaluateToken:j}}const fa=ra("pk_live_bKNDVbtiZQ0O23KxCW0KpWiJ"),ga={mode:"payment",amount:1099,currency:"gbp",paymentMethodCreation:"manual",payment_method_types:["card"]},ba={button:{color:t=>t.palette.text.primary,borderColor:t=>t.border,height:"48px","&:hover":{borderColor:t=>t.border}}},ja=({formik:t,handleChangeStep:m,inviteToken:r,loading:a,plan:d,loggedInUser:c,submitButtonRef:n,billingAmount:j,userSliderCount:E,setPaymentLoading:g,discountCoupon:I,registerData:h,duration:V,signUpProvider:U,handleBeforeOAuth:M,socialSignUpInProgress:q=!1})=>{const{t:L}=ce("auth"),N=je();new URLSearchParams(N.search);const G=ye(),[b,z]=l.useState(!0),[_,se]=l.useState(!1),D=()=>{z(P=>!P)},u=()=>{se(P=>!P)};l.useEffect(()=>{Y(c)||(z(!1),se(!0))},[c]);const o=()=>{d!=null&&d.id?G("/pricing"):m(0)},w=P=>
1{P.key==="Enter"&&(P.preventDefault(),t.submitForm())};return e.jsxs(i,{container:!0,flexDirection:"column",height:"100%",py:{xs:2,md:3},gap:{xs:2,md:3},children:[e.jsx(i,{children:e.jsx(Ke,{})}),h.flow==="pricing"&&e.jsxs(i,{container:!0,justifyContent:"center",gap:2,children:[e.jsx(i,{container:!0,width:"100%",gap:1,flexWrap:{xs:"wrap",md:"nowrap"},children:e.jsx(ft,{variant:"signup",size:{xs:12,md:6},onBeforeOAuth:M,disabled:q})}),e.jsx(i,{size:12,children:e.jsx(le,{sx:{my:1},children:e.jsx(S,{fontSize:"14px",color:"textSecondary",children:L("or")})})})]}),e.jsx(i,{flex:1,maxWidth:600,overflow:"auto",margin:"auto",children:e.jsxs(i,{container:!0,gap:2,children:[e.jsx(i,{size:12,children:e.jsxs(Pe,{square:!0,sx:{position:"unset",border:P=>`1px solid ${P.border}`,p:{xs:b?2:"0 16px",md:b?2:"0 16px",lg:b?"16px 16px 24px 16px":2},borderRadius:"16px","&.Mui-disabled":{bgcolor:Y(c)?"#fff":"unset"}},elevation:0,disabled:!Y(c)&&c.club_id,expanded:b,onChange:D,children:[e.jsx(Te,{expandIcon:e.jsx(Ae,{}),sx:{padding:0,"&.Mui-disabled":{opacity:"unset"}},children:e.jsxs(Le,{children:[e.jsx(S,{fontSize:{xs:"18px",md:"24px"},children:L("createYourAccountTitle")}),!Y(c)&&e.jsx(S,{fontSize:"14px",color:"text.secondary",children:h.email})]})}),e.jsxs(Ie,{sx:{padding:0},children:[e.jsxs(i,{container:!0,gap:2,maxWidth:600,margin:"auto",children:[U==="email"&&e.jsxs(i,{container:!0,spacing:3,children:[e.jsx(i,{size:12,children:e.jsx(he,{name:"email",label:L("email"),value:t.values.email,error:t.touched.email&&!!t.errors.email,helperText:t.touched.email&&t.errors.email,handleChange:t.handleChange,InputProps:{onKeyDown:w}})}),e.jsx(i,{size:{xs:12,md:6},children:e.jsx(he,{name:"fullName",label:"Full Name",value:t.values.fullName,error:t.touched.fullName&&!!t.errors.fullName,helperText:t.touched.fullName&&t.errors.fullName,handleChange:t.handleChange,InputProps:{onKeyDown:w}})}),e.jsx(i,{size:{xs:12,md:6},children:e.jsx(he,{name:"password",label:"Password",type:"password",autoComplete:"new-password",value:t.values.password,error:t.touched.password&&!!t.errors.password,helperText:t.touched.password&&t.errors.password,handleChange:t.handleChange,InputProps:{onKeyDown:w}})})]}),!r&&e.jsxs(e.Fragment,{children:[e.jsx(he,{name:"clubName",label:"Club Name",value:t.values.clubName,error:t.touched.clubName&&!!t.errors.clubName,helperText:t.touched.clubName&&t.errors.clubName,handleChange:t.handleChange,InputProps:{onKeyDown:w}}),e.jsxs(Pe,{square:!0,sx:{boxShadow:"none",position:"unset"},elevation:0,children:[e.jsx(Te,{expandIcon:e.jsx(Ae,{}),sx:{padding:0},children:e.jsxs(S,{fontSize:"24px",color:"text.secondary",children:[L("clubSettings")," ",e.jsx(S,{variant:"caption",color:"text.secondary",children:"( optional )"})]})}),e.jsx(Ie,{sx:{padding:0},children:e.jsxs(i,{container:!0,spacing:3,children:[e.jsx(i,{size:{xs:12,md:6},children:e.jsx(nt,{label:"Primary Color",name:"primaryColor",value:t.values.primaryColor,error:t.touched.primaryColor&&!!t.errors.primaryColor,helperText:t.touched.primaryColor&&t.errors.primaryColor,onChange:t.handleChange,InputProps:{onKeyDown:w}})}),e.jsx(i,{size:{xs:12,md:6},children:e.jsx(nt,{label:"Contrast Color",name:"contrastColor",value:t.values.contrastColor,error:t.touched.contrastColor&&!!t.errors.contrastColor,helperText:t.touched.contrastColor&&t.errors.contrastColor,onChange:t.handleChange,InputProps:{onKeyDown:w}})}),e.jsx(i,{size:{xs:12,md:6},children:e.jsx(rt,{readOnly:!0,label:"Season Start Date",name:"startDate",value:t.values.startDate,onChange:t.handleChange,error:t.touched.startDate&&!!t.errors.startDate,helperText:t.touched.startDate&&t.errors.startDate,InputProps:{onKeyDown:w}})}),e.jsx(i,{size:{xs:12,md:6},children:e.jsx(rt,{readOnly:!0,label:"Season End Date",name:"endDate",minDate:t.values.startDate,value:t.values.endDate,onChange:t.handleChange,error:t.touched.endDate&&!!t.errors.endDate,helperText:t.touched.endDate&&t.errors.endDate,InputProps:{onKeyDown:w}})})]})})]})]})]}),e.jsxs(i,{container:!0,justifyContent:"space-between",pt:2,children:[e.jsx(be,{startIcon:e.jsx(aa,{}),text:"Back",variant:"outlined",customStyles:ba.button,onClick:o}),e.jsx(be,{text:"Continue",loading:a,onClick:t.handleSubmit,endIcon:e.jsx(xa,{})})]})]})]})}),(d==null?void 0:d.id)!==1&&h.flow==="pricing"&&e.jsx(i,{size:12,children:e.jsxs(Pe,{square:!0,sx:{position:"unset",border:P=>`1px solid ${P.border}`,p:{xs:_?2:"0 16px",md:_?2:"0 16px",lg:_?"16px 16px 24px 16px":2}
1,borderRadius:"16px","&.Mui-disabled":{bgcolor:Y(c)?"unset":"#fff"}},elevation:0,expanded:_,onChange:u,children:[e.jsx(Te,{expandIcon:e.jsx(Ae,{}),sx:{padding:0,"&.Mui-disabled":{opacity:"unset"}},children:e.jsx(S,{fontSize:{xs:"18px",md:"24px"},children:L("paymentDetails")})}),e.jsx(Ie,{sx:{padding:0},children:e.jsx(na,{stripe:fa,options:ga,children:e.jsx(sa,{submitButtonRef:n,billingAmount:j,plan:d,duration:V,setLoading:g,userSliderCount:E,discountCoupon:I,upgrade:!1,downgrade:!1})})})]})})]})})]})},v={heading:{fontSize:{xs:"16px",md:"24px"},fontWeight:600,color:"text.primary",textAlign:{xs:"center",md:"start"}},accordionSummary:{fontSize:"16px",fontWeight:600,color:"text.primary"},description:{fontSize:"14px",color:"text.secondary"},trailContainer:{borderRadius:"8px",backgroundColor:t=>t.palette.common.white},divider:{color:t=>t.palette.border},trailHeading:{fontSize:"16px",fontWeight:600,lineHeight:"24px",color:"text.primary"},trailDescription:{fontSize:"14px",lineHeight:"22px",color:"text.secondary"},featureText:{fontSize:"14px",lineHeight:"22px"},upgradeLaterBtn:{width:{xs:"121px",md:"unset"},textTransform:"unset",borderColor:t=>t.border,color:t=>t.palette.text.primary,"&:hover":{borderColor:t=>t.border}},upgradeTodayBtn:{width:{xs:"200px",md:"unset"},"@media (max-width: 375px)":{width:"auto"}},accordion:{"&.MuiPaper-root":{boxShadow:"none"}}},ya=()=>{const{t}=ce("auth"),m=He(n=>n.breakpoints.down("md")),r=ye(),a=l.useMemo(()=>[{name:"Engine Room",icon:e.jsx(ia,{}),description:t("engineRoomDescription")},{name:"Dugout",icon:e.jsx(ta,{}),description:t("dugoutDescription")},{name:"Session Planner",icon:e.jsx(la,{}),description:t("sessionPlannerDescription")}],[t]),d=l.useMemo(()=>[t("freeTrialFeature1"),t("freeTrialFeature2"),t("freeTrialFeature3"),t("freeTrialFeature4")],[t]),c=async n=>{r(n,{replace:!0})};return e.jsxs(i,{container:!0,flexDirection:"column",height:"100%",pb:{xs:16,md:3},pt:{xs:2,md:3},gap:{xs:2,md:3},children:[e.jsx(i,{children:e.jsx(Ke,{})}),e.jsx(i,{overflow:"auto",flex:1,children:e.jsxs(i,{container:!0,gap:1,children:[e.jsx(S,{sx:{...v.heading,width:"100%"},children:t("freeTrialTitle")}),!m&&e.jsx(S,{sx:v.description,children:t("freeTrialSubtitle")}),m?e.jsx(i,{container:!0,direction:"column",sx:v.trailContainer,children:e.jsxs(Pe,{sx:v.accordion,defaultExpanded:!0,children:[e.jsx(Te,{expandIcon:e.jsx(Ae,{}),sx:v.accordionSummary,children:t("yourFreeTrialIncludes")}),e.jsx(Ie,{children:e.jsxs(i,{container:!0,gap:1,children:[e.jsx(i,{container:!0,gap:2,direction:"column",children:a.map(n=>e.jsxs(i,{container:!0,gap:1.5,flexWrap:"nowrap",children:[e.jsx(i,{minWidth:"unset",children:n.icon}),e.jsxs(i,{container:!0,direction:"column",children:[e.jsx(S,{sx:v.trailHeading,children:n.name}),e.jsx(S,{sx:v.trailDescription,children:n.description})]})]},n.name))}),e.jsx(i,{pt:2,size:12,children:e.jsx(le,{flexItem:!0,sx:v.divider})}),e.jsxs(i,{container:!0,gap:2,direction:"column",children:[e.jsx(S,{sx:{...v.featureText,color:"text.secondary",fontWeight:600},children:t("growYourTeam")}),e.jsx(i,{container:!0,gap:1,direction:"column",children:d.map(n=>e.jsxs(i,{container:!0,gap:1,alignItems:"center",wrap:"nowrap",children:[e.jsx(st,{fill:"#2F80ED"}),e.jsx(i,{children:e.jsx(S,{sx:{...v.featureText,color:"text.primary"},children:n})})]},n))})]})]})})]})}):e.jsxs(i,{container:!0,direction:"column",sx:v.trailContainer,children:[e.jsx(i,{pb:1,children:e.jsx(S,{sx:v.trailHeading,children:t("yourFreeTrialIncludesDesktop")})}),e.jsx(le,{flexItem:!0,sx:v.divider}),e.jsxs(i,{container:!0,gap:1,pt:2,children:[e.jsx(i,{container:!0,direction:"column",gap:1,children:a.map(n=>e.jsxs(i,{container:!0,gap:1.5,flexWrap:"nowrap",children:[e.jsx(i,{children:n.icon}),e.jsxs(i,{container:!0,direction:"column",children:[e.jsx(S,{sx:v.trailHeading,children:n.name}),e.jsx(S,{sx:v.trailDescription,children:n.description})]})]},n.name))}),e.jsx(i,{pt:2,size:12,children:e.jsx(le,{flexItem:!0,sx:v.divider})}),e.jsxs(i,{container:!0,gap:1,direction:"column",children:[e.jsx(S,{sx:{...v.featureText,color:"text.secondary",fontWeight:600},children:t("growYourTeam")}),e.jsx(i,{container:!0,gap:1,direction:"column",children:d.map(n=>e.jsxs(i,{container:!0,gap:1,alignItems:"center",wrap:"nowrap",children:[e.jsx(st,{fill:"#2F80ED"}),e.jsx(i,{children:e.jsx(S,{sx:{...v.featureText,color:"text.primary"},children:n})})]},n))})]})]})]})]})}),e.jsxs(i,{container:!0,mt:2,gap:3,justifyContent:{xs:"space-between",sm:"unset",md:"unset"},flexWrap:"nowrap",children:[e.jsx(be,{customStyles:v.upgradeTodayBtn,text:t("upgradeToday"),onClick:()=>c("/billing")}),e.jsx(be,{text:t("upgradeLater"),variant:"outlined",customStyles:v.upgradeLaterBtn,onClick:()=>c("/engine-room/home")})]})]})},xe={heading:{fontSize:"40px",lineHeight:"48px",textAlign:"center",color:"text.primary",fontWeight:700},linkText:{textDecoration:"none",color:"primary.main"},link:{color:"primary.main",fontSize:"14px"}},wa=({formik:t,inviteToken:m,handleBeforeOAuth:r,socialProvider:a,completeProfileLoading:d})=>{const{t:c}=ce("auth"),n=He(j=>j.breakpoints.down("md"));return e.jsxs(i,{container:!0,flexDirection:"column",height:"100%",py:{xs:2,md:3},gap:{xs:2,md:3},children:[e.jsx(Ke,{}),e.jsxs(i,{flex:1,alignContent:"space-evenly",children:[e.jsxs(i,{container:!0,justifyContent:"center",gap:2,maxWidth:600,margin:"auto",children:[e.jsx(S,{sx:xe.heading,children:c("getStartedTitle")}),e.jsxs(S,{fontSize:"16px",color:"text.primary",textAlign:"center",children:[c("getStartedSubtitle")," "]}),e.jsx(he,{name:"email",label:c("email"),disabled:!!m,value:t.values.email,error:t.touched.email&&!!t.errors.email,helperText:t.touched.email&&t.errors.email,handleChange:t.handleChange,InputProps:{onKeyDown:j=>
1{j.key==="Enter"&&(j.preventDefault(),t.submitForm())}}}),e.jsx(be,{fullWidth:!0,text:c("getStartedButton"),onClick:t.handleSubmit,customStyles:{height:"55px"},disabled:d}),e.jsx(i,{size:12,children:e.jsx(le,{sx:{my:1},children:e.jsx(S,{fontSize:"14px",color:"textSecondary",children:c("or")})})}),e.jsx(i,{size:12,children:e.jsx(ft,{variant:"signup",socialProvider:a,onBeforeOAuth:r,completeProfileLoading:d})}),e.jsxs(S,{textAlign:"center",children:[c("byProceedingYouAgree")," ",n&&e.jsx("br",{}),e.jsx(at,{href:"/terms-and-conditions",target:"_blank",sx:xe.linkText,children:c("termsOfService")})," ",c("andConjunction")," ",e.jsx(at,{href:"/privacy-policy",target:"_blank",sx:xe.linkText,children:c("privacyPolicy")}),"."]})]}),e.jsx(i,{pt:"24px",children:e.jsxs(S,{textAlign:"center",children:[c("alreadyHaveAccount")," ",e.jsx(Le,{component:Mt,to:"/login",sx:xe.linkText,children:c("logIn")})]})}),e.jsx(i,{pt:"24px",children:e.jsxs(Xt,{container:!0,direction:"column",justifyContent:"center",alignItems:"center",children:[e.jsx(i,{children:e.jsx(S,{color:"textPrimary",fontSize:"14px",children:c("notLinkedToApp")})}),e.jsx(i,{children:e.jsx(Le,{component:"a",href:"https://app.touchtight.com/sign_in",sx:xe.link,alignItems:"center",target:"_blank",children:"app.touchtight.com"})})]})})]})]})},Fe={container:{flexDirection:{xs:"row",md:"row"},height:"100vh",overflow:{xs:"auto",md:"hidden",lg:"hidden"}},paymentSummary:{border:t=>`1px solid ${t.palette.divider}`,borderRadius:5,p:3},divider:{color:t=>t.palette.divider,height:"70%",mt:10,borderRightWidth:"5px"}},Sa={email:""};let Ye=new Date;Ye.setFullYear(Ye.getFullYear()+1);const va={email:"",fullName:"",password:"",clubName:"",primaryColor:"#292F4C",contrastColor:"#637381",startDate:new Date,endDate:Ye},Ca=()=>{var Ze,Xe,et;const{t}=ce("auth"),[m]=gt(Jt),r=Ue(),a=it(s=>s.register),d=qt();Gt();const[c,n]=l.useState(null),{handleSignUpWithMetadata:j,loading:E}=$e(),{handleCompleteProfile:g,loading:I}=xt(),{data:h,isLoading:V}=Me(),{decodedToken:U}=Pt(c),{handleSignOut:M}=ht(),q=h!=null&&h.user&&!h.user.club_id?"social":"email",L=ye(),N=je(),{state:G}=N,b=lt(),z=He(s=>s.breakpoints.down("md")),_=l.useRef(null),D=new URLSearchParams(N.search).get("plan");D&&!ct(D)&&L("/");const u=dt(D),o=u==null?void 0:u.planId,w=u==null?void 0:u.userCount,P=u==null?void 0:u.duration,[ne,oe]=l.useState(Y(u)?(G==null?void 0:G.stepper)||0:1),[k,we]=l.useState(0),[T,Se]=l.useState(!1),[O,Z]=l.useState({}),[J,de]=l.useState(P==="yearly"),[R,ue]=l.useState(null),[ve,y]=l.useState(""),[F,A]=l.useState(!1),[B,$]=l.useState(!1),[re,Ce]=l.useState(!1),[It,Et]=l.useState(""),Q=c,{data:pe}=ca(ea,{fetchPolicy:"no-cache"}),kt=Ee({email:W().trim().required(t("emailRequired")).email(t("emailInvalid"))}),Lt=Ee({...q==="email"&&{email:W().trim().required(t("emailRequired")).email(t("emailInvalid")),fullName:W().required(t("fullNameRequired")).matches(Be,t("nameAlphanumericOnly")),password:W().required(t("passwordRequired")).matches(qe,t("passwordComplexity"))},...!Q&&{clubName:W().required(t("clubNameRequired")).matches(Be,t("nameAlphanumericOnly")),startDate:Kt().required(t("startDateRequired")),endDate:W().required(t("endDateRequired"))}}),_e=ke({initialValues:Sa,enableReinitialize:!0,validationSchema:kt,onSubmit:s=>{me(1),r(H({email:s.email.trim()}))}}),C=ke({initialValues:{...va,email:_e.values.email.trim()},enableReinitialize:!0,validationSchema:Lt,onSubmit:()=>{q==="email"?_t():Ge(Q)}}),me=s=>{oe(s)},Ge=async(s=null)=>{var f;const x={};s?x.inviteToken=s:(x.clubName=C.values.clubName.trim().slice(0,40),x.seasonStartDate=new Date(C.values.startDate).getTime(),x.seasonEndDate=new Date(C.values.endDate).getTime(),x.primaryColor=C.values.primaryColor,x.contrastColor=C.values.contrastColor);const p=await g(x);!p.success||(p==null?void 0:p.status)<200||(p==null?void 0:p.status)>=300?setTimeout(()=>{M(!1),L("/",{replace:!0})},2e3):(p.data&&(r(ze(p.data)),p.data.clubDetails&&r(We(p.data.clubDetails)),p.data.UserActivePlan&&r(ut(p.data.UserActivePlan))),r(H({userId:(f=p.data)==null?void 0:f.id})))},_t=async()=>{var f;const s=C.values.fullName.trim().slice(0,40);s.split(" ");const x={flow:"signup"};Q||(x.clubName=C.values.clubName.trim().slice(0,40),x.seasonStartDate=new Date(C.values.startDate).getTime(),x.seasonEndDate=new Date(C.values.endDate).getTime(),x.primaryColor=C.values.primaryColor,x.contrastColor=C.values.contrastColor),Q&&(x.inviteToken=Q);const p=await j({name:s,email:C.values.email.trim(),password:C.values.password,metadata:x});Ve({event:"register"}),p.success&&r(H({email:C.values.email.trim(),password:C.values.password,userId:(f=p.data)==null?void 0:f.id}))},Je=s=>typeof s=="string"?JSON.parse(s):s,Ot=s=>{var p,f,X,ee,te,ae;const x=s?(X=tt(Je((f=(p=O==null?void 0:O.plan_prices)==null?void 0:p[1])==null?void 0:f.price),w))==null?void 0:X.annualPrice:(ae=tt(Je((te=(ee=O==null?void 0:O.plan_prices)==null?void 0:ee[0])==null?void 0:te.price),w))==null?void 0:ae.price;return parseFloat(x).toFixed(2)},Qe=async s=>{try{const x=`${N.pathname}${N.search}`,p={plan:O,duration:J,planDuration:J?"yearly":"monthly",userSliderCount:w,billingAmount:Oe(k),discountCoupon:R,registerData:a,timestamp:Date.now(),selectedStep:ne,returnPath:x,flow:"signUpWithSocial",provider:s,...Q&&{inviteToken:Q}};sessionStorage.setItem(K,JSON.stringify(p))}catch(x){console.error("Error saving OAuth state:",x)}},Rt=()=>{switch(ne){case 0:return e.jsx(wa,{handleChangeStep:me,formik:_e,inviteToken:Q,socialProvider:It,handleBeforeOAuth:Qe,completeProfileLoading:I});case 1:return e.jsx(ja,{socialSignUpInProgress:(h==null?void 0:h.user)&&!h.user.club_id,handleChangeStep:me,formik:C,inviteToken:Q,loading:T||E||I,plan:O,loggedInUser:d,submitButtonRef:_,billingAmount:Oe(k),userSliderCount:w,signUpProvider:q,setPaymentLoading:$,discountCoupon:R,registerData:a,duration:J,handleBeforeOAuth:Qe});case 2:return e.jsx(ya,{handleChangeStep:me})}},Ft=()=>{_.current.click()},Oe=s=>{var x,p;
1if((x=R==null?void 0:R.data)!=null&&x.percentage){const f=R.data.percentage/100*s;return(s-f).toFixed(2)}else return(p=R==null?void 0:R.data)!=null&&p.price?(s-(R==null?void 0:R.data.price)).toFixed(2):s},Bt=async(s,x)=>{var f,X,ee,te,ae;const p=await m({variables:{verifyDiscountCouponInput:{discount_code:s,plan_id:O.id,duration:J?"yearly":"monthly",userCount:+w}}});(f=p==null?void 0:p.data)!=null&&f.verifyDiscountCoupon&&ue({data:(ee=(X=p==null?void 0:p.data)==null?void 0:X.verifyDiscountCoupon)==null?void 0:ee.data,message:(ae=(te=p==null?void 0:p.data)==null?void 0:te.verifyDiscountCoupon)==null?void 0:ae.message}),A(!1)},Yt=({target:{value:s}})=>{s&&(A(!0),Bt(s))},Ut=({target:{value:s}})=>{s||ue(null),y(s)};return l.useEffect(()=>{window.scrollTo(0,0)},[]),l.useEffect(()=>{const s=Y(d)?(h==null?void 0:h.user)||null:d;if(Y(s))return;r(H({userId:s.id}));async function x(){var f,X,ee,te,ae;if((X=(f=s.userRolesPermissions)==null?void 0:f.roles)!=null&&X.some(Re=>Re.type===zt.SUPER_ADMIN)){try{Se(!0),b.capture(pt.DUGOUT_ADDED_CLUB,{customData:{email:s==null?void 0:s.email,username:s==null?void 0:s.username,userId:s==null?void 0:s.id,clubId:s==null?void 0:s.club_id,roles:(te=(ee=s==null?void 0:s.userRolesPermissions)==null?void 0:ee.roles)==null?void 0:te.map(Re=>Re.name),clubName:(s==null?void 0:s.club_name)||"New Club",seasonStartDate:ie(C.values.startDate,"DD/MM/YYYY"),seasonEndDate:ie(C.values.endDate,"DD/MM/YYYY"),active:!0,createdAt:ie(null,"DD/MM/YYYY"),planName:((ae=a==null?void 0:a.plan)==null?void 0:ae.title)||"Starter",planDuration:(a==null?void 0:a.duration)==="month"?"Monthly":(a==null?void 0:a.duration)==="year"?"Annual":"Unknown",signupFlow:(a==null?void 0:a.flow)||"Unknown",lifetimeValue:0,totalPayments:0,teamAdded:"N",playersAdded:"N"}})}finally{Se(!1)}if(a.flow==="pricing"&&a.plan.id===1)return me(2)}}x()},[d,(Ze=h==null?void 0:h.user)==null?void 0:Ze.id,a==null?void 0:a.flow,(Xe=a==null?void 0:a.plan)==null?void 0:Xe.id]),l.useEffect(()=>{const x=new URLSearchParams(window.location.search).get("join_club_token");x&&n(x)},[]),l.useEffect(()=>{U&&_e.setFieldValue("email",U==null?void 0:U.email)},[U]),l.useEffect(()=>{const x=new URLSearchParams(window.location.search).get("join_club_token");(a==null?void 0:a.flow)===""&&!x&&r(H({flow:"getStarted"}))},[a]),l.useEffect(()=>{var s,x;!V&&re&&((s=h==null?void 0:h.user)!=null&&s.id)&&!((x=h==null?void 0:h.user)!=null&&x.club_id)&&(oe(1),Ce(!1))},[V,re,h]),l.useEffect(()=>{var s,x;if(!V)try{const p=sessionStorage.getItem(K);if(p){const f=JSON.parse(p);f.selectedStep!==void 0&&f.returnPath&&!f.inviteToken?(f.registerData?(r(H(f.registerData)),f.registerData.plan&&!Y(f.registerData.plan)&&Z(f.registerData.plan)):f.plan&&Z(f.plan),de(f.duration),we(f.billingAmount),f.discountCoupon&&ue(f.discountCoupon),(s=h==null?void 0:h.user)!=null&&s.id&&!((x=h==null?void 0:h.user)!=null&&x.club_id)?oe(1):oe(f.selectedStep),Ce(!0)):f.inviteToken&&(n(f.inviteToken),Et(f.provider),Ge(f.inviteToken)),sessionStorage.removeItem(K)}}catch(p){console.error("Error restoring OAuth state:",p),sessionStorage.removeItem(K)}},[r,V,(et=h==null?void 0:h.user)==null?void 0:et.id]),l.useEffect(()=>{!Y(d)&&!Y(O)&&we(Ot(J))},[d,J,O]),l.useEffect(()=>{var s;if((s=pe==null?void 0:pe.plansList)!=null&&s.data){const x=pe.plansList.data.find(p=>p.id===+o);Z(x)}},[pe,o]),e.jsxs(i,{container:!0,sx:Fe.container,flexWrap:{xs:"wrap",md:"nowrap"},children:[e.jsx(i,{height:{xs:"unset",md:"100%"},size:{md:6,lg:7},children:e.jsx(i,{container:!0,px:{xs:3,md:10},gap:3,height:"100%",alignContent:{xs:"flex-start"},direction:"column",children:e.jsx(Le,{height:"100%",width:"100%",children:Rt()})})}),o&&o!=1&&!Y(d)&&a.flow!=="getStarted"?e.jsxs(e.Fragment,{children:[!z&&e.jsx(le,{sx:Fe.divider,orientation:"vertical"}),e.jsx(i,{size:{md:6,lg:5},pt:{xs:"0px",md:"90px"},pr:{xs:3,md:10},pl:{xs:3,md:10,lg:10,xl:20},width:"100vw",justifyContent:"flex-end",children:e.jsx(oa,{plan:O,userSliderCount:w,billingAmount:k,upgrade:!0,loading:B,handleSubmit:Ft,getDiscountedPrice:Oe,duration:J,discountCoupon:R,handleOnBlurDiscountCode:Yt,verifyDiscountCouponLoading:F,handleChangeDiscountCode:Ut,discountCouponCode:ve,directPaymentFlow:!0,customStyles:Fe.paymentSummary})})]}):!z&&e.jsx(i,{size:{md:6,lg:5},width:"100vw",justifyContent:"flex-end",children:e.jsx(Zt,{isMobile:z})})]})},Tt=[{roman:"I",label:"Creating account",caption:"Securing your Touchtight account"},{roman:"II",label:"Setting up club",caption:"Preparing your club workspace"},{roman:"III",label:"Preparing trial",caption:"Getting your trial ready"}],Na=[...Tt,{roman:"IV",label:"Taking you to checkout",caption:"Almost there"}],Da=[...Tt,{roman:"IV",label:"Taking you to pricing",caption:"Choose the plan that suits you"}];function Pa(t){return t==="failed"?"bg-[rgba(245,158,11,0.15)] border-warn text-warn":t==="done"?"bg-[rgba(16,185,129,0.15)] border-ok text-ok":t==="active"?"bg-[rgba(255,128,208,0.15)] border-accent text-accent":"bg-bg-raised border-tt-border text-subtle"}function Ta(t){return t==="failed"?"text-warn font-bold":t==="done"?"text-ok font-bold":t==="active"?"text-accent font-bold":"text-subtle font-semibold"}function Aa(t,m){return t==="done"?`${m} â done.`:t==="active"?`${m} â in progress.`:t==="failed"?`${m} â failed.`:""}function Ia({hasValidPlan:t,currentStep:m,failure:r,onCancel:a}){const d=t?Na:Da,c=Math.min(m,d.length),n=d.map((j,E)=>{const g=E+1;return r&&g===c?"failed":g<c?"done":g===c?"active":"upcoming"});return l.useEffect(()=>{const j=document.getElementById("auth-loading-title");j==null||j.focus()},[]),e.jsxs("div",{className:"relative",children:[a&&r&&e.jsx("button",{type:"button",onClick:a,"aria-label":"Cancel and return to form",className:"absolute top-0 right-0 w-8 h-8 bg-transparent border border-tt-border rounded-sm flex items-center justify-center text-subtle hover:text-fg cursor-pointer",children:e.jsx(Wt,{className:"w-4 h-4"})}
1),e.jsxs("h1",{id:"auth-loading-title",tabIndex:-1,className:"font-head font-bold uppercase text-[42px] leading-[1.05] tracking-wide4 text-fg outline-none",children:["Setting up your"," ",e.jsx("span",{className:"font-serif italic text-accent normal-case font-normal",children:"engine room"}),e.jsx("span",{className:"text-accent",children:"â¦"})]}),e.jsx("ol",{className:"mt-8 list-none pl-0 m-0 space-y-4","aria-live":"polite",children:d.map((j,E)=>{const g=n[E];return e.jsxs("li",{className:"flex items-start gap-3",children:[e.jsx("span",{className:fe("w-[22px] h-[22px] rounded-sm border flex-shrink-0 flex items-center justify-center font-mono text-[10px] tracking-wide8",Pa(g)),children:g==="done"?"â":g==="failed"?"â":j.roman}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:fe("font-head uppercase text-[14px] tracking-wide4",Ta(g)),children:j.label}),g==="active"&&e.jsx("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-accent motion-safe:animate-pulse"})]}),e.jsx("div",{className:"mt-0.5 font-body text-[12px] text-muted",children:j.caption}),e.jsx("span",{className:"sr-only",children:Aa(g,j.label)})]})]},j.roman)})}),t?e.jsx("p",{className:"mt-8 text-[13px] text-muted leading-[1.55]",children:"We're handing you off to Stripe in a moment. Don't close the tab â your trial starts as soon as checkout completes."}):e.jsx("p",{className:"mt-8 text-[13px] text-muted leading-[1.55]",children:"Taking you to pricing to pick a plan. Your account is already created."})]})}const Ea="Unknown Plan";function ka({planId:t,userCount:m,duration:r}){if(t==null||m==null||r==null)return null;const a=mt(t),d=a===Ea?"Your Selected Plan":bt(a),c=m===1?"1 LICENCE":`${m} LICENCES`,n=r==="yearly"?"YEARLY":"MONTHLY";return e.jsxs("div",{className:"inline-flex items-center gap-3.5 px-3 py-2.5 rounded-sm bg-bg-raised border border-hairline border-l-[3px] border-l-accent-2",children:[e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide12 text-accent-2 flex items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-accent-2"}),"Continuing as"]}),e.jsx("span",{"aria-hidden":!0,className:"w-px h-4 bg-hairline"}),e.jsx("span",{className:"font-head font-bold uppercase text-[14px] tracking-wide4 text-fg whitespace-nowrap",children:d}),e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-wide10 text-muted whitespace-nowrap",children:["· ",c," · ",n]})]})}function At(){return e.jsx(ma,{variant:"signup"})}function La(){return e.jsxs("div",{className:"flex flex-nowrap items-center gap-1 sm:gap-2 whitespace-nowrap",children:[e.jsx("span",{"aria-hidden":!0,className:"w-1.5 h-1.5 rounded-full bg-accent-2 flex-shrink-0"}),e.jsx("span",{className:"font-body text-[9px] sm:text-[10px] normal-case tracking-normal text-accent-2",children:"Trusted by"}),e.jsx("span",{className:"font-body text-[9px] sm:text-[10px] normal-case tracking-normal text-fg font-bold",children:"100,000+ coaches and clubs worldwide"})]})}function _a(t){return t==="done"?"bg-[rgba(16,185,129,0.15)] border-ok text-ok":t==="active"?"bg-[rgba(255,128,208,0.15)] border-accent text-accent":"bg-bg-raised border-tt-border text-subtle"}function Oa(t){return t==="done"?"text-ok font-semibold":t==="active"?"text-accent font-bold":"text-subtle font-semibold"}function Ra({planFirst:t,activeIdx:m}){const r=t?["Choose Plan","Create Account","Payment"]:["Create Account","Choose Plan","Payment"],a=r.map((c,n)=>n<m?"done":n===m?"active":"upcoming"),d=["1","2","3"];return e.jsx("div",{className:"flex w-full items-center justify-between gap-1 flex-nowrap",children:r.map((c,n)=>e.jsxs("div",{className:"inline-flex min-w-0 items-center gap-1",children:[e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:fe("box-border shrink-0 w-[18px] h-[18px] sm:w-[22px] sm:h-[22px] rounded-sm border flex items-center justify-center font-mono text-[10px] tracking-wide8",_a(a[n])),children:d[n]}),e.jsx("span",{className:fe("font-body whitespace-nowrap text-[10px] sm:text-[11.5px] normal-case tracking-normal",Oa(a[n])),children:c})]}
1),n<r.length-1&&e.jsx("span",{"aria-hidden":!0,className:fe("hidden sm:block w-[12px] h-px",a[n]==="done"?"bg-ok":"bg-hairline")})]},c))})}function Fa(t){const[m,r]=l.useState(1),[a,d]=l.useState(!1),c=l.useCallback(g=>{d(!1),r(I=>g>I?g:I)},[]),n=l.useCallback(()=>{d(!0)},[]),j=l.useCallback(()=>{r(1),d(!1)},[]);return{isLoading:t.signupLoading||t.processingCheckout||t.oauthProcessing||t.showOAuthReturnLoading,currentStep:m,failure:a,advanceTo:c,markFailed:n,reset:j}}function Ba(){var ve;const{t}=ce("auth"),m=ye(),r=je(),a=Ue(),d=lt(),[c]=Vt(),n=it(y=>y.register),{handleSignUpWithMetadata:j,loading:E}=$e(),{data:g,isPending:I}=Me(),{oauthProcessing:h}=da(),[V]=gt(Qt),[U,M]=l.useState(!1),[q,L]=l.useState(!1),[N,G]=l.useState(null),[b,z]=l.useState(!1),_=l.useMemo(()=>{var F,A;const y=g==null?void 0:g.user;if(I||!(g!=null&&g.user)||y!=null&&y.club_id)return!1;try{const B=sessionStorage.getItem(K);if(!B)return!1;const $=JSON.parse(B);return($==null?void 0:$.flow)==="signUpWithSocial"&&!!((A=(F=$==null?void 0:$.registerData)==null?void 0:F.plan)!=null&&A.planId)}catch{return!1}}
1,[I,g==null?void 0:g.user]),D=new URLSearchParams(r.search).get("plan"),u=!!(D&&ct(D)),o=l.useMemo(()=>{if(!u||!D)return{planId:null,userCount:null,duration:null};const y=dt(D);return{planId:(y==null?void 0:y.planId)??null,userCount:(y==null?void 0:y.userCount)??null,duration:(y==null?void 0:y.duration)??null}},[u,D]),w=o.planId!=null?mt(o.planId):"Unknown Plan",P=w==="Unknown Plan"?"YOUR PLAN":bt(w).toUpperCase(),ne=o.userCount===1?"1 LICENCE":o.userCount!=null?`${o.userCount} LICENCES`:"",oe=o.duration==="yearly"?"YEARLY":"MONTHLY",k=Fa({signupLoading:E,processingCheckout:U,oauthProcessing:h,showOAuthReturnLoading:_});l.useEffect(()=>{_&&k.advanceTo(4)},[_,k]);const we=Ee({email:W().trim().required(t("emailRequired")).email(t("emailInvalid")),password:W().required(t("passwordRequired")).matches(qe,t("passwordComplexity"))}),T=ke({initialValues:{email:"",password:""},validationSchema:we,onSubmit:async y=>{const F={clubName:"Club Name",seasonStartDate:new Date().getTime(),seasonEndDate:new Date().setFullYear(new Date().getFullYear()+1),primaryColor:"#292F4C",contrastColor:"#637381",flow:"getStarted"},A=await j({name:y.email.trim().split("@")[0],email:y.email.trim(),password:y.password,metadata:F});if(Ve({event:"register"}),A.success&&A.data){k.advanceTo(2),L(!0),G(A.data.id),a(H({email:y.email.trim(),password:y.password,userId:A.data.id})),a(ze(A.data));const B=A.data;B.clubDetails&&a(We(B.clubDetails)),k.advanceTo(3)}}});l.useEffect(()=>{if(!q||!N)return;(async()=>{var F,A;try{if(d==null||d.capture(pt.DUGOUT_ADDED_CLUB,{customData:{email:T.values.email,userId:N,clubName:"Club Name",seasonStartDate:ie(new Date().getTime(),"DD/MM/YYYY"),seasonEndDate:ie(new Date().setFullYear(new Date().getFullYear()+1),"DD/MM/YYYY"),active:!0,createdAt:ie(null,"DD/MM/YYYY"),planName:u&&o.planId?o.planId===1?"Starter":((F=n==null?void 0:n.plan)==null?void 0:F.title)||w:w,planDuration:u&&o.duration?o.duration==="yearly"?"Annual":"Monthly":"Unknown",signupFlow:(n==null?void 0:n.flow)||"getStarted",lifetimeValue:0,totalPayments:0,teamAdded:"N",playersAdded:"N"}}),k.advanceTo(4),u&&o.planId&&o.userCount&&o.duration){M(!0);const B=await V({variables:{planId:o.planId,duration:o.duration==="yearly"?"year":"month",userCount:o.userCount,userId:N}}),{success:$,data:re,message:Ce}=((A=B.data)==null?void 0:A.createCheckoutSession)??{};$&&(re!=null&&re.url)?(k.advanceTo(5),pa(re.url)):(c({msg:Ce||"Failed to create checkout session",variant:"error"}),k.markFailed(),M(!1))}else m("/pricing")}catch(B){console.error("Checkout error:",B),c({msg:"An error occurred. Please try again.",variant:"error"}),k.markFailed(),M(!1)}})()},[q,N]),l.useEffect(()=>{const F=new URLSearchParams(window.location.search).get("join_club_token");(n==null?void 0:n.flow)===""&&!F&&a(H({flow:"getStarted"}))},[n,a]);const Se=l.useCallback(y=>{const F=`${r.pathname}${r.search}`,A=u&&o.planId&&o.userCount&&o.duration?{id:o.planId,planId:o.planId,userCount:o.userCount,duration:o.duration,subscriptionCode:D}:{},B={returnPath:F,flow:"signUpWithSocial",provider:y,registerData:{flow:"getStarted",plan:A,duration:o.duration||"",userCount:o.userCount!=null?String(o.userCount):"",email:"",password:""}};sessionStorage.setItem(K,JSON.stringify(B))},[u,o,D,r]),O=l.useCallback(()=>{k.reset(),L(!1),M(!1)},[k]),{isLoading:Z,currentStep:J,failure:de}=k,ue=Z||de&&(q||_);return e.jsxs(e.Fragment,{children:[e.jsx(ua,{}),e.jsx(wt,{rail:e.jsx(At,{}),children:e.jsxs("section",{className:"flex flex-col px-6 py-5 md:px-12 md:py-10","aria-busy":Z,children:[e.jsx(St,{}),e.jsx("div",{className:"flex-1 mt-4 md:mt-8 max-w-[480px] w-full",children:ue?e.jsx(Ia,{email:T.values.email||(((ve=g==null?void 0:g.user)==null?void 0:ve.email)??""),planName:P,licenceLabel:ne,cycleLabel:oe,hasValidPlan:u,currentStep:J,failure:de,onCancel:de?O:void 0}):e.jsxs("form",{onSubmit:T.handleSubmit,className:"flex flex-col gap-5",children:[e.jsx(Ra,{planFirst:u,activeIdx:u?1:0}),u&&e.jsx(ka,{planId:o.planId,userCount:o.userCount,duration:o.duration}),e.jsxs("div",{children:[e.jsx("h1",{className:`m-0 font-head font-bold uppercase text-[34px] md:text-[32px] leading-[1.05] tracking-wide4 text-fg ${u?"":"md:whitespace-nowrap"}`,children:u?e.jsxs(e.Fragment,{children:["One more"," ",e.jsx("span",{className:"font-serif italic text-accent normal-case font-normal text-[36px] md:text-[34px]",children:"step"})," ","to your engine room."]}
1):e.jsxs(e.Fragment,{children:["Coach"," ",e.jsx("span",{className:"font-serif italic text-accent normal-case font-normal text-[36px] md:text-[34px]",children:"smarter"})," ","from minute one."]})}),e.jsxs("p",{className:"mt-3 text-[13px] text-muted leading-[1.6]",children:[u?"Create your account · then we'll take you to checkout to finalise. ":"Start a 14-day trial · card on file · cancel any time. ",e.jsx("a",{href:"/login",className:"text-fg border-b border-hairline hover:border-fg",children:"Already have an account?"})]})]}),e.jsx(jt,{variant:"signup",disabled:Z,onBeforeOAuth:Se}),e.jsx(yt,{label:"Or email"}),e.jsx(ge,{id:"signup-email",name:"email",label:t("email"),type:"email",autoComplete:"email",autoFocus:!0,value:T.values.email,onChange:T.handleChange,onBlur:T.handleBlur,error:!!(T.touched.email&&T.errors.email),errorSuffix:"· required"}),e.jsx(ge,{id:"signup-password",name:"password",label:t("password"),type:b?"text":"password",autoComplete:"new-password",value:T.values.password,onChange:T.handleChange,onBlur:T.handleBlur,trailing:e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>z(y=>!y),className:"bg-transparent border-0 text-muted font-mono text-[10px] uppercase tracking-wide6 cursor-pointer hover:text-fg",children:b?"Hide":"Show"}),children:e.jsx(Ct,{value:T.values.password})}),e.jsx(vt,{disabled:Z||!T.isValid||!T.values.email||!T.values.password,children:u?"Continue to checkout":"Get started"}),e.jsx("div",{className:"pt-2",children:e.jsx(La,{})}),e.jsxs("p",{className:"text-[11.5px] text-subtle leading-[1.55]",children:["By proceeding you agree to our"," ",e.jsx("a",{href:"/terms-and-conditions",target:"_blank",rel:"noopener noreferrer",className:"text-fg border-b border-hairline hover:border-fg",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:"/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-fg border-b border-hairline hover:border-fg",children:"Privacy Policy"}),"."]})]})})]})})]})}function Ya(){const{t}=ce("auth"),m=ye(),r=je(),a=Ue(),{handleSignUpWithMetadata:d,loading:c}=$e(),{handleCompleteProfile:n,loading:j}=xt(),{handleSignOut:E}=ht(),{isPending:g}=Me(),[I,h]=l.useState(null),[V,U]=l.useState(""),[M,q]=l.useState(!1),L=l.useRef(!1),{decodedToken:N}=Pt(I??"");l.useEffect(()=>{const o=new URLSearchParams(window.location.search).get("join_club_token");o&&h(o)},[]);const G=Ee({email:W().trim().required(t("emailRequired")).email(t("emailInvalid")),fullName:W().required(t("fullNameRequired")).matches(Be,t("nameAlphanumericOnly")),password:W().required(t("passwordRequired")).matches(qe,t("passwordComplexity"))}),b=ke({initialValues:{email:"",fullName:"",password:""},validationSchema:G,onSubmit:async u=>{var ne;const o=u.fullName.trim().slice(0,40),w={flow:"signup"};I&&(w.inviteToken=I);const P=await d({name:o,email:u.email.trim(),password:u.password,metadata:w});Ve({event:"register"}),P.success&&a(H({email:u.email.trim(),password:u.password,userId:(ne=P.data)==null?void 0:ne.id}))}}),{setFieldValue:z}=b;l.useEffect(()=>{N!=null&&N.email&&z("email",N.email)},[N,z]);const _=async u=>{var w;const o=await n({inviteToken:u});if(!o.success||(o==null?void 0:o.status)==null||o.status<200||o.status>=300){setTimeout(()=>{E(!1),m("/",{replace:!0})},2e3);return}o.data&&(a(ze(o.data)),o.data.clubDetails&&a(We(o.data.clubDetails)),o.data.UserActivePlan&&a(ut(o.data.UserActivePlan))),a(H({userId:(w=o.data)==null?void 0:w.id}))},se=u=>{try{const w={returnPath:`${r.pathname}${r.search}`,flow:"signUpWithSocial",provider:u,...I&&{inviteToken:I}};sessionStorage.setItem(K,JSON.stringify(w))}catch(o){console.error("Error saving OAuth state:",o)}};l.useEffect(()=>{if(!(g||L.current))try{const u=sessionStorage.getItem(K);if(!u)return;const o=JSON.parse(u);o.inviteToken&&(L.current=!0,sessionStorage.removeItem(K),h(o.inviteToken),o.provider&&U(o.provider),_(o.inviteToken))}catch(u){console.error("Error restoring OAuth state:",u),sessionStorage.removeItem(K)}},[g]),l.useEffect(()=>{window.scrollTo(0,0)},[]);const D=c||j;return e.jsx(wt,{rail:e.jsx(At,{}),children:e.jsxs("section",{className:"flex flex-col px-6 py-8 md:px-12 md:py-10","aria-busy":D,children:[e.jsx(St,{}),e.jsx("div",{className:"flex-1 mt-8 max-w-[480px] w-full",children:e.jsxs("form",{onSubmit:b.handleSubmit,className:"flex flex-col gap-5",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"font-head font-bold uppercase text-[40px] leading-[1.05] tracking-wide4 text-fg",children:["Join your"," ",e.jsx("span",{className:"font-serif italic text-accent normal-case font-normal text-[42px]",children:"club"}),"."]}),e.jsxs("p",{className:"mt-3 text-[13px] text-muted leading-[1.6]",children:["You've been invited to Touchtight · set up your account to get started."," ",e.jsx("a",{href:"/login",className:"text-fg border-b border-hairline hover:border-fg",children:"Already have an account?"})]})]}),e.jsx(jt,{variant:"signup",disabled:D,onBeforeOAuth:se,socialProvider:V,completeProfileLoading:j}),e.jsx(yt,{label:"Or email"}),e.jsx(ge,{id:"invite-email",name:"email",label:t("email"),type:"email",autoComplete:"email",disabled:!0,value:b.values.email,onChange:b.handleChange,onBlur:b.handleBlur,error:!!(b.touched.email&&b.errors.email),errorSuffix:"· required"}),e.jsx(ge,{id:"invite-fullname",name:"fullName",label:t("fullName"),type:"text",autoComplete:"name",autoFocus:!0,value:b.values.fullName,onChange:b.handleChange,onBlur:b.handleBlur,error:!!(b.touched.fullName&&b.errors.fullName),errorSuffix:"· required"}),e.jsx(ge,{id:"invite-password",name:"password",label:t("password"),type:M?"text":"password",autoComplete:"new-password",value:b.values.password,onChange:b.handleChange,onBlur:b.handleBlur,trailing:e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>q(u=>!u),className:"bg-transparent border-0 text-muted font-mono text-[10px] uppercase tracking-wide6 cursor-pointer hover:text-fg",children:M?"Hide":"Show"}),children:e.jsx(Ct,{value:b.values.password})}),e.jsx(vt,{disabled:D||!b.isValid||!b.values.email||!b.values.fullName||!b.values.password,children:"Create account"}),e.jsxs("p",{className:"text-[11.5px] text-subtle leading-[1.55]",children:["By proceeding you agree to our"," ",e.jsx("a",{href:"/terms-and-conditions",target:"_blank",rel:"noopener noreferrer",className:"text-fg border-b border-hairline hover:border-fg",children:"Terms of Service"})," ","and"," ",e.jsx("a",{href:"/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"text-fg border-b border-hairline hover:border-fg",children:"Privacy Policy"}),"."]})]})})]})})}const Hn=()=>{const t=je(),m=new URLSearchParams(t.search);m.get("plan");const r=m.get("join_club_token"),a=$t("signup_v2");return r?a?e.jsx(Ya,{}):e.jsx(Ca,{}):a?e.jsx(Ba,{}):e.jsx(Ht,{})};export{Hn 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.