import B from"./CWalxxGV.js";import{d as j,Y as v,f as l,m as n,p as t,j as e,i as f,A as i,q as T,t as r,v as C}from"./BCLrUOBx.js";const D=["aria-label","disabled","type"],A=["disabled","type","aria-label"],N={key:1,class:"ml-15"},R={key:2},I={__name:"AjaxButton",props:{color:{type:String,default:""},text:{type:String,default:null},loadingText:{type:String,default:null},fetchingData:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},type:{type:String,default:"Submit"}},emits:["clicked"],setup(_,{emit:x}){const c=_,k=x,{t:u}=j(),{color:d,text:g,loadingText:S,fetchingData:a,disabled:p,type:s}=v(c),h=()=>{c.type!=="Submit"&&k("clicked")},o=l(()=>g.value||u("ajaxButton.submit")),b=l(()=>S.value||u("ajaxButton.gettingResponse")),m=l(()=>a.value);return(V,q)=>{const y=B;return t(s)==="Submit"?(e(),n("button",{key:0,class:"ajax-btn","aria-label":t(o),disabled:t(m)||t(p),type:t(s)},[t(a)?(e(),f(y,{key:0,color:t(d),class:"mr-15"},null,8,["color"])):i("",!0),T(" "+r(t(o)),1)],8,D)):(e(),n("button",{key:1,onClick:C(h,["prevent"]),class:"ajax-btn",disabled:t(m)||t(p),type:t(s),"aria-label":t(o)},[t(a)?(e(),f(y,{key:0,color:t(d)},null,8,["color"])):i("",!0),t(b)&&t(a)?(e(),n("span",N,r(t(b)),1)):t(a)?i("",!0):(e(),n("span",R,r(t(o)),1))],8,A))}}};export{I as default};
