var y=Object.defineProperty;var T=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var E=(s,e,t)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,C=(s,e)=>{for(var t in e||(e={}))I.call(e,t)&&E(s,t,e[t]);if(T)for(var t of T(e))w.call(e,t)&&E(s,t,e[t]);return s};import{j as n,_ as l,z as r}from"./main.2.9.0.js";import{u as L,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as A}from"./SnackMsg.DYSD96P4.js";import{S as P}from"./Steps.BYe8zHkm.js";import{I as z,g as D}from"./Integrations.DL8wqGct.js";import{c as S,T as M}from"./theEventsCalendarCommonFunctions.B52F1C2_.js";import{T as B}from"./TheEventsCalendarIntegLayout.OIiP0IEC.js";import F from"./TheEventsCalendarAuthorization.BSsVcyMC.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./TutorialLink.CFG7bS5c.js";function se({formFields:s,setFlow:e,flow:t,allIntegURL:p}){const f=L(),[j,g]=i.useState(!1),[u,v]=i.useState({auth:!1,events:!1}),[o,h]=i.useState(1),[k,d]=i.useState({show:!1}),[a,m]=i.useState({name:"The Events Calendar",type:"The Events Calendar",field_map:[],staticFields:[],selectedTask:"",events:[],selectedEvent:"",actions:{}}),_=()=>{g(!0),D(t,e,p,a,f,"","",g).then(c=>{var x;c.success?(r.success((x=c.data)==null?void 0:x.msg),f(p)):r.error(c.data||c)})},N=b=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!a.selectedTask){r.error(l("Please select a task!","bit-integrations"));return}if(a.selectedTask===M.NEW_ATTENDEE&&!a.selectedEvent){r.error(l("Please select a event!","bit-integrations"));return}if(!S(a)){r.error(l("Please map mandatory fields!","bit-integrations"));return}a.field_map.length>0&&h(b)};return n.jsxs("div",{children:[n.jsx(A,{snack:k,setSnackbar:d}),n.jsx("div",{className:"txt-center mt-2",children:n.jsx(P,{step:3,active:o})}),n.jsx(F,{theEventsCalendarConf:a,setTheEventsCalendarConf:m,step:o,setStep:h,loading:u,setLoading:v,setSnackbar:d}),n.jsxs("div",{className:"btcd-stp-page",style:C({},o===2&&{width:900,height:"auto",overflow:"visible"}),children:[n.jsx(B,{formFields:s,theEventsCalendarConf:a,setTheEventsCalendarConf:m,loading:u,setLoading:v,setSnackbar:d}),n.jsxs("button",{onClick:()=>N(3),disabled:!S(a),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[l("Next","bit-integrations"),"  ",n.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),n.jsx(z,{step:o,saveConfig:()=>_(),isLoading:j,dataConf:a,setDataConf:m,formFields:s})]})}export{se as default};
