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.9.0.js";import{u as E,b as i}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as z}from"./SnackMsg.DYSD96P4.js";import{S as A}from"./Steps.BYe8zHkm.js";import{I as F,g as L}from"./Integrations.DL8wqGct.js";import T from"./BentoAuthorization.DzPQy_Tl.js";import{c as M}from"./BentoCommonFunc.CJLWv-Tr.js";import{B as P}from"./BentoIntegLayout.DY_P3xri.js";import"./react-vendor.P7K3d6op.js";import"./Note.NSUdvR3c.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TutorialLink.CFG7bS5c.js";import"./ProUtilHelpers.CHf_DzPf.js";import"./ActionProFeatureLabels.gUp7_RXn.js";import"./CustomFieldKey.iFz21-av.js";import"./TagifyInput.KPPRQJ1B.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};
