var n=Object.defineProperty;var c=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var p=(a,t,e)=>t in a?n(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,r=(a,t)=>{for(var e in t||(t={}))_.call(t,e)&&p(a,e,t[e]);if(c)for(var e of c(t))g.call(t,e)&&p(a,e,t[e]);return a};import{c as m,_ as l,d$ as o}from"./main-40.js";const b=(a,t,e)=>{const i=r({},t);i.name=a.target.value,e(r({},i))},T=(a,t,e,i)=>{e(!0);const f={api_key:a.api_key};m(f,"bitforms_sblue_refresh_lists").then(s=>{if(s&&s.success){const d=r({},a);d.default||(d.default={}),s.data.sblueList&&(d.default.sblueList=s.data.sblueList),i({show:!0,msg:l("List refreshed")}),t(r({},d))}else s&&s.data&&s.data.data||!s.success&&typeof s.data=="string"?i({show:!0,msg:o(l("List refresh failed Cause: %s. please try again"),s.data.data||s.data)}):i({show:!0,msg:l("List failed. please try again")});e(!1)}).catch(()=>e(!1))},F=(a,t,e)=>{const i={api_key:a.api_key};m(i,"bitforms_sblue_refresh_template").then(f=>{if(f&&f.success){const s=r({},a);s.default||(s.default={}),f.data.sblueTemplates&&(s.default.sblueTemplates=f.data.sblueTemplates),e({show:!0,msg:l("Templates refreshed")}),t(r({},s))}else f&&f.data&&f.data.data||!f.success&&typeof f.data=="string"?e({show:!0,msg:o(l("Templates refresh failed Cause: %s. please try again"),f.data.data||f.data)}):e({show:!0,msg:l("Templates failed. please try again")})})},L=(a,t,e,i)=>{const f={api_key:a.api_key};m(f,"bitforms_sblue_headers").then(s=>{if(s&&s.success){const d=r({},a);if(s.data.sendinBlueField){d.default.fields=s.data.sendinBlueField;const{fields:u}=d.default;d.field_map=Object.values(u).filter(h=>h.required).map(h=>({formField:"",sendinBlueField:h.fieldId,required:!0})),i({show:!0,msg:l("Sendinblue fields refreshed")})}else i({show:!0,msg:l("No Sendinblue fields found. Try changing the header row number or try again")});t(r({},d))}else i({show:!0,msg:l("Sendinblue fields refresh failed. please try again")});e(!1)}).catch(()=>e(!1))},q=a=>{var e;const t=a!=null&&a.field_map?a.field_map.filter(i=>!i.formField&&i.sendinBlueField&&i.required):[];return!(a.lists&&((e=a.lists)==null?void 0:e.length)===void 0||t.length>0)};export{T as a,L as b,q as c,b as h,F as r};
