var k=Object.defineProperty;var c=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var u=(e,r,t)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,n=(e,r)=>{for(var t in r||(r={}))_.call(r,t)&&u(e,t,r[t]);if(c)for(var t of c(r))g.call(r,t)&&u(e,t,r[t]);return e};import{_ as o,b as m,z as l}from"./main.2.9.0.js";const S=(e,r,t)=>{const a=n({},r),{name:i}=e.target;e.target.value!==""?a[i]=e.target.value:delete a[i],t(n({},a))},f=(e,r,t,a,i,y)=>{if(!e.api_key){t({api_key:e.api_key?"":o("Api Key can't be empty","bit-integrations")});return}t({}),i(!0);const F=window.location.origin,h={api_key:e.api_key,auth_url:F};m(h,"sureCart_authorization").then(s=>{if(s&&s.success){const d=n({},e);r(d),a(!0),i(!1),l.success(o("Authorized Successfully","bit-integrations"));return}l.error(o("Authorization Failed","bit-integrations")),i(!1)})},w=e=>!((e?e==null?void 0:e.filter(t=>!t.formField||!t.SureCartFormField):[]).length>0),A=e=>{const r=e==null?void 0:e.customerFields.filter(t=>t.required===!0);return r.length>0?r.map(t=>({formField:"",SureCartFormField:t.key})):[{formField:"",SureCartFormField:""}]};export{f as a,w as c,A as g,S as h};
