(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[461],{32922:function(e,t,s){Promise.resolve().then(s.bind(s,12011))},12011:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return _}});var o=s(57437),n=s(2265),a=s(99376),c=s(20831),r=s(94789),i=s(12514),l=s(49804),u=s(67101),d=s(84264),m=s(49566),h=s(96761),p=s(84566),x=s(19250),f=s(14474),w=s(13634),g=s(73002),k=s(3914);function _(){let[e]=w.Z.useForm(),t=(0,a.useSearchParams)();(0,k.e)("token");let s=t.get("invitation_id"),_=t.get("action"),[j,S]=(0,n.useState)(null),[Z,b]=(0,n.useState)(""),[N,y]=(0,n.useState)(""),[T,E]=(0,n.useState)(null),[U,v]=(0,n.useState)(""),[C,P]=(0,n.useState)(""),[A,F]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{(0,x.MO)().then(e=>{console.log("ui config in onboarding.tsx:",e),F(!1)})},[]),(0,n.useEffect)(()=>{s&&!A&&(0,x.W_)(s).then(e=>{let t=e.login_url;console.log("login_url:",t),v(t);let s=e.token,o=(0,f.o)(s);P(s),console.log("decoded:",o),S(o.key),console.log("decoded user email:",o.user_email),y(o.user_email),E(o.user_id)})},[s,A]),(0,o.jsx)("div",{className:"mx-auto w-full max-w-md mt-10",children:(0,o.jsxs)(i.Z,{children:[(0,o.jsx)(h.Z,{className:"text-sm mb-5 text-center",children:"\uD83D\uDE85 LiteLLM"}),(0,o.jsx)(h.Z,{className:"text-xl",children:"reset_password"===_?"Reset Password":"Sign up"}),(0,o.jsx)(d.Z,{children:"reset_password"===_?"Reset your password to access Admin UI.":"Claim your user account to login to Admin UI."}),"reset_password"!==_&&(0,o.jsx)(r.Z,{className:"mt-4",title:"SSO",icon:p.GH$,color:"sky",children:(0,o.jsxs)(u.Z,{numItems:2,className:"flex justify-between items-center",children:[(0,o.jsx)(l.Z,{children:"SSO is under the Enterprise Tier."}),(0,o.jsx)(l.Z,{children:(0,o.jsx)(c.Z,{variant:"primary",className:"mb-2",children:(0,o.jsx)("a",{href:"https://forms.gle/W3U4PZpJGFHWtHyA9",target:"_blank",children:"Get Free Trial"})})})]})}),(0,o.jsxs)(w.Z,{className:"mt-10 mb-5 mx-auto",layout:"vertical",onFinish:e=>{console.log("in handle submit. accessToken:",j,"token:",C,"formValues:",e),j&&C&&(e.user_email=N,T&&s&&(0,x.m_)(j,s,T,e.password).then(e=>{let t="/ui/";t+="?login=success",document.cookie="token="+C,console.log("redirecting to:",t);let s=(0,x.zX)();console.log("proxyBaseUrl:",s),s?window.location.href=s+t:window.location.href=t}))},children:[(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w.Z.Item,{label:"Email Address",name:"user_email",children:(0,o.jsx)(m.Z,{type:"email",disabled:!0,value:N,defaultValue:N,className:"max-w-md"})}),(0,o.jsx)(w.Z.Item,{label:"Password",name:"password",rules:[{required:!0,message:"password required to sign up"}],help:"reset_password"===_?"Enter your new password":"Create a password for your account",children:(0,o.jsx)(m.Z,{placeholder:"",type:"password",className:"max-w-md"})})]}),(0,o.jsx)("div",{className:"mt-10",children:(0,o.jsx)(g.ZP,{htmlType:"submit",children:"reset_password"===_?"Reset Password":"Sign Up"})})]})]})})}},3914:function(e,t,s){"use strict";function o(){let e=window.location.hostname,t=["Lax","Strict","None"];["/","/ui"].forEach(s=>{document.cookie="token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=".concat(s,";"),document.cookie="token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=".concat(s,"; domain=").concat(e,";"),t.forEach(t=>{let o="None"===t?" Secure;":"";document.cookie="token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=".concat(s,"; SameSite=").concat(t,";").concat(o),document.cookie="token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=".concat(s,"; domain=").concat(e,"; SameSite=").concat(t,";").concat(o)})}),console.log("After clearing cookies:",document.cookie)}function n(e){let t=document.cookie.split("; ").find(t=>t.startsWith(e+"="));return t?t.split("=")[1]:null}s.d(t,{b:function(){return o},e:function(){return n}})}},function(e){e.O(0,[665,402,899,250,971,117,744],function(){return e(e.s=32922)}),_N_E=e.O()}]);