var d=Object.defineProperty,h=Object.defineProperties;var m=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var o=(e,a,t)=>a in e?d(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,u=(e,a)=>{for(var t in a||(a={}))y.call(a,t)&&o(e,t,a[t]);if(l)for(var t of l(a))b.call(a,t)&&o(e,t,a[t]);return e},c=(e,a)=>h(e,m(a));import{_ as n,b as p,z as _}from"./main.2.9.0.js";const f=(e,a,t)=>{const i=u({},a),{name:s}=e.target;e.target.value!==""?i[s]=e.target.value:delete i[s],t(u({},i))},A=e=>{const a=e.filter(t=>(t==null?void 0:t.required)===!0);return a.length>0?a.map(t=>({formField:"",acptFormField:t.key})):[{formField:"",acptFormField:""}]},z=e=>!((e!=null&&e.field_map?e.field_map.filter(t=>!t.formField||!t.acptFormField||t.formField==="custom"&&!t.customValue||t.acptFormField==="customFieldKey"&&!t.customFieldKey):[]).length>0),K=(e,a,t,i,s)=>{if(!e.api_key||!e.base_url){a({base_url:e.base_url?"":n("Homepage URL can't be empty","bit-integrations"),api_key:e.api_key?"":n("Api Key-Secret can't be empty","bit-integrations")});return}a({}),s(c(u({},i),{auth:!0}));const F={base_url:e.base_url,api_key:e.api_key};p(F,"acpt_authentication").then(r=>{if(r&&r.success){t(!0),s(c(u({},i),{auth:!1})),_.success(n("Authorized Successfully","bit-integrations"));return}s(c(u({},i),{auth:!1})),_.error(r!=null&&r.data&&typeof r.data=="string"?r.data:n("Authorized failed, Please enter valid Api Key-Secret","bit-integrations"))})};export{K as a,z as c,A as g,f as h};
