var y=Object.defineProperty;var b=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(b)for(var t of b(e))w.call(e,t)&&E(s,t,e[t]);return s};import{j as n,_ as l,z as r}from"./main.2.8.1.js";import{u as L,d as i}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as A}from"./SnackMsg.S8DrwLlT.js";import{S as P}from"./Steps.1hz7v9Vj.js";import{I as z,g as D}from"./Integrations.D2bgBas2.js";import{c as S,T as M}from"./theEventsCalendarCommonFunctions.V_9ePTS9.js";import{T as B}from"./TheEventsCalendarIntegLayout.BPNhjpvP.js";import F from"./TheEventsCalendarAuthorization.BQ69wRN0.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.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 T;c.success?(r.success((T=c.data)==null?void 0:T.msg),f(p)):r.error(c.data||c)})},N=x=>{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(x)};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};
