import{f as C,aa as w,l as I,ac as U,a5 as b,a1 as x,K as F,as as N,S as E,at as $,F as B,n as M,au as T,av as D,aw as R,ax as S,ay as P,y as G,k,az as j,aA as z,q as O,v as Q,aB as W,aC as H,m as K,_ as Y,r as l,o as h,c as g,a,b as i,w as V,W as J,aq as X,ar as Z,t as ee,p as te,e as ae,d as ne}from"./entry.c7cd0af6.js";const A=C({props:{listRef:{type:Object},entity:{type:Object,required:!0},modelValue:{type:String}},emits:["update:modelValue"],setup(e,{emit:t}){const d=w(e,"modelValue");w(e,"listRef");const u=I(()=>e.entity.name===U),s=I(()=>!(u.value&&!d.value)&&d.value!==e.entity.id);return()=>s.value?b("button",{class:{"btn btn-xs btn-primary":s.value,"btn btn-xs btn-danger":!s.value},onClick(f){f.preventDefault(),t("update:modelValue",e.entity.id)}},[b("i",{class:{"fa fa-check":s.value,"fa fa-times":!s.value}})]):b("button",{class:"btn btn-xs btn-disabled btn-success",disabled:!0},[b("i",{class:"fa-solid fa-check"})])}},"$BvqHu6TDsR"),oe=""+new URL("Login.bb43092d.svg",import.meta.url).href,se=x({props:{width:{type:[Number,String],default:750},height:{type:[Number,String],default:500}},setup(e){return()=>b("img",{src:oe,width:e.width,height:e.height,style:{maxWidth:"100%"}})}}),ie=C({components:{LoginSVG:se,IdentityProviderList:F,IdentityProviderIcon:N,RealmList:E,RealmSelectAction:A,FormSubmit:$,FormInput:B},setup(){const e=M(),t=T({name:"",password:"",realm_id:""}),d=D({name:{required:R,minLength:S(3),maxLength:P(255)},password:{required:R,minLength:S(3),maxLength:P(255)},realm_id:{}},t),u=G(),s=K(),f=k(!1),m=w(t,"realm_id"),c={filters:{realm_id:m.value||""}},p=k(null);j(m,async(o,r)=>{o!==r&&p.value&&(c.filters.realm_id=m.value,p.value.load())});const y=async()=>{try{await u.login({name:t.name,password:t.password,realmId:t.realm_id});const o=O(),{redirect:r,...n}=o.query;Q({path:r||"/",query:n})}catch(o){W(o)&&e&&e.warning({body:o.message},{pos:"top-center"})}};Promise.resolve().then(u.logout);const _=o=>H().identityProvider.getAuthorizeUri(s.public.apiUrl,o);return{vuelidate:d,translator:z(),form:t,submit:y,busy:f,identityProviderQuery:c,identityProviderRef:p,buildIdentityProviderURL:_}}},"$V4hxAv6YfE");const L=e=>(te("data-v-bd0b1065"),e=e(),ae(),e),re={class:"container"},le=L(()=>a("h4",null,[a("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),ne(" Login ")],-1)),de={class:"text-center"},ue={class:"row"},me={class:"col-8"},ce=L(()=>a("hr",null,null,-1)),pe=L(()=>a("h6",null,"IdentityProvider",-1)),ve={class:"d-flex flex-row"},be=["href"],fe={class:"d-flex flex-column"},ye={class:"text-center mb-1"},_e={class:"col-4"};function he(e,t,d,u,s,f){const m=l("LoginSVG"),c=l("FormInput"),p=l("FormSubmit"),y=l("IdentityProviderIcon"),_=l("IdentityProviderList"),o=A,r=l("RealmList");return h(),g("div",re,[le,a("div",de,[i(m,{height:320})]),a("form",{onSubmit:t[4]||(t[4]=J((...n)=>e.submit&&e.submit(...n),["prevent"]))},[a("div",ue,[a("div",me,[i(c,{modelValue:e.form.name,"onUpdate:modelValue":t[0]||(t[0]=n=>e.form.name=n),"validation-result":e.vuelidate.name,"validation-translator":e.translator,label:!0,"label-content":"Name"},null,8,["modelValue","validation-result","validation-translator"]),i(c,{modelValue:e.form.password,"onUpdate:modelValue":t[1]||(t[1]=n=>e.form.password=n),type:"password","validation-result":e.vuelidate.password,"validation-translator":e.translator,label:!0,"label-content":"Password"},null,8,["modelValue","validation-result","validation-translator"]),i(p,{modelValue:e.busy,"onUpdate:modelValue":t[2]||(t[2]=n=>e.busy=n),"validation-result":e.vuelidate,"create-text":"Login","create-button-class":{value:"btn btn-sm btn-dark btn-block",presets:{bootstrap:!1}},"create-icon-class":"fa-solid fa-right-to-bracket",submit:e.submit},null,8,["modelValue","validation-result","submit"]),ce,i(_,{ref:"identityProviderRef",query:e.identityProviderQuery,"footer-pagination":!1},{header:V(()=>[pe]),body:V(n=>[a("div",ve,[(h(!0),g(X,null,Z(n.data,(v,q)=>(h(),g("div",{key:q},[a("a",{href:e.buildIdentityProviderURL(v.id),class:"btn btn-dark btn-xs p-2 me-1 identity-provider-box bg-dark"},[a("div",fe,[a("div",ye,[i(y,{class:"fa-2x",entity:v},null,8,["entity"])]),a("div",null,ee(v.name),1)])],8,be)]))),128))])]),_:1},8,["query"])]),a("div",_e,[i(r,null,{itemActions:V(n=>[i(o,{modelValue:e.form.realm_id,"onUpdate:modelValue":t[3]||(t[3]=v=>e.form.realm_id=v),"list-ref":e.identityProviderRef,entity:n.data},null,8,["modelValue","list-ref","entity"])]),_:1})])])],32)])}const Ve=Y(ie,[["render",he],["__scopeId","data-v-bd0b1065"]]);export{Ve as default};
