import{u as j,k as b,r,j as t}from"./main-406.js";import{d as A,_ as S,I as k,s as C}from"./bi.394.85.js";import{B as I}from"./bi.46.744.js";import{S as v}from"./bi.68.941.js";import N from"./bi.17.236.js";import{A as _,g as y,c as w}from"./bi.385.753.js";import"./bi.150.760.js";import"./bi.704.707.js";import"./bi.701.708.js";function z({formFields:m,setFlow:d,flow:f,allIntegURL:g}){const x=j(),{formID:c}=b(),[p,n]=r.useState(!1),[e,l]=r.useState(1),[h,a]=r.useState({show:!1}),[s,i]=r.useState({name:"Autonami",type:"Autonami",field_map:[{formField:"",autonamiField:""}],actions:{}}),u=o=>{if(o==2&&s.name!=="")y(s,i,n,a),l(o);else if(o==3){if(!w(s)){a({show:!0,msg:"Please map all required fields to continue."});return}s.field_map.length>0&&l(o)}document.getElementById("btcd-settings-wrp").scrollTop=0};return t.jsxs("div",{children:[t.jsx(A,{snack:h,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:i,step:e,nextPage:u,isLoading:p,setIsLoading:n,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:i,setIsLoading:n,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:[S("Next","bit-integrations"),t.jsx(I,{className:"ml-1 rev-icn"})]})]}),t.jsx(k,{step:e,saveConfig:()=>C({flow:f,setFlow:d,allIntegURL:g,conf:s,navigate:x,setIsLoading:n,setSnackbar:a}),isLoading:p,dataConf:s,setDataConf:i,formFields:m})]})}export{z as default};
