import{A as h}from"./AmaTRG5a.js";import{_ as k}from"./BOhf1Bbf.js";import{s as x,j as n,l as F,d as R,e as w,m as s,w as j,o as i,c as p,b as l,F as B,g as V,G as A,J as C,H as N,T as P,t as D,f as T}from"./Bgmy51Qv.js";import{u as q}from"./7pZkuj9N.js";import"./CNIrc0EA.js";import"./DZl4_Bww.js";import"./BHvLfWtM.js";import"./DuSynPle.js";import"./B2895E6R.js";import"./D_7E8SMU.js";const M={class:"cp mtb-5"},$=["value"],G={class:"dply-felx j-right"},Y={__name:"send-email",setup(H){const u=q(),{getRequest:f,setRequest:v,setAllSubscriptionEmailFormats:_}=u,{allSubscriptionEmailFormats:e}=x(u),r=n(!1),t=n(""),m=n({format:""}),b=async a=>{r.value=!0,await v({params:{id:t.value},api:"sendSubscriptionEmail"}),r.value=!1};return F(async()=>{if(e.value)e.value.length&&(t.value=e.value[0].id);else{const a=await f({params:{},api:"getAllSubscriptionEmailFormats"});_(a),e.value.length&&(t.value=e.value[0].id)}}),(a,o)=>{const g=h,y=k;return s(e)&&a.$can("subscriber","view")?(i(),R(y,{key:0,ref:"dataPageRef","route-name":"subscribers",name:a.$t("dataPage.eFor"),gate:"subscriber","validation-keys":["subject"],result:s(m),onResult:o[1]||(o[1]=c=>m.value=c)},{form:j(({hasError:c})=>[(i(!0),p(B,null,V(s(e),(d,E)=>(i(),p("div",{key:E},[l("label",M,[A(l("input",{type:"radio",value:d.id,"onUpdate:modelValue":o[0]||(o[0]=S=>N(t)?t.value=S:null)},null,8,$),[[P,s(t)]]),C(" "+D(d.title),1)])]))),128)),l("div",G,[T(g,{class:"primary-btn",type:"button",text:"Send Email","fetching-data":s(r),onClicked:b},null,8,["fetching-data"])])]),_:1},8,["name","result"])):w("",!0)}}};export{Y as default};
