import{f as k,ag as U,m as P,ak as x,a8 as b,a1 as G,h as $,C as B,D,L as M,aA as j,U as W,aB as z,aC as H,aD as O,aE as S,aF as C,aG as L,y as Q,l as R,aH as J,aI as Y,q as K,v as X,aJ as Z,n as ee,_ as te,r as l,o as A,c as w,a as n,b as o,w as d,W as ae,d as I,ay as oe,az as ne,t as se,p as ie,e as le}from"./entry.eQZ3auYG.js";import{u as re}from"./toast.xQvLCn8q.js";const T=k({props:{listRef:{type:Object},entity:{type:Object,required:!0},modelValue:{type:String}},emits:["update:modelValue"],setup(e,{emit:a}){const s=U(e,"modelValue"),y=P(()=>e.entity.name===x),r=P(()=>!(y.value&&!s.value)&&s.value!==e.entity.id);return()=>r.value?b("button",{class:{"btn btn-xs btn-primary":r.value,"btn btn-xs btn-danger":!r.value},onClick(p){p.preventDefault(),a("update:modelValue",e.entity.id)}},[b("i",{class:{"fa fa-check":r.value,"fa fa-times":!r.value}})]):b("button",{class:"btn btn-xs btn-disabled btn-success",disabled:!0},[b("i",{class:"fa-solid fa-check"})])}},"$BvqHu6TDsR"),de=""+new URL("Login.lAurmWky.svg",import.meta.url).href,ue=G({props:{width:{type:[Number,String],default:750},height:{type:[Number,String],default:500}},setup(e){return()=>b("img",{src:de,width:e.width,height:e.height,style:{maxWidth:"100%"}})}}),me=k({components:{APagination:$,ASearch:B,ATitle:D,LoginSVG:ue,AIdentityProviders:M,AIdentityProviderIcon:j,ARealms:W,RealmSelectAction:T},setup(){const e=z(),a=re(),s=H({name:"",password:"",realm_id:""}),y=O({name:{required:S,minLength:C(3),maxLength:L(255)},password:{required:S,minLength:C(3),maxLength:L(255)},realm_id:{}},s),r=Q(),p=ee(),_=R(!1),u=U(s,"realm_id"),m={filters:{realm_id:u.value||""}},c=R(null);J(u,async(i,f)=>{i!==f&&c.value&&(m.filters.realm_id=u.value,c.value.load())});const h=async()=>{try{await r.login({name:s.name,password:s.password,realmId:s.realm_id});const i=K(),{redirect:f,...V}=i.query;X({path:f||"/",query:V})}catch(i){Z(i)&&a&&a.show({variant:"warning",body:i.message})}};Promise.resolve().then(r.logout);const g=i=>e.identityProvider.getAuthorizeUri(p.public.apiUrl,i);return{vuelidate:y,translator:Y(),form:s,submit:h,busy:_,identityProviderQuery:m,identityProviderRef:c,buildIdentityProviderURL:g}}},"$V4hxAv6YfE"),q=e=>(ie("data-v-03b701f5"),e=e(),le(),e),ce={class:"container"},fe=q(()=>n("h4",null,[n("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),I(" Login ")],-1)),ve={class:"text-center"},be={class:"row"},ye={class:"col-8"},pe=q(()=>n("hr",null,null,-1)),he={class:"d-flex flex-row"},_e=["href"],ge={class:"d-flex flex-column"},Ve={class:"text-center mb-1"},Ae={class:"col-4"};function we(e,a,s,y,r,p){const _=l("LoginSVG"),u=l("VCFormInput"),m=l("VCFormGroup"),c=l("VCFormSubmit"),h=l("APagination"),g=l("AIdentityProviderIcon"),i=l("AIdentityProviders"),f=l("ATitle"),V=l("ASearch"),F=T,N=l("ARealms");return A(),w("div",ce,[fe,n("div",ve,[o(_,{height:320})]),n("form",{onSubmit:a[4]||(a[4]=ae((...t)=>e.submit&&e.submit(...t),["prevent"]))},[n("div",be,[n("div",ye,[o(m,{"validation-result":e.vuelidate.name,"validation-translator":e.translator},{label:d(()=>[I(" Name ")]),default:d(()=>[o(u,{modelValue:e.form.name,"onUpdate:modelValue":a[0]||(a[0]=t=>e.form.name=t)},null,8,["modelValue"])]),_:1},8,["validation-result","validation-translator"]),o(m,{"validation-result":e.vuelidate.password,"validation-translator":e.translator},{label:d(()=>[I(" Password ")]),default:d(()=>[o(u,{modelValue:e.form.password,"onUpdate:modelValue":a[1]||(a[1]=t=>e.form.password=t),type:"password"},null,8,["modelValue"])]),_:1},8,["validation-result","validation-translator"]),o(c,{modelValue:e.busy,"onUpdate:modelValue":a[2]||(a[2]=t=>e.busy=t),"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"]),pe,o(i,{ref:"identityProviderRef",query:e.identityProviderQuery,footer:!1},{footer:d(t=>[o(h,{busy:t.busy,meta:t.meta,load:t.load,total:t.total},null,8,["busy","meta","load","total"])]),body:d(t=>[n("div",he,[(A(!0),w(oe,null,ne(t.data,(v,E)=>(A(),w("div",{key:E},[n("a",{href:e.buildIdentityProviderURL(v.id),class:"btn btn-dark btn-xs p-2 me-1 identity-provider-box bg-dark"},[n("div",ge,[n("div",Ve,[o(g,{class:"fa-2x",entity:v},null,8,["entity"])]),n("div",null,se(v.name),1)])],8,_e)]))),128))])]),_:1},8,["query"])]),n("div",Ae,[o(N,null,{header:d(t=>[o(f),o(V,{load:t.load,busy:t.busy},null,8,["load","busy"])]),footer:d(t=>[o(h,{busy:t.busy,meta:t.meta,load:t.load,total:t.total},null,8,["busy","meta","load","total"])]),itemActions:d(t=>[o(F,{modelValue:e.form.realm_id,"onUpdate:modelValue":a[3]||(a[3]=v=>e.form.realm_id=v),"list-ref":e.identityProviderRef,entity:t.data},null,8,["modelValue","list-ref","entity"])]),_:1})])])],32)])}const Se=te(me,[["render",we],["__scopeId","data-v-03b701f5"]]);export{Se as default};
