var F=Object.defineProperty;var d=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var n=(e,r,s)=>r in e?F(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,o=(e,r)=>{for(var s in r||(r={}))m.call(r,s)&&n(e,s,r[s]);if(d)for(var s of d(r))k.call(r,s)&&n(e,s,r[s]);return e};import{_ as l,c as h,d as u}from"./main-40.js";const y=(e,r,s)=>{const a=o({},r),{name:t}=e.target;e.target.value!==""?a[t]=e.target.value:delete a[t],s(o({},a))},b=e=>{const r=e==null?void 0:e.mailerLiteFields.filter(s=>s.required===!0);return r.length>0?r.map(s=>({formField:"",mailerLiteFormField:s.key})):[{formField:"",mailerLiteFormField:""}]},g=e=>!((e!=null&&e.field_map?e.field_map.filter(s=>!s.formField||!s.mailerLiteFormField||!s.formField==="custom"&&!s.customValue):[]).length>0),q=(e,r,s,a,t,i)=>{if(!e.auth_token){s({auth_token:e.auth_token?"":l("Api Key can't be empty")});return}s({}),t(!0);const _={auth_token:e.auth_token,version:e.version};h(_,"bitforms_mailerlite_refresh_fields").then(c=>{if(c&&c.success){const f=o({},e);c.data&&(f.mailerLiteFields=c.data),r(f),i==="authorization"?(t(!1),a(!0),u.success(l("Authorized successfully"))):(t(!1),u.success(l("Fields refresh successfully")));return}i==="authorization"?(t(!1),a(!1),u.error(l(c.data)),u.error(l("Authorized Failed"))):(t(!1),u.error(l("Fields refresh failed")))})},w=(e,r,s)=>{s(!0);const a={auth_token:e.auth_token,version:e.version};h(a,"bitforms_mailerlite_fetch_all_groups").then(t=>{if(t&&t.success){const i=o({},e);t.data&&(i.groups=t.data),r(i),s(!1),u.success(l("Group fetch successfully"));return}s(!1),u.error(l("Group fetch failed"))})};export{b as a,g as c,w as g,y as h,q as m};
