File: /var/www/html/wordpress/wp-content/plugins/bit-integrations/assets/bi.556.872.js
var K=Object.defineProperty,g=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var o=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var p=(e,s,t)=>s in e?K(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,n=(e,s)=>{for(var t in s||(s={}))b.call(s,t)&&p(e,t,s[t]);if(o)for(var t of o(s))A.call(s,t)&&p(e,t,s[t]);return e},h=(e,s)=>g(e,P(s));var y=(e,s,t)=>new Promise((r,a)=>{var u=c=>{try{i(t.next(c))}catch(m){a(m)}},l=c=>{try{i(t.throw(c))}catch(m){a(m)}},i=c=>c.done?r(c.value):Promise.resolve(c.value).then(u,l);i((t=t.apply(e,s)).next())});import{_ as d,c as F,V as f}from"./bi.878.0.js";import{g as z,s as q}from"./bi.776.3.js";const x=(e,s,t,r,a)=>{const u=n({},s),l=n({},r);l[e.target.name]="",u[e.target.name]=e.target.value,a(l),t(u)},M=(e,s,t,r,a)=>{if(!e.authKey){s({authKey:e.authKey?"":d("API Key can't be empty")});return}s({}),a(h(n({},r),{auth:!0}));const u={authKey:e.authKey};F(u,"moosend_handle_authorize").then(l=>{if(l.data.Code===0){t(!0),a(h(n({},r),{auth:!1})),f.success(d("Authorized Successfully"));return}a(h(n({},r),{auth:!1})),f.error(d("Authorized failed"))})},V=(e,s,t,r)=>y(void 0,null,function*(){r&&r(h(n({},t),{list:!0}));const a={authKey:e.authKey},u=yield F(a,"moosend_handle_authorize");if(u.success&&u.data.Code===0){const{MailingLists:l}=u.data.Context,i=n({},e);return l&&(i.default||(i.default={}),i.default.lists=l,s(i),r&&(r(h(n({},t),{list:!1})),f.success(d("List refresh successfully")))),!0}return r&&(r(h(n({},t),{list:!1})),f.success(d("List refresh failed"))),!1}),k=e=>{const s=e==null?void 0:e.moosendFields.filter(t=>t.required===!0);return s.length>0?s.map(t=>({formFields:"",moosendFormFields:t.key})):[{formFields:"",moosendFormFields:""}]},_=e=>!((e!=null&&e.field_map?e.field_map.filter(t=>!t.formFields||!t.moosendFormFields||!t.formFields==="custom"&&!t.customValue):[]).length>0),T=(e,s,t)=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!e.listId&&e.method!=="0"&&f.error("Please select list"),!_(e)){f.error(d("Please map mandatory fields","bit-integrations"));return}e.field_map.length>0&&s(t)},B=(e,s,t,r,a,u)=>{u(!0),z(e,s,t,r,a,"","",u).then(i=>{var c;i.success?(f.success((c=i.data)==null?void 0:c.msg),a(t)):f.error(i.data||i)})},E=(e,s,t,r,a,u)=>{if(!_(t)){f.error(d("Please map mandatory fields","bit-integrations"));return}q({flow:e,allIntegURL:s,conf:t,navigate:r,edit:a,setIsLoading:u})};export{k as a,M as b,B as c,V as g,x as h,T as n,E as s};