var T=Object.defineProperty;var g=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var b=(n,a,e)=>a in n?T(n,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[a]=e,u=(n,a)=>{for(var e in a||(a={}))V.call(a,e)&&b(n,e,a[e]);if(g)for(var e of g(a))E.call(a,e)&&b(n,e,a[e]);return n};import{g as F,u as I,r as l,j as s}from"./main-406.js";import{d as _,_ as c,L as $,G as M}from"./bi.394.85.js";import{S as B}from"./bi.68.941.js";import{c as P,C as z}from"./bi.954.848.js";import D from"./bi.651.294.js";import{T as x,t as G}from"./bi.150.760.js";function H(){const n=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let a=[];for(let e=0;e<36;e++)e===8||e===13||e===18||e===23?a[e]="-":a[e]=n[Math.ceil(Math.random()*n.length-1)];return a.join("")}var K=H,R=F(K);const Y=({formFields:n,setFlow:a,flow:e,allIntegURL:f})=>{const h=I(),[o,v]=l.useState(1),[j,y]=l.useState(!1),[r,N]=l.useState({}),[k,C]=l.useState({show:!1}),L=R(),{customAction:t}=G,[i,m]=l.useState({name:"Custom Action",type:"CustomAction",randomFileName:L,defaultValue:`<?php if (!defined('ABSPATH')) {exit;} 
    
  function yourFunctionName($trigger){
    $trigger['yourKey'];
    //write here your custom function
  }  
  yourFunctionName($trigger);`,value:""});l.useEffect(()=>{const d=u({},i);delete d.isValid,m(u({},d))},[i==null?void 0:i.value]);const S=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),v(2)},w=d=>{const p=u({},i);p[d.target.name]=d.target.value,m(p)};return s.jsxs("div",{children:[s.jsx(_,{snack:k,setSnackbar:C}),s.jsx("div",{className:"txt-center mt-2",children:s.jsx(B,{step:2,active:o})}),s.jsxs("div",{className:"btcd-stp-page",style:u({},o===1&&{width:"70%",height:"auto",overflow:"visible"}),children:[(t==null?void 0:t.youTubeLink)&&s.jsx(x,{title:t==null?void 0:t.title,youTubeLink:t==null?void 0:t.youTubeLink}),(t==null?void 0:t.docLink)&&s.jsx(x,{title:t==null?void 0:t.title,docLink:t==null?void 0:t.docLink}),s.jsxs("div",{className:"d-flx my-3",children:[s.jsx("div",{className:"wdt-200 d-in-b mt-3",children:s.jsx("b",{children:c("Integration Name:","bit-integrations")})}),s.jsx("input",{className:"btcd-paper-inp mt-1",onChange:w,name:"name",value:i.name,type:"text",placeholder:c("Integration Name...","bit-integrations")})]}),s.jsx(D,{customActionConf:i,setCustomActionConf:m,formFields:n}),s.jsxs("button",{onClick:()=>P(i,m,r,N),disabled:!i.value||(r==null?void 0:r.validate),className:"btn f-left btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:[i!=null&&i.isValid?c("Validated ✔","bit-integrations"):c("Validated","bit-integrations"),(r==null?void 0:r.validate)&&s.jsx($,{size:"20",clr:"#022217",className:"ml-2"})]}),s.jsxs("button",{onClick:()=>S(),disabled:!i.isValid,className:"btn f-right btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:[c("Next","bit-integrations")," "," ",s.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),s.jsx("div",{className:"btcd-stp-page",style:{width:o===2&&"100%",height:o===2&&"auto"},children:s.jsx(z,{step:o,saveConfig:()=>M(e,a,f,i,h,"","",y),isLoading:j})})]})};export{Y as default};
