import{v as I,w,r as a,a as j,j as t,S as k,B as v,x as N,_ as G}from"./main-40.js";/* empty css          */import{B as _}from"./bf-586-70.js";import{S as y}from"./bf-679-136.js";import{a as B,G as C,s as R}from"./bf-42-363.js";import{I as b}from"./bf-94-335.js";import E from"./bf-193-248.js";import{h as F,d as P}from"./bf-768-364.js";import"./bf-141-80.js";import"./bf-860-126.js";import"./bf-892-199.js";import"./bf-132-75.js";import"./bf-200-122.js";import"./bf-689-131.js";import"./bf-541-403.js";import"./bf-504-404.js";function X({formFields:c,setIntegration:l,integrations:d,allIntegURL:h}){const g=I(),{formID:i}=w(),[m,r]=a.useState(!1),[s,p]=a.useState(1),{css:f}=j(),[u,o]=a.useState({show:!1}),[e,n]=a.useState({name:"Google Sheet API",type:"Google Sheet",clientId:"",clientSecret:"",spreadsheetId:"",worksheetName:"",field_map:[{formField:"",googleSheetField:""}],header:"ROWS",headerRow:"A1",actions:{}});a.useEffect(()=>{window.opener&&B("googleSheet")},[]);const S=()=>{if(setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),!P(e)){o({show:!0,msg:"Please map fields to continue."});return}e.spreadsheetId!==""&&e.worksheetName!==""&&e.field_map.length>0&&p(3)};return t.jsxs("div",{children:[t.jsx(k,{snack:u,setSnackbar:o}),t.jsx("div",{className:"txt-center w-9 mt-2 cal-width",children:t.jsx(y,{step:3,active:s})}),t.jsx(E,{formID:i,sheetConf:e,setSheetConf:n,step:s,setstep:p,setSnackbar:o,isLoading:m,setisLoading:r}),t.jsxs("div",{className:"btcd-stp-page",style:{width:s===2&&900,height:s===2&&"100%"},children:[t.jsx(C,{formID:i,formFields:c,handleInput:x=>F(x,e,n,i,r,o),sheetConf:e,setSheetConf:n,isLoading:m,setisLoading:r,setSnackbar:o}),t.jsxs(v,{onClick:()=>S(),disabled:!e.spreadsheetId||!e.worksheetName||e.field_map.length<1,className:f(N.ftRight),children:[G("Next"),t.jsx(_,{className:"ml-1 rev-icn"})]})]}),t.jsx(b,{step:s,saveConfig:()=>R(d,l,h,e,g)})]})}export{X as default};
