(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,566606,e=>{"use strict";var s=e.i(843476),t=e.i(271645),l=e.i(618566),i=e.i(304967),r=e.i(629569),a=e.i(599724),o=e.i(779241),n=e.i(366283),c=e.i(994388),d=e.i(350967),u=e.i(309426);let m=({color:e="currentColor",size:s=24,className:l,...i})=>t.default.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:s,height:s,fill:e,...i,className:"remixicon "+(l||"")},t.default.createElement("path",{d:"M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM17.4571 9.45711L16.0429 8.04289L11 13.0858L8.20711 10.2929L6.79289 11.7071L11 15.9142L17.4571 9.45711Z"}));var x=e.i(764205),h=e.i(947293),g=e.i(808613),p=e.i(464571),w=e.i(268004);function j(){let[e]=g.Form.useForm(),j=(0,l.useSearchParams)();(0,w.getCookie)("token");let f=j.get("invitation_id"),C=j.get("action"),[b,y]=(0,t.useState)(null),[S,T]=(0,t.useState)(""),[_,v]=(0,t.useState)(""),[N,k]=(0,t.useState)(null),[L,F]=(0,t.useState)(""),[U,P]=(0,t.useState)(""),[B,E]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{(0,x.getUiConfig)().then(e=>{console.log("ui config in onboarding.tsx:",e),E(!1)})},[]),(0,t.useEffect)(()=>{f&&!B&&(0,x.getOnboardingCredentials)(f).then(e=>{let s=e.login_url;console.log("login_url:",s),F(s);let t=e.token,l=(0,h.jwtDecode)(t);P(t),console.log("decoded:",l),y(l.key),console.log("decoded user email:",l.user_email),v(l.user_email),k(l.user_id)})},[f,B]),(0,s.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,s.jsxs)(i.Card,{children:[(0,s.jsx)(r.Title,{className:"text-sm mb-5 text-center",children:"🚅 LiteLLM"}),(0,s.jsx)(r.Title,{className:"text-xl",children:"reset_password"===C?"Reset Password":"Sign up"}),(0,s.jsx)(a.Text,{children:"reset_password"===C?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==C&&(0,s.jsx)(n.Callout,{className:"mt-4",title:"SSO",icon:m,color:"sky",children:(0,s.jsxs)(d.Grid,{numItems:2,className:"flex justify-between items-center",children:[(0,s.jsx)(u.Col,{children:"SSO is under the Enterprise Tier."}),(0,s.jsx)(u.Col,{children:(0,s.jsx)(c.Button,{variant:"primary",className:"mb-2",children:(0,s.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,s.jsxs)(g.Form,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",b,"token:",U,"formValues:",e),!b||!U||(e.user_email=_,N&&f&&(0,x.claimOnboardingToken)(b,f,N,e.password).then(e=>{document.cookie="token="+U;let s=(0,x.getProxyBaseUrl)();console.log("proxyBaseUrl:",s);let t=s?`${s}/ui/?login=success`:"/ui/?login=success";console.log("redirecting to:",t),window.location.href=t}))},children:[(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.Form.Item,{label:"Email Address",name:"user_email",children:(0,s.jsx)(o.TextInput,{type:"email",disabled:!0,value:_,defaultValue:_,className:"max-w-md"})}),(0,s.jsx)(g.Form.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===C?"Enter your new password":"Create a password for your account",children:(0,s.jsx)(o.TextInput,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,s.jsx)("div",{className:"mt-10",children:(0,s.jsx)(p.Button,{htmlType:"submit",children:"reset_password"===C?"Reset Password":"Sign Up"})})]})]})})}function f(){return(0,s.jsx)(t.Suspense,{fallback:(0,s.jsx)("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}),children:(0,s.jsx)(j,{})})}e.s(["default",()=>f],566606)}]);