var w=Object.defineProperty;var _=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var j=(a,t,e)=>t in a?w(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,S=(a,t)=>{for(var e in t||(t={}))I.call(t,e)&&j(a,e,t[e]);if(_)for(var e of _(t))C.call(t,e)&&j(a,e,t[e]);return a};import{_ as d,j as o,z as k}from"./main.2.8.10.js";import{u as E,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.BnhKHfEP.js";import{S as z}from"./SnackMsg.7BjcJK1j.js";import{S as A}from"./Steps.B84Ui3GU.js";import{I as F,g as L}from"./Integrations.BFhED4ck.js";import T from"./BentoAuthorization.Ci9HxqmQ.js";import{c as M}from"./BentoCommonFunc.DpgW-Asb.js";import{B as P}from"./BentoIntegLayout.inlRUKTw.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"./ActionProFeatureLabels.BzMNdAoD.js";import"./CustomFieldKey.DXUNVoDV.js";import"./TagifyInput.C4ilRm4k.js";import"./lodash.DCvQBX3r.js";function ot({formFields:a,setFlow:t,flow:e,allIntegURL:l}){const u=E(),[g,c]=i.useState(!1),[f,b]=i.useState({}),[n,x]=i.useState(1),[B,p]=i.useState({show:!1}),[s,m]=i.useState({name:"Bento",type:"Bento",publishable_key:"",secret_key:"",site_uuid:"",field_map:[{formField:"",bentoFormField:""}],action:"",actions:[{value:"add_people",label:d("Add People","bit-integrations"),is_pro:!1},{value:"add_event",label:d("Add Event","bit-integrations"),is_pro:!0}]}),y=()=>{c(!0),L(e,t,l,s,u,"","",c).then(r=>{var h;r.success?(k.success((h=r.data)==null?void 0:h.msg),u(l)):k.error(r.data||r)})},N=v=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),s.field_map.length>0&&x(v)};return o.jsxs("div",{children:[o.jsx(z,{snack:B,setSnackbar:p}),o.jsx("div",{className:"txt-center mt-2",children:o.jsx(A,{step:3,active:n})}),o.jsx(T,{bentoConf:s,setBentoConf:m,step:n,setStep:x,loading:f,setLoading:b,setSnackbar:p}),o.jsxs("div",{className:"btcd-stp-page",style:S({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:[o.jsx(P,{formFields:a,bentoConf:s,setBentoConf:m,loading:f,setLoading:b,isLoading:g,setIsLoading:c,setSnackbar:p}),(s==null?void 0:s.action)&&o.jsxs("button",{onClick:()=>N(3),disabled:!M(s),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),"  ",o.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),(s==null?void 0:s.action)&&o.jsx(F,{step:n,saveConfig:()=>y(),isLoading:g,dataConf:s,setDataConf:m,formFields:a})]})}export{ot as default};
