import{j as t,_ as y}from"./main.2.8.10.js";import{u as B,e as S,b as e}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{B as I}from"./BackIcn.BFDZx8No.js";import{S as v}from"./SnackMsg.7BjcJK1j.js";import{I as N,g as _}from"./Integrations.BFhED4ck.js";import C from"./BooklyAuthorization.U0-bfmhB.js";import{B as L,g as w}from"./BooklyIntegLayout.CM1BllFg.js";import"./react-vendor.P7K3d6op.js";import"./Note.DalStCGz.js";import"./Table.DSsAy4VI.js";import"./index.DpWdl9V1.js";import"./TutorialLink.D6K_DiHL.js";import"./ProUtilHelpers.CtRYkgop.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";import"./GlobalIntegrationHelper.Belqr4OT.js";function U({formFields:d,setFlow:f,flow:u,allIntegURL:x}){const b=B(),{formID:n}=S(),[r,m]=e.useState(!1),[h,j]=e.useState({}),[o,l]=e.useState(1),[k,a]=e.useState({show:!1}),[s,p]=e.useState({name:"Bookly",type:"Bookly",field_map:[{formField:"",booklyField:""}],actions:{},mainAction:""}),c=i=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),i===3){const g=w(s);if(g){a({show:!0,msg:g});return}s.name!==""&&s.field_map.length>0&&l(i)}else l(i)};return t.jsxs("div",{children:[t.jsx(v,{snack:k,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2"}),t.jsx(C,{formID:n,booklyConf:s,setBooklyConf:p,step:o,nextPage:c,isLoading:r,setIsLoading:m,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:o===2&&900,height:o===2&&"auto",minHeight:o===2&&"500px"},children:[t.jsx(L,{formID:n,formFields:d,booklyConf:s,setBooklyConf:p,setSnackbar:a,dataLoading:h,setDataLoading:j}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>c(3),disabled:s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[y("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(N,{step:o,saveConfig:()=>_(u,f,x,s,b,"","",m),isLoading:r})]})}export{U as default};
