import{u as b,k as A,r,j as t}from"./main-333.js";import{d as S,_ as d,I as k,s as C}from"./bi.636.93.js";import{B as I}from"./bi.429.767.js";import{S as v}from"./bi.563.969.js";import N from"./bi.321.247.js";import{A as _,g as y,c as w}from"./bi.725.776.js";import"./bi.318.783.js";import"./bi.535.730.js";import"./bi.286.731.js";function z({formFields:m,setFlow:f,flow:g,allIntegURL:x}){const h=b(),{formID:c}=A(),[p,i]=r.useState(!1),[e,l]=r.useState(1),[j,a]=r.useState({show:!1}),[s,n]=r.useState({name:"Autonami",type:"Autonami",field_map:[{formField:"",autonamiField:""}],actions:{}}),u=o=>{if(o==2&&s.name!=="")y(s,n,i,a),l(o);else if(o==3){if(!w(s)){a({show:!0,msg:d("Please map all required fields to continue.","bit-integrations")});return}s.field_map.length>0&&l(o)}document.getElementById("btcd-settings-wrp").scrollTop=0};return t.jsxs("div",{children:[t.jsx(S,{snack:j,setSnackbar:a}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(v,{step:3,active:e})}),t.jsx(N,{formID:c,autonamiConf:s,setAutonamiConf:n,step:e,nextPage:u,isLoading:p,setIsLoading:i,setSnackbar:a}),t.jsxs("div",{className:"btcd-stp-page",style:{width:e===2&&900,height:e===2&&"auto",minHeight:e===2&&"200px"},children:[t.jsx(_,{formID:c,formFields:m,autonamiConf:s,setAutonamiConf:n,setIsLoading:i,setSnackbar:a}),t.jsx("br",{}),t.jsx("br",{}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>u(3),disabled:s.field_map.length<1,className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[d("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(k,{step:e,saveConfig:()=>C({flow:g,setFlow:f,allIntegURL:x,conf:s,navigate:h,setIsLoading:i,setSnackbar:a}),isLoading:p,dataConf:s,setDataConf:n,formFields:m})]})}export{z as default};
