var F=Object.defineProperty;var m=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var g=(a,t,s)=>t in a?F(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,l=(a,t)=>{for(var s in t||(t={}))_.call(t,s)&&g(a,s,t[s]);if(m)for(var s of m(t))b.call(t,s)&&g(a,s,t[s]);return a};import{b as f,_ as r,A as w}from"./bi.636.93.js";const q=(a,t,s,n,i,o,e,d,p)=>{const c=l({},t);if(e){const u=l({},d);u[a.target.name]="",p(l({},u))}c[a.target.name]=a.target.value,s(l({},c))},A=(a,t,s,n,i)=>{n(!0);const o={formID:a,password:t.password,userName:t.userName};f(o,"fluent_support_get_all_support_staff").then(e=>{if(e&&e.success){const d=l({},t);d.default||(d.default={}),e.data&&(d.default.agents=e.data),i({show:!0,msg:r("Support Staff refreshed","bit-integrations")}),s(l({},d))}else i({show:!0,msg:r("Support Staff refresh failed. please try again","bit-integrations")});n(!1)}).catch(()=>n(!1))},B=(a,t,s,n)=>{s(!0),f(null,"fluent_support_get_custom_fields").then(i=>{t(o=>w(o,e=>{i&&i.success&&i.data?(e.fluentSupportFields=[...e.basicFields,...i.data],e.field_map=h([...e.basicFields,...i.data]),i.data.length>0?n({show:!0,msg:r("Custom Ticket Fields refreshed","bit-integrations")}):n({show:!0,msg:r("Custom Ticket Fields not found!","bit-integrations")})):(e.fluentSupportFields=e.basicFields,e.field_map=h(e.basicFields),n({show:!0,msg:r((i==null?void 0:i.data)||"Custom Ticket Fields failed. please try again","bit-integrations")}))})),s(!1)}).catch(()=>s(!1))},T=(a,t,s,n,i)=>{n(!0),f("","fluent_support_get_all_business_inboxes").then(o=>{if(o&&o.success){const e=l({},t);e.default||(e.default={}),o.data&&(e.default.businessInboxes=o.data),i({show:!0,msg:r("Business Inboxes refreshed","bit-integrations")}),s(l({},e))}else i({show:!0,msg:r("Business Inboxes refresh failed. please try again","bit-integrations")});n(!1)}).catch(()=>n(!1))},h=a=>{console.log(a);const t=a.filter(s=>s.required===!0);return t.length>0?t.map(s=>({formField:"",fluentSupportFormField:s.key})):[{formField:"",fluentSupportFormField:""}]},$=a=>!((a!=null&&a.field_map?a.field_map.filter(s=>!s.formField||!s.fluentSupportFormField||!s.formField==="custom"&&!s.customValue):[]).length>0),z=(a,t,s,n,i,o)=>{s({}),i(!0),f(null,"fluentSupport_authorization").then(e=>e).then(e=>{if(e&&e.success){const d=l({},a);t(d),n(!0),o({show:!0,msg:r("Connected Successfully","bit-integrations")})}else e&&e.data&&e.data.data||!e.success&&typeof e.data=="string"?o({show:!0,msg:`${r("Cunnection failed Cause:","bit-integrations")}${e.data.data||e.data}. ${r("please try again","bit-integrations")}`}):o({show:!0,msg:r("Cunnection failed. please try again","bit-integrations")});i(!1)})};export{B as a,z as b,$ as c,T as g,q as h,A as s};
