PageSourceSearch

https://srm.cleeng.com/assets/OidcRoutes-CglrRw8k.js

js cleeng.com collected 2026-10-01 11:26:05 UTC 80,910 bytes, 14 lines download raw bytes

1import{r as t,j as e}from"./react-CdvqIaE_.js";import{n as S,s as $n,d as yn,m as Pn,S as Sn,B as y,e as qn,E as Se,h as T,i as M,j as we,A as We,k as Zn,l as Jn,M as K,o as te,p as le,q as Q,r as Ne,t as wn,w as je,x as ee,y as jn,C as In,D as En,F as Ze,L as kn,G as H,H as Xn,O as Rn,V as Qn,J as Ke,K as eo,N as no,P as ce,Q as He,R as Oe,T as oo,U as vn,W as _n,X as to,Y as so,Z as tn,_ as io,$ as Je,a0 as ao,a1 as ro,a2 as lo,a3 as co,a4 as uo,a5 as mo,a6 as ho,a7 as po,a8 as fe,a9 as fo,aa as sn,ab as xo,ac as go,ad as Co,ae as bo,af as yo,ag as Po,ah as So,ai as wo,aj as jo,ak as Io,al as Eo,am as ko,an as Ro,ao as vo,ap as _o,a as An,aq as Ao,ar as Lo,u as Ln,as as an,at as To,au as No,av as Oo,aw as rn,ax as Do,ay as Mo,az as Bo}from"./main-B9uaBojp.js";import{b as Tn,c as Fo,e as Uo,f as Ho,g as ge,h as Ce,i as Vo,j as Go,u as zo}from"./_phosphor-icons_react-BtYQ6H8S.js";import{C as Yo,a as Wo}from"./cleeng_logo_collapsed-CC8iGh6d.js";import{i as me,a as Ko}from"./axios-BKhs0bAW.js";import{b as Nn,e as Y}from"./react-query-D4gnyQTc.js";import{o as On}from"./userManager-C-cbssvr.js";import{s as $o,t as qo,O as Zo}from"./OidcCallback-DhaU0Z0z.js";import{u as Jo,e as $e}from"./useExitImpersonationMutation-ZmBfUc4b.js";import{d as C,l as Xo}from"./styled-components-CspUMRJ3.js";import{O as ie,a as ae,b as X,p as Qo,S as et,c as nt}from"./OidcError-BMDFVmN1.js";import{L as B,H as G,S as De,D as be,C as Me,F as Dn,a as ot,b as ln,P as tt,c as oe,d as st,e as it,R as at,B as rt,f as lt,g as ct}from"./Layout-BGqChCDh.js";import{d as dt}from"./lodash-CNEbbXJo.js";import"./dayjs-BoW8uPke.js";import{S as ut}from"./SearchInput-DpIBnBe3.js";import{P as mt,a as cn,B as dn,T as ht,t as pt,g as V,b as ft,c as xt,r as re,f as gt,d as Ct,F as bt,e as yt,h as Pt,i as St}from"./PrefixedInput-DUuuXb3q.js";import{B as un}from"./Badge-BT18SIER.js";import{T as wt}from"./Tooltip-D9_MbWGb.js";import{a as jt}from"./_tanstack_table-core-Hu4Z8MPx.js";import{u as Z,b as Ve,c as It}from"./react-hook-form-BRi1N0ru.js";import{o as J}from"./_hookform_resolvers-1-p2ZdXf.js";import{F as i,C as Et}from"./Form-Bdp9EqCI.js";import{c as Ge,a as kt,b as Rt}from"./yup-gG3pJCAK.js";import{e as se}from"./_sentry_core-CwfwR2GV.js";import{LoggedOut as vt}from"./LoggedOut-CzDQ7mT2.js";import{r as _t,c as mn,i as hn,a as de,b as Mn,d as Bn,e as Fn}from"./oidcRedirect-Dgprl69L.js";import{I as Xe}from"./Input-BzU1U8Zu.js";import{a as ze,b as Te,u as At,d as U}from"./react-router-BQKR9g2V.js";import{u as Lt}from"./useInterval-BgNyAgs0.js";import{R as Tt}from"./react-google-recaptcha-DDM4c_5-.js";import"./dompurify-SvrV1nub.js";import"./react-dom-yR1VB4Ly.js";import"./scheduler-ZiDOES29.js";import"./react-router-dom-XLdeLIee.js";import"./_babel_runtime-Bwob-FAs.js";import"./history-Dz4qB4zn.js";import"./resolve-pathname-CHLxl2jX.js";import"./value-equal-DI3dv2GZ.js";import"./tiny-invariant-BkxCA8x3.js";import"./react-redux-Cw_OdgVa.js";import"./hoist-non-react-statics-Deq6SKSO.js";import"./react-is-BuZaPFth.js";import"./use-sync-external-store-kW_XXntP.js";import"./react-lazily-BAKmzSge.js";import"./sonner-CH-MCwuS.js";import"./redux-ByFSoKuf.js";import"./_redux-devtools_extension-Bnw2qPEJ.js";import"./redux-thunk-b-KG6BkZ.js";import"./redux-responsive-BOp373YN.js";import"./mediaquery-DA0_Lv61.js";import"./_reduxjs_toolkit-Ie1TCvrg.js";import"./immer-CkDtEnx6.js";import"./oidc-client-ts-BDndhDU0.js";import"./jwt-decode-CnOcxf5I.js";import"./_mui_material-Cs8FSLA0.js";import"./_mui_utils-DodJbEs_.js";import"./clsx-BUV1L3T1.js";import"./prop-types-C67IGS0Z.js";import"./react-transition-group-DwBMsqO4.js";import"./dom-helpers-COvqb1Me.js";import"./_mui_system-BLrtmzls.js";import"./_mui_styled-engine-XXOF_FEj.js";import"./_emotion_styled-Cu-zApma.js";import"./_emotion_is-prop-valid-DJMT2tGp.js";import"./_emotion_memoize-Dn7QU9en.js";import"./_emotion_utils-CotiZuMY.js";import"./_emotion_serialize-ChnfhtwL.js";import"./_emotion_hash-DdU9N0pI.js";import"./_emotion_unitless-B3kbewgV.js";import"./_emotion_use-insertion-effect-with-fallbacks-D13GI83T.js";import"./_emotion_react-CIz7mwR3.js";import"./_emotion_cache-CWmxyA-O.js";import"./_emotion_sheet-Bwe5lAAv.js";import"./stylis-CkEOXL2w.js";import"./_mui_private-theming-C_TD89tP.js";import"./_popperjs_core-NFHajA1K.js";import"./userpilot-kc2wEbCM.js";import"./react-loading-skeleton-BHJRUP0R.js";import"./_sentry_react-D9CiI0yk.js";import"./_sentry_browser-BPX58jU2.js";import"./_sentry-internal_browser-utils-B5rWzt4o.js";import"./_sentry-internal_replay-64N0ZuiD.js";import"./tslib-JYh5Qxvx.js";import"./path-to-regexp-uhA2a9cx.js";import"./isarray-CXnDmRI7.js";import"./property-expr-KIWKXpSC.js";import"./tiny-case-DlX8oHWz.js";import"./toposort-E9f2gXT9.js";import"./react-helmet-BNsPwHjF.js";import"./react-side-effect-DWGiUZg9.js";import"./react-fast-compare-B88S_YYK.js";import"./object-assign-BBLYpD-V.js";import"./_tanstack_react-table-DOWkKlYM.js";import"./react-select-D3iEUFul.js";import"./_floating-ui_dom-ByOATODE.js";import"./_floating-ui_utils-Bu7DNmq6.js";import"./use-isomorphic-layout-effect-UFfgoQEI.js";import"./memoize-one-CNyXxV9y.js";import"./Checkbox-xm_8K_X_.js";import"./react-async-script-BAiLlAp9.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"d77fe5d16c1b6ff8c173b7d7b73c0144e3fdccbf"}}catch{}})();try{(function(){var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="91a4a9f5-665e-4565-925f-df63fc5b89c2",n._sentryDebugIdIdentifier="sentry-dbid-91a4a9f5-665e-4565-925f-df63fc5b89c2")})()}catch{}const qe=2,Nt="ID3813",Qe=()=>new URLSearchParams(window.location.search).get("callback_id"),en=n=>{var o,s,a;return me(n)&&(((o=n.response)==null?void 0:o.status)===401||((a=(s=n.response)==null?void 0:s.data)==null?void 0:a.code)===Nt)},Ot=["role:clg-super-admin","role:clg-tenant-admin"],Dt=n=>Ot.some(o=>o===n),Un={"role:clg-engineering":"Cleeng Engineering","role:clg-super-admin":"Cleeng Super Admin","role:clg-support-l1":"Cleeng Support L1","role:clg-support-l2"
1:"Cleeng Support L2","role:clg-tenant-admin":"Cleeng Tenant Admin"},Hn=n=>{var o,s;if(!me(n)){S.error("Something went wrong");return}S.error(((s=(o=n.response)==null?void 0:o.data)==null?void 0:s.message)??"Something went wrong")},Mt="/v1/oidc/internal/context",Bt=async(n,o)=>{const{data:s}=await Ko.get(`${On}${Mt}`,{params:{callback_id:n,...o}});return s},Ft=n=>!me(n)||!n.response||n.response.status>=500,nn=(n,o)=>{const s=o.length>=qe;return Nn({enabled:!!n,onError:a=>{en(a)||Hn(a)},queryFn:()=>Bt(n??"",s?{q:o}:{}),queryKey:["internalConsole","selector",n,o],refetchOnWindowFocus:!1,retry:(a,r)=>a<3&&Ft(r)})},Ut=()=>Y({mutationFn:async({callbackId:n})=>(await $n(n),yn(n))}),Ht=C.div.withConfig({displayName:"StaffPortalLayout.styled__PageWrapper",componentId:"sc-302b367e-0"})(["display:flex;flex-direction:column;block-size:100%;"]),Vt=C.header.withConfig({displayName:"StaffPortalLayout.styled__Rail",componentId:"sc-302b367e-1"})(["display:flex;gap:1.5rem;align-items:center;padding-block:1rem;padding-inline:2em 1.5rem;[id='expanded-cleeng-logo']{display:block;}[id='collapsed-cleeng-logo']{display:none;}",""],Pn.small`
2    [id='expanded-cleeng-logo'] {
3      display: none;
4    }
5
6    [id='collapsed-cleeng-logo'] {
7      display: block;
8    }
9  `),pn=C.img.withConfig({displayName:"StaffPortalLayout.styled__Logo",componentId:"sc-302b367e-2"})(["block-size:1.5rem;"]),Gt=C.div.withConfig({displayName:"StaffPortalLayout.styled__Toolbar",componentId:"sc-302b367e-3"})(["display:flex;flex:1;gap:1rem;align-items:center;justify-content:space-between;padding-block:1rem;padding-inline:1.25rem;background:",";border-radius:",";"],({theme:n})=>n.colors.button.darkBlue,({theme:n})=>n.radii.medium),zt=C.div.withConfig({displayName:"StaffPortalLayout.styled__IdentityCluster",componentId:"sc-302b367e-4"})(["display:flex;gap:0.5rem;align-items:center;font-size:",";color:",";svg{color:",";}"],({theme:n})=>n.fonts.sm,({theme:n})=>n.colors.neutral[1e3],({theme:n})=>n.colors.system.brand),Yt=C.span.withConfig({displayName:"StaffPortalLayout.styled__RoleLabel",componentId:"sc-302b367e-5"})(["font-weight:600;"]),Wt=C.div.withConfig({displayName:"StaffPortalLayout.styled__ActionCluster",componentId:"sc-302b367e-6"})(["display:flex;gap:0.75rem;
9align-items:center;"]),Kt=C.main.withConfig({displayName:"StaffPortalLayout.styled__Content",componentId:"sc-302b367e-7"})(["overflow-y:auto;flex:1;min-block-size:0;"]),$t=({children:n})=>{const o=t.useRef(Qe()),{data:s}=nn(o.current,""),{isLoading:a,mutate:r}=Jo(),{isLoading:u,mutate:m}=Ut(),h=s!=null&&s.role?Un[s.role]:null,l=s==null?void 0:s.cleeng_admins_url,c=!!l&&Dt(s==null?void 0:s.role),x=t.useCallback(()=>{r(void 0,{onError:$e,onSuccess:$e})},[r]);t.useEffect(()=>{const d=g=>{g.persisted&&window.location.reload()};return window.addEventListener("pageshow",d),()=>window.removeEventListener("pageshow",d)},[]);const p=t.useCallback(()=>{!o.current||!c||!l||($o(l),m({callbackId:o.current},{onError:d=>{qo(),S.error(Sn.select(d).message)},onSuccess:({redirectUrl:d})=>{window.location.assign(d)}}))},[l,c,m]);return e.jsxs(Ht,{children:[e.jsxs(Vt,{children:[e.jsx(pn,{alt:"Cleeng",id:"expanded-cleeng-logo",src:Yo}),e.jsx(pn,{alt:"Cleeng",id:"collapsed-cleeng-logo",src:Wo}),e.jsxs(Gt,{children:[e.jsxs(zt,{children:[e.jsx(Tn,{size:18}),h?e.jsx(Yt,{children:h}):null]}),e.jsxs(Wt,{children:[o.current&&c?e.jsx(y,{color:"green",disabled:u,onClick:p,size:"small",variant:"outlined",children:"Cleeng Internal Console"}):null,e.jsx(y,{color:"green",disabled:a,onClick:x,size:"small",variant:"contained",children:"Sign out"})]})]})]}),e.jsx(Kt,{children:n})]})},qt=()=>Y({mutationFn:({callbackId:n})=>qn(n)}),fn=C.section.withConfig({displayName:"EmployeeRequestAccess.styled__LayoutInnerWrapper",componentId:"sc-a54647b5-0"})(["display:flex;flex-direction:column;gap:0.5rem;& > h1{padding-block-end:1em;}& > p{padding-block-end:0.5em;line-height:1.4;}& > a{align-self:center;}"]),Zt=()=>{const n=t.useRef(Qe()),o=t.useRef(sessionStorage.getItem(Se)??""),[s,a]=t.useState(null),{data:r,error:u,isError:m,isFetching:h}=nn(n.current,""),{isLoading:l,mutate:c}=qt(),x=t.useCallback(()=>{n.current&&c({callbackId:n.current},{onError:Hn,onSuccess:()=>a(new Date)})},[c]);if(!n.current||m&&en(u))return e.jsx(B,{title:"Request access",children:e.jsxs(ie,{children:[e.jsx(ae,{children:"This session link is missing or invalid"}),e.jsx(X,{children:"Please sign in again to restart."}),e.jsx(y,{onClick:M,to:T.path,variant:"outlined",children:"Return to sign in"})]})});if(h)return e.jsx(we,{});if(s||r!=null&&r.has_pending_request){const p=s?"Request sent":"Request already sent";return e.jsx(B,{title:p,children:e.jsxs(fn,{children:[e.jsx(G,{children:p}),s?e.jsx("p",{children:"We notified the Super Admins. You will get an email when your tier is assigned."}):e.jsx("p",{children:"You already have a request pending. You'll get an email once a Super Admin assigns your tier."}),e.jsx(We,{index:"request-access-success",isFullWidth:!0,isOutlined:!0,message:e.jsxs(e.Fragment,{children:["Requested by ",e.jsx("strong",{children:o.current}),s?` · ${s.toLocaleString()}`:""]}),type:"success"}),e.jsx(y,{className:"inline-full spaced",onClick:M,to:T.path,variant:"contained",children:"Back to sign in"})]})})}return e.jsx(B,{title:"Request access",children:e.jsxs(fn,{children:[e.jsx(G,{children:"You don't have access yet"}),e.jsxs("p",{children:["Google recognized ",e.jsx("strong",{children:o.current}),", but no Super Admin has approved you yet. Send a request and someone from the Super Admin team will decide what you can do."]}),e.jsx(We,{index:"request-access-info",isOutlined:!0,message:"Super Admins will pick a tier for you (Support L1, Support L2, Engineering, or Admin) - that decides what you can do inside a publisher. Every approved employee sees the full list of publishers.",type:"default"}),e.jsx(y,{className:"inline-full spaced",disabled:l,onClick:x,variant:"contained",children:"Request access"}),e.jsx(y,{color:"darkBlue",onClick:M,size:"small",to:T.path,children:"Back to sign in"})]})})},Jt=()=>Y({mutationFn:async({callbackId:n,publisherId:o})=>(await Zn(n,o),yn(n))}),Xt=({callbackId:n,isOpen:o,onClose:s,publisher:a,role:r})=>{const{isLoading:u,mutate:m}=Jt(),h=t.useCallback(()=>{m({callbackId:n,publisherId:a.publisher_id},{onError:l=>{const{message:c}=Sn.select(l);S.error(c),s()},onSuccess:({redirectUrl:l})=>{Jn({publisherName:a.name,roleLabel:r?Un[r]:void 0}),window.location.assign(l)}})},[n,s,a,r,m]);return e.jsxs(K,{isOpen:o,onClose:s,children:[e.jsx(K.Header,{children:e.jsx(K.Title,{children:"Open this publisher's dashboard?"})}),e.jsxs(K.Body,{children:["You're about to open:"," ",e.jsxs("strong",{children:[a.name," 
9(",a.publisher_id,")"]}),". Anything you change from here will affect this publisher's live account."]}),e.jsxs(K.Footer,{children:[e.jsx(y,{onClick:s,variant:"outlined",children:"Close"}),e.jsx(y,{disabled:u,onClick:h,variant:"contained",children:"Open dashboard"})]})]})},xn=C.section.withConfig({displayName:"PublisherPicker.styled__PublisherPicker",componentId:"sc-780f98ed-0"})(["display:flex;flex-direction:column;gap:1.5rem;width:100%;max-width:1200px;margin:0 auto;padding:2.5rem 1.5rem;","{margin:0;padding:0;}"],mt),Qt=C.p.withConfig({displayName:"PublisherPicker.styled__Subtitle",componentId:"sc-780f98ed-1"})(["line-height:1.4;color:",";"],({theme:n})=>n.colors.text.dark),es=C.div.withConfig({displayName:"PublisherPicker.styled__HeaderWrapper",componentId:"sc-780f98ed-2"})(["margin-block:1rem;"]),ns=C.div.withConfig({displayName:"PublisherPicker.styled__SearchWrapper",componentId:"sc-780f98ed-3"})(["width:100%;max-width:420px;"]),os=C.div.withConfig({displayName:"PublisherPicker.styled__ActionCell",componentId:"sc-780f98ed-4"})(["display:flex;gap:0.5rem;align-items:center;"]),ts=C.span.withConfig({displayName:"PublisherPicker.styled__TooltipWrapper",componentId:"sc-780f98ed-5"})(["display:inline-flex;"]),Le=jt(),ss=n=>[Le.accessor("name",{header:"Publisher Name"}),Le.accessor("publisher_id",{header:"Publisher ID"}),Le.accessor("enterable",{cell:o=>o.getValue()?e.jsx(un,{color:"success",children:"Active"}):e.jsx(un,{color:"warning",children:"Unavailable"}),header:"Status"}),Le.display({cell:({row:o})=>{const s=o.original,a=e.jsxs(y,{align:"start","aria-label":"Access publisher",disabled:!s.enterable,onClick:()=>n(s),size:"small",variant:"contained",children:[e.jsx(Fo,{size:18}),"Access publisher"]});return e.jsx(os,{children:!s.enterable&&s.not_enterable_reason?e.jsx(ts,{children:e.jsx(wt,{title:s.not_enterable_reason,children:a})}):a})},header:"Action",id:"action",minSize:200})],is=500,as=(n,o=is)=>{const[s,a]=t.useState(n),r=t.useMemo(()=>dt(a,o),[o]);return t.useEffect(()=>(r(n),()=>r.cancel()),[n,r]),s},rs=()=>{const n=t.useRef(Qe()),[o,s]=t.useState(""),[a,r]=t.useState(null),u=as(o),{data:m,error:h,isError:l,isFetching:c}=nn(n.current,u),x=t.useMemo(()=>ss(r),[]),p=t.useCallback(f=>s(f.target.value),[]),d=t.useCallback(()=>r(null),[]);if(!n.current||l&&en(h))return e.jsxs(xn,{children:[e.jsx(cn,{title:"Access a publisher"}),e.jsxs(dn,{children:[e.jsx("p",{children:"This sign-in session has ended. Please sign in again to restart."}),e.jsx(y,{onClick:$e,size:"small",children:"Return to sign in"})]})]});const g=(m==null?void 0:m.publishers)??[],b=u.length>=qe;return e.jsxs(xn,{children:[e.jsxs(es,{children:[e.jsx(cn,{title:"Access a publisher"}),e.jsx(Qt,{children:"Pick a publisher to open their dashboard. Everything you do inside is tied to your Cleeng identity."})]}),e.jsx(ns,{children:e.jsx(ut,{onChange:p,placeholder:"Search by publisher name or ID",value:o})}),b?e.jsx(ht,{columns:x,data:g,enableSorting:!1,isFetching:c,tableId:"publisher-picker-table"}):e.jsx(dn,{children:e.jsxs("p",{children:["Type at least ",qe," characters to search for a publisher."]})}),e.jsx(We,{index:"impersonation-publisher-picker-audit-trail-info",isFullWidth:!0,isOutlined:!0,message:"Every action you take in a publisher's dashboard is tied to your Cleeng identity via the session token.",type:"default"}),a?e.jsx(Xt,{callbackId:n.current,isOpen:!0,onClose:d,publisher:a,role:m==null?void 0:m.role}):null]})},ls=[{from:"/login",to:T.path},{from:"/register",to:te.path},{from:"/login/2fa",to:le.path},{from:"/forgot-password",to:Q.path},{from:"/reset-password",to:Ne.path},{from:"/activate",to:te.path},{from:"/auth-oidc/callback",to:wn.path},{from:"/oidc/error",to:je.path},{from:"/code-entry",to:ee.path},{from:"/auth-oidc/2fa",to:le.path},{from:"/auth-oidc/identify",to:T.path},{from:"/auth-oidc/internal/login",to:jn.path},{from:"/auth-oidc/internal/no-tier",to:In.path},{from:"/auth-oidc/internal/selector",to:En.path},{from:"/auth-oidc/login",to:Ze.path},{from:"/auth-oidc/password-reset",to:Q.path},{from:"/auth-oidc/password-reset/confirm",to:Ne.path},{from:"/auth-oidc/register",to:te.path},{from:"/auth-oidc/logged-out",to:kn.path}],cs=C.div.withConfig({displayName:"AuthBackLink.styled__BackRow",componentId:"sc-5bf66b6f-0"})(["justify-self:start;text-align:start;"]),Vn=({children:n,onClick:o})=>e.jsx(cs,{children:e.jsxs(y,{color:"darkBlue",onClick:o,size:"smallest",type:"button",children:[e.jsx(Uo,{"aria-hidden":!0}),n]})}),ds=C.p.withConfig({displayName:"AuthFooterLink.styled__FooterRow",componentId:"sc-f9150301-0"})(["display:flex;flex-wrap:wrap;gap:0.35em;align-items:center;justify-content:center;margin-block:0.75em 0;font-size:",";font-weight:300;color:",";button{font-size:",";text-decoration:underline;font-weight:400;}"],({theme:n})=>n.fonts.sm,({theme:n})=>n.colors.text.gray,({theme:n})=>n.fonts.sm),ye=({children:n,prompt:o,...s})=>e.jsxs(ds,{children:[o," ",s.to?e.jsx(H,{color:"accent",onClick:s.onClick,to:s.to,children:n}):e.jsx(y,{color:"green",disabled:s.disabled,onClick:s.onClick,size:"small",type:"button",children:n})]}),us=C.span.withConfig({displayName:"OtpChallenge.styled__OtpShieldBadge",componentId:"sc-323935e8-0"})(["display:flex;align-items:center;justify-content:center;width:44px;height:44px;font-size:",";color:",";background-color:",";border-radius:",";"],({theme:n})=>n.fonts.lg,({theme:n})=>n.colors.getColor("success"),({theme:n})=>n.colors.getColor("success",20),({theme:n})=>n.radii.large),ms=C.div.withConfig({displayName:"OtpChallenge.styled__OtpChallengeWrapper",componentId:"sc-323935e8-1"})(["display:grid;gap:0.75rem;justify-items:center;width:100%;form > div{align-items:center;}"]),hs=C.h1.withConfig({displayName:"OtpChallenge.styled__OtpChallengeTitle",componentId:"sc-323935e8-2"})(["color:",";font-size:",";font-weight:600;text-align:center;margin-block-end:0;"],({theme:n})=>n.colors.neutral[100],({theme:n})=>n.fonts["2xl"]),ps=C.p.withConfig({displayName:"OtpChallenge.styled__OtpChallengeDescription",componentId:"sc-323935e8-3"})(["max-width:400px;margin-block-end:1em;line-height:1.6;color:",";text-align:center;"],({theme:n})=>n.colors.text.dark),on=({description:n,email:o,isResendPending:s,isVerifyPending:a,onBack:r,onResend:u,onVerify:m,resendDisabled:h,submitDisabled:l,title:c})=>{const x=t.useRef(null),p=t.useRef(!1),{control:d,formState:g,handleSubmit:b,reset:f,...A}=Z({defaultValues:{code:""},mode:"onChange",resolver:J(Xn())}),P=t.useCallback(()=>{f({code:""})},[f]),E=t.useCallback(({code:w})=>{m(w,P)},[P,m]);return t.useEffect(()=>{var w;g.isValid&&!p.current&&((w=x.current)==null||w.focus()),p.current=g.isValid}
9,[g.isValid]),e.jsxs(ms,{children:[r?e.jsx(Vn,{onClick:r,children:"Back to sign in"}):null,e.jsx(us,{children:e.jsx(Ho,{"aria-hidden":!0,size:24,weight:"bold"})}),e.jsx(hs,{children:c}),e.jsx(ps,{children:n??e.jsxs(e.Fragment,{children:["We sent a 6-digit code to ",e.jsx("strong",{children:o||Rn}),"."]})}),e.jsxs(i,{control:d,formState:g,handleSubmit:b,onSubmit:E,reset:f,...A,children:[e.jsx(i.ItemControlled,{control:d,name:"code",render:({field:w})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{className:"visually-hidden",children:"Verification code"}),e.jsx(i.CodeInput,{autoFocus:!0,disabled:a,length:Qn,onBlur:w.onBlur,onChange:j=>w.onChange(Ke(j.target.value)),onPaste:j=>{j.preventDefault(),w.onChange(Ke(j.clipboardData.getData("text")))},ref:w.ref,value:w.value})]})}),e.jsx(y,{className:"inline-full spaced",disabled:!g.isValid||a||l,ref:x,type:"submit",variant:"contained",children:a?"Verifying…":"Verify & continue"})]}),e.jsx(ye,{disabled:s||h,onClick:u,prompt:"Didn't receive it?",children:"Resend code"})]})},fs=()=>Y({mutationFn:({callbackId:n,code:o})=>eo(n,o)}),xs=()=>Y({mutationFn:({callbackId:n,email:o})=>no(n,o)}),gs=30,Cs=30,gn=1e3,xe="oidc:otp-callback-id",Gn="oidc:registration-email",bs=()=>Ge().shape({email:kt().required("Please enter your email address").test("validSafeEmail","Please provide a valid email",pt).trim()}),ys=({isLoading:n,isOpen:o,onClose:s,onSubmit:a})=>{const{control:r,formState:u,reset:m,...h}=Z({defaultValues:{email:""},mode:"onSubmit",resolver:J(bs())}),l=Ve({control:r,name:"email"}),c=t.useCallback(({email:p})=>{a(p)},[a]),x=t.useCallback(()=>{m(),s()},[s,m]);return e.jsxs(K,{isOpen:o,onClose:x,children:[e.jsx(K.Header,{children:e.jsx(K.Title,{children:"Enter your email"})}),e.jsxs(i,{control:r,formProps:{noValidate:!0},formState:u,onSubmit:c,reset:m,...h,children:[e.jsx(K.Body,{children:e.jsxs(i.Item,{control:r,name:"email",children:[e.jsx(i.Label,{children:"Email"}),e.jsx(i.Input,{clearOnInvalid:!0,type:"email"}),e.jsx(i.Error,{})]})}),e.jsx(K.Footer,{children:e.jsxs(y.Wrapper,{children:[e.jsx(y,{onClick:x,type:"button",variant:"outlined",children:"Cancel"}),e.jsx(y,{disabled:n||!l.trim(),type:"submit",variant:"contained",children:"Send code"})]})})]})]})},Ps=C.section.withConfig({displayName:"EmailConfirmPending.styled__EmailConfirmPendingPage",componentId:"sc-2d354e82-0"})(["display:grid;height:100%;justify-items:center;place-content:center;gap:1.5rem;form >{button{margin-inline:auto;&[type='submit']{inline-size:100%;justify-content:center;}&:not([type='submit']){margin-block-start:calc(1.5em + 9px);}}}"]),Ss=C.h1.withConfig({displayName:"EmailConfirmPending.styled__EmailConfirmPendingTitle",componentId:"sc-2d354e82-1"})(["color:",";font-size:",";font-weight:600;text-align:center;"],({theme:n})=>n.colors.neutral[100],({theme:n})=>n.fonts["2xl"]),ws=C.p.withConfig({displayName:"EmailConfirmPending.styled__EmailConfirmPendingMessage",componentId:"sc-2d354e82-2"})(["color:",";line-height:1.4;max-width:400px;text-align:center;"],({theme:n})=>n.colors.text.dark);C.p.withConfig({displayName:"EmailConfirmPending.styled__InstructionText",componentId:"sc-2d354e82-3"})(["color:",";text-align:center;max-width:400px;"],({theme:n})=>n.colors.text.dark);const js=()=>{const n=t.useRef(sessionStorage.getItem(Gn)??""),[o]=t.useState(()=>new URLSearchParams(window.location.search).get("callback_id")),[s,a]=t.useState(!1),[r,u]=t.useState(null),[m,h]=t.useState(!1),{isLoading:l,mutate:c}=xs(),{isLoading:x,mutate:p}=fs();t.useEffect(()=>{o&&sessionStorage.setItem(xe,o)},[o]);const d=l||r!==null&&Date.now()<r;t.useEffect(()=>{if(r===null)return;const E=r-Date.now();if(E<=0){u(null);return}const w=setTimeout(()=>u(null),E);return()=>clearTimeout(w)},[r]);const g=t.useCallback(E=>{o&&c({callbackId:o,email:E},{onError:w=>{const j=ce(w);if(j.code==="ID3813"){sessionStorage.removeItem(xe),a(!0);return}const L=j.retryAfterSeconds??Cs;u(Date.now()+L*gn),S.error(V(w,"emailVerification"),{duration:8e3})},onSuccess:()=>{u(Date.now()+gs*gn),S.success("A new code has been sent to your inbox.")}})},[o,c]),b=t.useCallback(()=>{o&&(n.current?g(n.current):h(!0))},[o,n,g]),f=t.useCallback(E=>{h(!1),g(E)},[g]),A=t.useCallback(()=>{h(!1)},[]),P=t.useCallback((E,w)=>{o&&p({callbackId:o,code:E},{onError:j=>{const L=ce(j);if(L.code==="ID3813"){sessionStorage.removeItem(xe),a(!0);return}L.code==="ID3803"&&se(j),(L.code==="ID3808"||L.code==="ID3810"||L.code==="ID3811")&&w(),S.error(V(j,"emailVerification"),{duration:8e3})},onSuccess:async()=>{try{const{redirectUrl:j}=await He(o);if(j){sessionStorage.removeItem(xe),window.location.assign(j);return}}catch(j){se(j)}S.error("Could not finalize sign-in. Please try again.",{duration:8e3})}})},[o,p]);return!o||s?e.jsxs(Ps,{children:[e.jsx(Ss,{children:"This verification session has ended"}
9),e.jsx(ws,{children:"Your verification link is invalid or has expired. Please sign in again to restart."}),e.jsx(y,{onClick:M,to:T.path,variant:"outlined",children:"Return to sign in"})]}):e.jsx(B,{title:"Confirm your email",children:e.jsxs(e.Fragment,{children:[e.jsx(on,{email:n.current,isResendPending:l,isVerifyPending:x,onResend:b,onVerify:P,resendDisabled:d,title:"Confirm your email"}),e.jsx(ys,{isLoading:l,isOpen:m,onClose:A,onSubmit:f})]})})},ue="oidc:session-restarted",ne=n=>(sessionStorage.setItem(ue,"1"),Oe.signIn(n).catch(()=>{sessionStorage.removeItem(ue),S.error("Your sign-in session expired and could not be restarted. Please try again.")})),Is=n=>n.entryType==="navigation",Pe=()=>window.performance.getEntriesByType("navigation").filter(Is).some(n=>n.type==="back_forward"),Es=()=>{const n=t.useRef(new URLSearchParams(window.location.search).get("callback_id")),o=t.useRef(new URLSearchParams(window.location.search).get(oo)??void 0),[s,a]=t.useState(()=>!!n.current&&Pe()),[r,u]=t.useState(!1),{control:m,formState:h,reset:l,...c}=Z({defaultValues:{email:""},mode:"onSubmit",resolver:J(ft())}),x=t.useCallback(b=>{se(b instanceof Error?b:new Error("OIDC signIn failed to start"),{extra:{stage:"signin_start"}}),a(!1),u(!0),S.error("Could not start sign-in. Please try again.",{duration:8e3})},[]),p=t.useCallback(()=>{if(vn()){window.location.replace(`${je.path}?error=renewal_failed`);return}_n(),Oe.signIn({state:o.current}).catch(x)},[x]),d=t.useCallback(()=>{u(!1),n.current&&a(!0),Oe.signIn({state:o.current}).catch(x)},[x]);t.useEffect(()=>{n.current&&!Pe()||p()},[p]),t.useEffect(()=>{const b=f=>{f.persisted&&(a(!0),p())};return window.addEventListener("pageshow",b),()=>window.removeEventListener("pageshow",b)},[p]),t.useEffect(()=>{sessionStorage.getItem(ue)&&(sessionStorage.removeItem(ue),S.error("Your sign-in session may have expired or is invalid. Please sign in again.",{duration:8e3}))},[]);const g=t.useCallback(async({email:b})=>{if(!n.current)return;sessionStorage.setItem(Se,b);const f=await to(n.current,b);if(f.type==="redirect"){window.location.replace(f.url);return}if(f.type==="oidcError"){S.error(_t(f.error));return}if(f.type==="staleSession"){ne();return}S.error(V({code:f.code,message:f.message,status:f.status},"login"))},[]);return r?e.jsx(B,{title:"Sign in",children:e.jsxs(e.Fragment,{children:[e.jsx(G,{children:"Can't reach sign-in"}),e.jsx(De,{children:"We couldn't reach the sign-in service. Check your internet connection and try again."}),e.jsx(y.Wrapper,{align:"center",children:e.jsx(y,{onClick:d,variant:"contained",children:"Try again"})})]})}):!n.current||s?e.jsx(we,{}):e.jsx(B,{title:"Sign in",children:e.jsxs(e.Fragment,{children:[e.jsx(G,{children:"Sign in"}),e.jsx(De,{children:"Enter your email to continue."}),e.jsxs(i,{control:m,formProps:{noValidate:!0},formState:h,onSubmit:g,reset:l,...c,children:[e.jsxs(i.Item,{control:m,name:"email",children:[e.jsx(i.Label,{children:"Email address"}),e.jsx(i.Input,{autoFocus:!0,clearOnInvalid:!0,okSuffixConfirmed:h.isSubmitted,showOkSuffix:!0,type:"email"}),e.jsx(i.Error,{})]}),e.jsx(y,{className:"inline-full spaced",disabled:h.isSubmitting,type:"submit",variant:"contained",children:"Continue"})]}),e.jsx(ye,{prompt:"New to Cleeng?",to:te.path,children:"Create an account"})]})})},Be="oidc:reset-email",ks=C.div.withConfig({displayName:"PasswordStep.styled__LabelRow",componentId:"sc-3e1494eb-0"})(["display:flex;align-items:baseline;justify-content:space-between;margin-block-end:0.6em;"]),Rs=C.div.withConfig({displayName:"PasswordStep.styled__FooterLinks",componentId:"sc-3e1494eb-1"})(["margin-block-start:1.5em;display:grid;gap:0.25em;"]),vs=({callbackId:n,email:o,onBack:s})=>{const[a,r]=t.useState(!0),[u,m]=t.useState(null),{control:h,formState:l,handleSubmit:c,reset:x,...p}=Z({defaultValues:{password:""},mode:"onSubmit",resolver:J(xt())});t.useEffect(()=>{sessionStorage.setItem(Be,o)},[o]);const d=t.useCallback(()=>r(A=>!A),[]),g=t.useCallback(()=>{m(null),x()},[x]),b=t.useCallback(async({password:A})=>{try{const{redirectUrl:P}=await so(n,{email:o,password:A}),E=Qo(P);if(E){m({kind:"locked",resetPath:E.resetPath,unblockAt:E.lockedUntil});return}const w=mn(P);if(hn(w)){S.error(tn),x();return}if(w){window.location.replace(de(P,`${ee.path}?callback_id=${n}`));return}if(Mn(P)){window.location.replace(P);return}if(Bn(P)){window.location.replace(`${ee.path}?callback_id=${n}`);return}if(Fn(P)){window.location.replace(`${le.path}?callback_id=${n}`);return}const{redirectUrl:j}=await He(n),L=mn(j);if(hn(L)){S.error(tn),x();return}if(L){window.location.replace(de(j,`${ee.path}?callback_id=${n}`));return}if(j){window.location.replace(j);return}S.error("Could not finalize sign-in. Please try again.")}catch(P){if(me(P)&&P.response&&P.response.status<500){if(P.response.status===429){const{retryAfterSeconds:E}=ce(P);m({kind:"rateLimited",resetPath:null,unblockAt:new Date(Date.now()+(E??io)*1e3)});return}if(Je(P)){ne();return}if(ao(P)){S.error(ro);return}S.error(V(P,"login"));return}se(P),S.error("Sign-in failed. Please try again.")}},[n,o,x]),f=e.jsxs(e.Fragment,{children:[e.jsxs(ks,{children:[e.jsx(lo,{htmlFor:"password-step-email",children:"Email address"}),e.jsx(y,{color:"green",onClick:s,size:"smallest",type:"button",children:"Change"})]}),e.jsx(Xe,{disabled:!0,id:"password-step-email",readOnly:!0,value:o})]});return u?e.jsxs(e.Fragment,{children:[e.jsx(G,{children:"Sign in"}),e.jsx(De,{children:"Enter your email to continue."}),f,e.jsx(et,{kind:u.kind,onExpire:g,resetPath:u.resetPath,unblockAt:u.unblockAt})]}):e.jsxs(e.Fragment,{children:[e.jsx(G,{children:"Sign in"}),e.jsx(De,{children:"Enter your email to continue."}),f,e.jsx("br",{}),e.jsxs(i,{control:h,formProps:{noValidate:!0},formState:l,handleSubmit:c,onSubmit:b,reset:x,...p,children:[e.jsxs(i.Item,{control:h,name:"password",children:[e.jsx(i.Label,{children:"Password"}),e.jsx(i.Input,{autoFocus:!0,clearOnInvalid:!0,includeDefaultSuffix:!0,okSuffixConfirmed:l.isSubmitted,showOkSuffix:!0,suffixContent:e.jsxs(y,{color:"darkBlue",onClick:d,size:"small",children:[e.jsx("span",{className:"visually-hidden",children:a?"show password":"hide password"}),a?e.jsx(ge,{}):e.jsx(Ce,{})]}),type:a?"password":"text"}),e.jsx(i.Error,{})]}),e.jsx(y,{className:"inline-full spaced",disabled:l.isSubmitting,type:"submit",variant:"contained",children:"Sign in"})]}),e.jsxs(Rs,{children:[e.jsx(ye,{prompt:"Can't log in?",to:Q.path,children:"Reset your password"}),e.jsx(ye,{prompt:"New to Cleeng?",to:te.path,children:"Create an account"})]})]})},_s=()=>{const n=ze(),[{callbackId:o,email:s}]=t.useState(()=>({callbackId:new URLSearchParams(window.location.search).get("callback_id"),email:sessionStorage.getItem(Se)??""})),a=t.useCallback(()=>{M(),n.push(T.path)},[n]);return!o||!s?e.jsxs(ie,{children:[e.jsx(ae,{children:"This sign-in session has ended"}
9),e.jsx(X,{children:"Your sign-in session is invalid or has expired. Please sign in again to restart."}),e.jsx(y,{onClick:M,to:T.path,variant:"outlined",children:"Return to sign in"})]}):e.jsx(B,{title:"Sign in",children:e.jsx(vs,{callbackId:o,email:s,onBack:a})})},zn=Xo(["display:flex;gap:1em;align-items:flex-start;width:100%;padding:1.2em;text-align:start;background-color:",";border:1px solid ",";border-radius:",";transition:box-shadow "," ease-in-out;&:hover,&:focus-visible{box-shadow:",";}&:focus-visible{outline:none;border-color:",";}&:disabled{cursor:not-allowed;opacity:0.6;}"],({theme:n})=>n.colors.neutral[1e3],({theme:n})=>n.colors.neutral[650],({theme:n})=>n.radii[800],({theme:n})=>n.transitions.fastest,({theme:n})=>n.effects.shadow.lg,({theme:n})=>n.colors.getColor("brand")),As=C.button.withConfig({displayName:"SignInChoiceTile.styled__TileButton",componentId:"sc-2458305e-0"})([""," cursor:pointer;"],zn),Ls=C(H).withConfig({displayName:"SignInChoiceTile.styled__TileLink",componentId:"sc-2458305e-1"})([""," color:inherit;"],zn),Ts=C.span.withConfig({displayName:"SignInChoiceTile.styled__TileIcon",componentId:"sc-2458305e-2"})(["display:flex;flex-shrink:0;font-size:",";color:",";"],({theme:n})=>n.fonts.xl,({theme:n,$tone:o})=>o==="success"?n.colors.getColor("success"):n.colors.text.dark),Ns=C.span.withConfig({displayName:"SignInChoiceTile.styled__TileContent",componentId:"sc-2458305e-3"})(["display:flex;flex-direction:column;gap:0.3em;line-height:1.3em;"]),Os=C.span.withConfig({displayName:"SignInChoiceTile.styled__TileTitle",componentId:"sc-2458305e-4"})(["font-size:",";font-weight:600;color:",";"],({theme:n})=>n.fonts.md,({theme:n})=>n.colors.text.dark),Ds=C.span.withConfig({displayName:"SignInChoiceTile.styled__TileDescription",componentId:"sc-2458305e-5"})(["font-size:",";color:",";"],({theme:n})=>n.fonts.sm,({theme:n})=>n.colors.text.gray),Cn=({Icon:n,title:o,description:s,tone:a})=>e.jsxs(e.Fragment,{children:[e.jsx(Ts,{$tone:a,children:e.jsx(n,{})}),e.jsxs(Ns,{children:[e.jsx(Os,{children:o}),e.jsx(Ds,{children:s})]})]}),Fe=({Icon:n,title:o,description:s,tone:a,...r})=>r.href?e.jsx(Ls,{href:r.href,underline:"none",children:e.jsx(Cn,{Icon:n,description:s,title:o,tone:a})}):e.jsx(As,{disabled:r.disabled,onClick:r.onClick,type:"button",children:e.jsx(Cn,{Icon:n,description:s,title:o,tone:a})}),Ms=C.div.withConfig({displayName:"MfaFactorPicker.styled__TileGroup",componentId:"sc-eeaa0679-0"})(["display:flex;flex-direction:column;gap:1.5rem;outline:none;"]),Bs=new Set(["ArrowDown","ArrowRight"]),Fs=new Set(["ArrowLeft","ArrowUp"]),Us=({factors:n,onSelect:o})=>{const s=t.useRef(null),a=t.useCallback(()=>o("totp"),[o]),r=t.useCallback(()=>o("email_otp"),[o]),u=t.useCallback(c=>{var f,A,P;const x=Bs.has(c.key),p=Fs.has(c.key);if(!x&&!p)return;const d=Array.from(((f=s.current)==null?void 0:f.querySelectorAll("button"))??[]),g=d.indexOf(document.activeElement);if(c.preventDefault(),g===-1){(A=d[x?0:d.length-1])==null||A.focus();return}(P=d[(g+(x?1:-1)+d.length)%d.length])==null||P.focus()},[]);t.useEffect(()=>{var c;(c=s.current)==null||c.focus()},[]);const m=n.findIndex(c=>c.type==="totp"),h=n.findIndex(c=>c.type==="email_otp");if(m===-1||h===-1)return null;const l=[{element:e.jsx(Fe,{Icon:Vo,description:"Enter a code from your authenticator app.",onClick:a,title:"Authenticator app"}),key:"totp",order:m},{element:e.jsx(Fe,{Icon:Go,description:"We'll send a one-time code to your email address.",onClick:r,title:"Email code"}),key:"email_otp",order:h}].sort((c,x)=>c.order-x.order);return e.jsx(Ms,{onKeyDown:u,ref:s,tabIndex:-1,children:l.map(c=>e.jsx(t.Fragment,{children:c.element},c.key))})},Yn=t.forwardRef(({onChange:n,...o},s)=>{const a=t.useCallback(r=>{const{target:u}=r;u.value=co(u.value),n==null||n(r)},[n]);return e.jsx(Et,{autoCapitalize:"off",autoCorrect:"off",inputMode:"text",length:uo,onChange:a,pattern:"[A-Za-z0-9]*",spellCheck:!1,type:"text",...o,ref:s})});Yn.displayName="RecoveryCodeInput";const Hs=()=>Y({mutationFn:({callbackId:n,isStaff:o})=>mo(n,o)}),Vs=n=>Nn({enabled:n!==null,queryFn:()=>ho(n),queryKey:["auth","mfa-available-factors",n],retry:!1}),Gs=()=>Y({mutationFn:({callbackId:n,code:o,factorType:s})=>po(n,s,o)}),zs={email_otp:"mfa",recovery_codes:"mfaRecoveryCode",totp:"mfaTotp"},Ys=({factorType:n,isVerifyPending:o,onVerify:s,submitDisabled:a})=>{const{control:r,formState:u,handleSubmit:m,reset:h,...l}=Z({defaultValues:{code:""},mode:"onChange",resolver:J(bo(n))}),c=t.useCallback(()=>{h({code:""})}
9,[h]),x=t.useCallback(({code:d})=>{s(d,c)},[c,s]),p=n==="totp";return e.jsxs(i,{control:r,formState:u,handleSubmit:m,onSubmit:x,reset:h,...l,children:[e.jsx(i.ItemControlled,{control:r,name:"code",render:({field:d})=>p?e.jsx(i.CodeInput,{"aria-label":"Authenticator code",autoFocus:!0,disabled:o,length:yo,onBlur:d.onBlur,onChange:g=>d.onChange(Ke(g.target.value)),ref:d.ref,value:d.value}):e.jsx(Yn,{"aria-label":"Recovery code",autoFocus:!0,disabled:o,onBlur:d.onBlur,onChange:d.onChange,ref:d.ref,value:d.value})}),e.jsx(y,{className:"inline-full spaced",disabled:!u.isValid||o||a,type:"submit",variant:"contained",children:o?"Verifying…":"Verify & continue"})]})},Ws=()=>{const n=ze(),o=t.useRef(new URLSearchParams(window.location.search).get("callback_id")),s=t.useRef(sessionStorage.getItem(Se)??""),[a,r]=t.useState(!1),[u,m]=t.useState(null),[h,l]=t.useState(!1),[c,x]=t.useState(null),[p,d]=t.useState(null),[,g]=t.useState(0),b=t.useRef(null),{data:f,isError:A,isLoading:P}=Vs(o.current),{isLoading:E,mutate:w}=Hs(),{isLoading:j,mutate:L}=Gs(),k=A,O=f??[],W=O.some(I=>I.type==="email_otp"),R=O.some(I=>I.type==="totp"),v=k?"email_otp":c??(W&&R?null:R&&!W?"totp":"email_otp"),Ye=t.useCallback(()=>{M(),n.push(T.path)},[n]),$=p!==null&&Date.now()<p,Ie=p===null?0:Math.ceil((p-Date.now())/fe),Ee=E||$||u!==null&&Date.now()<u,ke=!k&&R&&v!=="recovery_codes";t.useEffect(()=>{if(u===null)return;const I=u-Date.now();if(I<=0){m(null);return}const D=setTimeout(()=>m(null),I);return()=>clearTimeout(D)},[u]),t.useEffect(()=>{if(p===null)return;const I=p-Date.now();if(I<=0){d(null);return}const D=setTimeout(()=>d(null),I);return()=>clearTimeout(D)}
9,[p]),Lt(()=>g(I=>I+1),$?fe:null);const Re=t.useCallback(()=>{const I=o.current;I&&w({callbackId:I,isStaff:k},{onError:D=>{const N=ce(D);m(Date.now()+sn(N)*fe),S.error(V(D,"mfa"),{duration:8e3})},onSuccess:()=>{m(Date.now()+fo*fe),S.success("A new code has been sent to your email address.")}})},[k,w]),ve=t.useCallback(I=>{x(I)},[]),_e=t.useCallback(()=>{b.current=c,x("recovery_codes")},[c]),Ae=t.useCallback(()=>{x(b.current)},[]),he=t.useCallback((I,D)=>{if(I.type==="redirect"){window.location.assign(I.url);return}if(I.type==="oidcError"){const N=new URLSearchParams({error:I.error});I.errorDescription&&N.set("error_description",I.errorDescription);const pe=`${window.location.origin}/?${N.toString()}`,z=de(pe,T.path)??je.path;z===T.path&&M(),window.location.assign(z);return}D(),S.error(V({code:I.code,message:I.message,status:I.status},"mfa"),{duration:8e3})},[]),_=t.useCallback(async(I,D)=>{const N=o.current;if(!N||!v||$)return;l(!0);let pe;try{pe=await xo(N,I)}finally{l(!1)}if(pe.type!=="pending"){he(pe,D);return}L({callbackId:N,code:I,factorType:v},{onError:z=>{const q=ce(z);if(q.code==="ID3813"){r(!0);return}(q.code==="ID3802"||q.code==="ID3803")&&se(z),q.code==="ID3807"?d(Date.now()+sn(q)*fe):q.code==="ID3810"&&v==="totp"?d(Co()):(q.code==="ID3808"||q.code==="ID3810"||q.code==="ID3811")&&D(),S.error(V(z,zs[v]),{duration:8e3})},onSuccess:async()=>{v==="recovery_codes"&&sessionStorage.setItem(go,"true");try{if(!o.current)return;const{redirectUrl:z}=await He(o.current);if(z){window.location.assign(z);return}}catch(z){se(z)}S.error("Could not finalize sign-in. Please try again.",{duration:8e3})}})},[v,he,$,L]);return!o.current||a?e.jsxs(ie,{children:[e.jsx(ae,{children:"This verification session has ended"}),e.jsx(X,{children:"Your verification session is invalid or has expired. Please sign in again to restart."}),e.jsx(y,{onClick:M,to:T.path,variant:"outlined",children:"Return to sign in"})]}):P?e.jsx(ie,{children:e.jsx(X,{children:"Checking your verification options…"})}):e.jsx(B,{title:"Two-factor verification",children:e.jsxs(ie,{children:[$?e.jsxs(X,{role:"alert",children:["Too many attempts. Please wait ",Ie," seconds before trying again."]}):null,v===null?e.jsxs(e.Fragment,{children:[e.jsx(ae,{children:"Two-factor verification"}),e.jsx(X,{children:"Choose how you want to verify it's you."}),e.jsx(Us,{factors:O,onSelect:ve})]}):null,v==="email_otp"?e.jsx(on,{description:e.jsxs(e.Fragment,{children:["Enter the 6-digit code we sent to ",e.jsx("strong",{children:s.current||Rn})]}),email:s.current,isResendPending:E,isVerifyPending:j||h,onBack:Ye,onResend:Re,onVerify:_,resendDisabled:Ee,submitDisabled:$,title:"Check your email"}):null,v==="totp"||v==="recovery_codes"?e.jsxs(e.Fragment,{children:[e.jsx(ae,{children:"Two-factor verification"}),e.jsx(X,{children:v==="totp"?"Enter the 6-digit code from your authenticator app.":"Enter one of the 8-character recovery codes you saved when you set up your authenticator app."}),e.jsx(Ys,{factorType:v,isVerifyPending:j||h,onVerify:_,submitDisabled:$},v)]}):null,ke?e.jsx(y,{color:"darkBlue",onClick:_e,size:"small",variant:"subtle",children:"Use a recovery code"}):null,v==="recovery_codes"?e.jsx(y,{color:"darkBlue",onClick:Ae,size:"small",variant:"subtle",children:"Back"}):null]})})},Ks=C.section.withConfig({displayName:"OidcInternalLogin.styled__ChooserPage",componentId:"sc-3cd7687c-0"})(["display:grid;gap:0.75rem;place-content:center;justify-items:stretch;height:100%;"]),$s=C.div.withConfig({displayName:"OidcInternalLogin.styled__TileStack",componentId:"sc-3cd7687c-1"})(["display:flex;flex-direction:column;gap:0.75em;margin-block-start:1rem;outline:none;"]),qs=C(G).withConfig({displayName:"OidcInternalLogin.styled__PageHeading",componentId:"sc-3cd7687c-2"})(["margin-block-start:0;text-align:start;"]),Zs=new Set(["ArrowDown","ArrowRight"]),Js=new Set(["ArrowLeft","ArrowUp"]),Wn="oidc:internal-login-submitted",bn=n=>!!n&&sessionStorage.getItem(Wn)===n,Xs=()=>{const n=ze(),o=t.useRef(new URLSearchParams(window.location.search).get("callback_id")),s=t.useRef(null),[a,r]=t.useState(()=>!!o.current&&(Pe()||bn(o.current))),[u,m]=t.useState(!1),h=t.useCallback(()=>{o.current=null,r(!1)},[]);t.useEffect(()=>{!o.current||!(Pe()||bn(o.current))||ne().then(h).catch(h)},[h]),t.useEffect(()=>{const d=g=>{g.persisted&&(r(!0),ne().then(h).catch(h))};return window.addEventListener("pageshow",d),()=>window.removeEventListener("pageshow",d)},[h]);const l=t.useCallback(()=>{o.current&&(sessionStorage.setItem(Wn,o.current),m(!0),Po(o.current))},[o]),c=t.useCallback(()=>{o.current&&(m(!0),window.location.replace(So(o.current)))},[o]),x=t.useCallback(()=>{M(),n.push(T.path)},[n]),p=t.useCallback(d=>{var E,w,j;const g=Zs.has(d.key),b=Js.has(d.key);if(!g&&!b)return;const f=Array.from(((E=s.current)==null?void 0:E.querySelectorAll("button, a[href]"))??[]),A=f.indexOf(document.activeElement);if(d.preventDefault(),A===-1){(w=f[g?0:f.length-1])==null||w.focus();return}(j=f[(A+(g?1:-1)+f.length)%f.length])==null||j.focus()},[]);return t.useEffect(()=>{var d;(d=s.current)==null||d.focus()},[]),a?e.jsx(we,{}):o.current?e.jsx(B,{title:"How do you want to sign in?",children:e.jsxs(Ks,{children:[e.jsx(Vn,{onClick:x,children:"Back"}),e.jsx(qs,{children:"How do you want to sign in?"}
9),e.jsxs($s,{onKeyDown:p,ref:s,tabIndex:-1,children:[e.jsx(Fe,{Icon:Tn,description:"Access internal tools and manage publisher accounts.",disabled:u,onClick:l,title:"Continue as a Cleeng support",tone:"success"}),e.jsx(Fe,{Icon:zo,description:"Access a standalone Cleeng account that you own and manage, including accounts created with an email alias.",disabled:u,onClick:c,title:"Continue to your publisher account"})]})]})}):e.jsxs(ie,{children:[e.jsx(ae,{children:"This sign-in session has ended"}),e.jsx(X,{children:"Your sign-in session is invalid or has expired. Please sign in again to restart."}),e.jsx(y,{onClick:M,to:T.path,variant:"outlined",children:"Return to sign in"})]})},Qs=()=>Y({mutationFn:n=>wo(n)}),ei=()=>Ge({email:re.email}),ni=()=>{const[n,o]=t.useState(!1),{isLoading:s,mutate:a}=Qs(),r=t.useRef(sessionStorage.getItem(Be)??""),u=t.useRef(null),m=t.useRef(!r.current),{control:h,formState:l,handleSubmit:c,...x}=Z({defaultValues:{email:r.current},mode:"onSubmit",resolver:J(ei())});t.useEffect(()=>{var g;m.current||!l.isValid||(m.current=!0,(g=u.current)==null||g.focus())},[l.isValid]);const p=Ve({control:h,name:"email"}),d=t.useCallback(({email:g})=>{sessionStorage.setItem(Be,g),a(g,{onError:b=>{S.error(V(b,"passwordReset"))},onSuccess:({redirectUrl:b})=>{if(b){window.location.assign(b);return}o(!0)}})},[a]);return n?e.jsxs(B,{title:"Reset your password",children:[e.jsx(G,{children:"Reset your password"}),e.jsx(be,{$margin:"25px 20px",children:"If an account with this email exists, we've sent a reset code to your inbox."}),e.jsx(Me,{children:e.jsx(H,{color:"subtone",onClick:M,to:T.path,children:"Back to login"})})]}):e.jsxs(B,{title:"Reset your password",children:[e.jsx(G,{children:"Reset your password"}),e.jsx(be,{children:"Enter your email and we'll send you a 6-digit reset code."}),e.jsxs(i,{control:h,formProps:{noValidate:!0},formState:l,handleSubmit:c,onSubmit:d,...x,children:[e.jsxs(i.Item,{control:h,name:"email",children:[e.jsx(i.Label,{children:"Email"}),e.jsx(i.Input,{autoFocus:!r.current,type:"email"}),e.jsx(i.Error,{})]}),e.jsx(y,{className:"inline-full spaced",disabled:!p.trim()||s,ref:u,type:"submit",variant:"contained",children:s?"Sending…":"Send Reset Code"})]}),e.jsx(Me,{children:e.jsx(H,{color:"subtone",onClick:M,to:T.path,children:"Back to login"})})]})},oi=()=>Y({mutationFn:n=>jo(n)}),ti=new Set(["ID3813","ID3815","ID3816","ID3817"]),si=()=>Ge({newPassword:re.password,repeatPassword:re.repeatPassword}),ii=()=>{const n=ze(),o=t.useRef(new URLSearchParams(window.location.search).get("callback_id")),s=t.useRef(sessionStorage.getItem(Be)??""),[a,r]=t.useState("code"),[u,m]=t.useState(""),[h,l]=t.useState(!1),[c,x]=t.useState(!0),[p,d]=t.useState(!0);t.useEffect(()=>{if(!o.current)return;const R=new URLSearchParams(window.location.search);R.delete("callback_id");const F=R.toString();n.replace({pathname:window.location.pathname,search:F?`?${F}`:""})},[n]);const{isLoading:g,mutate:b}=oi(),{control:f,formState:A,handleSubmit:P,...E}=Z({defaultValues:{newPassword:"",repeatPassword:""},mode:"onSubmit",resolver:J(si())}),[w,j]=Ve({control:f,name:["newPassword","repeatPassword"]}),L=t.useCallback(R=>{R==="newPassword"?x(F=>!F):d(F=>!F)},[]),k=t.useCallback(R=>{m(R),r("password")},[]),O=t.useCallback(()=>{n.push(Q.path)},[n]),W=t.useCallback(({newPassword:R})=>{o.current&&b({callbackId:o.current,newPassword:R,resetCode:u},{onError:F=>{const v=ce(F);if(v.code==="ID3814"){S.error(V(F,"passwordReset"),{duration:8e3}),r("code"),m("");return}if(ti.has(v.code)){S.error(V(F,"passwordReset"),{duration:8e3}),l(!0);return}if(v.code==="ID4002"||v.code==="ID4003"){S.error(V(F,"passwordReset"),{duration:8e3});return}S.error(V(F,"passwordReset"))},onSuccess:()=>{M(),n.push(T.path)}})},[u,b,n]);return o.current?a==="code"?e.jsx(B,{title:"Enter 6-digit code",children:e.jsx(on,{email:s.current,isResendPending:!1,isVerifyPending:!1,onResend:O,onVerify:k,resendDisabled:!1,title:"Enter 6-digit code"})}):e.jsxs(B,{title:"Set your new password",children:[e.jsx(G,{children:"Set your new password"}),e.jsxs(be,{$margin:"25px 20px",children:["Create a new password for ",e.jsx("strong",{children:s.current||"your account"}),"."]}),e.jsxs(i,{control:f,formProps:{noValidate:!0},formState:A,handleSubmit:P,onSubmit:W,...E,children:[e.jsxs(i.Item,{control:f,name:"newPassword",children:[e.jsx(i.Label,{children:"New password"}),e.jsx(i.Input,{autoFocus:!0,clearOnInvalid:!0,includeDefaultSuffix:!0,suffixContent:e.jsxs(y,{color:"darkBlue",onClick:()=>L("newPassword"),size:"small",children:[e.jsx("span",{className:"visually-hidden",children:c?"show password":"hide password"}),c?e.jsx(ge,{}):e.jsx(Ce,{})]}),type:c?"password":"text"}),e.jsx(i.Error,{})]}),e.jsxs(i.Item,{control:f,name:"repeatPassword",children:[e.jsx(i.Label,{children:"Confirm new password"}),e.jsx(i.Input,{clearOnInvalid:!0,includeDefaultSuffix:!0,suffixContent:e.jsxs(y,{color:"darkBlue",onClick:()=>L("repeatPassword"),size:"small",children:[e.jsx("span",{className:"visually-hidden",children:p?"show password":"hide password"}),p?e.jsx(ge,{}):e.jsx(Ce,{})]}),type:p?"password":"text"}),e.jsx(i.Error,{})]}),e.jsx(y,{className:"inline-full spaced",disabled:!w||!j||g,type:"submit",variant:"contained",children:g?"Updating…":"Update Password & Sign In"})]},"password-step"),e.jsx(Me,{children:h?e.jsx(H,{color:"subtone",to:Q.path,children:"Request a new reset code"}):e.jsx(H,{color:"subtone",onClick:M,to:T.path,children:"Back to login"})})]}):e.jsxs(B,{title:"Reset password",children:[e.jsx(G,{children:"This reset session has expired"}),e.jsx(be,{$margin:"25px 20px",children:"Your reset link is invali
9d or has expired. Please start over."}),e.jsx(Me,{children:e.jsx(H,{color:"subtone",to:Q.path,children:"Request a new reset code"})})]})},ai=()=>Y({mutationFn:({callbackId:n,payload:o})=>Io(n,o),onError:n=>{var a;if(Je(n)){const r=new URLSearchParams(window.location.search),u=r.get("invitation_id"),m=r.get("invitation_token"),h=r.get("publisher_id");if(u&&m&&h){ne({invitation:{invitation_id:u,invitation_token:m,publisher_id:h}});return}}const o=me(n)?(a=n.response)==null?void 0:a.data:void 0;if(o&&typeof o=="object"&&"code"in o?o.code:void 0){S.error(V(n,"invitationAccept"));return}S.error("This invitation link is invalid or has expired.")},onSuccess:async({redirectUrl:n},{callbackId:o})=>{if(!n){S.error("Something went wrong. Please try again.");return}const s=`${ee.path}?callback_id=${o}`,a=de(n,s);if(a){window.location.replace(a);return}if(Mn(n)){window.location.replace(n);return}if(Bn(n)){window.location.replace(s);return}if(Fn(n)){window.location.replace(`${le.path}?callback_id=${o}`);return}try{const{redirectUrl:r}=await He(o);if(r){const u=de(r,s);window.location.replace(u??r);return}}catch(r){se(r)}S.error("Something went wrong. Please try again.")}}),ri=()=>Ge().shape({firstName:re.firstName,lastName:re.lastName,password:re.password,termsAndConditions:Rt().oneOf([!0],gt.tc).required()}),li=()=>{const n=t.useRef(new URLSearchParams(window.location.search).get("callback_id")).current,o=t.useRef(new URLSearchParams(window.location.search).get("invitee_email")).current,s=t.useRef(new URLSearchParams(window.location.search).get("company_name")).current,[a,r]=t.useState(!0),u=t.useCallback(()=>r(P=>!P),[]),{isLoading:m,mutate:h}=ai(),{control:l,formState:c,handleSubmit:x,...p}=Z({mode:"onSubmit",resolver:J(ri())}),[d,g,b,f]=Ve({control:l,name:["firstName","lastName","password","termsAndConditions"]}),A=t.useCallback(({firstName:P,lastName:E,password:w})=>{n&&(o&&sessionStorage.setItem(Se,o),h({callbackId:n,payload:{first_name:P,last_name:E,password:w}}))},[h,n,o]);return n?e.jsxs(B,{title:"Complete your account",children:[e.jsx(G,{children:"Complete your account"}),e.jsx(be,{$margin:"25px 20px",children:s?e.jsxs(e.Fragment,{children:["You have been invited to ",e.jsx("strong",{children:s}),". Set your password to finish creating your account."]}):"Set your password to finish creating your account."}),e.jsxs(Eo,{children:[e.jsx(ko,{htmlFor:"invitee-email",children:"Email"}),e.jsx(Xe,{autoComplete:"username",disabled:!0,id:"invitee-email",name:"email",type:"email",value:o??""})]}),e.jsxs(i,{control:l,formProps:{noValidate:!0},formState:c,handleSubmit:x,onSubmit:A,...p,children:[e.jsxs(i.Item,{control:l,name:"firstName",children:[e.jsx(i.Label,{children:"First name"}),e.jsx(i.Input,{autoComplete:"given-name"}),e.jsx(i.Error,{})]}),e.jsxs(i.Item,{control:l,name:"lastName",children:[e.jsx(i.Label,{children:"Last name"}),e.jsx(i.Input,{autoComplete:"family-name"}),e.jsx(i.Error,{})]}),e.jsxs(i.Item,{control:l,name:"password",children:[e.jsx(i.Label,{children:"Password"}),e.jsx(i.Input,{autoComplete:"new-password",includeDefaultSuffix:!0,suffixContent:e.jsxs(y,{color:"darkBlue",onClick:u,size:"small",children:[e.jsx("span",{className:"visually-hidden",children:a?"show password":"hide password"}),a?e.jsx(ge,{}):e.jsx(Ce,{})]}),type:a?"password":"text"}),e.jsx(i.Error,{})]}),e.jsxs(Dn,{children:[e.jsxs(i.Item,{control:l,name:"termsAndConditions",children:[e.jsx(i.Checkbox,{variant:"black"}),e.jsx(i.Label,{children:e.jsxs("span",{children:["I accept the"," ",e.jsx(H,{href:"https://cleeng.com/master-service-agreement",target:"_blank",children:"Terms and Conditions"})," ","and"," ",e.jsx(H,{href:"https://cleeng.com/privacy-policy",target:"_blank",children:"Privacy Policy"})]})})]}),c.errors.termsAndConditions?e.jsx(i.Message,{className:"common-message","data-error":"true",children:c.errors.termsAndConditions.message}):null]}),e.jsx(y,{className:"inline-full spaced",disabled:!d||!g||!b||!f||m,type:"submit",variant:"contained",children:m?"Creating account…":"Create account & sign in"})]})]}):e.jsx(we,{})},ci=()=>Y({mutationFn:({callbackId:n,payload:o})=>Ro(n,o),onError:n=>{if(Je(n)){ne({prompt:"create"});return}if(me(n)){S.error(V(n,"registration"));return}ne({prompt:"create"})},onSuccess:({redirectUrl:n},{callbackId:o})=>{const s=`${ee.path}?callback_id=${o}`,a=de(n,s);if(a){window.location.replace(a);return}if(n&&new URL(n).origin===new URL(On).origin){window.location.replace(s);return}window.location.replace(n)}}),di=[{name:"Afghanistan",phonePrefix:"+93",isoCode:"AF"},{name:"Aland Islands",phonePrefix:"+358",isoCode:"AX"},{name:"Albania",phonePrefix:"+355",isoCode:"AL"},{name:"Algeria",phonePrefix:"+213",isoCode:"DZ"},{name:"American Samoa",phonePrefix:"+1684",isoCode:"AS"},{name:"Andorra",phonePrefix:"+376",isoCode:"AD"},{name:"Angola",phonePrefix:"+244",isoCode:"AO"},{name:"Anguilla",phonePrefix:"+1264",isoCode:"AI"},{name:"Antarctica",phonePrefix:"+672",isoCode:"AQ"},{name:"Antigua and Barbuda",phonePrefix:"+1268",isoCode:"AG"},{name:"Argentina",phonePrefix:"+54",isoCode:"AR"},{name:"Armenia",phonePrefix:"+374",isoCode:"AM"},{name:"Aruba",phonePrefix:"+297",isoCode:"AW"},{name:"Australia",phonePrefix:"+61",isoCode:"AU"},{name:"Austria",phonePrefix:"+43",isoCode:"AT"},{name:"Azerbaijan",phonePrefix:"+994",isoCode:"AZ"},{name:"Bahamas",phonePrefix:"+1242",isoCode:"BS"},{name:"Bahrain",phonePrefix:"+973",isoCode:"BH"},{name:"Bangladesh",phonePrefix:"+880",isoCode:"BD"},{name:"Barbados",phonePrefix:"+1246",isoCode:"BB"},{name:"Belarus",phonePrefix:"+375",isoCode:"BY"},{name:"Belgium",phonePrefix:"+32",isoCode:"BE"},{name:"Belize",phonePrefix:"+501",isoCode:"BZ"},{name:"Benin",phonePrefix:"+229",isoCode:"BJ"},{name:"Bermuda",phonePrefix:"+1441",isoCode:"BM"},{name:"Bhutan",phonePrefix:"+975",isoCode:"BT"},{name:"Bolivia, Plurinational State of",phonePrefix:"+591",isoCode:"BO"},{name:"Bosnia and Herzegovina",phonePrefix:"+387",isoCode:"BA"},{name:"Botswana",phonePrefix:"+267",isoCode:"BW"},{name:"Brazil",phonePrefix:"+55",isoCode:"BR"},{name:"British Indian Ocean Territory",phonePrefix:"+246",isoCode:"IO"},{name:"Brunei Darussalam",phonePrefix:"+673",isoCode:"BN"},{name:"Bulgaria",phonePrefix:"+359",isoCode:"BG"},{name:"Burkina Faso",phonePrefix:"+226",isoCode:"BF"},{name:"Burundi",phonePrefix:"+257",isoCode:"BI"}
9,{name:"Cambodia",phonePrefix:"+855",isoCode:"KH"},{name:"Cameroon",phonePrefix:"+237",isoCode:"CM"},{name:"Canada",phonePrefix:"+1",isoCode:"CA"},{name:"Cape Verde",phonePrefix:"+238",isoCode:"CV"},{name:"Cayman Islands",phonePrefix:"+ 345",isoCode:"KY"},{name:"Central African Republic",phonePrefix:"+236",isoCode:"CF"},{name:"Chad",phonePrefix:"+235",isoCode:"TD"},{name:"Chile",phonePrefix:"+56",isoCode:"CL"},{name:"China",phonePrefix:"+86",isoCode:"CN"},{name:"Christmas Island",phonePrefix:"+61",isoCode:"CX"},{name:"Cocos (Keeling) Islands",phonePrefix:"+61",isoCode:"CC"},{name:"Colombia",phonePrefix:"+57",isoCode:"CO"},{name:"Comoros",phonePrefix:"+269",isoCode:"KM"},{name:"Congo",phonePrefix:"+242",isoCode:"CG"},{name:"Congo, The Democratic Republic of the Congo",phonePrefix:"+243",isoCode:"CD"},{name:"Cook Islands",phonePrefix:"+682",isoCode:"CK"},{name:"Costa Rica",phonePrefix:"+506",isoCode:"CR"},{name:"Cote d'Ivoire",phonePrefix:"+225",isoCode:"CI"},{name:"Croatia",phonePrefix:"+385",isoCode:"HR"},{name:"Cuba",phonePrefix:"+53",isoCode:"CU"},{name:"Cyprus",phonePrefix:"+357",isoCode:"CY"},{name:"Czech Republic",phonePrefix:"+420",isoCode:"CZ"},{name:"Denmark",phonePrefix:"+45",isoCode:"DK"},{name:"Djibouti",phonePrefix:"+253",isoCode:"DJ"},{name:"Dominica",phonePrefix:"+1767",isoCode:"DM"},{name:"Dominican Republic",phonePrefix:"+1849",isoCode:"DO"},{name:"Ecuador",phonePrefix:"+593",isoCode:"EC"},{name:"Egypt",phonePrefix:"+20",isoCode:"EG"},{name:"El Salvador",phonePrefix:"+503",isoCode:"SV"},{name:"Equatorial Guinea",phonePrefix:"+240",isoCode:"GQ"},{name:"Eritrea",phonePrefix:"+291",isoCode:"ER"},{name:"Estonia",phonePrefix:"+372",isoCode:"EE"},{name:"Ethiopia",phonePrefix:"+251",isoCode:"ET"},{name:"Falkland Islands (Malvinas)",phonePrefix:"+500",isoCode:"FK"},{name:"Faroe Islands",phonePrefix:"+298",isoCode:"FO"},{name:"Fiji",phonePrefix:"+679",isoCode:"FJ"},{name:"Finland",phonePrefix:"+358",isoCode:"FI"},{name:"France",phonePrefix:"+33",isoCode:"FR"},{name:"French Guiana",phonePrefix:"+594",isoCode:"GF"},{name:"French Polynesia",phonePrefix:"+689",isoCode:"PF"},{name:"Gabon",phonePrefix:"+241",isoCode:"GA"},{name:"Gambia",phonePrefix:"+220",isoCode:"GM"},{name:"Georgia",phonePrefix:"+995",isoCode:"GE"},{name:"Germany",phonePrefix:"+49",isoCode:"DE"},{name:"Ghana",phonePrefix:"+233",isoCode:"GH"},{name:"Gibraltar",phonePrefix:"+350",isoCode:"GI"},{name:"Greece",phonePrefix:"+30",isoCode:"GR"},{name:"Greenland",phonePrefix:"+299",isoCode:"GL"},{name:"Grenada",phonePrefix:"+1473",isoCode:"GD"},{name:"Guadeloupe",phonePrefix:"+590",isoCode:"GP"},{name:"Guam",phonePrefix:"+1671",isoCode:"GU"},{name:"Guatemala",phonePrefix:"+502",isoCode:"GT"},{name:"Guernsey",phonePrefix:"+44",isoCode:"GG"},{name:"Guinea",phonePrefix:"+224",isoCode:"GN"},{name:"Guinea-Bissau",phonePrefix:"+245",isoCode:"GW"},{name:"Guyana",phonePrefix:"+595",isoCode:"GY"},{name:"Haiti",phonePrefix:"+509",isoCode:"HT"},{name:"Holy See (Vatican City State)",phonePrefix:"+379",isoCode:"VA"},{name:"Honduras",phonePrefix:"+504",isoCode:"HN"},{name:"Hong Kong",phonePrefix:"+852",isoCode:"HK"},{name:"Hungary",phonePrefix:"+36",isoCode:"HU"},{name:"Iceland",phonePrefix:"+354",isoCode:"IS"},{name:"India",phonePrefix:"+91",isoCode:"IN"},{name:"Indonesia",phonePrefix:"+62",isoCode:"ID"},{name:"Iran, Islamic Republic of Persian Gulf",phonePrefix:"+98",isoCode:"IR"},{name:"Iraq",phonePrefix:"+964",isoCode:"IQ"},{name:"Ireland",phonePrefix:"+353",isoCode:"IE"},{name:"Isle of Man",phonePrefix:"+44",isoCode:"IM"},{name:"Israel",phonePrefix:"+972",isoCode:"IL"},{name:"Italy",phonePrefix:"+39",isoCode:"IT"},{name:"Jamaica",phonePrefix:"+1876",isoCode:"JM"},{name:"Japan",phonePrefix:"+81",isoCode:"JP"},{name:"Jersey",phonePrefix:"+44",isoCode:"JE"},{name:"Jordan",phonePrefix:"+962",isoCode:"JO"},{name:"Kazakhstan",phonePrefix:"+77",isoCode:"KZ"},{name:"Kenya",phonePrefix:"+254",isoCode:"KE"},{name:"Kiribati",phonePrefix:"+686",isoCode:"KI"},{name:"Korea, Democratic People's Republic of Korea",phonePrefix:"+850",isoCode:"KP"},{name:"Korea, Republic of South Korea",phonePrefix:"+82",isoCode:"KR"},{name:"Kosovo",phonePrefix:"+383",isoCode:"XK"},{name:"Kuwait",phonePrefix:"+965",isoCode:"KW"},{name:"Kyrgyzstan",phonePrefix:"+996",isoCode:"KG"},{name:"Laos",phonePrefix:"+856",isoCode:"LA"},{name:"Latvia",phonePrefix:"+371",isoCode:"LV"},{name:"Lebanon",phonePrefix:"+961",isoCode:"LB"},{name:"Lesotho",phonePrefix:"+266",isoCode:"LS"},{name:"Liberia",phonePrefix:"+231",isoCode:"LR"},{name:"Libyan Arab Jamahiriya",phonePrefix:"+218",isoCode:"LY"},{name:"Liechtenstein",phonePrefix:"+423",isoCode:"LI"},{name:"Lithuania",phonePrefix:"+370",isoCode:"LT"},{name:"Luxembourg",phonePrefix:"+352",isoCode:"LU"},{name:"Macao",phonePrefix:"+853",isoCode:"MO"},{name:"Macedonia",phonePrefix:"+389",isoCode:"MK"},{name:"Madagascar",phonePrefix:"+261",isoCode:"MG"},{name:"Malawi",phonePrefix:"+265",isoCode:"MW"},{name:"Malaysia",phonePrefix:"+60",isoCode:"MY"},{name:"Maldives",phonePrefix:"+960",isoCode:"MV"},{name:"Mali",phonePrefix:"+223",isoCode:"ML"},{name:"Malta",phonePrefix:"+356",isoCode:"MT"},{name:"Marshall Islands",phonePrefix:"+692",isoCode:"MH"},{name:"Martinique",phonePrefix:"+596",isoCode:"MQ"},{name:"Mauritania",phonePrefix:"+222",isoCode:"MR"},{name:"Mauritius",phonePrefix:"+230",isoCode:"MU"},{name:"Mayotte",phonePrefix:"+262",isoCode:"YT"},{name:"Mexico",phonePrefix:"+52",isoCode:"MX"},{name:"Micronesia, Federated States of Micronesia",phonePrefix:"+691",isoCode:"FM"},{name:"Moldova",phonePrefix:"+373",isoCode:"MD"},{name:"Monaco",phonePrefix:"+377",isoCode:"MC"},{name:"Mongolia",phonePrefix:"+976",isoCode:"MN"},{name:"Montenegro",phonePrefix:"+382",isoCode:"ME"},{name:"Montserrat",phonePrefix:"+1664",isoCode:"MS"},{name:"Morocco",phonePrefix:"+212",isoCode:"MA"},{name:"Mozambique",phonePrefix:"+258",isoCode:"MZ"},{name:"Myanmar",phonePrefix:"+95",isoCode:"MM"},{name:"Namibia",phonePrefix:"+264",isoCode:"NA"}
9,{name:"Nauru",phonePrefix:"+674",isoCode:"NR"},{name:"Nepal",phonePrefix:"+977",isoCode:"NP"},{name:"Netherlands",phonePrefix:"+31",isoCode:"NL"},{name:"Netherlands Antilles",phonePrefix:"+599",isoCode:"AN"},{name:"New Caledonia",phonePrefix:"+687",isoCode:"NC"},{name:"New Zealand",phonePrefix:"+64",isoCode:"NZ"},{name:"Nicaragua",phonePrefix:"+505",isoCode:"NI"},{name:"Niger",phonePrefix:"+227",isoCode:"NE"},{name:"Nigeria",phonePrefix:"+234",isoCode:"NG"},{name:"Niue",phonePrefix:"+683",isoCode:"NU"},{name:"Norfolk Island",phonePrefix:"+672",isoCode:"NF"},{name:"Northern Mariana Islands",phonePrefix:"+1670",isoCode:"MP"},{name:"Norway",phonePrefix:"+47",isoCode:"NO"},{name:"Oman",phonePrefix:"+968",isoCode:"OM"},{name:"Pakistan",phonePrefix:"+92",isoCode:"PK"},{name:"Palau",phonePrefix:"+680",isoCode:"PW"},{name:"Palestinian Territory, Occupied",phonePrefix:"+970",isoCode:"PS"},{name:"Panama",phonePrefix:"+507",isoCode:"PA"},{name:"Papua New Guinea",phonePrefix:"+675",isoCode:"PG"},{name:"Paraguay",phonePrefix:"+595",isoCode:"PY"},{name:"Peru",phonePrefix:"+51",isoCode:"PE"},{name:"Philippines",phonePrefix:"+63",isoCode:"PH"},{name:"Pitcairn",phonePrefix:"+872",isoCode:"PN"},{name:"Poland",phonePrefix:"+48",isoCode:"PL"},{name:"Portugal",phonePrefix:"+351",isoCode:"PT"},{name:"Puerto Rico",phonePrefix:"+1939",isoCode:"PR"},{name:"Qatar",phonePrefix:"+974",isoCode:"QA"},{name:"Romania",phonePrefix:"+40",isoCode:"RO"},{name:"Russia",phonePrefix:"+7",isoCode:"RU"},{name:"Rwanda",phonePrefix:"+250",isoCode:"RW"},{name:"Reunion",phonePrefix:"+262",isoCode:"RE"},{name:"Saint Barthelemy",phonePrefix:"+590",isoCode:"BL"},{name:"Saint Helena, Ascension and Tristan Da Cunha",phonePrefix:"+290",isoCode:"SH"},{name:"Saint Kitts and Nevis",phonePrefix:"+1869",isoCode:"KN"},{name:"Saint Lucia",phonePrefix:"+1758",isoCode:"LC"},{name:"Saint Martin",phonePrefix:"+590",isoCode:"MF"},{name:"Saint Pierre and Miquelon",phonePrefix:"+508",isoCode:"PM"},{name:"Saint Vincent and the Grenadines",phonePrefix:"+1784",isoCode:"VC"},{name:"Samoa",phonePrefix:"+685",isoCode:"WS"},{name:"San Marino",phonePrefix:"+378",isoCode:"SM"},{name:"Sao Tome and Principe",phonePrefix:"+239",isoCode:"ST"},{name:"Saudi Arabia",phonePrefix:"+966",isoCode:"SA"},{name:"Senegal",phonePrefix:"+221",isoCode:"SN"},{name:"Serbia",phonePrefix:"+381",isoCode:"RS"},{name:"Seychelles",phonePrefix:"+248",isoCode:"SC"},{name:"Sierra Leone",phonePrefix:"+232",isoCode:"SL"},{name:"Singapore",phonePrefix:"+65",isoCode:"SG"},{name:"Slovakia",phonePrefix:"+421",isoCode:"SK"},{name:"Slovenia",phonePrefix:"+386",isoCode:"SI"},{name:"Solomon Islands",phonePrefix:"+677",isoCode:"SB"},{name:"Somalia",phonePrefix:"+252",isoCode:"SO"},{name:"South Africa",phonePrefix:"+27",isoCode:"ZA"},{name:"South Sudan",phonePrefix:"+211",isoCode:"SS"},{name:"South Georgia and the South Sandwich Islands",phonePrefix:"+500",isoCode:"GS"},{name:"Spain",phonePrefix:"+34",isoCode:"ES"},{name:"Sri Lanka",phonePrefix:"+94",isoCode:"LK"},{name:"Sudan",phonePrefix:"+249",isoCode:"SD"},{name:"Suriname",phonePrefix:"+597",isoCode:"SR"},{name:"Svalbard and Jan Mayen",phonePrefix:"+47",isoCode:"SJ"},{name:"Swaziland",phonePrefix:"+268",isoCode:"SZ"},{name:"Sweden",phonePrefix:"+46",isoCode:"SE"},{name:"Switzerland",phonePrefix:"+41",isoCode:"CH"},{name:"Syrian Arab Republic",phonePrefix:"+963",isoCode:"SY"},{name:"Taiwan",phonePrefix:"+886",isoCode:"TW"},{name:"Tajikistan",phonePrefix:"+992",isoCode:"TJ"},{name:"Tanzania, United Republic of Tanzania",phonePrefix:"+255",isoCode:"TZ"},{name:"Thailand",phonePrefix:"+66",isoCode:"TH"},{name:"Timor-Leste",phonePrefix:"+670",isoCode:"TL"},{name:"Togo",phonePrefix:"+228",isoCode:"TG"},{name:"Tokelau",phonePrefix:"+690",isoCode:"TK"},{name:"Tonga",phonePrefix:"+676",isoCode:"TO"},{name:"Trinidad and Tobago",phonePrefix:"+1868",isoCode:"TT"},{name:"Tunisia",phonePrefix:"+216",isoCode:"TN"},{name:"Turkey",phonePrefix:"+90",isoCode:"TR"},{name:"Turkmenistan",phonePrefix:"+993",isoCode:"TM"},{name:"Turks and Caicos Islands",phonePrefix:"+1649",isoCode:"TC"},{name:"Tuvalu",phonePrefix:"+688",isoCode:"TV"},{name:"Uganda",phonePrefix:"+256",isoCode:"UG"},{name:"Ukraine",phonePrefix:"+380",isoCode:"UA"},{name:"United Arab Emirates",phonePrefix:"+971",isoCode:"AE"},{name:"United Kingdom",phonePrefix:"+44",isoCode:"GB"},{name:"United States",phonePrefix:"+1",isoCode:"US"},{name:"Uruguay",phonePrefix:"+598",isoCode:"UY"},{name:"Uzbekistan",phonePrefix:"+998",isoCode:"UZ"},{name:"Vanuatu",phonePrefix:"+678",isoCode:"VU"},{name:"Venezuela, Bolivarian Republic of Venezuela",phonePrefix:"+58",isoCode:"VE"},{name:"Vietnam",phonePrefix:"+84",isoCode:"VN"},{name:"Virgin Islands, British",phonePrefix:"+1284",isoCode:"VG"},{name:"Virgin Islands, U.S.",phonePrefix:"+1340",isoCode:"VI"},{name:"Wallis and Futuna",phonePrefix:"+681",isoCode:"WF"},{name:"Yemen",phonePrefix:"+967",isoCode:"YE"},{name:"Zambia",phonePrefix:"+260",isoCode:"ZM"},{name:"Zimbabwe",phonePrefix:"+263",isoCode:"ZW"}],ui=()=>e.jsxs(e.Fragment,{children:["This is the main currency for your offers and payouts. You can change it anytime before you start selling. Localized offers in other currencies will be converted to this currency for reporting and payouts."," ",e.jsx(H,{href:"https://publisher.support.cleeng.com/hc/en-us/articles/218388377-Changing-my-Default-Currency",rel:"noopener noreferrer",target:"_blank",children:"Learn more"})]}),mi=C.div.withConfig({displayName:"Register.styled__WebsiteInputWrapper",componentId:"sc-ce7b477e-0"})(["legend{height:auto;margin-block-end:8px;}p[data-error='true']{margin-block-start:0.6em;}","{inline-size:4em;}",""],Ct,Pn.medium`
10    ${bt} {
11      width: 100%;
12    }
13  `),hi=C(y).withConfig({displayName:"Register.styled__WiderButton",componentId:"sc-ce7b477e-1"})(["min-width:90px;justify-content:center;"]),pi=C(i.Label).withConfig({displayName:"Register.styled__LabelWithFixedHeight",componentId:"sc-ce7b477e-2"})(["height:12px;"]),fi=8,xi=({field:n,errors:o})=>{var h,l,c,x;const s=t.useCallback(p=>n.onChange({...n.value,value:p.target.value}),[n]),a=t.useCallback(p=>n.onChange({...n.value,prefix:p.target.value}),[n]),r=t.useMemo(()=>({"aria-invalid":!!(o!=null&&o.value),id:"value",onBlur:n.onBlur}),[n.onBlur,o==null?void 0:o.value]),u=t.useMemo(()=>({"aria-invalid":!!(o!=null&&o.prefix),id:"prefix",onBlur:n.onBlur}),[n.onBlur,o==null?void 0:o.prefix]),m=!!((h=o==null?void 0:o.value)!=null&&h.message||(l=o==null?void 0:o.prefix)!=null&&l.message);return e.jsxs(mi,{children:[e.jsx(yt,{label:"Website",mainName:"Website Address",mainProps:r,mainValue:n.value.value,onChange:s,prefixLength:fi,prefixName:"Website Protocol",prefixOnChange:a,prefixProps:u,prefixValue:n.value.prefix}),e.jsx(i.Error,{dangerouslySetInnerHTML:m?{__html:((c=o==null?void 0:o.value)==null?void 0:c.message)??((x=o==null?void 0:o.prefix)==null?void 0:x.message)??""}:void 0})]})},gi=({step:n,isFormValid:o,isLoading:s,handleSteps:a})=>{switch(n){case 1:return e.jsx(y,{className:"inline-full spaced",disabled:!o,onClick:()=>a(2),variant:"contained",children:"Create your account"});case 2:return e.jsxs(e.Fragment,{children:[e.jsx(y,{onClick:()=>a(1),variant:"outlined",children:"Back"}),e.jsx(hi,{disabled:s||!o,type:"submit",variant:"contained",children:s?e.jsxs(e.Fragment,{children:[e.jsx(ot,{size:20})," Loading"]}):"Complete signup"})]});default:return""}},Ci=()=>vo.reduce((n,o)=>o.type==="checkbox"?{...n,[o.name]:!1}:o.type==="select"?{...n,[o.name]:null}:o.type==="multiselect"?{...n,[o.name]:[]}:o.type==="prefixed"?{...n,[o.name]:o.values}:{...n,[o.name]:""},{}),Ue=n=>Object.entries(n??{}).map(([o,s])=>({label:s,value:o})),bi=()=>Object.fromEntries(Object.entries(_o).map(([n,o])=>[n,o.map(s=>({label:s,value:s}))])),yi={1:["firstName","lastName","email","password","howDidYouHearAboutUs","howDidYouHearAboutUsCustom","phoneNumber","termsAndConditionsFirstSet","termsAndConditionsSecondSet"],2:["company","siteUrl","country","currency","whatBestDescribesYou","whatTypeOfProductDoYouOffer","whatBestDescribesYourRole"]},Pi=(n,o,s)=>yi[s].every(a=>{const r=n(a);return(a==="phoneNumber"||a==="howDidYouHearAboutUsCustom"||o(a)!=="")&&!r.invali
13d}),Si=di.map(n=>({label:n.name,value:n.phonePrefix})),wi=({areCurrentStepFieldsValid:n,control:o,formState:s,handleCaptchaChange:a,handleSteps:r,isLoading:u,reCaptchaKey:m,reCaptchaVisible:h,isFieldConfirmedValid:l,registerStep:c})=>{var Ie,Ee,ke,Re,ve,_e,Ae,he;const{clearErrors:x,getValues:p,setValue:d,watch:g}=It(),{publisherCountries:b,publisherCurrencies:f}=An(_=>_.auth),A=Ue(b.countries),P=Ue(f.currencies),{howDidYouHearAboutUs:E,whatBestDescribesYourRole:w,whatTypeOfProductDoYouOffer:j}=bi(),L=g("howDidYouHearAboutUs"),k=(L==null?void 0:L.value)==="Other",[O,W]=t.useState(!0),[R,F]=t.useState(null),{errors:v}=s;t.useEffect(()=>{k||x("howDidYouHearAboutUsCustom")},[L]),t.useEffect(()=>{W(!0)},[c]);const Ye=t.useCallback(()=>W(_=>!_),[]),$=_=>{if(!_)return;const{label:I,value:D}=_;if(!I||!D)return;const N=p("phoneNumber");N===""&&d("phoneNumber",D),R&&(N!=null&&N.startsWith(R.value))&&d("phoneNumber",N==null?void 0:N.replace(R.value,D)),N!=null&&N.startsWith("+")||d("phoneNumber",`${D}${N}`),F(_)};return e.jsxs(e.Fragment,{children:[c===1?e.jsxs(e.Fragment,{children:[e.jsx(ln,{children:e.jsx(G,{id:"auth-registration-heading",children:"Create an account"})}),e.jsxs(i.HorizontalLayout,{children:[e.jsxs(i.Item,{control:o,name:"firstName",children:[e.jsx(i.Label,{children:"First name"}),e.jsx(i.Input,{autoFocus:!0,clearOnInvalid:!0,okSuffixConfirmed:l==null?void 0:l("firstName"),showOkSuffix:!0})]}),e.jsxs(i.Item,{control:o,name:"lastName",children:[e.jsx(i.Label,{children:"Last name"}),e.jsx(i.Input,{clearOnInvalid:!0,okSuffixConfirmed:l==null?void 0:l("lastName"),showOkSuffix:!0})]}
13),(Ie=s.errors)!=null&&Ie.firstName||(Ee=s.errors)!=null&&Ee.lastName?e.jsx(i.Message,{className:"common-message","data-error":"true",children:((Re=(ke=s.errors)==null?void 0:ke.firstName)==null?void 0:Re.message)??((_e=(ve=s.errors)==null?void 0:ve.lastName)==null?void 0:_e.message)}):null]}),e.jsxs(i.Item,{control:o,name:"email",children:[e.jsx(i.Label,{children:"Professional Email"}),e.jsx(i.Input,{clearOnInvalid:!0,okSuffixConfirmed:l==null?void 0:l("email"),showOkSuffix:!0,type:"email"}),e.jsx(i.Error,{})]}),e.jsxs(i.Item,{control:o,name:"password",children:[e.jsx(i.Label,{children:"Password"}),e.jsx(i.Input,{clearOnInvalid:!0,includeDefaultSuffix:!0,okSuffixConfirmed:l==null?void 0:l("password"),showOkSuffix:!0,suffixContent:e.jsxs(y,{color:"darkBlue",onClick:Ye,size:"small",children:[e.jsx("span",{className:"visually-hidden",children:O?"show password":"hide password"}),O?e.jsx(ge,{}):e.jsx(Ce,{})]}),type:O?"password":"text"}),e.jsx(i.Error,{})]}),e.jsx(i.ItemControlled,{control:o,name:"phoneNumber",render:({field:_})=>e.jsxs(tt,{children:[e.jsxs(Ao,{as:"legend",children:["Phone number ",e.jsx(i.Badge,{})]}),e.jsx("label",{className:"visually-hidden",htmlFor:"phone-country-code",children:"Country prefix"}),e.jsx(oe,{blurInputOnSelect:!0,inputId:"phone-country-code",onChange:$,options:Si,value:R}),e.jsx("label",{className:"visually-hidden",htmlFor:"phone-number",children:"Phone number"}),e.jsx(Xe,{..._,className:"phone-number",id:"phone-number"}),e.jsx(i.Error,{})]})}),e.jsx(i.ItemControlled,{control:o,name:"howDidYouHearAboutUs",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{children:"How did you hear about us?"}),e.jsx(oe,{blurInputOnSelect:!0,options:E,placeholder:"Select",..._}),e.jsx(i.Error,{})]})}),k?e.jsxs(i.Item,{control:o,name:"howDidYouHearAboutUsCustom",children:[e.jsx(i.Label,{children:"If other, please specify:"}),e.jsx(i.Input,{}),e.jsx(i.Error,{})]}):null,e.jsxs(Dn,{children:[e.jsx(st,{children:"By creating an account I agree to:"}),e.jsxs(i.Item,{control:o,name:"termsAndConditionsFirstSet",children:[e.jsx(i.Checkbox,{variant:"black"}),e.jsx(i.Label,{children:e.jsxs("span",{children:[e.jsx("span",{className:"visually-hidden",children:"By creating an account I agree to: "}),e.jsx(H,{href:"https://cleeng.com/master-service-agreement",target:"_blank",children:"Master Subscription Agreement"})," ","and"," ",e.jsx(H,{href:"https://cleeng.com/cleeng-merchant-schedule",target:"_blank",children:"Merchant Schedule"})]})})]}),e.jsxs(i.Item,{control:o,name:"termsAndConditionsSecondSet",children:[e.jsx(i.Checkbox,{variant:"black"}),e.jsx(i.Label,{children:e.jsxs("span",{children:[e.jsx("span",{className:"visually-hidden",children:"By creating an account I agree to: "}),e.jsx(H,{href:"https://cleeng.com/data-processing-agreement",target:"_blank",children:"Data Processing Agreement"})," ","and"," ",e.jsx(H,{href:"https://cleeng.com/privacy-policy",target:"_blank",children:"Privacy Policy"})]})})]}),v.termsAndConditionsFirstSet||v.termsAndConditionsSecondSet?e.jsx(i.Message,{className:"common-message","data-error":"true",children:((Ae=v.termsAndConditionsFirstSet)==null?void 0:Ae.message)||((he=v.termsAndConditionsSecondSet)==null?void 0:he.message)}):null]}),e.jsxs(i.Item,{control:o,name:"marketingConsent",children:[e.jsx(i.Checkbox,{variant:"black"}),e.jsx(i.Label,{children:"Notify me about new cool product updates and use cases (optional)"})]})]}):null,c===2?e.jsxs(e.Fragment,{children:[e.jsxs(ln,{children:[e.jsx(it,{children:"Step 2 of 2"}),e.jsx(G,{as:"h2",children:"Help us set Cleeng up for you"}),e.jsx("p",{children:"You can always customize your account later"})]}),e.jsxs(i.HorizontalLayout,{children:[e.jsxs(i.Item,{control:o,name:"company",children:[e.jsx(i.Label,{children:"Company"}),e.jsx(i.Input,{autoFocus:!0,okSuffixConfirmed:l==null?void 0:l("company"),showOkSuffix:!0}),e.jsx(i.Error,{})]}),e.jsx(i.ItemControlled,{control:o,name:"siteUrl",render:({field:_})=>e.jsx(xi,{errors:v.siteUrl,field:_})})]}),e.jsxs(i.HorizontalLayout,{children:[e.jsx(i.ItemControlled,{control:o,name:"country",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{children:"Country"}),e.jsx(oe,{blurInputOnSelect:!0,options:A,placeholder:"Select",..._}),e.jsx(i.Error,{})]})}
13),e.jsx(i.ItemControlled,{control:o,name:"currency",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsxs(pi,{children:["Default currency ",e.jsx(Pt,{text:e.jsx(ui,{})})]}),e.jsx(oe,{blurInputOnSelect:!0,options:P,placeholder:"Select",..._}),e.jsx(i.Error,{})]})})]}),e.jsx(i.ItemControlled,{control:o,name:"whatBestDescribesYou",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{children:"What best describes your project?"}),e.jsx(oe,{blurInputOnSelect:!0,options:Lo,placeholder:"Select",..._}),e.jsx(i.Error,{})]})}),e.jsx(i.ItemControlled,{control:o,name:"whatTypeOfProductDoYouOffer",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{children:"What type of product do you offer?"}),e.jsx(oe,{blurInputOnSelect:!0,options:j,placeholder:"Select",..._}),e.jsx(i.Error,{})]})}),e.jsx(i.ItemControlled,{control:o,name:"whatBestDescribesYourRole",render:({field:_})=>e.jsxs(e.Fragment,{children:[e.jsx(i.Label,{children:"What best describes your role?"}),e.jsx(oe,{blurInputOnSelect:!0,options:w,placeholder:"Select",..._}),e.jsx(i.Error,{})]})})]}):null,h?e.jsx(at,{"data-testid":"recaptcha-container",children:e.jsx(Tt,{onChange:a,sitekey:m??""})}):null,e.jsx(rt,{children:gi({handleSteps:r,isFormValid:n,isLoading:u,step:c})})]})},ji="en-US",Ii=n=>({company_name:n.company,country:n.country.value,currency:n.currency.value,email:n.email,first_name:n.firstName,last_name:n.lastName,locale:ji,password:n.password,site_name:n.company,site_url:`${n.siteUrl.prefix}${n.siteUrl.value}`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}),Ei=({callbackId:n})=>{const o=Ln(),{mutate:s,isLoading:a}=ci(),[r,u]=t.useState(1),{isLoading:m,isPublisherDataLoading:h,publisherCountries:l,publisherCurrencies:c}=An(k=>k.auth),x=t.useMemo(()=>Ue(c.currencies).find(({value:k})=>c.default===k),[c.default,c.currencies]),p=t.useMemo(()=>Ue(l.countries).find(({value:k})=>l.default===k),[l.default,l.countries]),{control:d,formState:g,reset:b,...f}=Z({defaultValues:Ci(),mode:"onSubmit",resolver:J(St())});f.watch("email");const A=t.useRef(new Set);t.useEffect(()=>{const k=f.watch((O,{name:W})=>{const R=W;R&&A.current.has(R)&&f.trigger(R)});return()=>k.unsubscribe()},[f]);const P=t.useCallback(k=>an[1].includes(k)?A.current.has(k):g.isSubmitted,[g.isSubmitted]),E=t.useMemo(()=>r===1?e.jsx(lt,{}):e.jsx(ct,{}),[r]),w=async k=>{if(k<r){u(k);return}const O=an[k-1];if(await f.trigger(O),!O.map(R=>f.getFieldState(R)).every(R=>!R.invalid)){O.forEach(R=>A.current.add(R));return}u(k)},j=t.useCallback(async k=>{const O=await f.trigger();m||h||a||!O||(sessionStorage.setItem(Gn,k.email),s({callbackId:n,payload:Ii(k)}))},[n,f,m,h,a,s]),L=t.useMemo(()=>Pi(f.getFieldState,f.getValues,r),[f,r]);return t.useEffect(()=>{const k=f.getValues("country"),O=f.getValues("currency");p&&!k&&f.setValue("country",p),x&&!O&&f.setValue("currency",x)},[p,x,f]),t.useEffect(()=>{o(To()),o(No())},[o]),e.jsx(B,{banner:E,variant:"registration",children:e.jsxs(e.Fragment,{children:[e.jsx(i,{control:d,formProps:{noValidate:!0},formState:g,onSubmit:j,reset:b,...f,children:e.jsx(wi,{areCurrentStepFieldsValid:L,control:d,formState:g,handleSteps:w,isFieldConfirmedValid:P,isLoading:m||h||a,reCaptchaVisible:!1,registerStep:r})}),e.jsx(ye,{onClick:M,prompt:"Already have an account?",to:T.path,children:"Sign in"})]})})},ki=()=>{const n=Ln(),o=t.useRef();o.current===void 0&&(o.current=new URLSearchParams(window.location.search).get("callback_id"));const s=o.current,a=t.useRef();a.current===void 0&&(a.current=new URLSearchParams(window.location.search).has("invitee_email"));const r=a.current,u=t.useRef();if(u.current===void 0){const p=new URLSearchParams(window.location.search),d=p.get("invitation_id"),g=p.get("invitation_token"),b=p.get("publisher_id");u.current=d&&g&&b?{invitation_id:d,invitation_token:g,publisher_id:b}:null}const m=u.current,h=t.useRef();h.current===void 0&&(h.current=Oo(window.location.search),h.current?sessionStorage.setItem(rn,h.current):s||sessionStorage.removeItem(rn));const l=h.current;t.useEffect(()=>{n(Do()),S.closeNotification()},[n]),t.useEffect(()=>{sessionStorage.getItem(ue)&&(sessionStorage.removeItem(ue),S.error("Your session may have expired or is invali
13d. Please start again.",{duration:8e3}))},[]);const c=t.useCallback(()=>{if(vn()){window.location.replace(`${je.path}?error=renewal_failed`);return}_n(),ne()},[]);t.useEffect(()=>{if(r||s)return;if(Pe()){c();return}const p=m?{invitation:m}:{prompt:"create",...l?{external_properties:l}:void 0};Oe.signIn(p).catch(d=>{console.error("OidcRegister signIn failed",d),S.error("Could not start registration. Please try again.")})},[c,s,l,m,r]),t.useEffect(()=>{if(r)return;const p=d=>{!d.persisted||s||c()};return window.addEventListener("pageshow",p),()=>window.removeEventListener("pageshow",p)},[c,s,r]);const x=sessionStorage.getItem(xe);return s?r?e.jsx(li,{}):x&&s===x?e.jsx(Te,{to:`${ee.path}?callback_id=${x}`}):e.jsx(Ei,{callbackId:s}):e.jsx(we,{})},Kn=["/auth","/auth/","/auth-oidc","/auth-oidc/"],Ri=[...Kn,T.path,Ze.path,te.path,le.path,Q.path,Ne.path],Pr=()=>{const{isAuthenticated:n,isLoading:o}=Mo(),{pathname:s,search:a}=At();return!o&&n&&Ri.includes(s)?e.jsx(Te,{to:"/"}):e.jsxs(Bo,{children:[e.jsx(U,{exact:!0,path:Kn,children:e.jsx(Te,{to:T.path})}),e.jsx(U,{exact:!0,path:T.path,children:e.jsx(Es,{})}),e.jsx(U,{exact:!0,path:Ze.path,children:e.jsx(_s,{})}),e.jsx(U,{exact:!0,path:te.path,children:e.jsx(ki,{})}),e.jsx(U,{exact:!0,path:le.path,children:e.jsx(Ws,{})}),e.jsx(U,{exact:!0,path:Q.path,children:e.jsx(ni,{})}),e.jsx(U,{exact:!0,path:Ne.path,children:e.jsx(ii,{})}),e.jsx(U,{exact:!0,path:jn.path,children:e.jsx(Xs,{})}),e.jsx(U,{exact:!0,path:En.path,children:e.jsx($t,{children:e.jsx(rs,{})})}),e.jsx(U,{exact:!0,path:In.path,children:e.jsx(Zt,{})}),e.jsx(U,{exact:!0,path:wn.path,children:e.jsx(Zo,{})}),e.jsx(U,{exact:!0,path:je.path,children:e.jsx(nt,{})}),e.jsx(U,{exact:!0,path:ee.path,children:e.jsx(js,{})}),e.jsx(U,{exact:!0,path:kn.path,children:e.jsx(vt,{})}),ls.map(({from:r,to:u})=>e.jsx(U,{exact:!0,path:r,children:e.jsx(Te,{to:{pathname:u,search:a}})},r))]})};export{Pr as OidcRoutes};
14//# sourceMappingURL=OidcRoutes-CglrRw8k.js.map

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.