import{a7 as j,j as e,a8 as b,h as a,e as v,f as y,R as i,aB as C,v as l,aL as S,aJ as w,H as u,S as I}from"./vendor-ClLR6ncd.js";import{am as L,an as O,E as _,i as E}from"./index-OtVJl4GC.js";import{L as m}from"./Link-BLwKPJFF.js";import{C as c,L as R}from"./index-zrMDdWv_.js";import"./lodash-ZyeDnt0e.js";import{B as d}from"./Box-Co2WcNPC.js";import"./model-BBaroEiB.js";var s={},W=b;Object.defineProperty(s,"__esModule",{value:!0});var x=s.default=void 0,q=W(j()),k=e;x=s.default=(0,q.default)((0,k.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutlineOutlined");function A(r){return e.jsxs(a,{variant:"body2",color:"text.secondary",align:"center",...r,children:["Copyright ",e.jsx(m,{color:"inherit",href:L,target:"_blank",children:"Franz Inc"}),"."]})}function N(){const{error:r,submit:h,isLoading:p}=O(),f=v(),o=y(),[{error:t}]=i.useState(f.state||{});i.useEffect(()=>{t&&o(".",{replace:!0})},[t,o]);const n=r||t,g=_(["ssoAvailable"],async()=>!!await E({url:"/oauth/enabled"})).data;return e.jsx(c,{disableGutters:!0,maxWidth:!1,sx:{height:"100%",width:"100%",backgroundColor:"#80808030"},children:e.jsx(c,{maxWidth:"xs",sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:e.jsxs(C,{elevation:4,sx:{pt:8,pl:4,pr:4},children:[e.jsxs(d,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(R,{}),e.jsx(a,{component:"h1",variant:"h5",sx:{pt:4},children:"WebView authorization"}),e.jsxs(d,{component:"form",onSubmit:h,noValidate:!0,sx:{mt:1},children:[e.jsx(l,{"data-cy":"username-input",margin:"normal",required:!0,fullWidth:!0,id:"username",label:"Username",name:"username",autoComplete:"username",autoFocus:!0}),e.jsx(l,{"data-cy":"password-input",margin:"normal",required:!0,fullWidth:!0,name:"password",label:"Password",type:"password",id:"password",autoComplete:"current-password"}),e.jsx(S,{control:e.jsx(w,{name:"stay"}),label:"Stay logged in"}),e.jsx(u,{disabled:p,type:"submit",fullWidth:!0,variant:"contained",sx:{mt:3,mb:1},children:"LOG IN"}),g?e.jsx(u,{component:m,href:"/oauth/redirect",fullWidth:!0,variant:"outlined",sx:{mb:2},children:"Sign in with SSO"}):null]}),n&&e.jsxs(I,{color:"error.main",alignItems:"center",direction:"row",spacing:1,children:[e.jsx(x,{}),e.jsx(a,{textAlign:"left",children:n})]})]}),e.jsx(A,{sx:{mt:1,mb:4}})]})})})}export{N as default};
