var _=Object.defineProperty;var f=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var o=(e,t,a)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,n=(e,t)=>{for(var a in t||(t={}))F.call(t,a)&&o(e,a,t[a]);if(f)for(var a of f(t))k.call(t,a)&&o(e,a,t[a]);return e};import{_ as c,c as p,z as d}from"./main-343.js";import{a4 as h}from"./bf-659-81.js";const N=(e,t,a)=>{const l=n({},t),{name:i}=e.target;e.target.value!==""?l[i]=e.target.value:delete l[i],a(n({},l))},v=e=>{const t=e==null?void 0:e.contactsFields.filter(a=>a.required===!0);return t.length>0?t.map(a=>({formField:"",GroundhoggMapField:a.key})):[{formField:"",GroundhoggMapField:""}]},G=e=>!((e.field_map?e.field_map.find(l=>!l.formField||!l.GroundhoggMapField):!1)||(e.field_map?e.field_map.filter(l=>!l.formField&&!l.GroundhoggMapField):[]).length>0),S=e=>!((e.field_map_meta?e.field_map_meta.find(l=>!l.formField||!l.GroundhoggMetaMapField):!1)||(e.field_map_meta?e.field_map_meta.filter(l=>!l.formField&&!l.GroundhoggMetaMapField):[]).length>0),z=(e,t,a,l,i,m)=>{if(!e.public_key){a({public_key:e.public_key?"":c("Public Key can't be empty")});return}if(!e.token){a({token:e.token?"":c("token can't be empty")});return}if(!e.domainName){a({domainName:e.domainName?"":c("Domain Name can't be empty")});return}a({}),i(!0);const r={public_key:e.public_key,token:e.token,domainName:e.domainName};p(r,"bitforms_groundhogg_authorization_and_fetch_contacts").then(s=>{if(s&&s.success){const u=n({},e);t(u),h(u),l(!0),i(!1),d.success(c("Authorization Successful"));return}i(!1),d.error(c("Authorization Failed"))})},A=(e,t,a,l,i)=>{l(!0);const m={public_key:t.public_key,token:t.token,domainName:t.domainName};p(m,"bitforms_groundhogg_fetch_all_tags").then(r=>{if(r&&r.success){const s=n({},t);s.default||(s.default={}),r.data.tags&&(s.default.tags=r.data.tags),a(n({},s)),l(!1),d.success(c("Groundhogg all tag fetched successfully"));return}l(!1),d.error(c("Failed to fetch groundhoggtag"))}).catch(()=>l(!1))};export{N as a,S as b,G as c,A as f,v as g,z as h};
